diff --git a/.github/workflows/binary.yml b/.github/workflows/binary.yml index 18e757921..ed9808b5e 100644 --- a/.github/workflows/binary.yml +++ b/.github/workflows/binary.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 env: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 232354387..4a00c4f89 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,4 +17,4 @@ jobs: run: go build -v ./... - name: Test - run: go test -v `go list ./... | grep -v -E 'deprecated/|x/derivatives/|x/ecosystemincentive/|x/nftbackedloan/|x/nftfactory/|x/pricefeed/|x/yieldaggregator/'` + run: go test -v `go list ./... | grep -v -E 'x/nftbackedloan/|x/derivatives/|x/pricefeed/|x/ecosystemincentive/'` diff --git a/.gitignore b/.gitignore index 0cb78c0ab..afc486a17 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ docs/node_modules docs/.vuepress/dist data docker-build/* +cmd/ununifid/__debug_bin diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 66046b26e..9dc486867 100755 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -8,7 +8,6 @@ "golang.go", "zxh404.vscode-proto3", "eamodio.gitlens", - "TabNine.tabnine-vscode", - "streetsidesoftware.code-spell-checker", + "streetsidesoftware.code-spell-checker" ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 6d7081a83..a8d130deb 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,6 @@ "editor.detectIndentation": false, "editor.formatOnSave": true, "cSpell.enabled": true, - "tabnine.experimentalAutoImports": true, "go.lintTool": "golangci-lint", "go.formatTool": "goimports", "go.useLanguageServer": true, @@ -26,7 +25,7 @@ }, "files.eol": "\n", "[proto3]": { - "editor.defaultFormatter": "xaver.clang-format" + "editor.defaultFormatter": "zxh404.vscode-proto3" }, - "clang-format.style": "{BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 120, AlignConsecutiveAssignments: true, AlignConsecutiveDeclarations: true, SpacesInSquareBrackets: true}", -} \ No newline at end of file + "clang-format.style": "{BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 120, AlignConsecutiveAssignments: true, AlignConsecutiveDeclarations: true, SpacesInSquareBrackets: true}" +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..f288702d2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 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 General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSE.md b/LICENSE.md index ab20c300f..e2ad27d0d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,201 +1,102 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2020 Kava Labs, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Business Source License 1.1 + +License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. +"Business Source License" is a trademark of MariaDB Corporation Ab. + +----------------------------------------------------------------------------- + +Parameters + +Licensor: CAUCHYE ASIA PTE. LTD. + +Licensed Work: UnUniFi Core NFT Backed loan module + UnUniFi Core Interchain Yield Aggregator module + UnUniFi Core Derivatives module + The Licensed Work is (c) 2023 CAUCHYE ASIA PTE. LTD. + +Additional Use Grant: Non-commercial testnet building + Development of smart contracts that are integrated with the Licensed Work + Type definition files for developing interoperable modules or smart contracts that are integrated with the Licensed Work + +Change Date: The earlier of 2027-08-01 + +Change License: GNU General Public License v3.0 or later + +----------------------------------------------------------------------------- + +Terms + +The Licensor hereby grants you the right to copy, modify, create derivative +works, redistribute, and make non-production use of the Licensed Work. The +Licensor may make an Additional Use Grant, above, permitting limited +production use. + +Effective on the Change Date, or the fourth anniversary of the first publicly +available distribution of a specific version of the Licensed Work under this +License, whichever comes first, the Licensor hereby grants you rights under +the terms of the Change License, and the rights granted in the paragraph +above terminate. + +If your use of the Licensed Work does not comply with the requirements +currently in effect as described in this License, you must purchase a +commercial license from the Licensor, its affiliated entities, or authorized +resellers, or you must refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works +of the Licensed Work, are subject to this License. This License applies +separately for each version of the Licensed Work and the Change Date may vary +for each version of the Licensed Work released by Licensor. + +You must conspicuously display this License on each original or modified copy +of the Licensed Work. If you receive the Licensed Work in original or +modified form from a third party, the terms and conditions set forth in this +License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically +terminate your rights under this License for the current and all other +versions of the Licensed Work. + +This License does not grant you any right in any trademark or logo of +Licensor or its affiliates (provided that you may use a trademark or logo of +Licensor as expressly required by this License). + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +TITLE. + +MariaDB hereby grants you permission to use this License’s text to license +your works, and to refer to it using the trademark "Business Source License", +as long as you comply with the Covenants of Licensor below. + +----------------------------------------------------------------------------- + +Covenants of Licensor + +In consideration of the right to use this License’s text and the "Business +Source License" name and trademark, Licensor covenants to MariaDB, and to all +other recipients of the licensed work to be provided by Licensor: + +1. To specify as the Change License the GPL Version 2.0 or any later version, + or a license that is compatible with GPL Version 2.0 or a later version, + where "compatible" means that software provided under the Change License can + be included in a program with software provided under GPL Version 2.0 or a + later version. Licensor may specify additional Change Licenses without + limitation. + +2. To either: (a) specify an additional grant of rights to use that does not + impose any additional restriction on the right granted in this License, as + the Additional Use Grant; or (b) insert the text "None". + +3. To specify a Change Date. + +4. Not to modify this License in any other way. + +----------------------------------------------------------------------------- + +Notice + +The Business Source License (this document, or the "License") is not an Open +Source license. However, the Licensed Work will eventually be made available +under an Open Source License, as stated in this License. diff --git a/Makefile b/Makefile index 0301b9588..243f4ba97 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ endif PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') LEDGER_ENABLED ?= true SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') -TM_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::') # grab everything after the space in "github.com/tendermint/tendermint v0.34.7" +TM_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::') # grab everything after the space in "github.com/cometbft/cometbft v0.34.7" DOCKER := $(shell which docker) BUILDDIR ?= $(CURDIR)/build TEST_DOCKER_REPO=jackzampolin/ununifitest @@ -66,7 +66,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=ununifi \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \ - -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TM_VERSION) + -X github.com/cometbft/cometbft/version.TMCoreSemVer=$(TM_VERSION) ifeq (cleveldb,$(findstring cleveldb,$(JPYX_BUILD_OPTIONS))) ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb diff --git a/app/ante.go b/app/ante.go index e408372fa..5cc81e03c 100644 --- a/app/ante.go +++ b/app/ante.go @@ -11,6 +11,12 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" + + builderante "github.com/skip-mev/pob/x/builder/ante" + builderkeeper "github.com/skip-mev/pob/x/builder/keeper" + + ecosystemincentiveante "github.com/UnUniFi/chain/x/ecosystemincentive/ante" + ecosystemincentivekeeper "github.com/UnUniFi/chain/x/ecosystemincentive/keeper" ) // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC @@ -21,6 +27,12 @@ type HandlerOptions struct { IBCKeeper *keeper.Keeper WasmConfig *wasmTypes.WasmConfig TXCounterStoreKey storetypes.StoreKey + + BuilderKeeper builderkeeper.Keeper + TxEncoder sdk.TxEncoder + Mempool builderante.Mempool + + EcosystemincentiveKeeper ecosystemincentivekeeper.Keeper } func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { @@ -55,7 +67,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), + ecosystemincentiveante.NewFrontendIncentiveDecorator(options.EcosystemincentiveKeeper), ibcante.NewRedundantRelayDecorator(options.IBCKeeper), + builderante.NewBuilderDecorator(options.BuilderKeeper, options.TxEncoder, options.Mempool), } return sdk.ChainAnteDecorators(anteDecorators...), nil diff --git a/app/app.go b/app/app.go index 79902b39b..29f1308c5 100644 --- a/app/app.go +++ b/app/app.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "reflect" "strings" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" @@ -18,7 +19,6 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" @@ -36,137 +36,32 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" "github.com/cosmos/cosmos-sdk/x/crisis" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/group" - groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/cosmos-sdk/x/mint" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/nft" - nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" - nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module" - "github.com/cosmos/cosmos-sdk/x/params" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/cosmos/cosmos-sdk/x/slashing" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v7/testing" - ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" + "github.com/spf13/cast" "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - epochs "github.com/UnUniFi/chain/x/epochs" - epochskeeper "github.com/UnUniFi/chain/x/epochs/keeper" - epochstypes "github.com/UnUniFi/chain/x/epochs/types" - "github.com/UnUniFi/chain/x/yieldaggregator" - icacallbacks "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks" - icacallbackskeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/keeper" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - interchainquery "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery" - interchainquerykeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/keeper" - interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" - records "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records" - recordskeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/keeper" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - stakeibc "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc" - stakeibckeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" - yieldaggregatorkeeper "github.com/UnUniFi/chain/x/yieldaggregator/keeper" - yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" - - // "github.com/UnUniFi/chain/x/nftbackedloan" - // nftmarketkeeper "github.com/UnUniFi/chain/x/nftbackedloan/keeper" - // nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" - // "github.com/UnUniFi/chain/x/nftfactory" - // nftmintkeeper "github.com/UnUniFi/chain/x/nftfactory/keeper" - // nftminttypes "github.com/UnUniFi/chain/x/nftfactory/types" - // "github.com/UnUniFi/chain/x/derivatives" - // derivativeskeeper "github.com/UnUniFi/chain/x/derivatives/keeper" - // derivativestypes "github.com/UnUniFi/chain/x/derivatives/types" - // "github.com/UnUniFi/chain/x/pricefeed" - // pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" - // ecosystemincentive "github.com/UnUniFi/chain/x/ecosystemincentive" - // ecosystemincentivetypes "github.com/UnUniFi/chain/x/ecosystemincentive/types" + pobabci "github.com/skip-mev/pob/abci" + "github.com/skip-mev/pob/mempool" + + stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" "github.com/UnUniFi/chain/app/keepers" "github.com/UnUniFi/chain/app/upgrades" - v1_beta3 "github.com/UnUniFi/chain/app/upgrades/v1-beta.3" - v2_1 "github.com/UnUniFi/chain/app/upgrades/v2.1" - v2_2 "github.com/UnUniFi/chain/app/upgrades/v2.2" + v3 "github.com/UnUniFi/chain/app/upgrades/v3" + v3_1 "github.com/UnUniFi/chain/app/upgrades/v3.1" + v3_2 "github.com/UnUniFi/chain/app/upgrades/v3.2" ) const Name = "ununifi" @@ -203,99 +98,13 @@ var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic( - []govclient.ProposalHandler{ - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - }, - ), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - vesting.AppModuleBasic{}, - nftmodule.AppModuleBasic{}, - consensus.AppModuleBasic{}, - // non sdk modules - wasm.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - transfer.AppModuleBasic{}, - ica.AppModuleBasic{}, - ibcfee.AppModuleBasic{}, - - // original modules - // nftmarket.AppModuleBasic{}, - // nftmint.AppModuleBasic{}, - - yieldaggregator.AppModuleBasic{}, - stakeibc.AppModuleBasic{}, - epochs.AppModuleBasic{}, - interchainquery.AppModuleBasic{}, - records.AppModuleBasic{}, - icacallbacks.AppModuleBasic{}, - - // pricefeed.AppModuleBasic{}, - // derivatives.AppModuleBasic{}, - - // ecosystemincentive.AppModuleBasic{}, - ) - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - nft.ModuleName: nil, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - ibcfeetypes.ModuleName: nil, - icatypes.ModuleName: nil, - wasm.ModuleName: {authtypes.Burner}, - - // original modules - // nftmarkettypes.ModuleName: nil, - // nftmarkettypes.NftTradingFee: nil, - // nftminttypes.ModuleName: nil, - - yieldaggregatortypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - stakeibctypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - interchainquerytypes.ModuleName: nil, - - // derivativestypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - // derivativestypes.DerivativeFeeCollector: nil, - // derivativestypes.MarginManager: nil, - - // ecosystemincentivetypes.ModuleName: nil, - } - // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{ distrtypes.ModuleName: true, stakeibctypes.ModuleName: true, } - Upgrades = []upgrades.Upgrade{v1_beta3.Upgrade, v2_1.Upgrade, v2_2.Upgrade, v3.Upgrade} + Upgrades = []upgrades.Upgrade{v3.Upgrade, v3_1.Upgrade, v3_2.Upgrade} ) var ( @@ -318,67 +127,13 @@ func init() { // capabilities aren't needed for testing. type App struct { *baseapp.BaseApp + keepers.AppKeepers + legacyAmino *codec.LegacyAmino appCodec codec.Codec // txConfig client.TxConfig interfaceRegistry types.InterfaceRegistry - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - memKeys map[string]*storetypes.MemoryStoreKey - - // keepers - AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.BaseKeeper - CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - AuthzKeeper authzkeeper.Keeper - EvidenceKeeper evidencekeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper - GroupKeeper groupkeeper.Keeper - NFTKeeper nftkeeper.Keeper - ConsensusParamsKeeper consensusparamkeeper.Keeper - - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - IBCFeeKeeper ibcfeekeeper.Keeper - ICAControllerKeeper icacontrollerkeeper.Keeper - ICAHostKeeper icahostkeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper - WasmKeeper wasm.Keeper - - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper - ScopedWasmKeeper capabilitykeeper.ScopedKeeper - - // NftmarketKeeper nftmarketkeeper.Keeper - // NftmintKeeper nftmintkeeper.Keeper - - YieldaggregatorKeeper yieldaggregatorkeeper.Keeper - StakeibcKeeper stakeibckeeper.Keeper - ScopedStakeibcKeeper capabilitykeeper.ScopedKeeper - EpochsKeeper epochskeeper.Keeper - InterchainqueryKeeper interchainquerykeeper.Keeper - ScopedRecordsKeeper capabilitykeeper.ScopedKeeper - RecordsKeeper recordskeeper.Keeper - ScopedIcacallbacksKeeper capabilitykeeper.ScopedKeeper - IcacallbacksKeeper icacallbackskeeper.Keeper - - // DerivativesKeeper derivativeskeeper.Keeper - // PricefeedKeeper pricefeedkeeper.Keeper - - // EcosystemincentiveKeeper ecosystemincentivekeeper.Keeper - // the module manager mm *module.Manager @@ -388,10 +143,8 @@ type App struct { // module configurator configurator module.Configurator - keepers.AppKeepers - - // msgSvcRouter *authmiddleware.MsgServiceRouter - // legacyRouter sdk.Router + // Custom checkTx handler + checkTxHandler pobabci.CheckTx } // NewApp returns a reference to an initialized Gaia. @@ -401,14 +154,14 @@ func NewApp( db dbm.DB, traceStore io.Writer, loadLatest bool, - enabledProposals []wasm.ProposalType, appOpts servertypes.AppOptions, wasmOpts []wasm.Option, + enabledProposals []wasm.ProposalType, baseAppOptions ...func(*baseapp.BaseApp), ) *App { encodingConfig := MakeEncodingConfig() - appCodec, legacyAmino := encodingConfig.Marshaler, encodingConfig.Amino + appCodec, legacyAmino := encodingConfig.Codec, encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry txConfig := encodingConfig.TxConfig @@ -418,637 +171,57 @@ func NewApp( bApp.SetInterfaceRegistry(interfaceRegistry) bApp.SetTxEncoder(txConfig.TxEncoder()) - keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, - minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, - // non sdk store keys - ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, - wasm.StoreKey, icahosttypes.StoreKey, - icacontrollertypes.StoreKey, - - // original modules - // nftmarkettypes.StoreKey, - // nftminttypes.StoreKey, - - yieldaggregatortypes.StoreKey, - stakeibctypes.StoreKey, - epochstypes.StoreKey, - interchainquerytypes.StoreKey, - recordstypes.StoreKey, - icacallbackstypes.StoreKey, - - // derivativestypes.StoreKey, - // pricefeedtypes.StoreKey, - - // ecosystemincentivetypes.StoreKey, - ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - - // load state streaming if enabled - if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { - logger.Error("failed to load state streaming", "err", err) - os.Exit(1) - } + // for original AuctionFactory + // maxTx can be changed (0 is unlimited) + maxTx := 0 + factory := mempool.NewDefaultAuctionFactory(txConfig.TxDecoder()) + mempool := mempool.NewAuctionMempool(txConfig.TxDecoder(), txConfig.TxEncoder(), maxTx, factory) + bApp.SetMempool(mempool) app := &App{ BaseApp: bApp, + AppKeepers: keepers.AppKeepers{}, legacyAmino: legacyAmino, appCodec: appCodec, interfaceRegistry: interfaceRegistry, - keys: keys, - tkeys: tkeys, - memKeys: memKeys, - AppKeepers: keepers.AppKeepers{}, } - app.ParamsKeeper = initParamsKeeper( - appCodec, - legacyAmino, - keys[paramstypes.StoreKey], - tkeys[paramstypes.TStoreKey], - ) - - // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) - bApp.SetParamStore(&app.ConsensusParamsKeeper) + moduleAccountAddresses := app.ModuleAccountAddrs() - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper( + // Setup keepers + app.AppKeepers = *keepers.NewAppKeeper( appCodec, - keys[capabilitytypes.StoreKey], - memKeys[capabilitytypes.MemStoreKey], - ) - - // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName) - - // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper( - appCodec, - keys[authtypes.StoreKey], - authtypes.ProtoBaseAccount, + bApp, + legacyAmino, maccPerms, - AccountAddressPrefix, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - app.BankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - keys[banktypes.StoreKey], - app.AccountKeeper, + moduleAccountAddresses, app.BlockedAddrs(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, - keys[stakingtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.MintKeeper = mintkeeper.NewKeeper( - appCodec, - keys[minttypes.StoreKey], - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - app.DistrKeeper = distrkeeper.NewKeeper( - appCodec, - keys[distrtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, - legacyAmino, - keys[slashingtypes.StoreKey], - app.StakingKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) - app.CrisisKeeper = crisiskeeper.NewKeeper( - appCodec, - keys[crisistypes.StoreKey], - invCheckPeriod, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.FeeGrantKeeper = feegrantkeeper.NewKeeper( - appCodec, - keys[feegrant.StoreKey], - app.AccountKeeper, - ) - - // register the staking hooks - // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - app.DistrKeeper.Hooks(), - app.SlashingKeeper.Hooks(), - ), - ) - - app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper) - - groupConfig := group.DefaultConfig() - app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) - - // get skipUpgradeHeights from the app options - skipUpgradeHeights := map[int64]bool{} - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - homePath := cast.ToString(appOpts.Get(flags.FlagHome)) - // set the governance module account as the authority for conducting upgrades - app.UpgradeKeeper = upgradekeeper.NewKeeper( - skipUpgradeHeights, - keys[upgradetypes.StoreKey], - appCodec, - homePath, - app.BaseApp, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, - keys[ibcexported.StoreKey], - app.GetSubspace(ibcexported.ModuleName), - app.StakingKeeper, - app.UpgradeKeeper, - scopedIBCKeeper, - ) - - govConfig := govtypes.DefaultConfig() - govKeeper := govkeeper.NewKeeper( - appCodec, - keys[govtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.MsgServiceRouter(), - govConfig, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.GovKeeper = *govKeeper.SetHooks( - govtypes.NewMultiGovHooks( - // register the governance hooks - ), - ) - - app.NFTKeeper = nftkeeper.NewKeeper( - keys[nftkeeper.StoreKey], - appCodec, - app.AccountKeeper, - app.BankKeeper, - ) - - // Create evidence Keeper for to register the IBC light client misbehaviour evidence route - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, - keys[evidencetypes.StoreKey], - app.StakingKeeper, - app.SlashingKeeper, - ) - // If evidence needs to be handled for the app, set routes in router here and seal - app.EvidenceKeeper = *evidenceKeeper - - // IBC Fee Module keeper - app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( - appCodec, keys[ibcfeetypes.StoreKey], - app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, - ) - - // Create Transfer Keepers - app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, - keys[ibctransfertypes.StoreKey], - app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCFeeKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - scopedTransferKeeper, - ) - - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, - keys[icahosttypes.StoreKey], - app.GetSubspace(icahosttypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), - ) - app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, - keys[icacontrollertypes.StoreKey], - app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCFeeKeeper, // may be replaced with middleware such as ics29 fee - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, - app.MsgServiceRouter(), - ) - - wasmDir := filepath.Join(homePath, "wasm") - wasmConfig, err := wasm.ReadWasmConfig(appOpts) - if err != nil { - panic(fmt.Sprintf("error while reading wasm config: %s", err)) - } - - // The last arguments can contain custom message handlers, and custom query handlers, - // if we want to allow any custom callbacks - availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2" - app.WasmKeeper = wasm.NewKeeper( - appCodec, - keys[wasm.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - distrkeeper.NewQuerier(app.DistrKeeper), - app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - scopedWasmKeeper, - app.TransferKeeper, - app.MsgServiceRouter(), - app.GRPCQueryRouter(), - wasmDir, - wasmConfig, - availableCapabilities, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - wasmOpts..., - ) - - // app.NftmintKeeper = nftmintkeeper.NewKeeper( - // appCodec, - // keys[nftminttypes.StoreKey], - // keys[nftminttypes.MemStoreKey], - // app.GetSubspace(nftminttypes.ModuleName), - // app.AccountKeeper, - // app.NFTKeeper, - // ) - - // nftmarketKeeper := nftmarketkeeper.NewKeeper( - // appCodec, - // encodingConfig.TxConfig, - // keys[nftmarkettypes.StoreKey], - // keys[nftmarkettypes.MemStoreKey], - // app.GetSubspace(nftmarkettypes.ModuleName), - // app.AccountKeeper, - // app.BankKeeper, - // app.NFTKeeper, - // ) - - scopedIcacallbacksKeeper := app.CapabilityKeeper.ScopeToModule(icacallbackstypes.ModuleName) - app.ScopedIcacallbacksKeeper = scopedIcacallbacksKeeper - app.IcacallbacksKeeper = *icacallbackskeeper.NewKeeper( - appCodec, - keys[icacallbackstypes.StoreKey], - keys[icacallbackstypes.MemStoreKey], - app.GetSubspace(icacallbackstypes.ModuleName), - scopedIcacallbacksKeeper, - *app.IBCKeeper, - app.ICAControllerKeeper, - ) - - app.InterchainqueryKeeper = interchainquerykeeper.NewKeeper(appCodec, keys[interchainquerytypes.StoreKey], app.IBCKeeper) - - scopedRecordsKeeper := app.CapabilityKeeper.ScopeToModule(recordstypes.ModuleName) - app.ScopedRecordsKeeper = scopedRecordsKeeper - app.RecordsKeeper = *recordskeeper.NewKeeper( - appCodec, - keys[recordstypes.StoreKey], - keys[recordstypes.MemStoreKey], - app.GetSubspace(recordstypes.ModuleName), - scopedRecordsKeeper, - app.AccountKeeper, - app.TransferKeeper, - *app.IBCKeeper, - app.IcacallbacksKeeper, - ) - - scopedStakeibcKeeper := app.CapabilityKeeper.ScopeToModule(stakeibctypes.ModuleName) - app.ScopedStakeibcKeeper = scopedStakeibcKeeper - app.StakeibcKeeper = stakeibckeeper.NewKeeper( - appCodec, - keys[stakeibctypes.StoreKey], - keys[stakeibctypes.MemStoreKey], - app.GetSubspace(stakeibctypes.ModuleName), - app.IBCKeeper.ChannelKeeper, - // &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - app.ICAControllerKeeper, - *app.IBCKeeper, - scopedStakeibcKeeper, - scopedIBCKeeper, - app.InterchainqueryKeeper, - app.RecordsKeeper, - *app.StakingKeeper, - app.IcacallbacksKeeper, - ) - - // Register ICQ callbacks - err = app.InterchainqueryKeeper.SetCallbackHandler(stakeibctypes.ModuleName, app.StakeibcKeeper.CallbackHandler()) - if err != nil { - return nil - } - - // Register ICA calllbacks - // stakeibc - err = app.IcacallbacksKeeper.SetICACallbackHandler(stakeibctypes.ModuleName, app.StakeibcKeeper.ICACallbackHandler()) - if err != nil { - return nil - } - // records - err = app.IcacallbacksKeeper.SetICACallbackHandler(recordstypes.ModuleName, app.RecordsKeeper.ICACallbackHandler()) - if err != nil { - return nil - } - - app.YieldaggregatorKeeper = yieldaggregatorkeeper.NewKeeper( - appCodec, - keys[yieldaggregatortypes.StoreKey], - app.GetSubspace(yieldaggregatortypes.ModuleName), - app.BankKeeper, - wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper), - app.WasmKeeper, - app.StakeibcKeeper, - app.RecordsKeeper, - ) - - epochsKeeper := epochskeeper.NewKeeper(appCodec, keys[epochstypes.StoreKey]) - app.EpochsKeeper = *epochsKeeper.SetHooks( - epochstypes.NewMultiEpochHooks( - app.YieldaggregatorKeeper.Hooks(), - app.StakeibcKeeper.Hooks(), - ), + appOpts, + wasmOpts, + enabledProposals, + AccountAddressPrefix, ) - // app.DerivativesKeeper = derivativeskeeper.NewKeeper( - // appCodec, - // keys[derivativestypes.StoreKey], - // keys[derivativestypes.MemStoreKey], - // app.GetSubspace(derivativestypes.ModuleName), - // app.BankKeeper, - // app.PricefeedKeeper, - // ) - - // app.PricefeedKeeper = pricefeedkeeper.NewKeeper( - // appCodec, - // keys[pricefeedtypes.StoreKey], - // keys[pricefeedtypes.MemStoreKey], - // app.GetSubspace(pricefeedtypes.ModuleName), - // app.BankKeeper, - // ) - - // app.EcosystemincentiveKeeper = ecosystemincentivekeeper.NewKeeper( - // appCodec, - // keys[ecosystemincentivetypes.StoreKey], - // app.GetSubspace(ecosystemincentivetypes.ModuleName), - // app.AccountKeeper, - // app.BankKeeper, - // // same as the feeCollectorName in the distribution module - // authtypes.FeeCollectorName, - // ) - - // create Keeper objects which have Hooks - // app.NftmarketKeeper = *nftmarketKeeper.SetHooks(nftmarkettypes.NewMultiNftmarketHooks(app.EcosystemincentiveKeeper.Hooks())) - - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter. - AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). - AddRoute(yieldaggregatortypes.RouterKey, yieldaggregator.NewYieldAggregatorProposalHandler(app.YieldaggregatorKeeper)) - - // The gov proposal types can be individually enabled - if len(enabledProposals) != 0 { - govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) - } - - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - app.GovKeeper.SetLegacyRouter(govRouter) - - // Create Transfer Stack - var transferStack porttypes.IBCModule - transferStack = transfer.NewIBCModule(app.TransferKeeper) - transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper) - - // RecvPacket, message that originates from core IBC and goes down to app, the flow is: - // channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket - var icaHostStack porttypes.IBCModule - icaHostStack = icahost.NewIBCModule(app.ICAHostKeeper) - icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, app.IBCFeeKeeper) - - // Create fee enabled wasm ibc Stack - var wasmStack porttypes.IBCModule - wasmStack = wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCFeeKeeper) - wasmStack = ibcfee.NewIBCMiddleware(wasmStack, app.IBCFeeKeeper) - - // Stack two (Stakeibc Stack) contains - // - IBC - // - ICA - // - stakeibc - // - base app - var stakeibcStack porttypes.IBCModule = stakeibc.NewIBCModule(app.StakeibcKeeper) - stakeibcStack = icacontroller.NewIBCMiddleware(stakeibcStack, app.ICAControllerKeeper) - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := porttypes.NewRouter() - ibcRouter. - AddRoute(ibctransfertypes.ModuleName, transferStack). - AddRoute(wasm.ModuleName, wasmStack). - AddRoute(icahosttypes.SubModuleName, icaHostStack). - // Stakeibc Stack - AddRoute(icacontrollertypes.SubModuleName, stakeibcStack). - AddRoute(stakeibctypes.ModuleName, stakeibcStack) - - app.IBCKeeper.SetRouter(ibcRouter) - /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // we prefer to be more strict in what arguments the modules expect. skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - app.setupAppkeeper() - // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. - // tbbbt app.mm = module.NewManager( - genutil.NewAppModule( - app.AccountKeeper, - app.StakingKeeper, - app.BaseApp.DeliverTx, - encodingConfig.TxConfig, - ), - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), - vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), - upgrade.NewAppModule(app.UpgradeKeeper), - evidence.NewAppModule(app.EvidenceKeeper), - params.NewAppModule(app.ParamsKeeper), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - - wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), - ibc.NewAppModule(app.IBCKeeper), - transfer.NewAppModule(app.TransferKeeper), - ibcfee.NewAppModule(app.IBCFeeKeeper), - ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), - crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), - - // original modules - // nftmint.NewAppModule(appCodec, app.NftmintKeeper, app.NFTKeeper), - // nftmarket.NewAppModule(appCodec, app.NftmarketKeeper, app.AccountKeeper, app.BankKeeper), - - yieldaggregator.NewAppModule(appCodec, app.YieldaggregatorKeeper, app.AccountKeeper, app.BankKeeper), - stakeibc.NewAppModule(appCodec, app.StakeibcKeeper, app.AccountKeeper, app.BankKeeper), - epochs.NewAppModule(appCodec, app.EpochsKeeper), - interchainquery.NewAppModule(appCodec, app.InterchainqueryKeeper), - records.NewAppModule(appCodec, app.RecordsKeeper, app.AccountKeeper, app.BankKeeper), - icacallbacks.NewAppModule(appCodec, app.IcacallbacksKeeper, app.AccountKeeper, app.BankKeeper), - - // derivatives.NewAppModule(appCodec, app.DerivativesKeeper, app.BankKeeper), - // pricefeed.NewAppModule(appCodec, app.PricefeedKeeper, app.AccountKeeper), - // ecosystemincentive.NewAppModule(appCodec, app.EcosystemincentiveKeeper, app.BankKeeper), + appModules(app, encodingConfig, skipGenesisInvariants)..., ) // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - app.mm.SetOrderBeginBlockers( - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - nft.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - // original modules - // ecosystemincentivetypes.ModuleName, - // pricefeedtypes.ModuleName, - - // nftminttypes.ModuleName, - // nftmarkettypes.ModuleName, - - stakeibctypes.ModuleName, - epochstypes.ModuleName, - interchainquerytypes.ModuleName, - recordstypes.ModuleName, - icacallbackstypes.ModuleName, - - yieldaggregatortypes.ModuleName, - // derivativestypes.ModuleName, - - // additional non simd modules - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - wasm.ModuleName, - ) + app.mm.SetOrderBeginBlockers(orderBeginBlockers()...) - app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - nft.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - // original modules - // ecosystemincentivetypes.ModuleName, - // pricefeedtypes.ModuleName, - - // nftminttypes.ModuleName, - // nftmarkettypes.ModuleName, - stakeibctypes.ModuleName, - epochstypes.ModuleName, - interchainquerytypes.ModuleName, - recordstypes.ModuleName, - icacallbackstypes.ModuleName, - - yieldaggregatortypes.ModuleName, - // derivativestypes.ModuleName, - - // additional non simd modules - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - wasm.ModuleName, - ) + app.mm.SetOrderEndBlockers(orderEndBlockers()...) // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. @@ -1057,52 +230,9 @@ func NewApp( // can do so safely. // NOTE: wasm module should be at the end as it can call other module functionality direct or via message dispatching during // genesis phase. For example bank transfer, auth account check, staking, ... - app.mm.SetOrderInitGenesis( - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - nft.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - - // original modules - // pricefeedtypes.ModuleName, - // nftminttypes.ModuleName, - // nftmarkettypes.ModuleName, - // ecosystemincentivetypes.ModuleName, - - stakeibctypes.ModuleName, - epochstypes.ModuleName, - interchainquerytypes.ModuleName, - recordstypes.ModuleName, - icacallbackstypes.ModuleName, - - yieldaggregatortypes.ModuleName, - // derivativestypes.ModuleName, - - // additional non simd modules - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - // wasm after ibc transfer - wasm.ModuleName, - ) + app.mm.SetOrderInitGenesis(orderInitGenesis()...) - app.mm.RegisterInvariants(app.CrisisKeeper) + app.mm.RegisterInvariants(&app.AppKeepers.CrisisKeeper) app.configurator = module.NewConfigurator(appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) @@ -1115,43 +245,51 @@ func NewApp( reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AppKeepers.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), } app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) app.sm.RegisterStoreDecoders() // initialize stores + keys := app.AppKeepers.GetKVStoreKey() app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memKeys) + app.MountTransientStores(app.AppKeepers.GetTransientStoreKey()) + app.MountMemoryStores(app.AppKeepers.GetMemoryStoreKey()) + + // load state streaming if enabled + if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil { + logger.Error("failed to load state streaming", "err", err) + os.Exit(1) + } app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) - app.setAnteHandler(encodingConfig.TxConfig, wasmConfig, keys[wasm.StoreKey]) - app.setupUpgradeHandlers() - app.setupUpgradeStoreLoaders() + wasmConfig, err := wasm.ReadWasmConfig(appOpts) + if err != nil { + panic(fmt.Sprintf("error while reading wasm config: %s", err)) + } + anteHandler := app.CreateAnteHandler(encodingConfig.TxConfig, wasmConfig, keys[wasm.StoreKey], mempool) + app.SetAnteHandler(anteHandler) + app.SetupProposalHandler(encodingConfig.TxConfig, mempool, anteHandler) + app.SetupCheckTx(encodingConfig.TxConfig, mempool, anteHandler) + + app.SetupUpgradeHandlers() + app.SetupUpgradeStoreLoaders() // must be before Loading version // requires the snapshot store to be created and registered as a BaseAppOption // see cmd/wasmd/root.go: 206 - 214 approx if manager := app.SnapshotManager(); manager != nil { err := manager.RegisterExtensions( - wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper), + wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.AppKeepers.WasmKeeper), ) if err != nil { panic(fmt.Errorf("failed to register snapshot extension: %s", err)) } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedWasmKeeper = scopedWasmKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedStakeibcKeeper = scopedStakeibcKeeper - // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like // antehandlers, but are run _after_ the `runMsgs` execution. They are also // defined as a chain, and have the same signature as antehandlers. @@ -1179,7 +317,7 @@ func NewApp( } ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) // Initialize pinned codes in wasmvm as they are not persisted there - if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { + if err := app.AppKeepers.WasmKeeper.InitializePinnedCodes(ctx); err != nil { tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) } } @@ -1187,25 +325,77 @@ func NewApp( return app } -func (app *App) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey storetypes.StoreKey) { +func (app *App) CreateAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey storetypes.StoreKey, mempool *mempool.AuctionMempool) sdk.AnteHandler { anteHandler, err := NewAnteHandler( HandlerOptions{ HandlerOptions: ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, + AccountKeeper: app.AppKeepers.AccountKeeper, + BankKeeper: app.AppKeepers.BankKeeper, SignModeHandler: txConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, + FeegrantKeeper: app.AppKeepers.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - IBCKeeper: app.IBCKeeper, + IBCKeeper: app.AppKeepers.IBCKeeper, WasmConfig: &wasmConfig, TXCounterStoreKey: txCounterStoreKey, + + TxEncoder: txConfig.TxEncoder(), + BuilderKeeper: app.AppKeepers.BuilderKeeper, + Mempool: mempool, + + EcosystemincentiveKeeper: app.AppKeepers.EcosystemincentiveKeeper, }, ) if err != nil { panic(fmt.Errorf("failed to create AnteHandler: %s", err)) } - app.SetAnteHandler(anteHandler) + return anteHandler +} + +func (app *App) SetupProposalHandler(txConfig client.TxConfig, mempool *mempool.AuctionMempool, anteHandler sdk.AnteHandler) { + // Set the custom gov proposal handler on BaseApp. + // These methods perform custom logic when validator nodes are instructed to create proposals + proposalHandlers := pobabci.NewProposalHandler( + mempool, + app.Logger(), + anteHandler, + txConfig.TxEncoder(), + txConfig.TxDecoder(), + ) + app.SetPrepareProposal(proposalHandlers.PrepareProposalHandler()) + app.SetProcessProposal(proposalHandlers.ProcessProposalHandler()) +} + +func (app *App) SetupCheckTx(txConfig client.TxConfig, mempool *mempool.AuctionMempool, anteHandler sdk.AnteHandler) { + // Set the custom CheckTx handler on BaseApp. + checkTxHandler := pobabci.NewCheckTxHandler( + app.BaseApp, + txConfig.TxDecoder(), + mempool, + anteHandler, + app.ChainID(), + ) + app.SetCheckTx(checkTxHandler.CheckTx()) +} + +// ChainID gets chainID from private fields of BaseApp +// Should be removed once SDK 0.50.x will be adopted +func (app *App) ChainID() string { + field := reflect.ValueOf(app.BaseApp).Elem().FieldByName("chainID") + return field.String() +} + +// CheckTx will check the transaction with the provided checkTxHandler. We override the default +// handler so that we can verify bid transactions before they are inserted into the mempool. +// With the POB CheckTx, we can verify the bid transaction and all of the bundled transactions +// before inserting the bid transaction into the mempool. +func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx { + return app.checkTxHandler(req) +} + +// SetCheckTx sets the checkTxHandler for the app. +func (app *App) SetCheckTx(handler pobabci.CheckTx) { + app.checkTxHandler = handler } func (app *App) setPostHandler() { @@ -1224,32 +414,6 @@ func (app *App) Name() string { return app.BaseApp.Name() } // GetBaseApp returns the base app of the application func (app *App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } -// GetStakingKeeper implements the TestingApp interface. -func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper { - return app.StakingKeeper -} - -// GetTransferKeeper implements the TestingApp interface. -func (app *App) GetTransferKeeper() *ibctransferkeeper.Keeper { - return &app.TransferKeeper -} - -// GetIBCKeeper implements the TestingApp interface. -func (app *App) GetIBCKeeper() *ibckeeper.Keeper { - return app.IBCKeeper -} - -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - -// GetTxConfig implements the TestingApp interface. -func (app *App) GetTxConfig() client.TxConfig { - cfg := MakeEncodingConfig() - return cfg.TxConfig -} - // BeginBlocker application updates every begin block func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) @@ -1270,7 +434,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) + app.AppKeepers.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } @@ -1321,35 +485,6 @@ func (app *App) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } -// GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { - return app.keys[storeKey] -} - -// GetTKey returns the TransientStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey { - return app.tkeys[storeKey] -} - -// GetMemKey returns the MemStoreKey for the provided mem key. -// -// NOTE: This is solely used for testing purposes. -func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { - return app.memKeys[storeKey] -} - -// GetSubspace returns a param subspace for a given module name. -// -// NOTE: This is solely to be used for testing purposes. -func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) - return subspace -} - // SimulationManager implements the SimulationApp interface func (app *App) SimulationManager() *module.SimulationManager { return app.sm @@ -1405,49 +540,13 @@ func GetMaccPerms() map[string][]string { return dupMaccPerms } -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName) - paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(wasm.ModuleName) - - // original modules - // paramsKeeper.Subspace(nftmarkettypes.ModuleName) - // paramsKeeper.Subspace(nftminttypes.ModuleName) - - paramsKeeper.Subspace(stakeibctypes.ModuleName) - paramsKeeper.Subspace(epochstypes.ModuleName) - paramsKeeper.Subspace(interchainquerytypes.ModuleName) - paramsKeeper.Subspace(recordstypes.ModuleName) - paramsKeeper.Subspace(icacallbackstypes.ModuleName) - paramsKeeper.Subspace(yieldaggregatortypes.ModuleName) - - // paramsKeeper.Subspace(pricefeedtypes.ModuleName) - // paramsKeeper.Subspace(derivativestypes.ModuleName) - // paramsKeeper.Subspace(ecosystemincentivetypes.ModuleName) - - return paramsKeeper -} - -func (app *App) setupUpgradeStoreLoaders() { - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() +func (app *App) SetupUpgradeStoreLoaders() { + upgradeInfo, err := app.AppKeepers.UpgradeKeeper.ReadUpgradeInfoFromDisk() if err != nil { panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) } - if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if app.AppKeepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { return } @@ -1459,9 +558,9 @@ func (app *App) setupUpgradeStoreLoaders() { } -func (app *App) setupUpgradeHandlers() { +func (app *App) SetupUpgradeHandlers() { for _, upgrade := range Upgrades { - app.UpgradeKeeper.SetUpgradeHandler( + app.AppKeepers.UpgradeKeeper.SetUpgradeHandler( upgrade.UpgradeName, upgrade.CreateUpgradeHandler( app.mm, @@ -1472,12 +571,3 @@ func (app *App) setupUpgradeHandlers() { ) } } - -func (app *App) setupAppkeeper() { - app.AppKeepers.AccountKeeper = &app.AccountKeeper - app.AppKeepers.BankKeeper = &app.BankKeeper - app.AppKeepers.ConsensusParamsKeeper = &app.ConsensusParamsKeeper - app.AppKeepers.ParamsKeeper = &app.ParamsKeeper - app.AppKeepers.WasmKeeper = &app.WasmKeeper - app.AppKeepers.YieldaggregatorKeeper = &app.YieldaggregatorKeeper -} diff --git a/app/export.go b/app/export.go index 4512c62ca..267fd147f 100644 --- a/app/export.go +++ b/app/export.go @@ -34,7 +34,7 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, app.StakingKeeper) + validators, err := staking.WriteValidators(ctx, &app.AppKeepers.StakingKeeper) return servertypes.ExportedApp{ AppState: appState, Validators: validators, @@ -45,7 +45,8 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height +// +// in favour of export at a block height func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -65,18 +66,18 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str } /* Just to be safe, assert the invariants on current state. */ - app.CrisisKeeper.AssertInvariants(ctx) + app.AppKeepers.CrisisKeeper.AssertInvariants(ctx) /* Handle fee distribution state. */ // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + app.AppKeepers.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + _, _ = app.AppKeepers.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) return false }) // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) + dels := app.AppKeepers.StakingKeeper.GetAllDelegations(ctx) for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -85,30 +86,30 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) - if _, err = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr); err != nil { + if _, err = app.AppKeepers.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr); err != nil { panic(err) } } // clear validator slash events - app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) + app.AppKeepers.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) // clear validator historical rewards - app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + app.AppKeepers.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) // set context height to zero height := ctx.BlockHeight() ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + app.AppKeepers.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.DistrKeeper.GetFeePool(ctx) + scraps := app.AppKeepers.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + feePool := app.AppKeepers.DistrKeeper.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.DistrKeeper.SetFeePool(ctx, feePool) + app.AppKeepers.DistrKeeper.SetFeePool(ctx, feePool) - if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { + if err := app.AppKeepers.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { panic(err) } return false @@ -122,12 +123,12 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str } delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) - if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { + if err := app.AppKeepers.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { // never called as BeforeDelegationCreated always returns nil panic(fmt.Errorf("error while incrementing period: %w", err)) } - if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil { + if err := app.AppKeepers.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil { // never called as AfterDelegationModified always returns nil panic(fmt.Errorf("error while creating a new delegation period record: %w", err)) } @@ -139,32 +140,32 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle staking state. */ // iterate through redelegations, reset creation height - app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + app.AppKeepers.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetRedelegation(ctx, red) + app.AppKeepers.StakingKeeper.SetRedelegation(ctx, red) return false }) // iterate through unbonding delegations, reset creation height - app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + app.AppKeepers.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + app.AppKeepers.StakingKeeper.SetUnbondingDelegation(ctx, ubd) return false }) // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. - store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) + store := ctx.KVStore(app.AppKeepers.GetKey(stakingtypes.StoreKey)) iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.StakingKeeper.GetValidator(ctx, addr) + validator, found := app.AppKeepers.StakingKeeper.GetValidator(ctx, addr) if !found { panic("expected validator, not found") } @@ -174,7 +175,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str validator.Jailed = true } - app.StakingKeeper.SetValidator(ctx, validator) + app.AppKeepers.StakingKeeper.SetValidator(ctx, validator) counter++ } @@ -183,7 +184,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str return } - _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err := app.AppKeepers.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } @@ -191,11 +192,11 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle slashing state. */ // reset start height on signing infos - app.SlashingKeeper.IterateValidatorSigningInfos( + app.AppKeepers.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 - app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + app.AppKeepers.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) return false }, ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index b89b99f10..cbca947cd 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -1,46 +1,714 @@ package keepers import ( - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + "fmt" + "path/filepath" + + "github.com/spf13/cast" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + storetypes "github.com/cosmos/cosmos-sdk/store/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" + feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/cosmos/cosmos-sdk/x/group" + groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" + "github.com/cosmos/cosmos-sdk/x/params" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/cosmos-sdk/x/upgrade" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" + ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" + transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" + ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + + "github.com/UnUniFi/chain/wasmbinding" + + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + + ibchookskeeper "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/keeper" + ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" + + builderkeeper "github.com/skip-mev/pob/x/builder/keeper" + buildertypes "github.com/skip-mev/pob/x/builder/types" + + ununifinftkeeper "github.com/UnUniFi/chain/x/nft/keeper" + + epochskeeper "github.com/UnUniFi/chain/x/epochs/keeper" + epochstypes "github.com/UnUniFi/chain/x/epochs/types" + yieldaggregatorkeeper "github.com/UnUniFi/chain/x/yieldaggregator/keeper" + icacallbackskeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/keeper" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + interchainquerykeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/keeper" + interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + records "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records" + recordskeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + stakeibc "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc" + stakeibckeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" + yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" + + nftbackedloankeeper "github.com/UnUniFi/chain/x/nftbackedloan/keeper" - yieldaggregatorKeeper "github.com/UnUniFi/chain/x/yieldaggregator/keeper" + derivativeskeeper "github.com/UnUniFi/chain/x/derivatives/keeper" + nftfactorykeeper "github.com/UnUniFi/chain/x/nftfactory/keeper" + nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" + pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper" + + ecosystemincentivekeeper "github.com/UnUniFi/chain/x/ecosystemincentive/keeper" ) type AppKeepers struct { - // keepers, by order of initialization - // "Special" keepers - ParamsKeeper *paramskeeper.Keeper + // keys to access the substores + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey + + // keepers + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.BaseKeeper CapabilityKeeper *capabilitykeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ConsensusParamsKeeper *consensusparamkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper crisiskeeper.Keeper + UpgradeKeeper upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + AuthzKeeper authzkeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + GroupKeeper groupkeeper.Keeper + NFTKeeper nftkeeper.Keeper + UnUniFiNFTKeeper ununifinftkeeper.Keeper + ConsensusParamsKeeper consensusparamkeeper.Keeper + + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + IBCFeeKeeper ibcfeekeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + WasmKeeper wasm.Keeper + // IBC hooks + IBCHooksKeeper ibchookskeeper.Keeper + + NftbackedloanKeeper nftbackedloankeeper.Keeper + NftfactoryKeeper nftfactorykeeper.Keeper + + YieldaggregatorKeeper yieldaggregatorkeeper.Keeper + StakeibcKeeper stakeibckeeper.Keeper + ScopedStakeibcKeeper capabilitykeeper.ScopedKeeper + EpochsKeeper epochskeeper.Keeper + InterchainqueryKeeper interchainquerykeeper.Keeper + ScopedRecordsKeeper capabilitykeeper.ScopedKeeper + RecordsKeeper recordskeeper.Keeper + ScopedIcacallbacksKeeper capabilitykeeper.ScopedKeeper + IcacallbacksKeeper icacallbackskeeper.Keeper + + DerivativesKeeper derivativeskeeper.Keeper + PricefeedKeeper pricefeedkeeper.Keeper + + EcosystemincentiveKeeper ecosystemincentivekeeper.Keeper + + // BuilderKeeper is the keeper that handles processing auction transactions + BuilderKeeper builderkeeper.Keeper + + // Modules + ICAModule ica.AppModule + TransferModule transfer.AppModule // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedWasmKeeper capabilitykeeper.ScopedKeeper - ScopedICQKeeper capabilitykeeper.ScopedKeeper - - // "Normal" keepers - AccountKeeper *authkeeper.AccountKeeper - BankKeeper *bankkeeper.BaseKeeper - AuthzKeeper *authzkeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - DistrKeeper *distrkeeper.Keeper - - WasmKeeper *wasmkeeper.Keeper - - // ununifi original keepers - YieldaggregatorKeeper *yieldaggregatorKeeper.Keeper + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper + ScopedWasmKeeper capabilitykeeper.ScopedKeeper +} + +func NewAppKeeper( + appCodec codec.Codec, + bApp *baseapp.BaseApp, + legacyAmino *codec.LegacyAmino, + maccPerms map[string][]string, + modAccAddrs map[string]bool, + blockedAddress map[string]bool, + appOpts servertypes.AppOptions, + wasmOpts []wasm.Option, + enabledProposals []wasm.ProposalType, + accountAddressPrefix string, +) *AppKeepers { + appKeepers := AppKeepers{} + + invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) + // get skipUpgradeHeights from the app options + skipUpgradeHeights := map[int64]bool{} + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + homePath := cast.ToString(appOpts.Get(flags.FlagHome)) + + // Set keys KVStoreKey, TransientStoreKey, MemoryStoreKey + appKeepers.GenerateKeys() + + appKeepers.ParamsKeeper = initParamsKeeper( + appCodec, + legacyAmino, + appKeepers.keys[paramstypes.StoreKey], + appKeepers.tkeys[paramstypes.TStoreKey], + ) + + // set the BaseApp's parameter store + appKeepers.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, appKeepers.keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + bApp.SetParamStore(&appKeepers.ConsensusParamsKeeper) + + // add capability keeper and ScopeToModule for ibc module + appKeepers.CapabilityKeeper = capabilitykeeper.NewKeeper( + appCodec, + appKeepers.keys[capabilitytypes.StoreKey], + appKeepers.memKeys[capabilitytypes.MemStoreKey], + ) + + // grant capabilities for the ibc and ibc-transfer modules + scopedIBCKeeper := appKeepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + scopedICAHostKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + scopedICAControllerKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + scopedTransferKeeper := appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedWasmKeeper := appKeepers.CapabilityKeeper.ScopeToModule(wasm.ModuleName) + + // add keepers + appKeepers.AccountKeeper = authkeeper.NewAccountKeeper( + appCodec, + appKeepers.keys[authtypes.StoreKey], + authtypes.ProtoBaseAccount, + maccPerms, + accountAddressPrefix, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + appKeepers.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, + appKeepers.keys[banktypes.StoreKey], + appKeepers.AccountKeeper, + blockedAddress, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + appKeepers.StakingKeeper = *stakingkeeper.NewKeeper( + appCodec, + appKeepers.keys[stakingtypes.StoreKey], + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.MintKeeper = mintkeeper.NewKeeper( + appCodec, + appKeepers.keys[minttypes.StoreKey], + appKeepers.StakingKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + appKeepers.DistrKeeper = distrkeeper.NewKeeper( + appCodec, + appKeepers.keys[distrtypes.StoreKey], + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.StakingKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( + appCodec, + legacyAmino, + appKeepers.keys[slashingtypes.StoreKey], + appKeepers.StakingKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.CrisisKeeper = *crisiskeeper.NewKeeper( + appCodec, + appKeepers.keys[crisistypes.StoreKey], + invCheckPeriod, + appKeepers.BankKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.FeeGrantKeeper = feegrantkeeper.NewKeeper( + appCodec, + appKeepers.keys[feegrant.StoreKey], + appKeepers.AccountKeeper, + ) + + // register the staking hooks + appKeepers.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + appKeepers.DistrKeeper.Hooks(), + appKeepers.SlashingKeeper.Hooks(), + ), + ) + + appKeepers.AuthzKeeper = authzkeeper.NewKeeper(appKeepers.keys[authzkeeper.StoreKey], appCodec, bApp.MsgServiceRouter(), appKeepers.AccountKeeper) + + groupConfig := group.DefaultConfig() + appKeepers.GroupKeeper = groupkeeper.NewKeeper(appKeepers.keys[group.StoreKey], appCodec, bApp.MsgServiceRouter(), appKeepers.AccountKeeper, groupConfig) + + // set the governance module account as the authority for conducting upgrades + appKeepers.UpgradeKeeper = *upgradekeeper.NewKeeper( + skipUpgradeHeights, + appKeepers.keys[upgradetypes.StoreKey], + appCodec, + homePath, + bApp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.IBCKeeper = ibckeeper.NewKeeper( + appCodec, + appKeepers.keys[ibcexported.StoreKey], + appKeepers.GetSubspace(ibcexported.ModuleName), + appKeepers.StakingKeeper, + appKeepers.UpgradeKeeper, + scopedIBCKeeper, + ) + + govConfig := govtypes.DefaultConfig() + govKeeper := govkeeper.NewKeeper( + appCodec, + appKeepers.keys[govtypes.StoreKey], + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.StakingKeeper, + bApp.MsgServiceRouter(), + govConfig, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.GovKeeper = *govKeeper.SetHooks( + govtypes.NewMultiGovHooks( + // register the governance hooks + ), + ) + + appKeepers.NFTKeeper = nftkeeper.NewKeeper(appKeepers.keys[nftkeeper.StoreKey], + appCodec, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + ) + + appKeepers.UnUniFiNFTKeeper = ununifinftkeeper.NewKeeper( + appKeepers.NFTKeeper, + appCodec, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Create evidence Keeper for to register the IBC light client misbehaviour evidence route + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, + appKeepers.keys[evidencetypes.StoreKey], + appKeepers.StakingKeeper, + appKeepers.SlashingKeeper, + ) + // If evidence needs to be handled for the app, set routes in router here and seal + appKeepers.EvidenceKeeper = *evidenceKeeper + + // IBC Fee Module keeper + appKeepers.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + appCodec, appKeepers.keys[ibcfeetypes.StoreKey], + appKeepers.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + appKeepers.IBCKeeper.ChannelKeeper, + &appKeepers.IBCKeeper.PortKeeper, appKeepers.AccountKeeper, appKeepers.BankKeeper, + ) + + appKeepers.keys[ibchookstypes.StoreKey] = storetypes.NewKVStoreKey(ibchookstypes.StoreKey) + appKeepers.IBCHooksKeeper = ibchookskeeper.NewKeeper( + appKeepers.keys[ibchookstypes.StoreKey], + ) + + // Create Transfer Keepers + appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, + appKeepers.keys[ibctransfertypes.StoreKey], + appKeepers.GetSubspace(ibctransfertypes.ModuleName), + appKeepers.IBCFeeKeeper, + appKeepers.IBCKeeper.ChannelKeeper, + &appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + scopedTransferKeeper, + ) + + appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, + appKeepers.keys[icahosttypes.StoreKey], + appKeepers.GetSubspace(icahosttypes.SubModuleName), + appKeepers.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + appKeepers.IBCKeeper.ChannelKeeper, + &appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + scopedICAHostKeeper, + bApp.MsgServiceRouter(), + ) + appKeepers.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, + appKeepers.keys[icacontrollertypes.StoreKey], + appKeepers.GetSubspace(icacontrollertypes.SubModuleName), + appKeepers.IBCFeeKeeper, // may be replaced with middleware such as ics29 fee + appKeepers.IBCKeeper.ChannelKeeper, + &appKeepers.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, + bApp.MsgServiceRouter(), + ) + + wasmDir := filepath.Join(homePath, "wasm") + wasmConfig, err := wasm.ReadWasmConfig(appOpts) + if err != nil { + panic(fmt.Sprintf("error while reading wasm config: %s", err)) + } + + // The last arguments can contain custom message handlers, and custom query handlers, + // if we want to allow any custom callbacks + availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2" + + wasmOpts = append(wasmbinding.RegisterCustomPlugins(&appKeepers.BankKeeper, &appKeepers.InterchainqueryKeeper, &appKeepers.RecordsKeeper), wasmOpts...) + + appKeepers.WasmKeeper = wasm.NewKeeper( + appCodec, + appKeepers.keys[wasm.StoreKey], + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.StakingKeeper, + distrkeeper.NewQuerier(appKeepers.DistrKeeper), + appKeepers.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware + appKeepers.IBCKeeper.ChannelKeeper, + &appKeepers.IBCKeeper.PortKeeper, + scopedWasmKeeper, + appKeepers.TransferKeeper, + bApp.MsgServiceRouter(), + bApp.GRPCQueryRouter(), + wasmDir, + wasmConfig, + availableCapabilities, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + wasmOpts..., + ) + + // Instantiate the builder keeper, store keys, and module manager + appKeepers.BuilderKeeper = builderkeeper.NewKeeper( + appCodec, + appKeepers.keys[buildertypes.StoreKey], + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.DistrKeeper, + appKeepers.StakingKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.NftfactoryKeeper = nftfactorykeeper.NewKeeper( + appCodec, + appKeepers.keys[nftfactorytypes.StoreKey], + appKeepers.keys[nftfactorytypes.MemStoreKey], + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.UnUniFiNFTKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // nftbackedloanKeeper := nftbackedloankeeper.NewKeeper( + // appCodec, + // appKeepers.keys[nftbackedloantypes.StoreKey], + // appKeepers.keys[nftbackedloantypes.MemStoreKey], + // appKeepers.GetSubspace(nftbackedloantypes.ModuleName), + // appKeepers.AccountKeeper, + // appKeepers.BankKeeper, + // appKeepers.UnUniFiNFTKeeper, + // ) + + // appKeepers.EcosystemincentiveKeeper = ecosystemincentivekeeper.NewKeeper( + // appCodec, + // appKeepers.keys[ecosystemincentivetypes.StoreKey], + // appKeepers.GetSubspace(ecosystemincentivetypes.ModuleName), + // appKeepers.AccountKeeper, + // appKeepers.BankKeeper, + // appKeepers.DistrKeeper, + // // same as the feeCollectorName in the distribution module + // authtypes.FeeCollectorName, + // ) + + // create Keeper objects which have Hooks + // appKeepers.NftbackedloanKeeper = *nftbackedloanKeeper.SetHooks(nftbackedloantypes.NewMultiNftbackedloanHooks(appKeepers.EcosystemincentiveKeeper.Hooks())) + + // appKeepers.PricefeedKeeper = pricefeedkeeper.NewKeeper( + // appCodec, + // appKeepers.keys[pricefeedtypes.StoreKey], + // appKeepers.keys[pricefeedtypes.MemStoreKey], + // appKeepers.GetSubspace(pricefeedtypes.ModuleName), + // appKeepers.BankKeeper, + // ) + + // appKeepers.DerivativesKeeper = derivativeskeeper.NewKeeper( + // appCodec, + // appKeepers.keys[derivativestypes.StoreKey], + // appKeepers.keys[derivativestypes.MemStoreKey], + // appKeepers.GetSubspace(derivativestypes.ModuleName), + // appKeepers.AccountKeeper, + // appKeepers.BankKeeper, + // appKeepers.PricefeedKeeper, + // appKeepers.UnUniFiNFTKeeper, + // ) + + scopedIcacallbacksKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icacallbackstypes.ModuleName) + appKeepers.ScopedIcacallbacksKeeper = scopedIcacallbacksKeeper + appKeepers.IcacallbacksKeeper = *icacallbackskeeper.NewKeeper( + appCodec, + appKeepers.keys[icacallbackstypes.StoreKey], + appKeepers.keys[icacallbackstypes.MemStoreKey], + appKeepers.GetSubspace(icacallbackstypes.ModuleName), + scopedIcacallbacksKeeper, + *appKeepers.IBCKeeper, + appKeepers.ICAControllerKeeper, + ) + + appKeepers.InterchainqueryKeeper = interchainquerykeeper.NewKeeper( + appCodec, + appKeepers.keys[interchainquerytypes.StoreKey], + appKeepers.IBCKeeper, + &appKeepers.WasmKeeper, + ) + + scopedRecordsKeeper := appKeepers.CapabilityKeeper.ScopeToModule(recordstypes.ModuleName) + appKeepers.ScopedRecordsKeeper = scopedRecordsKeeper + appKeepers.RecordsKeeper = *recordskeeper.NewKeeper( + appCodec, + appKeepers.keys[recordstypes.StoreKey], + appKeepers.keys[recordstypes.MemStoreKey], + appKeepers.GetSubspace(recordstypes.ModuleName), + scopedRecordsKeeper, + appKeepers.AccountKeeper, + appKeepers.TransferKeeper, + *appKeepers.IBCKeeper, + appKeepers.IcacallbacksKeeper, + &appKeepers.WasmKeeper, + ) + + scopedStakeibcKeeper := appKeepers.CapabilityKeeper.ScopeToModule(stakeibctypes.ModuleName) + appKeepers.ScopedStakeibcKeeper = scopedStakeibcKeeper + appKeepers.StakeibcKeeper = stakeibckeeper.NewKeeper( + appCodec, + appKeepers.keys[stakeibctypes.StoreKey], + appKeepers.keys[stakeibctypes.MemStoreKey], + appKeepers.GetSubspace(stakeibctypes.ModuleName), + appKeepers.IBCKeeper.ChannelKeeper, + // &appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.ICAControllerKeeper, + *appKeepers.IBCKeeper, + scopedStakeibcKeeper, + scopedIBCKeeper, + appKeepers.InterchainqueryKeeper, + appKeepers.RecordsKeeper, + appKeepers.StakingKeeper, + appKeepers.IcacallbacksKeeper, + ) + + // Register ICQ callbacks + err = appKeepers.InterchainqueryKeeper.SetCallbackHandler(stakeibctypes.ModuleName, appKeepers.StakeibcKeeper.CallbackHandler()) + if err != nil { + return nil + } + + // Register ICA calllbacks + // stakeibc + err = appKeepers.IcacallbacksKeeper.SetICACallbackHandler(icacontrollertypes.SubModuleName, appKeepers.StakeibcKeeper.ICACallbackHandler()) + if err != nil { + return nil + } + // records + err = appKeepers.IcacallbacksKeeper.SetICACallbackHandler(recordstypes.ModuleName, appKeepers.RecordsKeeper.ICACallbackHandler()) + if err != nil { + return nil + } + + appKeepers.YieldaggregatorKeeper = yieldaggregatorkeeper.NewKeeper( + appCodec, + appKeepers.keys[yieldaggregatortypes.StoreKey], + appKeepers.BankKeeper, + wasmkeeper.NewDefaultPermissionKeeper(appKeepers.WasmKeeper), + appKeepers.WasmKeeper, + appKeepers.StakeibcKeeper, + appKeepers.RecordsKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + epochsKeeper := epochskeeper.NewKeeper(appCodec, appKeepers.keys[epochstypes.StoreKey]) + appKeepers.EpochsKeeper = *epochsKeeper.SetHooks( + epochstypes.NewMultiEpochHooks( + appKeepers.YieldaggregatorKeeper.Hooks(), + appKeepers.StakeibcKeeper.Hooks(), + ), + ) + + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://docs.cosmos.network/main/modules/gov#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter. + AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)). + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&appKeepers.UpgradeKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper)) + + // The gov proposal types can be individually enabled + if len(enabledProposals) != 0 { + govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(appKeepers.WasmKeeper, enabledProposals)) + } + + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://docs.cosmos.network/main/modules/gov#proposal-messages + appKeepers.GovKeeper.SetLegacyRouter(govRouter) + + // Create Transfer Stack + var transferStack porttypes.IBCModule + transferStack = transfer.NewIBCModule(appKeepers.TransferKeeper) + transferStack = records.NewIBCModule(appKeepers.RecordsKeeper, transferStack) + transferStack = ibcfee.NewIBCMiddleware(transferStack, appKeepers.IBCFeeKeeper) + + // RecvPacket, message that originates from core IBC and goes down to app, the flow is: + // channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket + var icaHostStack porttypes.IBCModule + icaHostStack = icahost.NewIBCModule(appKeepers.ICAHostKeeper) + icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, appKeepers.IBCFeeKeeper) + + // Create fee enabled wasm ibc Stack + var wasmStack porttypes.IBCModule + wasmStack = wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCFeeKeeper) + wasmStack = ibcfee.NewIBCMiddleware(wasmStack, appKeepers.IBCFeeKeeper) + + // Stack two (Stakeibc Stack) contains + // - IBC + // - ICA + // - stakeibc + // - base app + var stakeibcStack porttypes.IBCModule = stakeibc.NewIBCModule(appKeepers.StakeibcKeeper) + stakeibcStack = icacontroller.NewIBCMiddleware(stakeibcStack, appKeepers.ICAControllerKeeper) + + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter() + ibcRouter. + AddRoute(ibctransfertypes.ModuleName, transferStack). + AddRoute(wasm.ModuleName, wasmStack). + AddRoute(icahosttypes.SubModuleName, icaHostStack). + // Stakeibc Stack + AddRoute(icacontrollertypes.SubModuleName, stakeibcStack). + AddRoute(stakeibctypes.ModuleName, stakeibcStack) + + appKeepers.IBCKeeper.SetRouter(ibcRouter) + + appKeepers.ScopedIBCKeeper = scopedIBCKeeper + appKeepers.ScopedTransferKeeper = scopedTransferKeeper + appKeepers.ScopedWasmKeeper = scopedWasmKeeper + appKeepers.ScopedICAHostKeeper = scopedICAHostKeeper + appKeepers.ScopedICAControllerKeeper = scopedICAControllerKeeper + appKeepers.ScopedStakeibcKeeper = scopedStakeibcKeeper + + return &appKeepers +} + +// GetSubspace returns a param subspace for a given module name. +func (appKeepers *AppKeepers) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := appKeepers.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName) + paramsKeeper.Subspace(crisistypes.ModuleName) + paramsKeeper.Subspace(ibctransfertypes.ModuleName) + paramsKeeper.Subspace(ibcexported.ModuleName) + paramsKeeper.Subspace(icahosttypes.SubModuleName) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName) + paramsKeeper.Subspace(wasm.ModuleName) + paramsKeeper.Subspace(buildertypes.ModuleName) + + // original modules + paramsKeeper.Subspace(nftfactorytypes.ModuleName) + // paramsKeeper.Subspace(nftbackedloantypes.ModuleName) + // paramsKeeper.Subspace(ecosystemincentivetypes.ModuleName) + + // paramsKeeper.Subspace(pricefeedtypes.ModuleName) + // paramsKeeper.Subspace(derivativestypes.ModuleName) + + paramsKeeper.Subspace(stakeibctypes.ModuleName) + paramsKeeper.Subspace(epochstypes.ModuleName) + paramsKeeper.Subspace(interchainquerytypes.ModuleName) + paramsKeeper.Subspace(recordstypes.ModuleName) + paramsKeeper.Subspace(icacallbackstypes.ModuleName) + + // Deprecated: Just for migration + paramsKeeper.Subspace(yieldaggregatortypes.ModuleName) + + return paramsKeeper } diff --git a/app/keepers/keys.go b/app/keepers/keys.go new file mode 100644 index 000000000..38d336680 --- /dev/null +++ b/app/keepers/keys.go @@ -0,0 +1,112 @@ +package keepers + +import ( + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" + ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + + "github.com/CosmWasm/wasmd/x/wasm" + + buildertypes "github.com/skip-mev/pob/x/builder/types" + + epochstypes "github.com/UnUniFi/chain/x/epochs/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" + yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" + + nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" +) + +func (appKeepers *AppKeepers) GenerateKeys() { + // Define what keys will be used in the cosmos-sdk key/value store. + // Cosmos-SDK modules each have a "key" that allows the application to reference what they've stored on the chain. + appKeepers.keys = sdk.NewKVStoreKeys( + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, + minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + evidencetypes.StoreKey, capabilitytypes.StoreKey, + authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, + // non sdk store keys + ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, + wasm.StoreKey, icahosttypes.StoreKey, + icacontrollertypes.StoreKey, + buildertypes.StoreKey, + + // original modules + // nftbackedloantypes.StoreKey, + nftfactorytypes.StoreKey, + // ecosystemincentivetypes.StoreKey, + + // derivativestypes.StoreKey, + // pricefeedtypes.StoreKey, + + yieldaggregatortypes.StoreKey, + stakeibctypes.StoreKey, + epochstypes.StoreKey, + interchainquerytypes.StoreKey, + recordstypes.StoreKey, + icacallbackstypes.StoreKey, + ) + + // Define transient store keys + appKeepers.tkeys = sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + + // MemKeys are for information that is stored only in RAM. + appKeepers.memKeys = sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) +} + +func (appKeepers *AppKeepers) GetKVStoreKey() map[string]*storetypes.KVStoreKey { + return appKeepers.keys +} + +func (appKeepers *AppKeepers) GetTransientStoreKey() map[string]*storetypes.TransientStoreKey { + return appKeepers.tkeys +} + +func (appKeepers *AppKeepers) GetMemoryStoreKey() map[string]*storetypes.MemoryStoreKey { + return appKeepers.memKeys +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (appKeepers *AppKeepers) GetKey(storeKey string) *storetypes.KVStoreKey { + return appKeepers.keys[storeKey] +} + +// GetTKey returns the TransientStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (appKeepers *AppKeepers) GetTKey(storeKey string) *storetypes.TransientStoreKey { + return appKeepers.tkeys[storeKey] +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (appKeepers *AppKeepers) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + return appKeepers.memKeys[storeKey] +} diff --git a/app/modules.go b/app/modules.go new file mode 100644 index 000000000..95627ca5d --- /dev/null +++ b/app/modules.go @@ -0,0 +1,460 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/capability" + capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + "github.com/cosmos/cosmos-sdk/x/consensus" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/evidence" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" + feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" + "github.com/cosmos/cosmos-sdk/x/mint" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/nft" + nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module" + "github.com/cosmos/cosmos-sdk/x/params" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/cosmos-sdk/x/upgrade" + upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" + icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" + ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" + transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v7/modules/core" + ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + + "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7" + ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" + + "github.com/skip-mev/pob/x/builder" + buildertypes "github.com/skip-mev/pob/x/builder/types" + + ununifinftmodule "github.com/UnUniFi/chain/x/nft/module" + + epochs "github.com/UnUniFi/chain/x/epochs" + epochstypes "github.com/UnUniFi/chain/x/epochs/types" + "github.com/UnUniFi/chain/x/yieldaggregator" + icacallbacks "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + interchainquery "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery" + interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + records "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + stakeibc "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc" + stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" + yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" + + nftbackedloan "github.com/UnUniFi/chain/x/nftbackedloan" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + + "github.com/UnUniFi/chain/x/derivatives" + derivativestypes "github.com/UnUniFi/chain/x/derivatives/types" + nftfactory "github.com/UnUniFi/chain/x/nftfactory" + nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" + "github.com/UnUniFi/chain/x/pricefeed" + + ecosystemincentive "github.com/UnUniFi/chain/x/ecosystemincentive" + ecosystemincentivetypes "github.com/UnUniFi/chain/x/ecosystemincentive/types" + + ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" + + appparams "github.com/UnUniFi/chain/app/params" +) + +var maccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + nft.ModuleName: nil, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + icatypes.ModuleName: nil, + wasm.ModuleName: {authtypes.Burner}, + buildertypes.ModuleName: nil, + ibchookstypes.ModuleName: nil, + + // original modules + nftbackedloantypes.ModuleName: nil, + // nftbackedloantypes.NftTradingFee: nil, + nftfactorytypes.ModuleName: nil, + + yieldaggregatortypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + stakeibctypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, + interchainquerytypes.ModuleName: nil, + + derivativestypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + derivativestypes.DerivativeFeeCollector: nil, + derivativestypes.MarginManager: nil, + derivativestypes.PendingPaymentManager: nil, + + ecosystemincentivetypes.ModuleName: nil, +} + +// ModuleBasics defines the module BasicManager is in charge of setting up basic, +// non-dependant module elements, such as codec registration +// and genesis verification. +var ModuleBasics = module.NewBasicManager( + auth.AppModuleBasic{}, + genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + bank.AppModuleBasic{}, + capability.AppModuleBasic{}, + staking.AppModuleBasic{}, + mint.AppModuleBasic{}, + distr.AppModuleBasic{}, + gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + upgradeclient.LegacyProposalHandler, + upgradeclient.LegacyCancelProposalHandler, + ibcclientclient.UpdateClientProposalHandler, + ibcclientclient.UpgradeProposalHandler, + }, + ), + params.AppModuleBasic{}, + crisis.AppModuleBasic{}, + slashing.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, + upgrade.AppModuleBasic{}, + evidence.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, + groupmodule.AppModuleBasic{}, + vesting.AppModuleBasic{}, + ununifinftmodule.AppModuleBasic{}, + consensus.AppModuleBasic{}, + // non sdk modules + wasm.AppModuleBasic{}, + ibc.AppModuleBasic{}, + ibctm.AppModuleBasic{}, + transfer.AppModuleBasic{}, + ica.AppModuleBasic{}, + ibcfee.AppModuleBasic{}, + ibchooks.AppModuleBasic{}, + builder.AppModuleBasic{}, + + // original modules + pricefeed.AppModuleBasic{}, + derivatives.AppModuleBasic{}, + + nftbackedloan.AppModuleBasic{}, + nftfactory.AppModuleBasic{}, + ecosystemincentive.AppModuleBasic{}, + + yieldaggregator.AppModuleBasic{}, + stakeibc.AppModuleBasic{}, + epochs.AppModuleBasic{}, + interchainquery.AppModuleBasic{}, + records.AppModuleBasic{}, + icacallbacks.AppModuleBasic{}, +) + +func appModules( + app *App, + encodingConfig appparams.EncodingConfig, + skipGenesisInvariants bool, +) []module.AppModule { + appCodec := encodingConfig.Codec + + return []module.AppModule{ + builder.NewAppModule(appCodec, app.AppKeepers.BuilderKeeper), + genutil.NewAppModule( + app.AppKeepers.AccountKeeper, + app.AppKeepers.StakingKeeper, + app.BaseApp.DeliverTx, + encodingConfig.TxConfig, + ), + auth.NewAppModule(appCodec, app.AppKeepers.AccountKeeper, authsims.RandomGenesisAccounts, app.AppKeepers.GetSubspace(authtypes.ModuleName)), + vesting.NewAppModule(app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), + bank.NewAppModule(appCodec, app.AppKeepers.BankKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.AppKeepers.CapabilityKeeper, false), + feegrantmodule.NewAppModule(appCodec, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.AppKeepers.FeeGrantKeeper, app.interfaceRegistry), + gov.NewAppModule(appCodec, &app.AppKeepers.GovKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.AppKeepers.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.AppKeepers.MintKeeper, app.AppKeepers.AccountKeeper, nil, app.AppKeepers.GetSubspace(minttypes.ModuleName)), + slashing.NewAppModule(appCodec, app.AppKeepers.SlashingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.GetSubspace(slashingtypes.ModuleName)), + distr.NewAppModule(appCodec, app.AppKeepers.DistrKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.GetSubspace(distrtypes.ModuleName)), + staking.NewAppModule(appCodec, &app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.AppKeepers.GetSubspace(stakingtypes.ModuleName)), + upgrade.NewAppModule(&app.AppKeepers.UpgradeKeeper), + evidence.NewAppModule(app.AppKeepers.EvidenceKeeper), + params.NewAppModule(app.AppKeepers.ParamsKeeper), + authzmodule.NewAppModule(appCodec, app.AppKeepers.AuthzKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.interfaceRegistry), + groupmodule.NewAppModule(appCodec, app.AppKeepers.GroupKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.interfaceRegistry), + ununifinftmodule.NewAppModule(nftmodule.NewAppModule(appCodec, app.AppKeepers.NFTKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.interfaceRegistry), app.AppKeepers.UnUniFiNFTKeeper), + consensus.NewAppModule(appCodec, app.AppKeepers.ConsensusParamsKeeper), + + wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.AppKeepers.GetSubspace(wasmtypes.ModuleName)), + ibc.NewAppModule(app.AppKeepers.IBCKeeper), + transfer.NewAppModule(app.AppKeepers.TransferKeeper), + ibcfee.NewAppModule(app.AppKeepers.IBCFeeKeeper), + ibchooks.NewAppModule(app.AppKeepers.AccountKeeper), + ica.NewAppModule(&app.AppKeepers.ICAControllerKeeper, &app.AppKeepers.ICAHostKeeper), + crisis.NewAppModule(&app.AppKeepers.CrisisKeeper, skipGenesisInvariants, app.AppKeepers.GetSubspace(crisistypes.ModuleName)), + + // original modules + nftfactory.NewAppModule(appCodec, app.AppKeepers.NftfactoryKeeper, app.AppKeepers.UnUniFiNFTKeeper), + // nftbackedloan.NewAppModule(appCodec, app.AppKeepers.NftbackedloanKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), + // ecosystemincentive.NewAppModule(appCodec, app.AppKeepers.EcosystemincentiveKeeper, app.AppKeepers.BankKeeper), + + // pricefeed.NewAppModule(appCodec, app.AppKeepers.PricefeedKeeper, app.AppKeepers.AccountKeeper), + // derivatives.NewAppModule(appCodec, app.AppKeepers.DerivativesKeeper, app.AppKeepers.BankKeeper), + + yieldaggregator.NewAppModule(appCodec, app.AppKeepers.YieldaggregatorKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), + stakeibc.NewAppModule(appCodec, app.AppKeepers.StakeibcKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), + epochs.NewAppModule(appCodec, app.AppKeepers.EpochsKeeper), + interchainquery.NewAppModule(appCodec, app.AppKeepers.InterchainqueryKeeper), + records.NewAppModule(appCodec, app.AppKeepers.RecordsKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), + icacallbacks.NewAppModule(appCodec, app.AppKeepers.IcacallbacksKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), + } +} + +// simulationModules returns modules for simulation manager +// define the order of the modules for deterministic simulations +func simulationModules( + app *App, + encodingConfig appparams.EncodingConfig, + _ bool, +) []module.AppModuleSimulation { + // appCodec := encodingConfig.Codec + + return []module.AppModuleSimulation{} +} + +/* +orderBeginBlockers tells the app's module manager how to set the order of +BeginBlockers, which are run at the beginning of every block. + +Interchain Security Requirements: +During begin block slashing happens after distr.BeginBlocker so that +there is nothing left over in the validator fee pool, so as to keep the +CanWithdrawInvariant invariant. +NOTE: staking module is required if HistoricalEntries param > 0 +NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) +*/ + +func orderBeginBlockers() []string { + return []string{ + buildertypes.ModuleName, + upgradetypes.ModuleName, + capabilitytypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + govtypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + nft.ModuleName, + group.ModuleName, + paramstypes.ModuleName, + vestingtypes.ModuleName, + consensusparamtypes.ModuleName, + // original modules + nftfactorytypes.ModuleName, + // nftbackedloantypes.ModuleName, + // ecosystemincentivetypes.ModuleName, + + // pricefeedtypes.ModuleName, + // derivativestypes.ModuleName, + + stakeibctypes.ModuleName, + epochstypes.ModuleName, + interchainquerytypes.ModuleName, + recordstypes.ModuleName, + icacallbackstypes.ModuleName, + + yieldaggregatortypes.ModuleName, + + // additional non simd modules + ibctransfertypes.ModuleName, + ibcexported.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + ibchookstypes.ModuleName, + wasm.ModuleName, + } +} + +/* +Interchain Security Requirements: +- provider.EndBlock gets validator updates from the staking module; +thus, staking.EndBlock must be executed before provider.EndBlock; +- creating a new consumer chain requires the following order, +CreateChildClient(), staking.EndBlock, provider.EndBlock; +thus, gov.EndBlock must be executed before staking.EndBlock +*/ +func orderEndBlockers() []string { + return []string{ + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + minttypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + nft.ModuleName, + group.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + consensusparamtypes.ModuleName, + // original modules + nftfactorytypes.ModuleName, + // nftbackedloantypes.ModuleName, + // ecosystemincentivetypes.ModuleName, + + // pricefeedtypes.ModuleName, + // derivativestypes.ModuleName, + + stakeibctypes.ModuleName, + epochstypes.ModuleName, + interchainquerytypes.ModuleName, + recordstypes.ModuleName, + icacallbackstypes.ModuleName, + + yieldaggregatortypes.ModuleName, + + // additional non simd modules + ibctransfertypes.ModuleName, + ibcexported.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + ibchookstypes.ModuleName, + wasm.ModuleName, + buildertypes.ModuleName, + } +} + +/* +NOTE: The genutils module must occur after staking so that pools are +properly initialized with tokens from genesis accounts. +NOTE: The genutils module must also occur after auth so that it can access the params from auth. +NOTE: Capability module must occur first so that it can initialize any capabilities +so that other modules that want to create or claim capabilities afterwards in InitChain +can do so safely. +*/ +func orderInitGenesis() []string { + return []string{ + buildertypes.ModuleName, + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + nft.ModuleName, + group.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + consensusparamtypes.ModuleName, + + // original modules + nftfactorytypes.ModuleName, + // nftbackedloantypes.ModuleName, + // ecosystemincentivetypes.ModuleName, + + // pricefeedtypes.ModuleName, + // derivativestypes.ModuleName, + + stakeibctypes.ModuleName, + epochstypes.ModuleName, + interchainquerytypes.ModuleName, + recordstypes.ModuleName, + icacallbackstypes.ModuleName, + + yieldaggregatortypes.ModuleName, + + // additional non simd modules + ibctransfertypes.ModuleName, + ibcexported.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + ibchookstypes.ModuleName, + // wasm after ibc transfer + wasm.ModuleName, + } +} + +// GetStakingKeeper implements the TestingApp interface. +func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper { + return app.AppKeepers.StakingKeeper +} + +// GetTransferKeeper implements the TestingApp interface. +func (app *App) GetTransferKeeper() *ibctransferkeeper.Keeper { + return &app.AppKeepers.TransferKeeper +} + +// GetIBCKeeper implements the TestingApp interface. +func (app *App) GetIBCKeeper() *ibckeeper.Keeper { + return app.AppKeepers.IBCKeeper +} + +// GetScopedIBCKeeper implements the TestingApp interface. +func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.AppKeepers.ScopedIBCKeeper +} + +// GetTxConfig implements the TestingApp interface. +func (app *App) GetTxConfig() client.TxConfig { + cfg := MakeEncodingConfig() + return cfg.TxConfig +} diff --git a/app/params/encoding.go b/app/params/encoding.go index 3d634abf1..8ff9ea04b 100644 --- a/app/params/encoding.go +++ b/app/params/encoding.go @@ -10,7 +10,7 @@ import ( // This is provided for compatibility between protobuf and amino implementations. type EncodingConfig struct { InterfaceRegistry types.InterfaceRegistry - Marshaler codec.Codec + Codec codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino } diff --git a/app/params/proto.go b/app/params/proto.go index 84ff35a39..100e547a2 100644 --- a/app/params/proto.go +++ b/app/params/proto.go @@ -15,7 +15,7 @@ func MakeEncodingConfig() EncodingConfig { return EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, + Codec: marshaler, TxConfig: txCfg, Amino: amino, } diff --git a/app/test_common.go b/app/test_common.go index 2c81c8ca1..396b12739 100644 --- a/app/test_common.go +++ b/app/test_common.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/CosmWasm/wasmd/x/wasm" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto" @@ -33,10 +32,11 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" // "github.com/cosmos/cosmos-sdk/x/supply" + pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" // authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" // "github.com/cosmos/cosmos-sdk/x/supply" - // "github.com/CosmWasm/wasmd/x/wasm" + "github.com/CosmWasm/wasmd/x/wasm" ) var emptyWasmOpts []wasm.Option = nil @@ -76,10 +76,11 @@ func NewTestApp() TestApp { db, nil, true, - wasm.EnableAllProposals, appOptions, emptyWasmOpts, + wasm.EnableAllProposals, ) + return TestApp{App: *tApp} } @@ -88,17 +89,17 @@ func (tApp TestApp) GetAccountKeeper() authkeeper.AccountKeeper { return tApp.Ac func (tApp TestApp) GetBankKeeper() bankkeeper.Keeper { return tApp.BankKeeper } // func (tApp TestApp) GetSupplyKeeper() supply.Keeper { return tApp.SupplyKeeper } -func (tApp TestApp) GetStakingKeeper() *stakingkeeper.Keeper { return tApp.StakingKeeper } +func (tApp TestApp) GetStakingKeeper() stakingkeeper.Keeper { return tApp.StakingKeeper } func (tApp TestApp) GetSlashingKeeper() slashingkeeper.Keeper { return tApp.SlashingKeeper } func (tApp TestApp) GetMintKeeper() mintkeeper.Keeper { return tApp.MintKeeper } func (tApp TestApp) GetDistrKeeper() distrkeeper.Keeper { return tApp.DistrKeeper } func (tApp TestApp) GetGovKeeper() govkeeper.Keeper { return tApp.GovKeeper } -func (tApp TestApp) GetCrisisKeeper() *crisiskeeper.Keeper { return tApp.CrisisKeeper } -func (tApp TestApp) GetUpgradeKeeper() *upgradekeeper.Keeper { return tApp.UpgradeKeeper } +func (tApp TestApp) GetCrisisKeeper() crisiskeeper.Keeper { return tApp.CrisisKeeper } +func (tApp TestApp) GetUpgradeKeeper() upgradekeeper.Keeper { return tApp.UpgradeKeeper } func (tApp TestApp) GetParamsKeeper() paramskeeper.Keeper { return tApp.ParamsKeeper } // func (tApp TestApp) GetVVKeeper() validatorvesting.Keeper { return tApp.vvKeeper } -// func (tApp TestApp) GetPriceFeedKeeper() pricefeedkeeper.Keeper { return tApp.PricefeedKeeper } +func (tApp TestApp) GetPriceFeedKeeper() pricefeedkeeper.Keeper { return tApp.PricefeedKeeper } // func (tApp TestApp) GetHarvestKeeper() harvest.Keeper { return tApp.harvestKeeper } // func (tApp TestApp) GetCommitteeKeeper() committee.Keeper { return tApp.committeeKeeper } diff --git a/app/test_helpers.go b/app/test_helpers.go index 157b6c096..dcbfa70ef 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -63,7 +63,7 @@ func setup(t testing.TB, chainID string, withGenesis bool, invCheckPeriod uint, appOptions := make(simtestutil.AppOptionsMap, 0) appOptions[flags.FlagHome] = nodeHome // ensure unique folder appOptions[server.FlagInvCheckPeriod] = invCheckPeriod - app := NewApp(log.NewNopLogger(), db, nil, true, wasmtypes.EnableAllProposals, appOptions, opts, bam.SetChainID(chainID), bam.SetSnapshot(snapshotStore, snapshottypes.SnapshotOptions{KeepRecent: 2})) + app := NewApp(log.NewNopLogger(), db, nil, true, appOptions, opts, wasmtypes.EnableAllProposals, bam.SetChainID(chainID), bam.SetSnapshot(snapshotStore, snapshottypes.SnapshotOptions{KeepRecent: 2})) if withGenesis { return app, NewDefaultGenesisState(app.AppCodec()) } @@ -89,7 +89,7 @@ func NewAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), } - app := NewApp(options.Logger, options.DB, nil, true, wasmtypes.EnableAllProposals, options.AppOpts, options.WasmOpts) + app := NewApp(options.Logger, options.DB, nil, true, options.AppOpts, options.WasmOpts, wasmtypes.EnableAllProposals) genesisState := NewDefaultGenesisState(app.appCodec) genesisState, err = GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) require.NoError(t, err) @@ -133,7 +133,6 @@ func Setup(t *testing.T, opts ...wasm.Option) *App { } chainID := "testing" app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, chainID, opts, balance) - return app } diff --git a/app/upgrades/v1-beta.3/bank_send.go b/app/upgrades/v1-beta.3/bank_send.go deleted file mode 100644 index 3c6461075..000000000 --- a/app/upgrades/v1-beta.3/bank_send.go +++ /dev/null @@ -1,262 +0,0 @@ -package v1_beta3 - -import ( - "fmt" - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" -) - -func upgradeBankSend( - ctx sdk.Context, - authkeeper authkeeper.AccountKeeper, - bankkeeper bankkeeper.Keeper, - bank_send_list ResultList) error { - ctx.Logger().Info(fmt.Sprintf("upgrade :%s", UpgradeName)) - - total_allocate_coin := sdk.NewCoin(Denom, sdk.NewInt(0)) - assumed_coin := sdk.NewCoin(Denom, sdk.NewInt(0)) - - // before get total supply - before_total_supply := bankkeeper.GetSupply(ctx, Denom) - ctx.Logger().Info(fmt.Sprintf("bank send : total supply[%d]", before_total_supply.Amount)) - - fromAddr, err := sdk.AccAddressFromBech32(FromAddressValidator) - if err != nil { - panic(err) - } - // Validator - for index, value := range bank_send_list.Validator { - ctx.Logger().Info(fmt.Sprintf("bank send validator :%s[%s]", strconv.Itoa(index), value.ToAddress)) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin.Add(coin) - normalToken := sdk.NewCoin(Denom, sdk.NewInt(FundAmountValidator)) - toAddr, _ := sdk.AccAddressFromBech32(value.ToAddress) - if err := bankkeeper.SendCoins(ctx, fromAddr, toAddr, sdk.NewCoins(normalToken)); err != nil { - panic(err) - } - total_allocate_coin.Add(normalToken) - } - - // Lend validatos - for index, value := range bank_send_list.LendValidator { - ctx.Logger().Info(fmt.Sprintf("bank send validator :%s[%s]", strconv.Itoa(index), value.ToAddress)) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin.Add(coin) - } - - // Check the amount of tokens sent - assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountValidator))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the validator does not match.: Actual[%d] Assumed[%d]", - total_allocate_coin.Amount, - assumed_coin.Amount)) - } - - fromAddr, err = sdk.AccAddressFromBech32(FromAddressAirdrop) - if err != nil { - panic(err) - } - // Airdrop, Community reward and Moderator - for index, value := range bank_send_list.AirdropCommunityRewardModerator { - ctx.Logger().Info(fmt.Sprintf("bank send :%s", strconv.Itoa(index))) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin.Add(coin) - } - - // Check the amount of tokens sent - assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountExceptValidator))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the Airdrop, Community reward and Moderator does not match.: Actual[%d] Assumed[%d]", - total_allocate_coin.Amount, - assumed_coin.Amount)) - } - - // airdrop forfeit - toAddr, err := sdk.AccAddressFromBech32(ToAddressAirdropForfeit) - if err != nil { - panic(err) - } - for index, value := range bank_send_list.AirdropForfeit { - err = forfeitToken(ctx, authkeeper, bankkeeper, index, value, toAddr) - if err != nil { - panic(err) - } - } - - // others - for index, value := range bank_send_list.Others { - fromAddr, _ := sdk.AccAddressFromBech32(value.FromAddress) - bankTarget := value.BankSendTarget - ctx.Logger().Info(fmt.Sprintf("bank send :%s", strconv.Itoa(index))) - // subtract token from sender - token := sdk.NewCoin(bankTarget.Denom, sdk.NewInt(bankTarget.Amount)) - changeVestingAmount(ctx, authkeeper, token, fromAddr, false) - _ = tokenAllocation(ctx, authkeeper, bankkeeper, index, bankTarget, fromAddr) - } - - // after get total supply - after_total_supply := bankkeeper.GetSupply(ctx, Denom) - ctx.Logger().Info(fmt.Sprintf("bank send : total supply[%d]", after_total_supply.Amount)) - - return nil -} - -func forfeitToken( - ctx sdk.Context, - authkeeper authkeeper.AccountKeeper, - bankkeeper bankkeeper.Keeper, - index int, - fromAddr string, - toAddr sdk.AccAddress, -) error { - addr, err := sdk.AccAddressFromBech32(fromAddr) - if err != nil { - return err - } - accI := authkeeper.GetAccount(ctx, addr) - if accI == nil { - panic(fmt.Sprintf("error address not exist: [%s][%s]", strconv.Itoa(index), fromAddr)) - } - cont_acc, ok := accI.(*authvesting.ContinuousVestingAccount) - zeroCoins := sdk.NewCoins(sdk.NewCoin(Denom, sdk.ZeroInt())) - if ok { - // add coin amount to send forfeited amount of token to ToAirdropAddress - add_coins := sdk.NewCoins(sdk.NewCoin(Denom, cont_acc.OriginalVesting.AmountOf(Denom))) - cont_acc.OriginalVesting = zeroCoins - - if err := cont_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate ContinuousVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, cont_acc) - - if err := bankkeeper.SendCoins(ctx, addr, toAddr, add_coins); err != nil { - return err - } - } - return nil -} - -func changeVestingAmount( - ctx sdk.Context, - authkeeper authkeeper.AccountKeeper, - amount sdk.Coin, - addr sdk.AccAddress, - add bool, -) { - // subtract token from sender - accI := authkeeper.GetAccount(ctx, addr) - - cont_acc, _ := accI.(*authvesting.ContinuousVestingAccount) - if add { - modifiedAmount := cont_acc.OriginalVesting.Add(amount) - cont_acc.OriginalVesting = modifiedAmount - } else { - modifiedAmount := cont_acc.OriginalVesting.Sub(sdk.NewCoins(amount)...) - cont_acc.OriginalVesting = modifiedAmount - } - - if err := cont_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate ContinuousVestingAccount: %w", err)) - } - authkeeper.SetAccount(ctx, cont_acc) -} - -func tokenAllocation( - ctx sdk.Context, - authkeeper authkeeper.AccountKeeper, - bankkeeper bankkeeper.Keeper, - index int, - value BankSendTarget, - fromAddr sdk.AccAddress) sdk.Coin { - not_exist_vesting_account := true - add_coin := sdk.NewCoin(value.Denom, sdk.NewInt(value.Amount)) - - // check exits VestingAccount - toAddr, err := sdk.AccAddressFromBech32(value.ToAddress) - if err != nil { - panic(err) - } - - // if the account is not existant, this method creates account internally - if err := bankkeeper.SendCoins(ctx, fromAddr, toAddr, sdk.NewCoins(add_coin)); err != nil { - panic(err) - } - accI := authkeeper.GetAccount(ctx, toAddr) - - cont_acc, ok := accI.(*authvesting.ContinuousVestingAccount) - - if ok { - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : ContinuousVestingAccount is exits [%s]", strconv.Itoa(index), cont_acc.String())) - not_exist_vesting_account = false - - // add coins - newAmount := cont_acc.OriginalVesting.Add(add_coin) - cont_acc.OriginalVesting = newAmount - - // start time sets a more past date. - if cont_acc.GetStartTime() > value.VestingStarts { - cont_acc.StartTime = value.VestingStarts - } - // end time sets a more future date. - if cont_acc.GetEndTime() < value.VestingEnds { - cont_acc.EndTime = value.VestingEnds - } - - if err := cont_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate ContinuousVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, cont_acc) - - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : ContinuousVestingAccount [%s]", strconv.Itoa(index), cont_acc.String())) - } - - delayed_acc, ok := accI.(*authvesting.DelayedVestingAccount) - if ok { - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : DelayedVestingAccount is exits [%s]", strconv.Itoa(index), delayed_acc.String())) - not_exist_vesting_account = false - - // add coins - newAmount := delayed_acc.DelegatedVesting.Add(add_coin) - delayed_acc.DelegatedVesting = newAmount - - // end time sets a more future date. - if delayed_acc.GetEndTime() < value.VestingEnds { - delayed_acc.EndTime = value.VestingEnds - } - if err := delayed_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate DelayedVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, delayed_acc) - - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : DelayedVestingAccount [%s]", strconv.Itoa(index), delayed_acc.String())) - } - - if not_exist_vesting_account { - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : ContinuousVestingAccount / DelayedVestingAccount not exits", strconv.Itoa(index))) - // not exist - // create vesting account - cont_vesting_acc := authvesting.NewContinuousVestingAccount( - accI.(*authtypes.BaseAccount), - sdk.NewCoins(add_coin), - value.VestingStarts, - value.VestingEnds) - - if err := cont_vesting_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate new ContinuousVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, cont_vesting_acc) - - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : NewContinuousVestingAccount [%s]", strconv.Itoa(index), cont_vesting_acc.String())) - } - - return add_coin -} diff --git a/app/upgrades/v1-beta.3/bank_send_list.go b/app/upgrades/v1-beta.3/bank_send_list.go deleted file mode 100644 index 660e6e536..000000000 --- a/app/upgrades/v1-beta.3/bank_send_list.go +++ /dev/null @@ -1,1261 +0,0 @@ -package v1_beta3 - -import ( - "encoding/json" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func BankSendList(ctx sdk.Context) (ResultList, error) { - ctx.Logger().Info(fmt.Sprintf("bank send list:%s", UpgradeName)) - - // Read file and get list - var result ResultList - if err := json.Unmarshal([]byte(BANK_SEND_LIST), &result); err != nil { - panic(err) - } - return result, nil -} - -const BANK_SEND_LIST string = `{ - "validator": [ - { - "toAddress": "ununifi1az7xg9wyfruf94teg9u2dr8dec7sjf6esultlc", - "amount": 2328411000000, - "denom": "uguu", - "vesting_starts": 1693526400, - "vesting_ends": 1725148800 - }, - { - "toAddress": "ununifi199j70q49338yz9r83xsmfescn74gxachwfp9cs", - "amount": 2328411000000, - "denom": "uguu", - - "vesting_starts": 1693526400, - "vesting_ends": 1725148800 - }, - { - "toAddress": "ununifi1w92q2r53jgvyvcuuwmlggrvum7c6j72y403puk", - "amount": 20000000, - "denom": "uguu", - "vesting_starts": 1693526400, - "vesting_ends": 1725148800 - }, - { - "toAddress": "ununifi19f0w9svr905fhefusyx4z8sf83j6et0gkfnrpz", - "amount": 20000000, - "denom": "uguu", - "vesting_starts": 1693526400, - "vesting_ends": 1725148800 - }, - { - "toAddress": "ununifi1ca3k5gk7elrpej8rd74hruu2pm8dn5jzny2qqe", - "amount": 20000000, - "denom": "uguu", - "vesting_starts": 1693526400, - "vesting_ends": 1725148800 - }, - { - "toAddress": "ununifi14ktdwtyz82u28wzthsnvt8m70hu74h98h49eak", - "amount": 2617627058824, - "denom": "uguu", - "vesting_starts": 1693526400, - "vesting_ends": 1725148800 - } - ], - "lendValidator": [ - { - "toAddress": "ununifi1n92vgzkyn32n4wgk0wetq5xw5j5v8zwseetg8f", - "amount": 576653179398, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1716508800 - }, - { - "toAddress": "ununifi1zqt3snrfpq7zlqvwzvm4v926w26pcmrutklsl9", - "amount": 576983703088, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1716508800 - }, - { - "toAddress": "ununifi1p705f2vfnqx6t0k68my4ah6w4gdcujs3yvcwua", - "amount": 524564637871, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1716508800 - }, - { - "toAddress": "ununifi1gwcrz4cnzfurdxfcz7k4uklcrqd6prrme8m66s", - "amount": 498338807151, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1716508800 - }, - { - "toAddress": "ununifi13ua8cusfmx3lwta4n76vjuf6rarr5m90hggnvq", - "amount": 498341531779, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1716508800 - } - ], - "airdropCommunityRewardModerator": [ - { - "toAddress": "ununifi1vntg7ecgu7f3vydjmzlrtnav5pqlr7wezcw38h", - "amount": 1199314676, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1rdg72fz6qzztufeg85pqkcpz44vgfvj6y970nz", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi12p0q22mjxz7ywpjjpkctvy7yv8h852nnvtfz76", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1u5lwnej2gwxtjm2ys7fa6jnlwz8q8e0a9afyap", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1lyx90ps90t6dl92jmm30lzwlw8klmeul6v07gq", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1mahxnymyfxszxk7c54veha9dwwvkt42m5h6uu9", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1u52lf749s4sz8k6y4tgcx4m62cyqsxdrywuzt2", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1rkglywylt8hdnm3undmv0at2prchy0s5m67hal", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1swdlz05ms6nm4xj6xwlq4m7r6320ncz02r40ud", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1rqeu8c0ljagwulc9nf0acccv2y6ds4mhsptmes", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1pesrpts0a4rpeg4pmfsee5sr579urk4xawp9gp", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi13xvqw96lg3f8ek26g6p0hs8x5lwhyz66w2uzry", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1y4j0qsj76tgzx4se7657aannrwwtk9tq8glnzl", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1clay68h9xf6x49umn0turw294hu5vls64xscmx", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1xsrup2xwl3h02vc7gu5spgawm08zhwt0upnggj", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1f39ftt6nl3txq4yl5vnt4vc5ky9slqk7wf7q4m", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1km4tdzat0yw4a8r9yh3q6hggferwy93sp9mzdv", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1prvfte89hd7w08kl6n5rgjknuyandh49zg6g4z", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1lj0ptujepjfxdketv4h5edyrtd68e5c9m5lv8u", - "amount": 1199314676, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1jj5erf7kszg5u74q9h8cfqzaxkynf3cg2vhnsd", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1t9qvrz8jd20jjx5kz0ruuhnk9c3ctkh8cxp2hj", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1zllhxputanq6nr2grgv42xv93d6ykusttx2gpe", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi19846ajj4g7cldprrjjtcpkde4c24fhqymlzg67", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1sg5v5ty92slcl39yezzssz4sg8ves3ssy6ywpc", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1wtlv63qa4zw4d4pyqjnp6tagchzrkprtyeyq69", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1ce8rkj9hhptk7fjzkzq8nzeqgcd0cxcgft3pxn", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1qzhyw5gn4yw896pem0gn2nm8hwglm8ftsragxy", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1huqml6scl6qzvetkc3jce6knmwhtk4x0av5wgg", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1533zjekeeqsgk4l6je9nudaycpup3c3egpcvq8", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1xe0ckssfggcxwv65nr0r59fls5gpe6fthey2x4", - "amount": 1199314676, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1l24zlfegct4kzxvlddmv3v9zykxazjeksxwpjq", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi13ufs9fz4d9svh7ay5eqdcqhnrq369nu0pdr8rp", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1kddhvwmw85tpugwldg08usqsvphdsml60rhryc", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1r57prxdz5afzr0dy6pdpf9zx4wr5xy3ca9evdh", - "amount": 1199314676, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi15ff2v6tgltl4sgqqgt2cuxnpe9k996km86hjjc", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi12j6hcqnlannlfx4vcpjcezkaay55un3z2mcv5a", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi19s8p8hjyjwh7tl2yrp80fm2tnnn5rf2r0kranf", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi156qhxjg924wfpahhgzmat8ssm89k5ndtyq3k7v", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1jv08s99dhc0n8t6ya4yqtzgrwerpan3k572c4h", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi12v8a7tj50lzds3zmjwe388ss7sz9etjcxewp5f", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1nuucmhpay3rkjjz0qwp73c4qc9vjlcmefhw92q", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1tcrzpx3cg94pa87a9nk6m2984960lkatg9lfrt", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1l9qn05tjgrk8rptgzz4nztq72sm6hmxxl0valj", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1fd7rpspd7pwcl57gedzau547jcewcxxwlmqc05", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1lcspaj06pwdz9qskt0gxxh5y9l6altm0j4s9lc", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1c65c9nlggd2tmn3pxwz4ql5q7dgfjqxyc4pp5h", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1t0yyu79gyf0ynuagrxmrgu6evgeckdhtn5eeth", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1h0vrvjkmvzvja32u3ljwlxerv9t75qucr06vpd", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1n258cafkx6phkau6uqhyjwpdtsez93nr8cy3r7", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi17yn38x8hjkn9sed9vxkn7858f2t52uk4g8tnyk", - "amount": 4306618350, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1f02ck2lrqmn0cfsphu3wx8x2gkltdmcqt6ctm0", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1q84vhdwwhkxtn4pud7js8jfz9l505dyntqusvj", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi15ld4z0vn4psrrwalq035k4mywgps4wc3ht92jx", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi15w6g5dugd30csgev2gfnvat4mdtgkveznnujhk", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi179pwy6eruf588436g98xseaefcntsgxelh4u8m", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1rs4qaq0crj7v0m9hmznva06drpljht0ehn683v", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1wt3tpc7en3rvl3f608auzdlx7w4rhvfz6v4024", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1yxt9vq4svlk8j9dysmlhdx3u8lc08h2wfynkxg", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1n5jux49rxn2h05znv92rvqecj8ljmhv2nztuw8", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi16y0jgcslxj9f7rxq4v4uy6900afwq28d8r2vlq", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi13vypjk7wy3xucmtgaar2y4j404t027a6l7au4a", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1hz07sq3deezmp5j32z2xs7sfzccm9sx6820krl", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1g87rxhxtmeeqgch235puq73cmfxxk37gl8yxem", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi18cameakt4chmpvvh4km3ry6l4dmgpjzvxg96wl", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi145s06fr32tyyd0594lkrulp8n36uau4t5ypgvd", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi17r5as3h2zp3079vcx9ejg36myczl5pl0nywql7", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1lt837jpxja5ldnrax8wvadqnl5wvleesmg73zy", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1k4mns7svuhrn0vuy23d866xqz882mkpv235czg", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1tr5pfv38mtwww2qcuvf7k3cm2yzh6ey08z2jjr", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1g74tg3el62spyqfewr9szalxzdwre2wxl36um2", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1uue96qs9tdye9mjw2hvta97xkjmy7dmwgwplxx", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1cavga4cpvq3jc4l328877ta8hjjxl4g4yf5820", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1juf0xjh8tmjlvt3xa4jcv009vq3nsc4wm8tfay", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1u5rq7um22yu38hggfup9j4kv70sngfaelkck0w", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1qmswnrm87xy8v9wr644kng3qhjjqpt0sndu579", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1sxa5xjlyz9y72smjruc25qeh05q7y2jgwfaun0", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1f090d34fnczvlugzt5txeqw29cq9hym5t9uy9r", - "amount": 1199314676, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1cj5t0r7at6f55nl98t5hz9657z8ca00w2lyd9d", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1ale9tx38hm45keu4swvnkc34yc9ln3jz8p6488", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi159ckcjzm8qm4ad64yaenzyhwp3ttpz7q8zgvk5", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1zhs5w4cgwyf5j78my9kp5g9ppxs7d5xlphcvd6", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi12u9pxq2snxhft228u0xcs883l5sl0acjdwywqv", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi17naryjvzweytz73ntrqclwwjwtqp5hasty2wum", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi18h77jhystdgptu867actg2wzwkm9xug9ukv5kc", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1wpy4gj47ggr8tgzjreqgankylk59z2hzreatjz", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1kgdegkl8s2pf0gr4f409acccrvpujfsf4w4ppr", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1qkdppsqhmfy99fu68ud8cqyxtn9j583gg0uamj", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1epc2vczt28nud03jk049wpjcrtn4gregr779h4", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1f2pln0kl2vh4rzhwquuky2knkmh8ltwxhuazef", - "amount": 856653340, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1dtautusrks550sfj7f5mprknq3a50u60tx637z", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1sfyyj50djrd0kju4kvemyrf8pg7l5zt779qpx3", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1653py0583z9xudlpxgwuh97p3gjwmfnefwqvyd", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1wj77f4mr9jsk5rdezjady7l2fntcgmjtf002gq", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi15afu60dw33y65shzg6836wdjckxezx7rerh5nu", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1qv8q6jf7sju85s06v6lnuhpyfw7t56w9squs8e", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1r9z7kcelx4ylypxa5ey9a0la3vj0wjg4k60agx", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1qnkajfgqhkmxquetadxqn5jyp59wpgsfzfft3p", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1fluhhthnqhyzprg849n0qthyc7mzmglhfxvulg", - "amount": 513992004, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1j45emtyqdqxp6f2umngy3nd7d80xknsxw4g62h", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1y9sf62wxx7gkuw0jlwn909l7q465luwfzfxqdy", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1vm2tnldcenja0ctlqpcqusdpp5jv8k5n7cf4wz", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1sgtjkhzal4mgmd8hmxwxzkzdczwnrfsfack409", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1kz643fqvtdc8h7gs4x6k3c9732er0v04rtmap9", - "amount": 1713306681, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1eljt8f0z49xvmhtuderhd3dvrpyh5x2yd42wm4", - "amount": 2227298685, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1fmczw6xvue5l658nzfyv8gl0xwxeq2guyg4cf0", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1rzd3awqzl6h67u8ltdjnzfm7rqv5jse9zshhtr", - "amount": 8119615558, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1nwahmkt5lc8ajr35qjfuc9p9gsxr867yt6s9zw", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1zqx2lm3vmw9dcps333kce9wxeujqdhtlwp26w7", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi19c7m6yksgs9dafur6xw788jxeu54vjzul65usf", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi123p0wjzvu4kampc3hn3x9v5cn75zzudaquvld3", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1xurwjuy8dvucl6dnrzld0nvw6tpqp30rk0rafs", - "amount": 171330668, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1wqpdt48849gwr6qfslnu0vvrp7k40662w8nt3f", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1cgjhlgdnzlxp94j9msdl6gxf6qd8eh7wmmdqcn", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1vgjxz84exe55pmvmhrjgd50kuf8nteam9ql3lv", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1cxthcxhsks5hfdd5zfmz2t6gkjapvunte4en4q", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi16m5j7e232uuwgf0qa5ujc9g8rfels40e7jkhxr", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1zjee39sw23unvvnw0vxl3fmz33k3s3mfp4ea92", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1vkecuxvetuv86tgnjfkalmtcgy29l37hl74yuk", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1atmdkat7mqh35u5cpr29njs0qfv33ewn2hdrrv", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi19570z7f7r2x69056hc5ez3tk9gtau3vyg2zlt7", - "amount": 1370645344, - "denom": "uguu", - "vesting_starts": 1664582400, - "vesting_ends": 1696032000 - }, - { - "toAddress": "ununifi1s37k9ryxegcfp857r9pm79azc4x72l7vzjjg4j", - "amount": 39931147019, - "denom": "uguu", - "vesting_starts": 1656633600, - "vesting_ends": 1688169600 - }, - { - "toAddress": "ununifi1pfkuyknmfhp4uhhd7tqr4yeqvs9qdttvfgfsfm", - "amount": 15984064863, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1ydtts8a9r5jr0qmls9cy60p2j9ewvg6mrnkh4z", - "amount": 19949166364, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1qxfymvcz8h2ahnapezz2ed4awh29qswygt2prx", - "amount": 7706509689, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi17c7l66wgut2trha0qv996tqtg4scwusp4wm649", - "amount": 3800475059, - "denom": "uguu", - "vesting_starts": 1656633600, - "vesting_ends": 1688169600 - }, - { - "toAddress": "ununifi1p2rkc23ayawfzl8g4kneaymhp3nte7x3t39jx5", - "amount": 1900237529, - "denom": "uguu", - "vesting_starts": 1656633600, - "vesting_ends": 1688169600 - }, - { - "toAddress": "ununifi1ddpzczgwt55wtrdjyxfkvymltv7wzjhvv8p34h", - "amount": 4750593823, - "denom": "uguu", - "vesting_starts": 1656633600, - "vesting_ends": 1688169600 - }, - { - "toAddress": "ununifi1t2cky7r2rmrp50n2svk59752u4z3349hnj0t58", - "amount": 1425178147, - "denom": "uguu", - "vesting_starts": 1656633600, - "vesting_ends": 1688169600 - }, - { - "toAddress": "ununifi1vxg66xlzymyc5fd9hwk602xa0tg09dms8dg509", - "amount": 10747826085, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1t3syzcj74az3kzta8u5jpkxn6ft7qdumwdyqc0", - "amount": 2040579710, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi18g8870c64sr3t4v6802rj2h4m2xwj6udeuuj6h", - "amount": 1681159420, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1k8f9hre2szp7p7mjwp70kaydz5hl2lunuzvp78", - "amount": 1669565217, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi163j85dudtqpt40wwuzhn2r3kd5n3hufuacw3pu", - "amount": 1553623188, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi180zz0e8q4c3zyd82e8tz7nu4k4zj0c73ep420z", - "amount": 1530434782, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi104xee9d8gquaz7vyzwzurxjxk0sutqqf3emht6", - "amount": 5216547499, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1u9nlag5wdtx9wlnqu7h7gnadnjuqqa7tsmk0tn", - "amount": 1414492753, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi17tzgev3du8kttl98xpehd9vf2tvv55asd0kklw", - "amount": 1391304347, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1nhgprhqn3sl84wqvh2j6raezkach9gyrgvanf6", - "amount": 1391304347, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1nl4v9kcumsuc6uejqhmqrqsa9a2ju0jmf7gwur", - "amount": 1310144927, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1md5pmzpq5rzr5hj82tnt3ansgef95x2qepah9a", - "amount": 1298550724, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1rkh95rzym7cfcthwlc3ee00jcw6h07vey67p7c", - "amount": 1286956521, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi16e6agl7qsans0qjdzuqcq3ukzz8g2ztdnw8xgn", - "amount": 1286956521, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1xekcjker8npq28qcp5nxr8y0pddlap0x4jgaze", - "amount": 1286956521, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi132srs0hmcwcvl5xee7xmmsnsfu8gjf32kkt7rm", - "amount": 1275362318, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi104y2xw9ys02qlzlgntpefzwtqxk8eksrr0mkkk", - "amount": 1263768115, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1gqmhnxd5w9zkhhp4llvul0v4ck9cn8w7np4cp3", - "amount": 1228985507, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1avd4jplu89t6ds66udfspsv9nlkwn2ru03jy9j", - "amount": 2660283832, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1v45254hgxun3vnydjcl6dhw6sz82ulftu6t53s", - "amount": 18164935135, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1paj00usj7k69f9vvpknazcppr48pwnyqxg4lqj", - "amount": 18164935135, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1eq9star05sxl9heurjtcpdmhrcscdur9g85ttq", - "amount": 4295921537, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1skex8qg79h667zdvnsgt09pum9f7yyr5zv0dar", - "amount": 23914037190, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1qhxnlhh53y2t73urgdqqxn7ttkseegwz62aq4j", - "amount": 2184421596, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - }, - { - "toAddress": "ununifi1pnndh4ge5svw86myh3ng9cd0s729y4x3eh5gn8", - "amount": 283145825, - "denom": "uguu", - "vesting_starts": 1659312000, - "vesting_ends": 1690848000 - } - ], - "airdropForfeit": [ - "ununifi1dc8nfka4dgw90rfejrfncsp5rmgtj5ppkfma5v", - "ununifi1z9affl2d4yfahqn6nvm43tmxuxj084m36e7yjt", - "ununifi16f32hrzas8ks5pwjdurkm47g8dqhclqn7323fc", - "ununifi1qmsyp2f9f9tvzk9ncrp55a5p0gwheva8d4z2wv", - "ununifi196fstf8eqdsenc89v7r30vsu6xf3uj5y6eja0s", - "ununifi1nup4mfu7wtdychppcnsd76nmy7zuylws8k85le", - "ununifi1yc7qneet922fxcvgjzm5g7ka26hqfrxx9fs5jk", - "ununifi1flrwl30prh6p0ysq6jvumes24y4lvmzzlrpupe", - "ununifi1khscuq3ku9gf9mpgvg897lacug9tn8mhjhldv4", - "ununifi1cr3drk8decw8u25dqt3xrghu9nswhjjm0m26lc", - "ununifi1gwpgu55ug72q30sn95fgvupzc7m2frjcxez7es", - "ununifi19vu4j2wytjru5s779wr5dg0l8gskn5md08h0zy", - "ununifi1fm2eyrtt3ut2d9g9ksdc3rx2eh77wxzl9y2ln8", - "ununifi1cym27cxuc9zn74md3lq4jam2hs54xflvytl9p8", - "ununifi1syyklr60ykhjwhwnkf7s344xmwdu2kzxlt34ts", - "ununifi1j77ze43j79njy3sd62e3umpuglgwqn3ddezqmn" - ], - "others": [ - { - "fromAddress": "ununifi15h3drpk7mf0gn38eh3xnwmn4jrnkvlx7kvgj69", - "bankSendTarget": { - "toAddress": "ununifi1yajezpax35eyks3vzg60nsrtlwd75zu3xmy4w9", - "amount": 1038782191118, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1748044800 - } - }, - { - "fromAddress": "ununifi15h3drpk7mf0gn38eh3xnwmn4jrnkvlx7kvgj69", - "bankSendTarget": { - "toAddress": "ununifi13tgmuaupx9z73zwgj6jjcyqytv7rggqup42yr0", - "amount": 3116346573354, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1748044800 - } - }, - { - "fromAddress": "ununifi1lxjfmrd8xrsxxty7kemrz3rpgswrt8vtsq37nc", - "bankSendTarget": { - "toAddress": "ununifi1n52fqanrnyr47nj9w92qc04u28tmc4g4xalx8u", - "amount": 445192367622, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1748044800 - } - }, - { - "fromAddress": "ununifi1lxjfmrd8xrsxxty7kemrz3rpgswrt8vtsq37nc", - "bankSendTarget": { - "toAddress": "ununifi1cqfqf3rmdrklyg38s4qhfekh2rj2s86r7064w4", - "amount": 445192367622, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1748044800 - } - }, - { - "fromAddress": "ununifi1lxjfmrd8xrsxxty7kemrz3rpgswrt8vtsq37nc", - "bankSendTarget": { - "toAddress": "ununifi1wsnnxp3efqy9qu8xqv033nltmauqhvwj3nxg3k", - "amount": 296794911748, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1748044800 - } - }, - { - "fromAddress": "ununifi130rpfseu72la5rlnmmejr6w2hc7qhaqsdrh8am", - "bankSendTarget": { - "toAddress": "ununifi1s2wf3ena7gw992lmf0pzrqyzm6ejx5rkwahvd5", - "amount": 654402000000, - "denom": "uguu", - "vesting_starts": 1684972800, - "vesting_ends": 1748044800 - } - } - ] -}` - -// ignored addresses for this upgrade -// ununifi1uz90c4u5jzwdcryhsaqskfrtn6mudt2mr93tdj -// ununifi12h7qg749a43e5x7wdrafk3wldlayn84pgmghq0 diff --git a/app/upgrades/v1-beta.3/constants.go b/app/upgrades/v1-beta.3/constants.go deleted file mode 100644 index 572d6c266..000000000 --- a/app/upgrades/v1-beta.3/constants.go +++ /dev/null @@ -1,45 +0,0 @@ -package v1_beta3 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/UnUniFi/chain/app/upgrades" -) - -const UpgradeName string = "v1-beta.3" - -const TotalAmountValidator int64 = 9949510918111 -const TotalAmountExceptValidator int64 = 304963298762 -const TotalForfeitAmount int64 = 30839520258 -const FundAmountValidator int64 = 20000000 -const FromAddressValidator string = "ununifi19srj7ga7t2pyflz7f50le5fv0wa9kuf7tmdtla" -const FromAddressAirdrop string = "ununifi1r500cehqg5u6fhsaysmhu4cnw5pz3lxcqhgaq7" -const ToAddressAirdropForfeit string = "ununifi1r500cehqg5u6fhsaysmhu4cnw5pz3lxcqhgaq7" -const Denom string = "uguu" - -type ResultList struct { - Validator []BankSendTarget `json:"validator"` - LendValidator []BankSendTarget `json:"lendValidator"` - AirdropCommunityRewardModerator []BankSendTarget `json:"airdropCommunityRewardModerator"` - AirdropForfeit []string `json:"airdropForfeit"` - Others []SpecialBankSendTarget `json:"others"` -} - -type BankSendTarget struct { - ToAddress string `json:"toAddress,omitempty"` - Denom string `json:"denom,omitempty"` - Amount int64 `json:"amount,omitempty"` - VestingStarts int64 `json:"vesting_starts,omitempty"` - VestingEnds int64 `json:"vesting_ends,omitempty"` -} - -type SpecialBankSendTarget struct { - FromAddress string `json:"fromAddress,omitempty"` - BankSendTarget BankSendTarget `json:"bankSendTarget,omitempty"` -} - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{}, -} diff --git a/app/upgrades/v1-beta.3/upgrades.go b/app/upgrades/v1-beta.3/upgrades.go deleted file mode 100644 index fbf112bf7..000000000 --- a/app/upgrades/v1-beta.3/upgrades.go +++ /dev/null @@ -1,40 +0,0 @@ -package v1_beta3 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/UnUniFi/chain/app/keepers" - "github.com/UnUniFi/chain/app/upgrades" -) - -func CreateUpgradeHandler(mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) - ctx.Logger().Info(fmt.Sprintf("update start test:%s", UpgradeName)) - - bankPram := keepers.BankKeeper.GetParams(ctx) - bankPram.DefaultSendEnabled = true - keepers.BankKeeper.SetParams(ctx, bankPram) - - result, err := BankSendList(ctx) - if err != nil { - panic(err) - } - err = upgradeBankSend(ctx, *keepers.AccountKeeper, *keepers.BankKeeper, result) - if err != nil { - panic(err) - } - - bankPram.DefaultSendEnabled = false - keepers.BankKeeper.SetParams(ctx, bankPram) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v1-beta.4/bank_send.go b/app/upgrades/v1-beta.4/bank_send.go deleted file mode 100644 index 7bdc374f5..000000000 --- a/app/upgrades/v1-beta.4/bank_send.go +++ /dev/null @@ -1,237 +0,0 @@ -package v1_beta4 - -import ( - "fmt" - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" -) - -func upgradeBankSend( - ctx sdk.Context, - authkeeper authkeeper.AccountKeeper, - bankkeeper bankkeeper.Keeper, - bank_send_list ResultList) error { - ctx.Logger().Info(fmt.Sprintf("upgrade :%s", UpgradeName)) - - total_allocate_coin := sdk.NewCoin(Denom, sdk.NewInt(0)) - assumed_coin := sdk.NewCoin(Denom, sdk.NewInt(0)) - - // before get total supply - before_total_supply := bankkeeper.GetSupply(ctx, Denom) - ctx.Logger().Info(fmt.Sprintf("bank send : total supply[%d]", before_total_supply.Amount)) - - // others - for index, value := range bank_send_list.Others { - fromAddr, _ := sdk.AccAddressFromBech32(value.FromAddress) - bankTarget := value.BankSendTarget - ctx.Logger().Info(fmt.Sprintf("bank send :%s", strconv.Itoa(index))) - normalToken := sdk.NewCoin(bankTarget.Denom, sdk.NewInt(bankTarget.Amount)) - toAddr, _ := sdk.AccAddressFromBech32(bankTarget.ToAddress) - if err := bankkeeper.SendCoins(ctx, fromAddr, toAddr, sdk.NewCoins(normalToken)); err != nil { - panic(err) - } - total_allocate_coin = total_allocate_coin.Add(normalToken) - } - - // Check the amount of tokens sent - assumed_coin = assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountTransferredValidator))) - assumed_coin = assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalDelegationAmountValidator))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the others validator does not match.: Actual[%v] Assumed[%v]", - total_allocate_coin, - assumed_coin)) - } - - fromAddr, err := sdk.AccAddressFromBech32(FromAddressValidator) - if err != nil { - panic(err) - } - // Validator - for index, value := range bank_send_list.Validator { - ctx.Logger().Info(fmt.Sprintf("bank send validator :%s[%s]", strconv.Itoa(index), value.ToAddress)) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin = total_allocate_coin.Add(coin) - normalToken := sdk.NewCoin(Denom, sdk.NewInt(FundAmountValidator)) - toAddr, _ := sdk.AccAddressFromBech32(value.ToAddress) - if err := bankkeeper.SendCoins(ctx, fromAddr, toAddr, sdk.NewCoins(normalToken)); err != nil { - panic(err) - } - total_allocate_coin = total_allocate_coin.Add(normalToken) - } - - // Lend validatos - for index, value := range bank_send_list.LendValidator { - ctx.Logger().Info(fmt.Sprintf("bank send validator :%s[%s]", strconv.Itoa(index), value.ToAddress)) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin = total_allocate_coin.Add(coin) - } - - // Check the amount of tokens sent - assumed_coin = assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountValidator))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the validator does not match.: Actual[%v] Assumed[%v]", - total_allocate_coin, - assumed_coin)) - } - - fromAddr, err = sdk.AccAddressFromBech32(FromAddressEcocsytemDevelopment) - if err != nil { - panic(err) - } - // Ecocsytem Development(Community Program, Competition, Moderator) - for index, value := range bank_send_list.EcocsytemDevelopment { - ctx.Logger().Info(fmt.Sprintf("bank send :%s", strconv.Itoa(index))) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin = total_allocate_coin.Add(coin) - } - - // Check the amount of tokens sent - assumed_coin = assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountEcocsytemDevelopment))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the Ecocsytem Development(Community Program, Competition, Moderator) does not match.: Actual[%v] Assumed[%v]", - total_allocate_coin, - assumed_coin)) - } - - fromAddr, err = sdk.AccAddressFromBech32(FromAddressMarketing) - if err != nil { - panic(err) - } - // Marketing(Existing VC of Japanese company) - for index, value := range bank_send_list.Marketing { - ctx.Logger().Info(fmt.Sprintf("bank send :%s", strconv.Itoa(index))) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin = total_allocate_coin.Add(coin) - } - - // Check the amount of tokens sent - assumed_coin = assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountMarketing))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the Marketing(Existing VC of Japanese company) does not match.: Actual[%v] Assumed[%v]", - total_allocate_coin, - assumed_coin)) - } - - fromAddr, err = sdk.AccAddressFromBech32(FromAddressAdvisors) - if err != nil { - panic(err) - } - // advisors(Advisor) - for index, value := range bank_send_list.Advisors { - ctx.Logger().Info(fmt.Sprintf("bank send :%s", strconv.Itoa(index))) - coin := tokenAllocation(ctx, authkeeper, bankkeeper, index, value, fromAddr) - total_allocate_coin = total_allocate_coin.Add(coin) - } - - // Check the amount of tokens sent - assumed_coin = assumed_coin.Add(sdk.NewCoin(Denom, sdk.NewInt(TotalAmountAdvisors))) - if !total_allocate_coin.IsEqual(assumed_coin) { - panic(fmt.Sprintf("error: assumed amount sent to the advisors(Advisor) does not match.: Actual[%v] Assumed[%v]", - total_allocate_coin, - assumed_coin)) - } - - // after get total supply - after_total_supply := bankkeeper.GetSupply(ctx, Denom) - ctx.Logger().Info(fmt.Sprintf("bank send : total supply[%d]", after_total_supply.Amount)) - - return nil -} -func tokenAllocation( - ctx sdk.Context, - authkeeper authkeeper.AccountKeeper, - bankkeeper bankkeeper.Keeper, - index int, - value BankSendTarget, - fromAddr sdk.AccAddress) sdk.Coin { - not_exist_vesting_account := true - add_coin := sdk.NewCoin(value.Denom, sdk.NewInt(value.Amount)) - - // check exits VestingAccount - toAddr, err := sdk.AccAddressFromBech32(value.ToAddress) - if err != nil { - panic(err) - } - - // if the account is not existant, this method creates account internally - if err := bankkeeper.SendCoins(ctx, fromAddr, toAddr, sdk.NewCoins(add_coin)); err != nil { - panic(err) - } - accI := authkeeper.GetAccount(ctx, toAddr) - - cont_acc, ok := accI.(*authvesting.ContinuousVestingAccount) - - if ok { - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : ContinuousVestingAccount is exits [%s]", strconv.Itoa(index), cont_acc.String())) - not_exist_vesting_account = false - - // add coins - newAmount := cont_acc.OriginalVesting.Add(add_coin) - cont_acc.OriginalVesting = newAmount - - // start time sets a more past date. - if cont_acc.GetStartTime() > value.VestingStarts { - cont_acc.StartTime = value.VestingStarts - } - // end time sets a more future date. - if cont_acc.GetEndTime() < value.VestingEnds { - cont_acc.EndTime = value.VestingEnds - } - - if err := cont_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate ContinuousVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, cont_acc) - - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : ContinuousVestingAccount [%s]", strconv.Itoa(index), cont_acc.String())) - } - - delayed_acc, ok := accI.(*authvesting.DelayedVestingAccount) - if ok { - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : DelayedVestingAccount is exits [%s]", strconv.Itoa(index), delayed_acc.String())) - not_exist_vesting_account = false - - // add coins - newAmount := delayed_acc.DelegatedVesting.Add(add_coin) - delayed_acc.DelegatedVesting = newAmount - - // end time sets a more future date. - if delayed_acc.GetEndTime() < value.VestingEnds { - delayed_acc.EndTime = value.VestingEnds - } - if err := delayed_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate DelayedVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, delayed_acc) - - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : DelayedVestingAccount [%s]", strconv.Itoa(index), delayed_acc.String())) - } - - if not_exist_vesting_account { - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : ContinuousVestingAccount / DelayedVestingAccount not exits", strconv.Itoa(index))) - // not exist - // create vesting account - cont_vesting_acc := authvesting.NewContinuousVestingAccount( - accI.(*authtypes.BaseAccount), - sdk.NewCoins(add_coin), - value.VestingStarts, - value.VestingEnds) - - if err := cont_vesting_acc.Validate(); err != nil { - panic(fmt.Errorf("failed to validate new ContinuousVestingAccount: %w", err)) - } - - authkeeper.SetAccount(ctx, cont_vesting_acc) - - ctx.Logger().Info(fmt.Sprintf("bank send[%s] : NewContinuousVestingAccount [%s]", strconv.Itoa(index), cont_vesting_acc.String())) - } - - return add_coin -} diff --git a/app/upgrades/v1-beta.4/bank_send_list.go b/app/upgrades/v1-beta.4/bank_send_list.go deleted file mode 100644 index 0506fa1a4..000000000 --- a/app/upgrades/v1-beta.4/bank_send_list.go +++ /dev/null @@ -1,745 +0,0 @@ -package v1_beta4 - -import ( - "encoding/json" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func BankSendList(ctx sdk.Context) (ResultList, error) { - ctx.Logger().Info(fmt.Sprintf("bank send list:%s", UpgradeName)) - - // Read file and get list - var result ResultList - if err := json.Unmarshal([]byte(BANK_SEND_LIST), &result); err != nil { - panic(err) - } - return result, nil -} - -const BANK_SEND_LIST string = `{ - "validator": [ - { - "toAddress": "ununifi1jzr5ux9ydjmrch54c04rjt3fr5pdlrx08ng6p8", - "amount": 20000000, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1uny0f22uj5mn93sgg5d80nhnl7608fd9ap4ld6", - "amount": 3000000000000, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1llr0q0ggvnyu7fxh57wxkuvmlpyf6ygmknga26", - "amount": 3000000000000, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - } - ], - "lendValidator": [ - { - "toAddress": "ununifi1n92vgzkyn32n4wgk0wetq5xw5j5v8zwseetg8f", - "amount": 511145986071, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1zqt3snrfpq7zlqvwzvm4v926w26pcmrutklsl9", - "amount": 511426337194, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1p705f2vfnqx6t0k68my4ah6w4gdcujs3yvcwua", - "amount": 464896876114, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1gwcrz4cnzfurdxfcz7k4uklcrqd6prrme8m66s", - "amount": 441655905328, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi13ua8cusfmx3lwta4n76vjuf6rarr5m90hggnvq", - "amount": 441591206812, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1ca3k5gk7elrpej8rd74hruu2pm8dn5jzny2qqe", - "amount": 288264021643, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi1w92q2r53jgvyvcuuwmlggrvum7c6j72y403puk", - "amount": 309526695085, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - }, - { - "toAddress": "ununifi19f0w9svr905fhefusyx4z8sf83j6et0gkfnrpz", - "amount": 302587573611, - "denom": "uguu", - "vesting_starts": 1703084400, - "vesting_ends": 1734620400 - } - ], - "ecocsytemDevelopment": [ - { - "toAddress": "ununifi1ydk5djlj53p84gq9c3fhxe7mt3urhk0g5sq0vr", - "amount": 15652505410, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1k8f9hre2szp7p7mjwp70kaydz5hl2lunuzvp78", - "amount": 8441578742, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1t3syzcj74az3kzta8u5jpkxn6ft7qdumwdyqc0", - "amount": 6374629312, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1d5csc65hy3l8yk9s8rges7zxl9fwka88f6waec", - "amount": 4359974259, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi12x2trndk9p5umj64jjvn2j9kgguxfrujfzks9u", - "amount": 3537503493, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1qxfymvcz8h2ahnapezz2ed4awh29qswygt2prx", - "amount": 2137028121, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi182tul2dksmwur370ks4ghel0yr8mmgrf9g45ay", - "amount": 2003170316, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1aakg8cq30w03xn3gldaf9mh04sr6wume8ytgfc", - "amount": 13024479227, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi13kaqr9vzfxxpmerplda2me9eg3y8jyhgnc2f9n", - "amount": 1737803088, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1j4ng55e6snak7gyvzwx9xtsjfph752pez22cj6", - "amount": 1568719544, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1mcvgt3306fw8zx95hyacem932jusvu5epqalqy", - "amount": 2470498444, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1e34uc97tty95r70jx7ek7gkzf8aat84m3u6w5d", - "amount": 1343274819, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1ed2wt0dgnfrntns3gwsjzfkqhtprr3krjku4l8", - "amount": 1324487759, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1pvzssder5a5md4wdhjyzdhtxmcrpvp9ctd02jj", - "amount": 1293958785, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1jj9dysvjwyqvjv86gr8467sr3hjqc3why5vkga", - "amount": 1997755953, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1ug5x6ldl9xfqkwl70qn0tuxkudwu5jk83tz0fq", - "amount": 1056772148, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1nl4v9kcumsuc6uejqhmqrqsa9a2ju0jmf7gwur", - "amount": 1056772148, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1zkcuchahmc0n4mrqfzyhyaalypdzsw2gqrqxr3", - "amount": 1019198027, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1fsg8xkl0vyhz2ha2kjzzk9ardpa27uczx5kws4", - "amount": 939353020, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1qdyn7rss0ad6g85wj2ad28a52cvsqr56nrqe5g", - "amount": 1502964832, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi18g8870c64sr3t4v6802rj2h4m2xwj6udeuuj6h", - "amount": 901778899, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1vxg66xlzymyc5fd9hwk602xa0tg09dms8dg509", - "amount": 27476759026, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1y4uqc6tf435saqlqmdeswz5w8chtxhrhp6w6x7", - "amount": 786708154, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1lul6f99rxw0d9j5rn39mx3djndldu8yt0sstff", - "amount": 2428006775, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1xgw4zsxtm7mx0zav83an7pcrschkr8rxr5r7j9", - "amount": 3274054771, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1qzy40tuamwfdf320le6cnfkntfrn63j72quc43", - "amount": 1773009599, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1874lfx44c2gu47k6hh2nx8jpyh7n570pdcdcuv", - "amount": 2796194945, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1xekcjker8npq28qcp5nxr8y0pddlap0x4jgaze", - "amount": 1592320722, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1dn4tsvhuqpcksj4tdnrnkvmhylnzydcvyclf0y", - "amount": 1581027667, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1ecgmgzttrq52g6gp4d4f687g2xymnjxvdfqsqc", - "amount": 9719130344, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi15acyslq77wylle9kc3cueme5ml42aacsyz79z2", - "amount": 2997306289, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1c3dxnlqwfvjfgcyzqhdhtp7h348e78erj6a8lt", - "amount": 1212121212, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi179xh34gna498hdtglq7mv2hwrxqwzw8tfg43ec", - "amount": 1110483719, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1j5dtezz2e7mpvqj42x2c5p0qy7glsac7mqfrcl", - "amount": 1076604554, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi12evsxkfkq59v9s88zfx0cl9tn4zlavs9zuueuj", - "amount": 1057782796, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1kuhp2ywypwg2ekuz05zw4dlvtm40zswfawf32v", - "amount": 1054018445, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1j027zxk5wqp8ek2x490mf2awkyfcnztxc3e6zx", - "amount": 752870318, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1nhgprhqn3sl84wqvh2j6raezkach9gyrgvanf6", - "amount": 3757306262, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1pfkuyknmfhp4uhhd7tqr4yeqvs9qdttvfgfsfm", - "amount": 26162280745, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1l832mnjzn24hfqkvjr6se2r00at9p6el9w6rvq", - "amount": 2347518820, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1ydtts8a9r5jr0qmls9cy60p2j9ewvg6mrnkh4z", - "amount": 39492343498, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi19xek9465etmvshl5vhet2s7c8uc2lrjvte65ec", - "amount": 1646950376, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1n7d0pd3jj0r4wq764vth26radlnvcljele0cd4", - "amount": 737440467, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi18hpy9dlnf9wcmwu9mu778rwezuxnfmjjj3pvwl", - "amount": 1542479643, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1zvsl6u04wgxd8j9qek6nucycynu856pxcftq0f", - "amount": 1272084805, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1jz76pjr0zt997c07efpuq9n0g7zpjz64udnrgg", - "amount": 2393506942, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi132srs0hmcwcvl5xee7xmmsnsfu8gjf32kkt7rm", - "amount": 1966592211, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1p6naal89l93mlvwnjp4gzjuhm9jrlp06ag26lw", - "amount": 4000694565, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1aj9y7y4ngaqp7w9t56mr8cw5lrtsu9q0f0f5ce", - "amount": 2569890606, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1vchphhj9ykdt8sre4a2xwyzmmg4j2xd6zrgydd", - "amount": 1896162528, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi163j85dudtqpt40wwuzhn2r3kd5n3hufuacw3pu", - "amount": 1764195172, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1s8tgzyc3tws66a9lpu6hlj0s4th9r3nlx2qkk6", - "amount": 1666956068, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1awlrha5r7e5jzcceqgsle0vva2d8qrtmskg83t", - "amount": 1444695259, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1pzjzaftghc7m8k67qxs0p3nl7kkdvlghg28k8r", - "amount": 1284945303, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1453sp8gyfje8y8kuux9rhald6yzcjk03ylkmxj", - "amount": 1048793193, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1395u5yh5sx67hx3krhxa2w9gut479m2y2tz76d", - "amount": 1021010592, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1s82uxe4h3077temj7plxe0ydmhc84g70xkp2fe", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1az7k4r6qcyw54e5ltvfdva0lz9k7kqhy6a9num", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1ces9q4hsgn6x7j040z7a8jg5tnudrwtsps2vfa", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi16g2reacq384f8uqfkehdnt5q6wu6lgpc0xgk8v", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi15ur7aylv5tu5q4y5zkzmrwdwuxx0rajctgmmkz", - "amount": 4000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi14v2jryt8828p0mjqy4jqx29s9wj7n7gus87sdx", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1qrpd96dapnd87ff92k6hxgl7zvjqlykc8pffh5", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1rvge28l7le97e6qtzlnzrj9vp7v77pcujq0938", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1epc2vczt28nud03jk049wpjcrtn4gregr779h4", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi183hfvu0hnju50s32kqcf8nk6f5d70p54mc82w5", - "amount": 10000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1c5w9gv4x0cp3wnxnhk4vr08h4552u0fqe525d0", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi10eln7ccy0vth6r6hr7xgxfyg6yhfc3g9ck55vc", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1wuxggfh5verzhsyfjavtn5c4grd8k3jjlqsmxy", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1gwuu4xe3c759atkwk6uhryj6jwgyth5tde8m5d", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1cpu56kjrnhj8x04rxmdst4ztu77wz8ncflajd5", - "amount": 4000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi129ax5ctrjd0ddstm8pge52kwkvjvtvqjpmfjp2", - "amount": 1000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1uc68tmfc40yurpw8xqk30sxggvd5javt9xvny5", - "amount": 4000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1dsqsrgt5xkt6pj3nuht375jrt0xfl8p8ev336s", - "amount": 4000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1v45254hgxun3vnydjcl6dhw6sz82ulftu6t53s", - "amount": 25897028517, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1pnndh4ge5svw86myh3ng9cd0s729y4x3eh5gn8", - "amount": 5000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1pq9e4epludy78a96y0j89uqt0uq5k4z3205lka", - "amount": 52756766713, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1a5yqx4xa5v7ggs5xc5mnk4qzgrylqxd9xy46zy", - "amount": 1335497760, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi17c7l66wgut2trha0qv996tqtg4scwusp4wm649", - "amount": 25052095925, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1avd4jplu89t6ds66udfspsv9nlkwn2ru03jy9j", - "amount": 15289146778, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1paj00usj7k69f9vvpknazcppr48pwnyqxg4lqj", - "amount": 5428568139, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - } - ], - "marketing": [ - { - "toAddress": "ununifi1llr0q0ggvnyu7fxh57wxkuvmlpyf6ygmknga26", - "amount": 241720000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1uny0f22uj5mn93sgg5d80nhnl7608fd9ap4ld6", - "amount": 241720000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi1yf5cv54mclv84y2gufafh9cm2yzdne64zasfnk", - "amount": 181720000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - }, - { - "toAddress": "ununifi172rcust8rcuf5ef2j4ywrfccf9lre70dmv8k8v", - "amount": 241720000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1702998000 - } - ], - "advisors": [ - { - "toAddress": "ununifi1g94dh4vzqflc4xrjerza9t7ydc5gfpc4zhtal2", - "amount": 100000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1687186800 - }, - { - "toAddress": "ununifi1dn7ta3u4zxlug5npfcy3ue6stjlfw7kscynwtp", - "amount": 2000000000000, - "denom": "uguu", - "vesting_starts": 1671548400, - "vesting_ends": 1687186800 - } - ], - "others": [ - { - "fromAddress": "ununifi1pa29ejcfrylh69pvntrx3va9xej69tnx7re567", - "bankSendTarget": { - "toAddress": "ununifi1q6jfv5un5cc7lh26njttg0tje0jevt93shy9zv", - "amount": 2205862352941, - "denom": "uguu" - } - }, - { - "fromAddress": "ununifi19srj7ga7t2pyflz7f50le5fv0wa9kuf7tmdtla", - "bankSendTarget": { - "toAddress": "ununifi1q6jfv5un5cc7lh26njttg0tje0jevt93shy9zv", - "amount": 2050518544482, - "denom": "uguu" - } - } - ] -}` - -// excluding address since the format of the address is wrong. -// { -// "toAddress": "ununifi12fvdlw4ltmexpvj957gfintnhrrr4n4ay7u503", -// "amount": 6792443400, -// "denom": "uguu", -// "vesting_starts": 1671548400, -// "vesting_ends": 1702998000 -// }, diff --git a/app/upgrades/v1-beta.4/constants.go b/app/upgrades/v1-beta.4/constants.go deleted file mode 100644 index 3d488e808..000000000 --- a/app/upgrades/v1-beta.4/constants.go +++ /dev/null @@ -1,51 +0,0 @@ -package v1_beta4 - -import ( - "github.com/UnUniFi/chain/app/upgrades" - store "github.com/cosmos/cosmos-sdk/store/types" -) - -const UpgradeName string = "v1-beta.4" - -const TotalAmountValidator int64 = 9271174601858 - -// const TotalAmountEcocsytemDevelopment int64 = 408999999969 -const TotalAmountEcocsytemDevelopment int64 = 402207556569 // 408999999969 - 6792443400 (TotalAmount excluding Vanya) -const TotalAmountMarketing int64 = 906880000000 -const TotalAmountAdvisors int64 = 2100000000000 -const TotalAmountTransferredValidator int64 = 2205862352941 // validator -> validator (In preparation for the processing of money transfers to validators, when combining accounts into a single) -const TotalDelegationAmountValidator int64 = 2050518544482 // Ecocsytem Development -> validator -const FundAmountValidator int64 = 20000000 -const FromAddressValidator string = "ununifi1q6jfv5un5cc7lh26njttg0tje0jevt93shy9zv" -const FromAddressEcocsytemDevelopment string = "ununifi1pa29ejcfrylh69pvntrx3va9xej69tnx7re567" -const FromAddressMarketing string = "ununifi1khe6yv4zswaergkrzv0dmq3afcda5fx4jjmf07" -const FromAddressAdvisors string = "ununifi1y8430kzjeudf8x0zyvcdgqlzcnwt3zqzedayt9" -const Denom string = "uguu" - -type ResultList struct { - Validator []BankSendTarget `json:"validator"` - LendValidator []BankSendTarget `json:"lendValidator"` - EcocsytemDevelopment []BankSendTarget `json:"ecocsytemDevelopment"` - Marketing []BankSendTarget `json:"marketing"` - Advisors []BankSendTarget `json:"advisors"` - Others []SpecialBankSendTarget `json:"others"` -} - -type BankSendTarget struct { - ToAddress string `json:"toAddress,omitempty"` - Denom string `json:"denom,omitempty"` - Amount int64 `json:"amount,omitempty"` - VestingStarts int64 `json:"vesting_starts,omitempty"` - VestingEnds int64 `json:"vesting_ends,omitempty"` -} - -type SpecialBankSendTarget struct { - FromAddress string `json:"fromAddress,omitempty"` - BankSendTarget BankSendTarget `json:"bankSendTarget,omitempty"` -} - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{}, -} diff --git a/app/upgrades/v1-beta.4/upgrades.go b/app/upgrades/v1-beta.4/upgrades.go deleted file mode 100644 index 4c6c33fe0..000000000 --- a/app/upgrades/v1-beta.4/upgrades.go +++ /dev/null @@ -1,39 +0,0 @@ -package v1_beta4 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/UnUniFi/chain/app/keepers" - "github.com/UnUniFi/chain/app/upgrades" -) - -func CreateUpgradeHandler(mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) - - bankPram := keepers.BankKeeper.GetParams(ctx) - bankPram.DefaultSendEnabled = true - keepers.BankKeeper.SetParams(ctx, bankPram) - - result, err := BankSendList(ctx) - if err != nil { - panic(err) - } - err = upgradeBankSend(ctx, *keepers.AccountKeeper, *keepers.BankKeeper, result) - if err != nil { - panic(err) - } - - bankPram.DefaultSendEnabled = false - keepers.BankKeeper.SetParams(ctx, bankPram) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v2.1/upgrades.go b/app/upgrades/v2.1/upgrades.go deleted file mode 100644 index 55f38a0a3..000000000 --- a/app/upgrades/v2.1/upgrades.go +++ /dev/null @@ -1,34 +0,0 @@ -package v2_1 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - - "github.com/UnUniFi/chain/app/keepers" - "github.com/UnUniFi/chain/app/upgrades" -) - -func CreateUpgradeHandler(mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) - - // update 1 change wasm permission to everybody - // Add wasmStack on ibcRouter - // ibc patch version v7.0.1 - wasmParam := keepers.WasmKeeper.GetParams(ctx) - wasmParam.CodeUploadAccess.Permission = wasmtypes.AccessTypeEverybody - wasmParam.InstantiateDefaultPermission = wasmtypes.AccessTypeEverybody - - keepers.WasmKeeper.SetParams(ctx, wasmParam) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v2.2/constants.go b/app/upgrades/v2.2/constants.go deleted file mode 100644 index 2c282f129..000000000 --- a/app/upgrades/v2.2/constants.go +++ /dev/null @@ -1,18 +0,0 @@ -package v2_2 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/UnUniFi/chain/app/upgrades" -) - -const UpgradeName string = "v2_2" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v2/constants.go b/app/upgrades/v2/constants.go deleted file mode 100644 index e34ded977..000000000 --- a/app/upgrades/v2/constants.go +++ /dev/null @@ -1,33 +0,0 @@ -package v2 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/x/group" - "github.com/cosmos/cosmos-sdk/x/nft" - - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - - "github.com/UnUniFi/chain/app/upgrades" - - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - - auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - incentivetypes "github.com/UnUniFi/chain/deprecated/x/incentive/types" - ununifidisttypes "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" - pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" -) - -const UpgradeName string = "v2" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{group.ModuleName, nft.ModuleName, consensusparamtypes.ModuleName, crisistypes.ModuleName, ibcfeetypes.ModuleName, icahosttypes.SubModuleName}, - Deleted: []string{auctiontypes.ModuleName, cdptypes.ModuleName, incentivetypes.ModuleName, ununifidisttypes.ModuleName, pricefeedtypes.ModuleName}, - }, -} diff --git a/app/upgrades/v2/upgrades.go b/app/upgrades/v2/upgrades.go deleted file mode 100644 index 646bece15..000000000 --- a/app/upgrades/v2/upgrades.go +++ /dev/null @@ -1,88 +0,0 @@ -package v2 - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/UnUniFi/chain/app/keepers" - "github.com/UnUniFi/chain/app/upgrades" -) - -func CreateUpgradeHandler(mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { - for _, subspace := range keepers.ParamsKeeper.GetSubspaces() { - subspace := subspace - - // ctx.Logger().Info(fmt.Sprintf("subspace.Name:%s", subspace.Name())) - // ctx.Logger().Info(fmt.Sprintf("i:%d", i)) - var keyTable paramstypes.KeyTable - switch subspace.Name() { - case authtypes.ModuleName: - keyTable = authtypes.ParamKeyTable() //nolint:staticcheck - case banktypes.ModuleName: - keyTable = banktypes.ParamKeyTable() //nolint:staticcheck - case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck - case minttypes.ModuleName: - keyTable = minttypes.ParamKeyTable() //nolint:staticcheck - case distrtypes.ModuleName: - keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck - case slashingtypes.ModuleName: - keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck - case govtypes.ModuleName: - keyTable = govv1.ParamKeyTable() //nolint:staticcheck - case crisistypes.ModuleName: - keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - case wasmtypes.ModuleName: - keyTable = wasmtypes.ParamKeyTable() //nolint:staticcheck - } - - if !subspace.HasKeyTable() { - subspace.WithKeyTable(keyTable) - } - } - - baseAppLegacySS := keepers.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) - // update 1 change wasm permission to everybody - // need proposal change - // update 2 add metadeta in bank - keepers.BankKeeper.SetDenomMetaData(ctx, banktypes.Metadata{ - Description: "UnUniFi governance token", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: "uguu", - Exponent: 6, - Aliases: []string{"microguu"}, - }, - }, - Base: "uguu", - Symbol: "GUU", - Display: "GUU", - Name: "UnUniFi", - }) - baseapp.MigrateParams(ctx, baseAppLegacySS, keepers.ConsensusParamsKeeper) - - return mm.RunMigrations(ctx, configurator, vm) - } -} diff --git a/app/upgrades/v2.1/constants.go b/app/upgrades/v3.1/constants.go similarity index 86% rename from app/upgrades/v2.1/constants.go rename to app/upgrades/v3.1/constants.go index eb5bf3b33..43c1babeb 100644 --- a/app/upgrades/v2.1/constants.go +++ b/app/upgrades/v3.1/constants.go @@ -1,4 +1,4 @@ -package v2_1 +package v3_1 import ( store "github.com/cosmos/cosmos-sdk/store/types" @@ -6,7 +6,7 @@ import ( "github.com/UnUniFi/chain/app/upgrades" ) -const UpgradeName string = "v2_1" +const UpgradeName string = "v3_1" var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, diff --git a/app/upgrades/v2.2/upgrades.go b/app/upgrades/v3.1/upgrades.go similarity index 62% rename from app/upgrades/v2.2/upgrades.go rename to app/upgrades/v3.1/upgrades.go index a7674fa92..ce943eb26 100644 --- a/app/upgrades/v2.2/upgrades.go +++ b/app/upgrades/v3.1/upgrades.go @@ -1,7 +1,8 @@ -package v2_2 +package v3_1 import ( "fmt" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -9,6 +10,7 @@ import ( "github.com/UnUniFi/chain/app/keepers" "github.com/UnUniFi/chain/app/upgrades" + epochtypes "github.com/UnUniFi/chain/x/epochs/types" ) func CreateUpgradeHandler(mm *module.Manager, @@ -18,13 +20,13 @@ func CreateUpgradeHandler(mm *module.Manager, return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) - bankParam := keepers.BankKeeper.GetParams(ctx) - bankParam.DefaultSendEnabled = true + epochInfo, found := keepers.EpochsKeeper.GetEpochInfo(ctx, epochtypes.BASE_EPOCH) + if !found { + return vm, fmt.Errorf("epoch %s not found", epochtypes.BASE_EPOCH) + } + epochInfo.Duration = time.Minute * 15 // 15min + keepers.EpochsKeeper.SetEpochInfo(ctx, epochInfo) - keepers.BankKeeper.SetParams(ctx, bankParam) - - keepers.BankKeeper.SetSendEnabled(ctx, "uguu", false) - - return mm.RunMigrations(ctx, configurator, vm) + return vm, nil } } diff --git a/app/upgrades/v3.2/constants.go b/app/upgrades/v3.2/constants.go new file mode 100644 index 000000000..9ed9bcc74 --- /dev/null +++ b/app/upgrades/v3.2/constants.go @@ -0,0 +1,22 @@ +package v3_2 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types" + buildertypes "github.com/skip-mev/pob/x/builder/types" + + "github.com/UnUniFi/chain/app/upgrades" + nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types" +) + +const UpgradeName string = "v3_2" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{nftfactorytypes.StoreKey, buildertypes.StoreKey, ibchookstypes.StoreKey}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v3.2/upgrades.go b/app/upgrades/v3.2/upgrades.go new file mode 100644 index 000000000..357e5e389 --- /dev/null +++ b/app/upgrades/v3.2/upgrades.go @@ -0,0 +1,49 @@ +package v3_2 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/UnUniFi/chain/app/keepers" + "github.com/UnUniFi/chain/app/upgrades" + yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" +) + +func CreateUpgradeHandler(mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName)) + + iyaParams := yieldaggregatortypes.Params{} + paramtypes.NewKeyTable().RegisterParamSet(&yieldaggregatortypes.Params{}) + keepers.GetSubspace(yieldaggregatortypes.ModuleName).WithKeyTable(yieldaggregatortypes.ParamKeyTable()).GetParamSet(ctx, &iyaParams) + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + factoryParam, err := keepers.NftfactoryKeeper.GetParams(ctx) + if err != nil { + return vm, err + } + factoryParam.ClassCreationFee = []sdk.Coin{} + factoryParam.FeeCollectorAddress = "" + _ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam) + + // iyaParam, err := keepers.YieldaggregatorKeeper.GetParams(ctx) + // if err != nil { + // return vm, err + // } + _ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams) + + return vm, nil + } +} diff --git a/app/upgrades/v3/constants.go b/app/upgrades/v3/constants.go index 68da25222..d30578a65 100644 --- a/app/upgrades/v3/constants.go +++ b/app/upgrades/v3/constants.go @@ -8,10 +8,10 @@ import ( "github.com/UnUniFi/chain/app/upgrades" epochstypes "github.com/UnUniFi/chain/x/epochs/types" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types" ) diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go index 8b9500b17..4e1cdfb90 100644 --- a/app/upgrades/v3/upgrades.go +++ b/app/upgrades/v3/upgrades.go @@ -23,7 +23,10 @@ func CreateUpgradeHandler(mm *module.Manager, return vm, err } - iyaParam := keepers.YieldaggregatorKeeper.GetParams(ctx) + iyaParam, err := keepers.YieldaggregatorKeeper.GetParams(ctx) + if err != nil { + return vm, err + } iyaParam.CommissionRate = sdk.NewDecWithPrec(1, 3) iyaParam.VaultCreationFee = sdk.NewCoin("uguu", sdk.NewInt(10000000)) iyaParam.VaultCreationDeposit = sdk.NewCoin("uguu", sdk.NewInt(1000000)) diff --git a/cmd/ununifid/cmd/root.go b/cmd/ununifid/cmd/root.go index 68a9f1c68..063bb73af 100644 --- a/cmd/ununifid/cmd/root.go +++ b/cmd/ununifid/cmd/root.go @@ -44,7 +44,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { encodingConfig := app.MakeEncodingConfig() initClientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). + WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). @@ -159,7 +159,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { keys.Commands(app.DefaultNodeHome), ) // add rosetta - rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) + rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) } func addModuleInitFlags(startCmd *cobra.Command) { @@ -242,9 +242,9 @@ func newApp( return app.NewApp( logger, db, traceStore, true, - app.GetEnabledProposals(), appOpts, wasmOpts, + app.GetEnabledProposals(), baseappOptions..., ) } @@ -281,9 +281,9 @@ func appExport( db, traceStore, height == -1, - app.GetEnabledProposals(), appOpts, emptyWasmOpts, + app.GetEnabledProposals(), ) if height != -1 { diff --git a/deprecated/proto/auction/auction.proto b/deprecated/proto/auction/auction.proto deleted file mode 100644 index 14a2f37e1..000000000 --- a/deprecated/proto/auction/auction.proto +++ /dev/null @@ -1,120 +0,0 @@ -syntax = "proto3"; -package ununifi.auction; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/auction/types"; - -message BaseAuction { - uint64 id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; - string initiator = 2 [(gogoproto.moretags) = "yaml:\"initiator\""]; - cosmos.base.v1beta1.Coin lot = 3 [ - (gogoproto.moretags) = "yaml:\"lot\"", - (gogoproto.nullable) = false - ]; - string bidder = 4 [ - (gogoproto.moretags) = "yaml:\"bidder\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin bid = 5 [ - (gogoproto.moretags) = "yaml:\"bid\"", - (gogoproto.nullable) = false - ]; - bool has_received_bids = 6 [(gogoproto.moretags) = "yaml:\"has_received_bids\""]; - google.protobuf.Timestamp end_time = 7 [ - (gogoproto.moretags) = "yaml:\"end_time\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - google.protobuf.Timestamp max_end_time = 8 [ - (gogoproto.moretags) = "yaml:\"max_end_time\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; -} - -message SurplusAuction { - BaseAuction base_auction = 1 [ - (gogoproto.moretags) = "yaml:\"base_auction\"", - (gogoproto.embed) = true, - (gogoproto.nullable) = false - ]; -} - -message DebtAuction { - BaseAuction base_auction = 1 [ - (gogoproto.moretags) = "yaml:\"base_auction\"", - (gogoproto.embed) = true, - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin corresponding_debt = 2 [ - (gogoproto.moretags) = "yaml:\"corresponding_debt\"", - (gogoproto.nullable) = false - ]; -} - -message CollateralAuction { - BaseAuction base_auction = 1 [ - (gogoproto.moretags) = "yaml:\"base_auction\"", - (gogoproto.embed) = true, - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin corresponding_debt = 2 [ - (gogoproto.moretags) = "yaml:\"corresponding_debt\"", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin max_bid = 3 [ - (gogoproto.moretags) = "yaml:\"max_bid\"", - (gogoproto.nullable) = false - ]; - repeated WeightedAddress lot_returns = 4 [ - (gogoproto.moretags) = "yaml:\"lot_returns\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "WeightedAddresses" - ]; -} - -message WeightedAddress { - string address = 1 [ - (gogoproto.moretags) = "yaml:\"address\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string weight = 2 [ - (gogoproto.moretags) = "yaml:\"weight\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} - -message Params { - google.protobuf.Duration max_auction_duration = 1 [ - (gogoproto.moretags) = "yaml:\"max_auction_duration\"", - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true - ]; - google.protobuf.Duration bid_duration = 2 [ - (gogoproto.moretags) = "yaml:\"bid_duration\"", - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true - ]; - string increment_surplus = 3 [ - (gogoproto.moretags) = "yaml:\"increment_surplus\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - string increment_debt = 4 [ - (gogoproto.moretags) = "yaml:\"increment_debt\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - string increment_collateral = 5 [ - (gogoproto.moretags) = "yaml:\"increment_collateral\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} diff --git a/deprecated/proto/auction/genesis.proto b/deprecated/proto/auction/genesis.proto deleted file mode 100644 index ed4416706..000000000 --- a/deprecated/proto/auction/genesis.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package ununifi.auction; - -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos_proto/cosmos.proto"; -// this line is used by starport scaffolding # genesis/proto/import -import "auction/auction.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/auction/types"; - -// GenesisState defines the auction module's genesis state. -message GenesisState { - uint64 next_auction_id = 1 [(gogoproto.moretags) = "yaml:\"next_auction_id\""]; - Params params = 2 [ - (gogoproto.moretags) = "yaml:\"params\"", - (gogoproto.nullable) = false - ]; - repeated google.protobuf.Any auctions = 3 [ - (gogoproto.moretags) = "yaml:\"auctions\"" - ]; - // this line is used by starport scaffolding # genesis/proto/state -} diff --git a/deprecated/proto/auction/query.proto b/deprecated/proto/auction/query.proto deleted file mode 100644 index 409a5f48b..000000000 --- a/deprecated/proto/auction/query.proto +++ /dev/null @@ -1,50 +0,0 @@ -syntax = "proto3"; -package ununifi.auction; - -import "google/api/annotations.proto"; -import "google/protobuf/any.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos_proto/cosmos.proto"; -// this line is used by starport scaffolding # 1 -import "auction/auction.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/auction/types"; - -// Query defines the gRPC querier service. -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ununifi/auction/params"; - } - // this line is used by starport scaffolding # 2 - rpc Auction(QueryGetAuctionRequest) returns (QueryGetAuctionResponse) { - option (google.api.http).get = "/ununifi/auction/auctions/{id}"; - } - rpc AuctionAll(QueryAllAuctionRequest) returns (QueryAllAuctionResponse) { - option (google.api.http).get = "/ununifi/auction/auctions"; - } - -} - -message QueryParamsRequest {} - -message QueryParamsResponse { - Params params = 1; -} - -// this line is used by starport scaffolding # 3 -message QueryGetAuctionRequest { - uint64 id = 1; -} - -message QueryGetAuctionResponse { - google.protobuf.Any auction = 1 [(cosmos_proto.accepts_interface) = "Auction"]; -} - -message QueryAllAuctionRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllAuctionResponse { - repeated google.protobuf.Any auctions = 1 [(cosmos_proto.accepts_interface) = "Auction"]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} diff --git a/deprecated/proto/auction/tx.proto b/deprecated/proto/auction/tx.proto deleted file mode 100644 index 8df0e1fa8..000000000 --- a/deprecated/proto/auction/tx.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package ununifi.auction; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/auction/types"; - -service Msg { - rpc PlaceBid(MsgPlaceBid) returns (MsgPlaceBidResponse); -} - -message MsgPlaceBid { - uint64 auction_id = 1 [(gogoproto.moretags) = "yaml:\"auction_id\""]; - string bidder = 2 [ - (gogoproto.moretags) = "yaml:\"bidder\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; -} - -message MsgPlaceBidResponse {} diff --git a/deprecated/proto/cdp/cdp.proto b/deprecated/proto/cdp/cdp.proto deleted file mode 100644 index d1db9488b..000000000 --- a/deprecated/proto/cdp/cdp.proto +++ /dev/null @@ -1,169 +0,0 @@ -syntax = "proto3"; -package ununifi.cdp; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/cdp/types"; - -message Cdp { - uint64 id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; - string owner = 2 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string type = 3 [(gogoproto.moretags) = "yaml:\"type\""]; - cosmos.base.v1beta1.Coin collateral = 4 [ - (gogoproto.moretags) = "yaml:\"collateral\"", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin principal = 5 [ - (gogoproto.moretags) = "yaml:\"principal\"", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin accumulated_fees = 6 [ - (gogoproto.moretags) = "yaml:\"accumulated_fees\"", - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp fees_updated = 7 [ - (gogoproto.moretags) = "yaml:\"fees_updated\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - string interest_factor = 8 [ - (gogoproto.moretags) = "yaml:\"interest_factor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message Deposit { - uint64 cdp_id = 1 [(gogoproto.moretags) = "yaml:\"cdp_id\""]; - string depositor = 2 [ - (gogoproto.moretags) = "yaml:\"depositor\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.moretags) = "yaml:\"amount\"", - (gogoproto.nullable) = false - ]; -} - -message AugmentedCdp { - Cdp cdp = 1 [ - (gogoproto.moretags) = "yaml:\"cdp\"", - (gogoproto.embed) = true, - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin collateral_value = 2 [ - (gogoproto.moretags) = "yaml:\"collateral_value\"", - (gogoproto.nullable) = false - ]; - string collateralization_ratio = 3 [ - (gogoproto.moretags) = "yaml:\"collateralization_ratio\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message Params { - repeated CollateralParam collateral_params = 1 [ - (gogoproto.moretags) = "yaml:\"collateral_params\"", - (gogoproto.nullable) = false - ]; - repeated DebtParam debt_params = 2 [ - (gogoproto.moretags) = "yaml:\"debt_param\"", - (gogoproto.nullable) = false - ]; -} - -message CollateralParam { - string denom = 1 [(gogoproto.moretags) = "yaml:\"denom\""]; - string type = 2 [(gogoproto.moretags) = "yaml:\"type\""]; - string liquidation_ratio = 3 [ - (gogoproto.moretags) = "yaml:\"liquidation_ratio\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin debt_limit = 4 [ - (gogoproto.moretags) = "yaml:\"debt_limit\"", - (gogoproto.nullable) = false - ]; - string stability_fee = 5 [ - (gogoproto.moretags) = "yaml:\"stability_fee\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - string auction_size = 6 [ - (gogoproto.moretags) = "yaml:\"auction_size\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string liquidation_penalty = 7 [ - (gogoproto.moretags) = "yaml:\"liquidation_penalty\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - uint32 prefix = 8 [(gogoproto.moretags) = "yaml:\"prefix\""]; - string spot_market_id = 9 [(gogoproto.moretags) = "yaml:\"spot_market_id\""]; - string liquidation_market_id = 10 [(gogoproto.moretags) = "yaml:\"liquidation_market_id\""]; - string keeper_reward_percentage = 11 [ - (gogoproto.moretags) = "yaml:\"keeper_reward_percentage\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - string check_collateralization_index_count = 12 [ - (gogoproto.moretags) = "yaml:\"check_collateralization_index_count\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string conversion_factor = 13 [ - (gogoproto.moretags) = "yaml:\"conversion_factor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} - -message DebtParam { - string denom = 1 [(gogoproto.moretags) = "yaml:\"denom\""]; - string reference_asset = 2 [(gogoproto.moretags) = "yaml:\"reference_asset\""]; - string conversion_factor = 3 [ - (gogoproto.moretags) = "yaml:\"conversion_factor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string debt_floor = 4 [ - (gogoproto.moretags) = "yaml:\"debt_floor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin global_debt_limit = 5 [ - (gogoproto.moretags) = "yaml:\"global_debt_limit\"", - (gogoproto.nullable) = false - ]; - string debt_denom = 6 [(gogoproto.moretags) = "yaml:\"debt_denom\""]; - string surplus_auction_threshold = 7 [ - (gogoproto.moretags) = "yaml:\"surplus_auction_threshold\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string surplus_auction_lot = 8 [ - (gogoproto.moretags) = "yaml:\"surplus_auction_lot\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string debt_auction_threshold = 9 [ - (gogoproto.moretags) = "yaml:\"debt_auction_threshold\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string debt_auction_lot = 10 [ - (gogoproto.moretags) = "yaml:\"debt_auction_lot\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - bool circuit_breaker = 11 [(gogoproto.moretags) = "yaml:\"circuit_breaker\""]; -} diff --git a/deprecated/proto/cdp/genesis.proto b/deprecated/proto/cdp/genesis.proto deleted file mode 100644 index 991af798a..000000000 --- a/deprecated/proto/cdp/genesis.proto +++ /dev/null @@ -1,60 +0,0 @@ -syntax = "proto3"; -package ununifi.cdp; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; -// this line is used by starport scaffolding # genesis/proto/import -import "cdp/cdp.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/cdp/types"; - -// GenesisState defines the cdp module's genesis state. -message GenesisState { - Params params = 1 [ - (gogoproto.moretags) = "yaml:\"params\"", - (gogoproto.nullable) = false - ]; - repeated Cdp cdps = 2 [ - (gogoproto.moretags) = "yaml:\"cdps\"", - (gogoproto.nullable) = false - ]; - repeated Deposit deposits = 3 [ - (gogoproto.moretags) = "yaml:\"deposits\"", - (gogoproto.nullable) = false - ]; - uint64 starting_cdp_id = 4 [(gogoproto.moretags) = "yaml:\"starting_cdp_id\""]; - string gov_denom = 5 [(gogoproto.moretags) = "yaml:\"gov_denom\""]; - repeated GenesisAccumulationTime previous_accumulation_times = 6 [ - (gogoproto.moretags) = "yaml:\"previous_accumulation_times\"", - (gogoproto.nullable) = false - ]; - repeated GenesisTotalPrincipal total_principals = 7 [ - (gogoproto.moretags) = "yaml:\"total_principals\"", - (gogoproto.nullable) = false - ]; - // this line is used by starport scaffolding # genesis/proto/state -} - -message GenesisAccumulationTime { - string collateral_type = 1 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - google.protobuf.Timestamp previous_accumulation_time = 2 [ - (gogoproto.moretags) = "yaml:\"previous_accumulation_time\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - string interest_factor = 3 [ - (gogoproto.moretags) = "yaml:\"interest_factor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message GenesisTotalPrincipal { - string collateral_type = 1 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - string total_principal = 2 [ - (gogoproto.moretags) = "yaml:\"total_principal\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} diff --git a/deprecated/proto/cdp/query.proto b/deprecated/proto/cdp/query.proto deleted file mode 100644 index acee58fd0..000000000 --- a/deprecated/proto/cdp/query.proto +++ /dev/null @@ -1,71 +0,0 @@ -syntax = "proto3"; -package ununifi.cdp; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "google/protobuf/any.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -// this line is used by starport scaffolding # 1 -import "cdp/cdp.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/cdp/types"; - -// Query defines the gRPC querier service. -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ununifi/cdp/params"; - } - // this line is used by starport scaffolding # 2 - rpc Cdp(QueryGetCdpRequest) returns (QueryGetCdpResponse) { - option (google.api.http).get = "/ununifi/cdp/cdps/owners/{owner}/collateral-types/{collateral_type}/cdp"; - } - rpc CdpAll(QueryAllCdpRequest) returns (QueryAllCdpResponse) { - option (google.api.http).get = "/ununifi/cdp/cdps"; - } - rpc AccountAll(QueryAllAccountRequest) returns (QueryAllAccountResponse) { - option (google.api.http).get = "/ununifi/cdp/accounts"; - } - rpc DepositAll(QueryAllDepositRequest) returns (QueryAllDepositResponse) { - option (google.api.http).get = "/ununifi/cdp/deposits/owners/{owner}/collateral-types/{collateral_type}"; - } -} - -message QueryParamsRequest {} - -message QueryParamsResponse { - Params params = 1; -} - -// this line is used by starport scaffolding # 3 -message QueryGetCdpRequest { - string owner = 1; - string collateral_type = 2; -} - -message QueryGetCdpResponse { - AugmentedCdp cdp = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllCdpRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllCdpResponse { - repeated AugmentedCdp cdp = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryAllAccountRequest {} - -message QueryAllAccountResponse { - repeated google.protobuf.Any accounts = 1; -} - -message QueryAllDepositRequest { - string owner = 1; - string collateral_type = 2; -} - -message QueryAllDepositResponse { - repeated Deposit deposits = 1 [(gogoproto.nullable) = false]; -} diff --git a/deprecated/proto/cdp/tx.proto b/deprecated/proto/cdp/tx.proto deleted file mode 100644 index 6deb10417..000000000 --- a/deprecated/proto/cdp/tx.proto +++ /dev/null @@ -1,122 +0,0 @@ -syntax = "proto3"; -package ununifi.cdp; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/cdp/types"; - -service Msg { - rpc CreateCdp(MsgCreateCdp) returns (MsgCreateCdpResponse); - rpc Deposit(MsgDeposit) returns (MsgDepositResponse); - rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse); - rpc DrawDebt(MsgDrawDebt) returns (MsgDrawDebtResponse); - rpc RepayDebt(MsgRepayDebt) returns (MsgRepayDebtResponse); - rpc Liquidate(MsgLiquidate) returns (MsgLiquidateResponse); -} - -message MsgCreateCdp { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin collateral = 2 [ - (gogoproto.moretags) = "yaml:\"collateral\"", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin principal = 3 [ - (gogoproto.moretags) = "yaml:\"principal\"", - (gogoproto.nullable) = false - ]; - string collateral_type = 4 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; -} - -message MsgCreateCdpResponse {} - -message MsgDeposit { - string depositor = 1 [ - (gogoproto.moretags) = "yaml:\"depositor\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string owner = 2 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin collateral = 3 [ - (gogoproto.moretags) = "yaml:\"collateral\"", - (gogoproto.nullable) = false - ]; - string collateral_type = 4 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; -} - -message MsgDepositResponse {} - -message MsgWithdraw { - string depositor = 1 [ - (gogoproto.moretags) = "yaml:\"depositor\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string owner = 2 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin collateral = 3 [ - (gogoproto.moretags) = "yaml:\"collateral\"", - (gogoproto.nullable) = false - ]; - string collateral_type = 4 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; -} - -message MsgWithdrawResponse {} - -message MsgDrawDebt { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string collateral_type = 2 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - cosmos.base.v1beta1.Coin principal = 3 [ - (gogoproto.moretags) = "yaml:\"principal\"", - (gogoproto.nullable) = false - ]; -} - -message MsgDrawDebtResponse {} - -message MsgRepayDebt { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string collateral_type = 2 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - cosmos.base.v1beta1.Coin payment = 3 [ - (gogoproto.moretags) = "yaml:\"payment\"", - (gogoproto.nullable) = false - ]; -} - -message MsgRepayDebtResponse {} - -message MsgLiquidate { - string keeper = 1 [ - (gogoproto.moretags) = "yaml:\"keeper\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string borrower = 2 [ - (gogoproto.moretags) = "yaml:\"borrower\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string collateral_type = 3 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; -} - -message MsgLiquidateResponse {} diff --git a/deprecated/proto/incentive/genesis.proto b/deprecated/proto/incentive/genesis.proto deleted file mode 100644 index 18f26e5d5..000000000 --- a/deprecated/proto/incentive/genesis.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; -package ununifi.incentive; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -// this line is used by starport scaffolding # genesis/proto/import -import "incentive/incentive.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/incentive/types"; - -// GenesisState defines the incentive module's genesis state. -message GenesisState { - Params params = 1 [ - (gogoproto.moretags) = "yaml:\"params\"", - (gogoproto.nullable) = false - ]; - repeated GenesisAccumulationTime cdp_accumulation_times = 2 [ - (gogoproto.moretags) = "yaml:\"cdp_accumulation_times\"", - (gogoproto.nullable) = false - ]; - repeated CdpMintingClaim cdp_minting_claims = 3 [ - (gogoproto.moretags) = "yaml:\"cdp_minting_claims\"", - (gogoproto.nullable) = false - ]; - GenesisDenoms denoms = 4 [(gogoproto.moretags) = "yaml:\"denoms\""]; - // this line is used by starport scaffolding # genesis/proto/state -} - -message GenesisAccumulationTime { - string collateral_type = 1 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - google.protobuf.Timestamp previous_accumulation_time = 2 [ - (gogoproto.moretags) = "yaml:\"previous_accumulation_time\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; -} - -message GenesisDenoms { - string principal_denom = 1 [(gogoproto.moretags) = "yaml:\"principal_denom\""]; - string cdp_minting_reward_denom = 2 [(gogoproto.moretags) = "yaml:\"principal_denom\""]; -} diff --git a/deprecated/proto/incentive/incentive.proto b/deprecated/proto/incentive/incentive.proto deleted file mode 100644 index 28006bb62..000000000 --- a/deprecated/proto/incentive/incentive.proto +++ /dev/null @@ -1,97 +0,0 @@ -syntax = "proto3"; -package ununifi.incentive; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/incentive/types"; - -message BaseClaim { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin reward = 2 [ - (gogoproto.moretags) = "yaml:\"reward\"", - (gogoproto.nullable) = false - ]; -} - -message BaseMultiClaim { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated cosmos.base.v1beta1.Coin reward = 2 [ - (gogoproto.moretags) = "yaml:\"rewards\"", - (gogoproto.nullable) = false - ]; -} - -message CdpMintingClaim { - BaseClaim base_claim = 1 [ - (gogoproto.moretags) = "yaml:\"base_claim\"", - (gogoproto.embed) = true - ]; - repeated RewardIndex reward_indexes= 2 [ - (gogoproto.moretags) = "yaml:\"reward_indexes\"", - (gogoproto.nullable) = false - ]; -} - -message RewardIndex { - string collateral_type = 1 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - string reward_factor = 2 [ - (gogoproto.moretags) = "yaml:\"reward_factor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message Params { - repeated RewardPeriod cdp_minting_reward_periods = 1 [ - (gogoproto.moretags) = "yaml:\"cdp_minting_reward_periods\"", - (gogoproto.nullable) = false - ]; - repeated Multiplier claim_multipliers = 2 [ - (gogoproto.moretags) = "yaml:\"claim_multipliers\"", - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp claim_end = 3 [ - (gogoproto.moretags) = "yaml:\"claim_end\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; -} - -message RewardPeriod { - bool active = 1 [(gogoproto.moretags) = "yaml:\"active\""]; - string collateral_type = 2 [(gogoproto.moretags) = "yaml:\"collateral_type\""]; - google.protobuf.Timestamp start = 3 [ - (gogoproto.moretags) = "yaml:\"start\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - google.protobuf.Timestamp end = 4 [ - (gogoproto.moretags) = "yaml:\"end\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - cosmos.base.v1beta1.Coin rewards_per_second = 5 [ - (gogoproto.moretags) = "yaml:\"rewards_per_second\"", - (gogoproto.nullable) = false - ]; -} - -message Multiplier { - string name = 1 [(gogoproto.moretags) = "yaml:\"name\""]; - int64 months_lockup = 2 [(gogoproto.moretags) = "yaml:\"months_lockup\""]; - string factor = 3 [ - (gogoproto.moretags) = "yaml:\"factor\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} diff --git a/deprecated/proto/incentive/query.proto b/deprecated/proto/incentive/query.proto deleted file mode 100644 index 2e4f47e73..000000000 --- a/deprecated/proto/incentive/query.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package ununifi.incentive; - -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -// this line is used by starport scaffolding # 1 -import "incentive/incentive.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/incentive/types"; - -// Query defines the gRPC querier service. -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ununifi/incentive/params"; - } - // this line is used by starport scaffolding # 2 -} - -message QueryParamsRequest {} - -message QueryParamsResponse { - Params params = 1; -} - -// this line is used by starport scaffolding # 3 diff --git a/deprecated/proto/incentive/tx.proto b/deprecated/proto/incentive/tx.proto deleted file mode 100644 index b73a061be..000000000 --- a/deprecated/proto/incentive/tx.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package ununifi.incentive; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/incentive/types"; - -service Msg { - rpc ClaimCdpMintingReward(MsgClaimCdpMintingReward) returns (MsgClaimCdpMintingRewardResponse); -} - -message MsgClaimCdpMintingReward { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string multiplier_name = 2 [(gogoproto.moretags) = "yaml:\"multiplier_name\""]; -} - -message MsgClaimCdpMintingRewardResponse {} \ No newline at end of file diff --git a/deprecated/proto/nftmarketv1/genesis.proto b/deprecated/proto/nftmarketv1/genesis.proto deleted file mode 100644 index a5a1ba8e7..000000000 --- a/deprecated/proto/nftmarketv1/genesis.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package ununifi.nftmarketv1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "nftmarketv1/nftmarket.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types"; - -// GenesisState defines the nftmarket module's genesis state. -message GenesisState { - Params params = 1 [ - (gogoproto.moretags) = "yaml:\"params\"", - (gogoproto.nullable) = false - ]; - repeated NftListing listings = 2 [ (gogoproto.nullable) = false ]; - repeated NftBid bids = 3 [ (gogoproto.nullable) = false ]; - repeated NftBid cancelled_bids = 4 [ (gogoproto.nullable) = false ]; - repeated Loan loans = 5 [ (gogoproto.nullable) = false ]; -} - -// Built based on following spec -// https://github.com/UnUniFi/chain/tree/design/spec/x/nftmarket/spec \ No newline at end of file diff --git a/deprecated/proto/nftmarketv1/nftmarket.proto b/deprecated/proto/nftmarketv1/nftmarket.proto deleted file mode 100644 index cf73bf5b2..000000000 --- a/deprecated/proto/nftmarketv1/nftmarket.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; -package ununifi.nftmarketv1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types"; - -enum ListingType { - DIRECT_ASSET_BORROW = 0; - SYNTHETIC_ASSET_CREATION = 1; - LATE_SHIPPING = 2; -} -enum ListingState { - LISTING = 0; - BIDDING = 1; - SELLING_DECISION = 2; - LIQUIDATION = 3; - END_LISTING = 4; - SUCCESSFUL_BID = 5; -} - -message NftIdentifier { - string class_id = 1; - string nft_id = 2; -} - -message Loan { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin loan = 2 [(gogoproto.nullable) = false]; -} - -message ListedClass { - string class_id = 1; - repeated string nft_ids = 2; -} - -message ListedNft { - string id = 1; - string uri = 2; - string uri_hash = 3; -} - -message NftListing { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - string owner = 2; - ListingType listing_type = 3; - ListingState state = 4; - string bid_token = 5; - string min_bid = 6 [ - (gogoproto.moretags) = "yaml:\"min_bid\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - uint64 bid_active_rank = 7; - google.protobuf.Timestamp started_at = 8 - [(gogoproto.moretags) = "yaml:\"started_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp end_at = 9 - [(gogoproto.moretags) = "yaml:\"end_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp full_payment_end_at = 10 - [(gogoproto.moretags) = "yaml:\"full_payment_end_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp successful_bid_end_at = 11 [ - (gogoproto.moretags) = "yaml:\"successful_bid_end_at\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - uint64 auto_relisted_count = 12; -} - -message NftBid { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - string bidder = 2; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; - bool automatic_payment = 4; - string paid_amount = 5 [ - (gogoproto.moretags) = "yaml:\"paid_amount\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp bid_time = 6 - [(gogoproto.moretags) = "yaml:\"bid_time\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} - -message Params { - string min_staking_for_listing = 1 [ - (gogoproto.moretags) = "yaml:\"min_staking_for_listing\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - uint64 default_bid_active_rank = 2; - repeated string bid_tokens = 3; - uint64 auto_relisting_count_if_no_bid = 4; - uint64 nft_listing_delay_seconds = 5; - uint64 nft_listing_period_initial = 6; - uint64 nft_listing_cancel_required_seconds = 7; - uint64 nft_listing_cancel_fee_percentage = 8; - uint64 nft_listing_gap_time = 9; - uint64 bid_cancel_required_seconds = 10; - uint64 bid_token_disburse_seconds_after_cancel = 11; - uint64 nft_listing_full_payment_period = 12; - uint64 nft_listing_nft_delivery_period = 13; - uint64 nft_creator_share_percentage = 14; - string market_administrator = 15; - uint64 nft_listing_commission_fee = 16; - uint64 nft_listing_extend_seconds = 17; - cosmos.base.v1beta1.Coin nft_listing_period_extend_fee_per_hour = 18 [(gogoproto.nullable) = false]; -} - -message EventListNft { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventCancelListNfting { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventExpandListingPeriod { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventSellingDecision { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventEndListNfting { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventPlaceBid { - string bidder = 1; - string class_id = 2; - string nft_id = 3; - string amount = 4; -} - -message EventCancelBid { - string bidder = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventPayFullBid { - string bidder = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventBorrow { - string borrower = 1; - string class_id = 2; - string nft_id = 3; - string amount = 4; -} - -message EventRepay { - string repayer = 1; - string class_id = 2; - string nft_id = 3; - string amount = 4; -} - -message EventLiquidate { - string liquidator = 1; - string class_id = 2; - string nft_id = 3; -} - -message PaymentStatus { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - string bidder = 2; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; - bool automatic_payment = 4; - string paid_amount = 5 [ - (gogoproto.moretags) = "yaml:\"paid_amount\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp bid_time = 6 - [(gogoproto.moretags) = "yaml:\"bid_time\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - ListingState state = 7; - bool all_paid = 8; -} \ No newline at end of file diff --git a/deprecated/proto/nftmarketv1/query.proto b/deprecated/proto/nftmarketv1/query.proto deleted file mode 100644 index c5af97f77..000000000 --- a/deprecated/proto/nftmarketv1/query.proto +++ /dev/null @@ -1,159 +0,0 @@ -syntax = "proto3"; -package ununifi.nftmarketv1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos_proto/cosmos.proto"; -import "nftmarketv1/nftmarket.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types"; - -// Query defines the gRPC querier service. -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ununifi/nftmarket/params"; - } - rpc NftListing(QueryNftListingRequest) returns (QueryNftListingResponse) { - option (google.api.http).get = "/ununifi/nftmarket/nft_listing/{class_id}/{nft_id}"; - } - rpc ListedNfts(QueryListedNftsRequest) returns (QueryListedNftsResponse) { - option (google.api.http).get = "/ununifi/nftmarket/listed_nfts"; - } - rpc ListedClasses(QueryListedClassesRequest) returns (QueryListedClassesResponse) { - option (google.api.http).get = "/ununifi/nftmarket/listed_classes"; - } - rpc ListedClass(QueryListedClassRequest) returns (QueryListedClassResponse) { - option (google.api.http).get = "/ununifi/nftmarket/listed_class/{class_id}/{nft_limit}"; - } - - rpc Loans(QueryLoansRequest) returns (QueryLoansResponse) { - option (google.api.http).get = "/ununifi/nftmarket/loans"; - } - - rpc Loan(QueryLoanRequest) returns (QueryLoanResponse) { - option (google.api.http).get = "/ununifi/nftmarket/loans/{class_id}/{nft_id}"; - } - rpc CDPsList(QueryCDPsListRequest) returns (QueryCDPsListResponse) { - option (google.api.http).get = "/ununifi/nftmarket/cdps_list"; - } - rpc NftBids(QueryNftBidsRequest) returns (QueryNftBidsResponse) { - option (google.api.http).get = "/ununifi/nftmarket/nft_bids/{class_id}/{nft_id}"; - } - rpc BidderBids(QueryBidderBidsRequest) returns (QueryBidderBidsResponse) { - option (google.api.http).get = "/ununifi/nftmarket/bidder_bids/{bidder}"; - } - rpc PaymentStatus(QueryPaymentStatusRequest) returns (QueryPaymentStatusResponse) { - option (google.api.http).get = "/ununifi/nftmarket/payment_status/{class_id}/{nft_id}/{bidder}"; - } - rpc Rewards(QueryRewardsRequest) returns (QueryRewardsResponse) { - option (google.api.http).get = "/ununifi/nftmarket/rewards/{address}"; - } -} - -message QueryParamsRequest {} -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryNftListingRequest { - string class_id = 1; - string nft_id = 2; -} -message QueryNftListingResponse { - NftListing listing = 1 [(gogoproto.nullable) = false]; -} - -message QueryListedNftsRequest { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (cosmos_proto.scalar) = "github.com/UnUniFi/chain/types.StringAccAddress" - ]; -} -message QueryListedClassesRequest { - int32 nft_limit = 1; -} -message QueryListedClassRequest { - string class_id = 1; - int32 nft_limit = 2; -} -message QueryListedNftsResponse { - repeated NftListing listings = 1 [(gogoproto.nullable) = false]; -} - -message QueryListedClassesResponse { - repeated QueryListedClassResponse classes = 1; -} -message QueryListedClassResponse { - string class_id = 1; - string name = 2; - string description = 3; - string symbol = 4; - string uri = 5; - string urihash = 6; - repeated ListedNft nfts = 7; - uint64 nft_count = 8; -} - -message QueryLoansRequest {} -message QueryLoansResponse { - repeated Loan loans = 1 [(gogoproto.nullable) = false]; -} - -message QueryLoanRequest { - string class_id = 1; - string nft_id = 2; -} - -message QueryLoanResponse { - Loan loan = 1 [(gogoproto.nullable) = false]; - string borrowing_limit = 2 [ - (gogoproto.moretags) = "yaml:\"borrowing_limit\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} - -message QueryCDPsListRequest {} -message QueryCDPsListResponse { - // List of collateral rates for each NFT secured - // Issuing stable tokens Balance list -} - -message QueryNftBidsRequest { - string class_id = 1; - string nft_id = 2; -} -message QueryNftBidsResponse { - repeated NftBid bids = 1 [(gogoproto.nullable) = false]; -} -message QueryPaymentStatusRequest { - string class_id = 1; - string nft_id = 2; - string bidder = 3 [ - (gogoproto.moretags) = "yaml:\"bidder\"", - (cosmos_proto.scalar) = "github.com/UnUniFi/chain/types.StringAccAddress" - ]; -} - -message QueryPaymentStatusResponse { - PaymentStatus paymentStatus = 1 [(gogoproto.nullable) = false]; -} - -message QueryBidderBidsRequest { - string bidder = 1 [ - (gogoproto.moretags) = "yaml:\"bidder\"", - (cosmos_proto.scalar) = "github.com/UnUniFi/chain/types.StringAccAddress" - ]; -} -message QueryBidderBidsResponse { - repeated NftBid bids = 1 [(gogoproto.nullable) = false]; -} - -message QueryRewardsRequest { - uint64 address = 1; -} -message QueryRewardsResponse { - repeated cosmos.base.v1beta1.Coin rewards = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/deprecated/proto/nftmarketv1/tx.proto b/deprecated/proto/nftmarketv1/tx.proto deleted file mode 100644 index 44ca1266f..000000000 --- a/deprecated/proto/nftmarketv1/tx.proto +++ /dev/null @@ -1,179 +0,0 @@ -syntax = "proto3"; -package ununifi.nftmarketv1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "nftmarketv1/nftmarket.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types"; - -service Msg { - rpc MintNft(MsgMintNft) returns (MsgMintNftResponse); - rpc ListNft(MsgListNft) returns (MsgListNftResponse); - rpc CancelNftListing(MsgCancelNftListing) returns (MsgCancelNftListingResponse); - rpc ExpandListingPeriod(MsgExpandListingPeriod) returns (MsgExpandListingPeriodResponse); - rpc PlaceBid(MsgPlaceBid) returns (MsgPlaceBidResponse); - rpc CancelBid(MsgCancelBid) returns (MsgCancelBidResponse); - rpc SellingDecision(MsgSellingDecision) returns (MsgSellingDecisionResponse); - rpc EndNftListing(MsgEndNftListing) returns (MsgEndNftListingResponse); - rpc PayFullBid(MsgPayFullBid) returns (MsgPayFullBidResponse); - rpc Borrow(MsgBorrow) returns (MsgBorrowResponse); - rpc Repay(MsgRepay) returns (MsgRepayResponse); - rpc MintStableCoin(MsgMintStableCoin) returns (MsgMintStableCoinResponse); - rpc BurnStableCoin(MsgBurnStableCoin) returns (MsgBurnStableCoinResponse); - rpc Liquidate(MsgLiquidate) returns (MsgLiquidateResponse); -} - -message MsgMintNft { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string classId = 2; - string nftId = 3; - string nftUri = 4; - string nftUriHash = 5; -} -message MsgMintNftResponse {} - -message MsgListNft { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - ListingType listing_type = 3; - string bid_token = 4; - string min_bid = 5 [ - (gogoproto.moretags) = "yaml:\"min_bid\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - uint64 bid_active_rank = 6; -} -message MsgListNftResponse {} - -message MsgCancelNftListing { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgCancelNftListingResponse {} - -message MsgExpandListingPeriod { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgExpandListingPeriodResponse {} - -message MsgPlaceBid { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; - bool automatic_payment = 4; -} -message MsgPlaceBidResponse {} - -message MsgCancelBid { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgCancelBidResponse {} - -message MsgEndNftListing { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgEndNftListingResponse {} - -message MsgSellingDecision { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgSellingDecisionResponse {} - -message MsgPayFullBid { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgPayFullBidResponse {} - -message MsgBorrow { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; -} -message MsgBorrowResponse {} - -message MsgRepay { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; -} -message MsgRepayResponse {} - -message MsgMintStableCoin { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -message MsgMintStableCoinResponse {} - -message MsgBurnStableCoin { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -message MsgBurnStableCoinResponse {} - -message MsgLiquidate { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -message MsgLiquidateResponse {} diff --git a/deprecated/proto/ununifidist/genesis.proto b/deprecated/proto/ununifidist/genesis.proto deleted file mode 100644 index b166e4d1f..000000000 --- a/deprecated/proto/ununifidist/genesis.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package ununifi.ununifidist; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -// this line is used by starport scaffolding # genesis/proto/import -import "ununifidist/ununifidist.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/ununifidist/types"; - -// GenesisState defines the ununifidist module's genesis state. -message GenesisState { - Params params = 1 [ - (gogoproto.moretags) = "yaml:\"params\"", - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp previous_block_time = 2 [ - (gogoproto.moretags) = "yaml:\"previous_block_time\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - string gov_denom = 3 [(gogoproto.moretags) = "yaml:\"gov_denom\""]; - // this line is used by starport scaffolding # genesis/proto/state -} diff --git a/deprecated/proto/ununifidist/query.proto b/deprecated/proto/ununifidist/query.proto deleted file mode 100644 index 7404840ea..000000000 --- a/deprecated/proto/ununifidist/query.proto +++ /dev/null @@ -1,36 +0,0 @@ -syntax = "proto3"; -package ununifi.ununifidist; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/base/v1beta1/coin.proto"; -// this line is used by starport scaffolding # 1 -import "ununifidist/ununifidist.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/ununifidist/types"; - -// Query defines the gRPC querier service. -service Query { - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ununifi/ununifidist/params"; - } - // this line is used by starport scaffolding # 2 - rpc Balances(QueryGetBalancesRequest) returns (QueryGetBalancesResponse) { - option (google.api.http).get = "/ununifi/ununifidist/balances"; - } -} - -message QueryParamsRequest {} - -message QueryParamsResponse { - Params params = 1; -} - -message QueryGetBalancesRequest {} - -message QueryGetBalancesResponse { - repeated cosmos.base.v1beta1.Coin balances = 1 [(gogoproto.nullable) = false]; -} - -// this line is used by starport scaffolding # 3 diff --git a/deprecated/proto/ununifidist/ununifidist.proto b/deprecated/proto/ununifidist/ununifidist.proto deleted file mode 100644 index 8bccec045..000000000 --- a/deprecated/proto/ununifidist/ununifidist.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; -package ununifi.ununifidist; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/ununifidist/types"; - -message Params { - bool active = 1 [(gogoproto.moretags) = "yaml:\"active\""]; - repeated Period periods = 2 [ - (gogoproto.moretags) = "yaml:\"periods\"", - (gogoproto.nullable) = false - ]; -} - -message Period { - google.protobuf.Timestamp start = 1 [ - (gogoproto.moretags) = "yaml:\"start\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - google.protobuf.Timestamp end = 2 [ - (gogoproto.moretags) = "yaml:\"end\"", - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - string inflation = 11 [ - (gogoproto.moretags) = "yaml:\"inflation\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} diff --git a/deprecated/proto/yieldaggregatorv1/asset.proto b/deprecated/proto/yieldaggregatorv1/asset.proto deleted file mode 100644 index d9ce17e3a..000000000 --- a/deprecated/proto/yieldaggregatorv1/asset.proto +++ /dev/null @@ -1,104 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldaggregator; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/any.proto"; -import "yieldaggregatorv1/params.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types"; - -enum IntegrateType { - GOLANG_MOD = 0; - COSMWASM = 1; -} -message IntegrateInfo { - IntegrateType type = 1; - // for cosmwasm contract - string contract_ibc_port_id = 2; - // for golang module - string mod_name = 3; -} -message AssetCondition { - string denom = 1; - string min = 2; - uint32 ratio = 3; -} -message AssetManagementTarget { - string id = 1; - string asset_management_account_id = 2; - string account_address = 4; - repeated AssetCondition asset_conditions = 5 [(gogoproto.nullable) = false]; - google.protobuf.Duration unbonding_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - IntegrateInfo integrate_info = 7 [(gogoproto.nullable) = false]; - bool enabled = 8; -} - -message AssetManagementAccount { - string id = 1; - string name = 2; - bool enabled = 3; -} - -message FarmingOrder { - string id = 1; - string from_address = 2; - Strategy strategy = 3 [(gogoproto.nullable) = false]; - google.protobuf.Duration max_unbonding_time = 4 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - uint32 overall_ratio = 5; - string min = 6; - string max = 7; - google.protobuf.Timestamp date = 8 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bool active = 9; -} - -message UserInfo { - string user = 1; - repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; - repeated FarmingOrder farming_orders = 3; - uint64 farmed_counter = 4; -} - -message UserDeposit { - string user = 1; - repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; -} - -// FarmingUnit is managing users' investment on a yield farm target -// Here, amount field is the amount withdrawable instantly, staked amount on yield farms are not calculated here -// since the value of staked amount could change after deposit - it's only determined at the time of withdrawal -// from the farm -message FarmingUnit { - string account_id = 1; - string target_id = 2; - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; - string farming_start_time = 4; - google.protobuf.Timestamp unbonding_starttime = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string owner = 6; -} - -// Strategy types -// recent30DaysHighDPRStrategy - Invest in the best DPR destination in the last 30 days on average -// recent1DayHighDPRStrategy - Invest in the best DPR destination in the last average day -// notHaveDPRStrategy - Invest in something that does not have a DPR. -// ManualStrategy - Manual investment, whiteTargetIdlist required. -message Strategy { - string strategy_type = 1; - repeated string whitelisted_target_ids = 2; - repeated string blacklisted_target_ids = 3; -} - -message DailyPercent { - string account_id = 1; - string target_id = 2; - string rate = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - google.protobuf.Timestamp date = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} - -message DepositAllocation { - string id = 1; - string order_id = 2; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/deprecated/proto/yieldaggregatorv1/genesis.proto b/deprecated/proto/yieldaggregatorv1/genesis.proto deleted file mode 100644 index ab3f6be48..000000000 --- a/deprecated/proto/yieldaggregatorv1/genesis.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldaggregator; - -import "gogoproto/gogo.proto"; -import "yieldaggregatorv1/params.proto"; -import "yieldaggregatorv1/asset.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types"; - -// GenesisState defines the yieldaggregator module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated AssetManagementAccount asset_management_accounts = 2 [(gogoproto.nullable) = false]; - repeated AssetManagementTarget asset_management_targets = 3 [(gogoproto.nullable) = false]; - repeated FarmingOrder farming_orders = 4 [(gogoproto.nullable) = false]; - repeated FarmingUnit farming_units = 5 [(gogoproto.nullable) = false]; - repeated UserDeposit user_deposits = 6 [(gogoproto.nullable) = false]; - repeated DailyPercent daily_percents = 7 [(gogoproto.nullable) = false]; -} diff --git a/deprecated/proto/yieldaggregatorv1/params.proto b/deprecated/proto/yieldaggregatorv1/params.proto deleted file mode 100644 index 6a12038c3..000000000 --- a/deprecated/proto/yieldaggregatorv1/params.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldaggregator; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types"; - -// Params defines the parameters for the module. -message Params { - string reward_rate_feeders = 1; -} diff --git a/deprecated/proto/yieldaggregatorv1/proposal.proto b/deprecated/proto/yieldaggregatorv1/proposal.proto deleted file mode 100644 index e53f7bca9..000000000 --- a/deprecated/proto/yieldaggregatorv1/proposal.proto +++ /dev/null @@ -1,66 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldaggregator; - -import "gogoproto/gogo.proto"; -import "yieldaggregatorv1/params.proto"; -import "yieldaggregatorv1/asset.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types"; - -// proposal to add new yield farm. -message ProposalAddYieldFarm { - string title = 1; - string description = 2; - AssetManagementAccount account = 3; -} - -// proposal to update yield farm info -message ProposalUpdateYieldFarm { - string title = 1; - string description = 2; - AssetManagementAccount account = 3; -} - -// proposal to remove yield farm -message ProposalStopYieldFarm { - string title = 1; - string description = 2; - string id = 3; -} - -// proposal to remove yield farm -message ProposalRemoveYieldFarm { - string title = 1; - string description = 2; - string id = 3; -} - -// proposal to add new yield farm target -message ProposalAddYieldFarmTarget { - string title = 1; - string description = 2; - AssetManagementTarget target = 3; -} - -// proposal to update yield farm target -message ProposalUpdateYieldFarmTarget { - string title = 1; - string description = 2; - AssetManagementTarget target = 3; -} - -// proposal to stop yield farm target -message ProposalStopYieldFarmTarget { - string title = 1; - string description = 2; - string id = 3; - string asset_management_account_id = 4; -} - -// proposal to delete yield farm target -message ProposalRemoveYieldFarmTarget { - string title = 1; - string description = 2; - string id = 3; - string asset_management_account_id = 4; -} diff --git a/deprecated/proto/yieldaggregatorv1/query.proto b/deprecated/proto/yieldaggregatorv1/query.proto deleted file mode 100644 index c723563ee..000000000 --- a/deprecated/proto/yieldaggregatorv1/query.proto +++ /dev/null @@ -1,84 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldaggregator; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "yieldaggregatorv1/params.proto"; -import "yieldaggregatorv1/asset.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/UnUniFi/chain/yieldaggregatorv1/params"; - } - rpc AssetManagementAccount(QueryAssetManagementAccountRequest) returns (QueryAssetManagementAccountResponse) { - option (google.api.http).get = "/UnUniFi/chain/yieldaggregatorv1/asset_management_account/{id}"; - } - rpc AllAssetManagementAccounts(QueryAllAssetManagementAccountsRequest) - returns (QueryAllAssetManagementAccountsResponse) { - option (google.api.http).get = "/UnUniFi/chain/yieldaggregatorv1/all_asset_management_accounts"; - } - rpc UserInfo(QueryUserInfoRequest) returns (QueryUserInfoResponse) { - option (google.api.http).get = "/UnUniFi/chain/yieldaggregatorv1/user_info/{address}"; - } - rpc AllFarmingUnits(QueryAllFarmingUnitsRequest) returns (QueryAllFarmingUnitsResponse) { - option (google.api.http).get = "/UnUniFi/chain/yieldaggregatorv1/all_user_infos"; - } - rpc DailyRewardPercents(QueryDailyRewardPercentsRequest) returns (QueryDailyRewardPercentsResponse) { - option (google.api.http).get = "/UnUniFi/chain/yieldaggregatorv1/daily_reward_percents"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message AssetManagementAccountInfo { - string id = 1; - string name = 2; - repeated AssetManagementTarget asset_management_targets = 3 [(gogoproto.nullable) = false]; -} - -message QueryAssetManagementAccountRequest { - string id = 1; -} -message QueryAssetManagementAccountResponse { - AssetManagementAccountInfo account = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllAssetManagementAccountsRequest {} -message QueryAllAssetManagementAccountsResponse { - repeated AssetManagementAccountInfo accounts = 1 [(gogoproto.nullable) = false]; -} - -message QueryUserInfo { - repeated cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; - repeated FarmingOrder farming_orders = 2 [(gogoproto.nullable) = false]; - uint64 farmed_counter = 3; -} -message QueryUserInfoRequest { - string address = 1; -} -message QueryUserInfoResponse { - QueryUserInfo user_info = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllFarmingUnitsRequest {} -message QueryAllFarmingUnitsResponse { - repeated FarmingUnit units = 1 [(gogoproto.nullable) = false]; -} - -message QueryDailyRewardPercentsRequest {} -message QueryDailyRewardPercentsResponse { - repeated DailyPercent daily_percents = 1 [(gogoproto.nullable) = false]; -} diff --git a/deprecated/proto/yieldaggregatorv1/tx.proto b/deprecated/proto/yieldaggregatorv1/tx.proto deleted file mode 100644 index f2e7a785d..000000000 --- a/deprecated/proto/yieldaggregatorv1/tx.proto +++ /dev/null @@ -1,92 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldaggregator; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "yieldaggregatorv1/asset.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types"; - -// Msg defines the Msg service. -service Msg { - rpc Deposit(MsgDeposit) returns (MsgDepositResponse); - rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse); - rpc BeginWithdrawAll(MsgBeginWithdrawAll) returns (MsgBeginWithdrawAllResponse); - rpc AddFarmingOrder(MsgAddFarmingOrder) returns (MsgAddFarmingOrderResponse); - rpc DeleteFarmingOrder(MsgDeleteFarmingOrder) returns (MsgDeleteFarmingOrderResponse); - rpc ActivateFarmingOrder(MsgActivateFarmingOrder) returns (MsgActivateFarmingOrderResponse); - rpc InactivateFarmingOrder(MsgInactivateFarmingOrder) returns (MsgInactivateFarmingOrderResponse); - rpc ExecuteFarmingOrders(MsgExecuteFarmingOrders) returns (MsgExecuteFarmingOrdersResponse); - rpc SetDailyRewardPercent(MsgSetDailyRewardPercent) returns (MsgSetDailyRewardPercentResponse); -} - -message MsgDeposit { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; - bool execute_orders = 3; -} - -message MsgDepositResponse {} - -message MsgWithdraw { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; -} - -message MsgWithdrawResponse {} - -message MsgAddFarmingOrder { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - FarmingOrder order = 2; -} -message MsgAddFarmingOrderResponse {} - -message MsgDeleteFarmingOrder { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - string order_id = 2; -} -message MsgDeleteFarmingOrderResponse {} - -message MsgActivateFarmingOrder { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - string order_id = 2; -} -message MsgActivateFarmingOrderResponse {} - -message MsgInactivateFarmingOrder { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - string order_id = 2; -} -message MsgInactivateFarmingOrderResponse {} - -message MsgExecuteFarmingOrders { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - repeated string order_ids = 2; -} -message MsgExecuteFarmingOrdersResponse {} - -message MsgSetDailyRewardPercent { - string from_address = 1 - [(gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", (gogoproto.nullable) = false]; - string account_id = 2; - string target_id = 3; - string rate = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - google.protobuf.Timestamp date = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} -message MsgSetDailyRewardPercentResponse {} - -message MsgBeginWithdrawAll { - string from_address = 1 [ - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -message MsgBeginWithdrawAllResponse {} diff --git a/deprecated/proto/yieldfarm/genesis.proto b/deprecated/proto/yieldfarm/genesis.proto deleted file mode 100644 index 0ec7c28fb..000000000 --- a/deprecated/proto/yieldfarm/genesis.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldfarm; - -import "gogoproto/gogo.proto"; -import "yieldfarm/params.proto"; -import "yieldfarm/yieldfarm.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types"; - -// GenesisState defines the yieldfarm module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated FarmerInfo farmer_infos = 2 [(gogoproto.nullable) = false]; -} diff --git a/deprecated/proto/yieldfarm/params.proto b/deprecated/proto/yieldfarm/params.proto deleted file mode 100644 index 1b100abf5..000000000 --- a/deprecated/proto/yieldfarm/params.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldfarm; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types"; - -// Params defines the parameters for the module. -message Params { - uint64 daily_reward = 1; -} diff --git a/deprecated/proto/yieldfarm/yieldfarm.proto b/deprecated/proto/yieldfarm/yieldfarm.proto deleted file mode 100644 index 522cd2fe9..000000000 --- a/deprecated/proto/yieldfarm/yieldfarm.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package ununifi.chain.yieldfarm; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types"; - -message FarmerInfo { - string account = 1; - repeated cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; - repeated cosmos.base.v1beta1.Coin rewards = 3 [(gogoproto.nullable) = false]; -} diff --git a/deprecated/types/string_address.go b/deprecated/types/string_address.go deleted file mode 100644 index d30277394..000000000 --- a/deprecated/types/string_address.go +++ /dev/null @@ -1,96 +0,0 @@ -package types - -import ( - "encoding/json" - "unsafe" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type StringAccAddress sdk.AccAddress - -func StringAccAddresses(addrs []sdk.AccAddress) []StringAccAddress { - return *(*[]StringAccAddress)(unsafe.Pointer(&addrs)) -} - -func (aa StringAccAddress) AccAddress() sdk.AccAddress { - return sdk.AccAddress(aa) -} - -func AccAddresses(addrs []StringAccAddress) []sdk.AccAddress { - return *(*[]sdk.AccAddress)(unsafe.Pointer(&addrs)) -} - -func (aa StringAccAddress) MarshalJSON() ([]byte, error) { - str := aa.AccAddress().String() - - return json.Marshal(str) -} - -func (aa *StringAccAddress) UnmarshalJSON(data []byte) error { - if len(data) == 0 { - aa = nil - return nil - } - - var str string - err := json.Unmarshal(data, &str) - if err != nil { - return err - } - _aa, _ := sdk.AccAddressFromBech32(str) - *aa = StringAccAddress(_aa) - - return nil -} - -func (aa StringAccAddress) Marshal() ([]byte, error) { - str := aa.AccAddress().String() - - return []byte(str), nil -} - -// MarshalTo implements the gogo proto custom type interface. -func (aa *StringAccAddress) MarshalTo(data []byte) (n int, err error) { - bz, err := aa.Marshal() - if err != nil { - return 0, err - } - - copy(data, bz) - return len(bz), nil -} - -// Unmarshal implements the gogo proto custom type interface. -func (aa *StringAccAddress) Unmarshal(data []byte) error { - if len(data) == 0 { - aa = nil - return nil - } - - _aa, err := sdk.AccAddressFromBech32(string(data)) - if err != nil { - return err - } - *aa = StringAccAddress(_aa) - - return nil -} - -// Size implements the gogo proto custom type interface. -func (aa *StringAccAddress) Size() int { - bz, _ := aa.Marshal() - return len(bz) -} - -func (aa *StringAccAddress) VerifyAddressFormat() error { - return sdk.VerifyAddressFormat(aa.AccAddress()) -} - -func (aa *StringAccAddress) Len() int { - address := aa.AccAddress() - if !address.Empty() { - return len(address.Bytes()) - } - return 0 -} diff --git a/deprecated/x/auction/abci.go b/deprecated/x/auction/abci.go deleted file mode 100644 index 5ca82d1ed..000000000 --- a/deprecated/x/auction/abci.go +++ /dev/null @@ -1,19 +0,0 @@ -package auction - -import ( - "errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/keeper" - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// BeginBlocker closes all expired auctions at the end of each block. It panics if -// there's an error other than ErrAuctionNotFound. -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - err := k.CloseExpiredAuctions(ctx) - if err != nil && !errors.Is(err, types.ErrAuctionNotFound) { - panic(err) - } -} diff --git a/deprecated/x/auction/abci_test.go b/deprecated/x/auction/abci_test.go deleted file mode 100644 index 0a6fdccf7..000000000 --- a/deprecated/x/auction/abci_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package auction_test - -// import ( -// "testing" - -// "github.com/stretchr/testify/require" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - -// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/auction" -// auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// func fundModuleAccount(bk bankkeeper.Keeper, ctx sdk.Context, modName string, coins sdk.Coins) error { -// err := bk.MintCoins(ctx, minttypes.ModuleName, coins) -// if err != nil { -// return err -// } -// err = bk.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, modName, coins) -// return err -// } - -// func TestKeeper_BeginBlocker(t *testing.T) { -// // Setup -// _, addrs := app.GeneratePrivKeyAddressPairs(2) -// buyer := addrs[0] -// returnAddrs := addrs[1:] -// returnWeights := []sdk.Int{sdk.NewInt(1)} -// sellerModName := cdptypes.LiquidatorMacc -// modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(sellerModName), nil, 0, 0) -// modAcc := authtypes.NewModuleAccount(modBaseAcc, sellerModName, []string{authtypes.Minter, authtypes.Burner}...) - -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{}) - -// require.NoError(t, fundModuleAccount(tApp.BankKeeper, ctx, modAcc.Name, cs(c("token1", 100), c("token2", 100), c("debt", 100)))) -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // auth.NewBaseAccount(buyer, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // sellerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{buyer}, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{modAcc}), -// ) - -// keeper := tApp.GetAuctionKeeper() - -// // Start an auction and place a bid -// auctionID, err := keeper.StartCollateralAuction(ctx, sellerModName, c("token1", 20), c("token2", 50), returnAddrs, returnWeights, c("debt", 40)) -// require.NoError(t, err) -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, buyer, c("token2", 30))) - -// // Run the beginblocker, simulating a block time 1ns before auction expiry -// preExpiryTime := ctx.BlockTime().Add(auctiontypes.DefaultBidDuration - 1) -// auction.BeginBlocker(ctx.WithBlockTime(preExpiryTime), keeper) - -// // Check auction has not been closed yet -// _, found := keeper.GetAuction(ctx, auctionID) -// require.True(t, found) - -// // Run the endblocker, simulating a block time equal to auction expiry -// expiryTime := ctx.BlockTime().Add(auctiontypes.DefaultBidDuration) -// auction.BeginBlocker(ctx.WithBlockTime(expiryTime), keeper) - -// // Check auction has been closed -// _, found = keeper.GetAuction(ctx, auctionID) -// require.False(t, found) -// } - -// func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -// func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } - -// func NewAuthGenStateFromAccs(accounts authtypes.GenesisAccounts) app.GenesisState { -// authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), accounts) -// return app.GenesisState{authtypes.ModuleName: authtypes.ModuleCdc.MustMarshalJSON(authGenesis)} -// } diff --git a/deprecated/x/auction/client/cli/query.go b/deprecated/x/auction/client/cli/query.go deleted file mode 100644 index 0d299c43a..000000000 --- a/deprecated/x/auction/client/cli/query.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group auction queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListAuction()) - cmd.AddCommand(CmdShowAuction()) - - return cmd -} diff --git a/deprecated/x/auction/client/cli/query_auction.go b/deprecated/x/auction/client/cli/query_auction.go deleted file mode 100644 index 8410b08e2..000000000 --- a/deprecated/x/auction/client/cli/query_auction.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "context" - "fmt" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func CmdListAuction() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-auction", - Short: "list all auction", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllAuctionRequest{ - Pagination: pageReq, - } - - res, err := queryClient.AuctionAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowAuction() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-auction [id]", - Short: "shows a auction", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("auction-id '%s' not a valid uint", args[0]) - } - - params := &types.QueryGetAuctionRequest{ - Id: id, - } - - res, err := queryClient.Auction(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/auction/client/cli/query_params.go b/deprecated/x/auction/client/cli/query_params.go deleted file mode 100644 index 2bf4bdfd3..000000000 --- a/deprecated/x/auction/client/cli/query_params.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows a params", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/auction/client/cli/tx.go b/deprecated/x/auction/client/cli/tx.go deleted file mode 100644 index 098785d6a..000000000 --- a/deprecated/x/auction/client/cli/tx.go +++ /dev/null @@ -1,28 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - cmd.AddCommand(CmdPlaceBid()) - - return cmd -} diff --git a/deprecated/x/auction/client/cli/txAuction.go b/deprecated/x/auction/client/cli/txAuction.go deleted file mode 100644 index 1a6a3d488..000000000 --- a/deprecated/x/auction/client/cli/txAuction.go +++ /dev/null @@ -1,50 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func CmdPlaceBid() *cobra.Command { - cmd := &cobra.Command{ - Use: "place-bid [auction-id] [amount]", - Short: "Places a bid", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return fmt.Errorf("auction-id '%s' not a valid uint", args[0]) - } - - amt, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgPlaceBid(id, clientCtx.GetFromAddress(), amt) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/auction/client/rest/rest.go b/deprecated/x/auction/client/rest/rest.go deleted file mode 100644 index da0f1e7a8..000000000 --- a/deprecated/x/auction/client/rest/rest.go +++ /dev/null @@ -1,13 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - // this line is used by starport scaffolding # 1 -) - -// RegisterRoutes registers cdp-related REST handlers to a router -func RegisterRoutes(clientCtx client.Context, r *mux.Router) { - // this line is used by starport scaffolding # 2 -} diff --git a/deprecated/x/auction/genesis.go b/deprecated/x/auction/genesis.go deleted file mode 100644 index 4bb8f0bdd..000000000 --- a/deprecated/x/auction/genesis.go +++ /dev/null @@ -1,90 +0,0 @@ -package auction - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/keeper" - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - // Set all the auction - // for _, elem := range genState.AuctionList { - // k.SetAuction(ctx, *elem) - // } - - // // Set auction count - // k.SetAuctionCount(ctx, int64(len(genState.AuctionList))) - if err := genState.Validate(); err != nil { - panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) - } - - k.SetNextAuctionID(ctx, genState.NextAuctionId) - - k.SetParams(ctx, genState.Params) - - totalAuctionCoins := sdk.NewCoins() - auctions, err := types.UnpackGenesisAuctions(genState.Auctions) - if err != nil { - panic(err) - } - for _, a := range auctions { - k.SetAuction(ctx, a) - // find the total coins that should be present in the module account - totalAuctionCoins = totalAuctionCoins.Add(a.GetModuleAccountCoins()...) - } - - // check if the module account exists - moduleAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) - if moduleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) - } - // check module coins match auction coins - // Note: Other sdk modules do not check this, instead just using the existing module account coins, or if zero, setting them. - balances := bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress()) - if !balances.IsEqual(totalAuctionCoins) { - panic(fmt.Sprintf("total auction coins (%s) do not equal (%s) module account (%s) ", balances, types.ModuleName, totalAuctionCoins)) - } -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - // genesis := types.DefaultGenesis() - - // this line is used by starport scaffolding # genesis/module/export - // Get all auction - // auctionList := k.GetAllAuction(ctx) - // for _, elem := range auctionList { - // elem := elem - // genesis.AuctionList = append(genesis.AuctionList, &elem) - // } - - // return genesis - nextAuctionID, err := k.GetNextAuctionID(ctx) - if err != nil { - panic(err) - } - - params := k.GetParams(ctx) - - genAuctions := types.GenesisAuctions{} // return empty list instead of nil if no auctions - k.IterateAuctions(ctx, func(a types.Auction) bool { - ga, ok := a.(types.GenesisAuction) - if !ok { - panic("could not convert stored auction to GenesisAuction type") - } - genAuctions = append(genAuctions, ga) - return false - }) - packed, err := types.PackGenesisAuctions(genAuctions) - if err != nil { - panic(err) - } - ret := types.NewGenesisState(nextAuctionID, params, packed) - return &ret -} diff --git a/deprecated/x/auction/genesis_test.go b/deprecated/x/auction/genesis_test.go deleted file mode 100644 index 492cc2781..000000000 --- a/deprecated/x/auction/genesis_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package auction_test - -// import ( -// "sort" -// "testing" -// "time" - -// "github.com/stretchr/testify/require" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/auction" -// auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" -// ) - -// var _, testAddrs = app.GeneratePrivKeyAddressPairs(2) -// var testTime = time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC) -// var weightedAddresses, _ = auctiontypes.NewWeightedAddresses(testAddrs, []sdk.Int{sdk.OneInt(), sdk.OneInt()}) -// var testAuction = auctiontypes.NewCollateralAuction( -// "seller", -// c("lotdenom", 10), -// testTime, -// c("biddenom", 1000), -// weightedAddresses, -// c("debt", 1000), -// ).WithID(3).(*auctiontypes.CollateralAuction) -// var testAuctions, _ = auctiontypes.PackGenesisAuctions(auctiontypes.GenesisAuctions{testAuction}) - -// func TestInitGenesis(t *testing.T) { -// t.Run("valid", func(t *testing.T) { -// // setup keepers -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) - -// // setup module account -// modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(auctiontypes.ModuleName), nil, 0, 0) -// modAcc := authtypes.NewModuleAccount(modBaseAcc, auctiontypes.ModuleName, []string{authtypes.Minter, authtypes.Burner}...) -// tApp.GetAccountKeeper().SetModuleAccount(ctx, modAcc) -// tApp.GetBankKeeper().MintCoins(ctx, auctiontypes.ModuleName, testAuction.GetModuleAccountCoins()) - -// // create genesis -// gs := auctiontypes.NewGenesisState( -// 10, -// auctiontypes.DefaultParams(), -// // auctiontypes.GenesisAuctions{testAuction}, -// testAuctions, -// ) -// require.Equal(t, gs.Auctions[0], testAuctions[0]) - -// // run init -// keeper := tApp.GetAuctionKeeper() -// require.NotPanics(t, func() { -// // auction.InitGenesis(ctx, keeper, supplyKeeper, gs) -// auction.InitGenesis(ctx, keeper, tApp.GetAccountKeeper(), tApp.GetBankKeeper(), gs) -// }) - -// // check state is as expected -// actualID, err := keeper.GetNextAuctionID(ctx) -// require.NoError(t, err) -// require.Equal(t, gs.NextAuctionId, actualID) - -// require.Equal(t, gs.Params, keeper.GetParams(ctx)) - -// // TODO is there a nicer way of comparing state? -// sort.Slice(gs.Auctions, func(i, j int) bool { -// // Any型からAuction型へUnpackする -// unpackAuctions, _ := auctiontypes.UnpackGenesisAuctions(gs.Auctions) -// return unpackAuctions[i].GetID() > unpackAuctions[j].GetID() -// }) -// i := 0 -// keeper.IterateAuctions(ctx, func(a auctiontypes.Auction) bool { -// unpacked, _ := auctiontypes.UnpackAuction(gs.Auctions[i]) -// require.Equal(t, unpacked, a) -// i++ -// return false -// }) -// }) -// t.Run("invalid (invalid nextAuctionID)", func(t *testing.T) { -// // setup keepers -// tApp := app.NewTestApp() -// sk := tApp.GetBankKeeper() -// keeper := tApp.GetAuctionKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{}) -// accountKeeper := tApp.GetAccountKeeper() - -// // create invalid genesis -// gs := auctiontypes.NewGenesisState( -// 0, // next id < testAuction ID -// auctiontypes.DefaultParams(), -// // auctiontypes.GenesisAuctions{testAuction}, -// testAuctions, -// ) - -// // check init fails -// require.Panics(t, func() { -// auction.InitGenesis(ctx, keeper, accountKeeper, sk, gs) -// }) -// }) -// t.Run("invalid (missing mod account coins)", func(t *testing.T) { -// // setup keepers -// tApp := app.NewTestApp() -// sk := tApp.GetBankKeeper() -// keeper := tApp.GetAuctionKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{}) -// accountKeeper := tApp.GetAccountKeeper() - -// // create invalid genesis -// gs := auctiontypes.NewGenesisState( -// 10, -// auctiontypes.DefaultParams(), -// // auctiontypes.GenesisAuctions{testAuction}, -// testAuctions, -// ) -// // invalid as there is no module account setup - -// // check init fails -// require.Panics(t, func() { -// auction.InitGenesis(ctx, keeper, accountKeeper, sk, gs) -// }) -// }) -// } - -// // func TestExportGenesis(t *testing.T) { -// // t.Run("default", func(t *testing.T) { -// // // setup state -// // tApp := app.NewTestApp() -// // ctx := tApp.NewContext(true, tmproto.Header{}) -// // tApp.InitializeFromGenesisStates() - -// // // export -// // gs := auction.ExportGenesis(ctx, tApp.GetAuctionKeeper()) - -// // // check state matches -// // // require.Equal(t, auction.DefaultGenesisState(), gs) -// // require.Equal(t, auctiontypes.DefaultGenesis(), gs) -// // }) -// // t.Run("one auction", func(t *testing.T) { -// // // setup state -// // tApp := app.NewTestApp() -// // ctx := tApp.NewContext(true, tmproto.Header{}) -// // tApp.InitializeFromGenesisStates() -// // tApp.GetAuctionKeeper().SetAuction(ctx, testAuction) - -// // // export -// // gs := auction.ExportGenesis(ctx, tApp.GetAuctionKeeper()) - -// // // check state matches -// // // expectedGenesisState := auction.DefaultGenesisState() -// // expectedGenesisState := auctiontypes.DefaultGenesis() -// // expectedGenesisState.Auctions = append(expectedGenesisState.Auctions, testAuctions...) -// // require.Equal(t, expectedGenesisState, gs) -// // }) -// // } diff --git a/deprecated/x/auction/handler.go b/deprecated/x/auction/handler.go deleted file mode 100644 index d9047bb88..000000000 --- a/deprecated/x/auction/handler.go +++ /dev/null @@ -1,28 +0,0 @@ -package auction - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/auction/keeper" - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - // this line is used by starport scaffolding # 1 - case *types.MsgPlaceBid: - return handleMsgPlaceBid(ctx, k, *msg) - - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/deprecated/x/auction/handler_auction.go b/deprecated/x/auction/handler_auction.go deleted file mode 100644 index fef86c8be..000000000 --- a/deprecated/x/auction/handler_auction.go +++ /dev/null @@ -1,28 +0,0 @@ -package auction - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/keeper" - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func handleMsgPlaceBid(ctx sdk.Context, k keeper.Keeper, msg types.MsgPlaceBid) (*sdk.Result, error) { - - err := k.PlaceBid(ctx, msg.AuctionId, msg.Bidder.AccAddress(), msg.Amount) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Bidder.AccAddress().String()), - ), - ) - - return &sdk.Result{ - Events: ctx.EventManager().Events().ToABCIEvents(), - }, nil -} diff --git a/deprecated/x/auction/keeper/auctions.go b/deprecated/x/auction/keeper/auctions.go deleted file mode 100644 index a22644a56..000000000 --- a/deprecated/x/auction/keeper/auctions.go +++ /dev/null @@ -1,580 +0,0 @@ -package keeper - -import ( - "errors" - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// StartSurplusAuction starts a new surplus (forward) auction. -func (k Keeper) StartSurplusAuction(ctx sdk.Context, seller string, lot sdk.Coin, bidDenom string) (uint64, error) { - auction := types.NewSurplusAuction( - seller, - lot, - bidDenom, - types.DistantFuture, - ) - - // NOTE: for the duration of the auction the auction module account holds the lot - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, seller, types.ModuleName, sdk.NewCoins(lot)) - if err != nil { - return 0, err - } - - auctionID, err := k.StoreNewAuction(ctx, &auction) - if err != nil { - return 0, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionStart, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auctionID)), - sdk.NewAttribute(types.AttributeKeyAuctionType, auction.GetType()), - sdk.NewAttribute(types.AttributeKeyBid, auction.Bid.String()), - sdk.NewAttribute(types.AttributeKeyLot, auction.Lot.String()), - ), - ) - return auctionID, nil -} - -// StartDebtAuction starts a new debt (reverse) auction. -func (k Keeper) StartDebtAuction(ctx sdk.Context, buyer string, bid sdk.Coin, initialLot sdk.Coin, debt sdk.Coin) (uint64, error) { - - auction := types.NewDebtAuction( - buyer, - bid, - initialLot, - types.DistantFuture, - debt, - ) - - // This auction type mints coins at close. Need to check module account has minting privileges to avoid potential err in endblocker. - macc := k.accountKeeper.GetModuleAccount(ctx, buyer) - if !macc.HasPermission(authtypes.Minter) { - panic(fmt.Errorf("module '%s' does not have '%s' permission", buyer, authtypes.Minter)) - } - - // NOTE: for the duration of the auction the auction module account holds the debt - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, buyer, types.ModuleName, sdk.NewCoins(debt)) - if err != nil { - return 0, err - } - - auctionID, err := k.StoreNewAuction(ctx, &auction) - if err != nil { - return 0, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionStart, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auctionID)), - sdk.NewAttribute(types.AttributeKeyAuctionType, auction.GetType()), - sdk.NewAttribute(types.AttributeKeyBid, auction.Bid.String()), - sdk.NewAttribute(types.AttributeKeyLot, auction.Lot.String()), - ), - ) - return auctionID, nil -} - -// StartCollateralAuction starts a new collateral (2-phase) auction. -func (k Keeper) StartCollateralAuction( - ctx sdk.Context, seller string, lot, maxBid sdk.Coin, - lotReturnAddrs []sdk.AccAddress, lotReturnWeights []sdk.Int, debt sdk.Coin, -) (uint64, error) { - weightedAddresses, err := types.NewWeightedAddresses(lotReturnAddrs, lotReturnWeights) - if err != nil { - return 0, err - } - auction := types.NewCollateralAuction( - seller, - lot, - types.DistantFuture, - maxBid, - weightedAddresses, - debt, - ) - - // NOTE: for the duration of the auction the auction module account holds the debt and the lot - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, seller, types.ModuleName, sdk.NewCoins(lot)) - if err != nil { - return 0, err - } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, seller, types.ModuleName, sdk.NewCoins(debt)) - if err != nil { - return 0, err - } - - auctionID, err := k.StoreNewAuction(ctx, &auction) - if err != nil { - return 0, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionStart, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auctionID)), - sdk.NewAttribute(types.AttributeKeyAuctionType, auction.GetType()), - sdk.NewAttribute(types.AttributeKeyBid, auction.Bid.String()), - sdk.NewAttribute(types.AttributeKeyLot, auction.Lot.String()), - sdk.NewAttribute(types.AttributeKeyMaxBid, auction.MaxBid.String()), - ), - ) - return auctionID, nil -} - -// PlaceBid places a bid on any auction. -func (k Keeper) PlaceBid(ctx sdk.Context, auctionID uint64, bidder sdk.AccAddress, newAmount sdk.Coin) error { - - auction, found := k.GetAuction(ctx, auctionID) - if !found { - return sdkerrors.Wrapf(types.ErrAuctionNotFound, "%d", auctionID) - } - - // validation common to all auctions - if ctx.BlockTime().After(auction.GetEndTime()) { - return sdkerrors.Wrapf(types.ErrAuctionHasExpired, "%d", auctionID) - } - - // move coins and return updated auction - var ( - err error - updatedAuction types.Auction - ) - switch auctionType := auction.(type) { - case *types.SurplusAuction: - _updatedAuction, _err := k.PlaceBidSurplus(ctx, *auctionType, bidder, newAmount) - updatedAuction = &_updatedAuction - err = _err - case *types.DebtAuction: - _updatedAuction, _err := k.PlaceBidDebt(ctx, *auctionType, bidder, newAmount) - updatedAuction = &_updatedAuction - err = _err - case *types.CollateralAuction: - if !auctionType.IsReversePhase() { - _updatedAuction, _err := k.PlaceForwardBidCollateral(ctx, *auctionType, bidder, newAmount) - updatedAuction = &_updatedAuction - err = _err - } else { - _updatedAuction, _err := k.PlaceReverseBidCollateral(ctx, *auctionType, bidder, newAmount) - updatedAuction = &_updatedAuction - err = _err - } - default: - err = sdkerrors.Wrap(types.ErrUnrecognizedAuctionType, auction.GetType()) - } - - if err != nil { - return err - } - - k.SetAuction(ctx, updatedAuction) - - return nil -} - -// PlaceBidSurplus places a forward bid on a surplus auction, moving coins and returning the updated auction. -func (k Keeper) PlaceBidSurplus(ctx sdk.Context, auction types.SurplusAuction, bidder sdk.AccAddress, bid sdk.Coin) (types.SurplusAuction, error) { - // Validate new bid - if bid.Denom != auction.Bid.Denom { - return auction, sdkerrors.Wrapf(types.ErrInvalidBidDenom, "%s ≠ %s)", bid.Denom, auction.Bid.Denom) - } - minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost - sdk.MaxInt( - sdk.NewInt(1), - sdk.NewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementSurplus).RoundInt(), - ), - ) - if bid.Amount.LT(minNewBidAmt) { - return auction, sdkerrors.Wrapf(types.ErrBidTooSmall, "%s < %s%s", bid, minNewBidAmt, auction.Bid.Denom) - } - - // New bidder pays back old bidder - // Catch edge cases of a bidder replacing their own bid, or the amount being zero (sending zero coins produces meaningless send events). - if !bidder.Equals(auction.Bidder.AccAddress()) && !auction.Bid.IsZero() { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - } - // Increase in bid is burned - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, auction.Initiator, sdk.NewCoins(bid.Sub(auction.Bid))) - if err != nil { - return auction, err - } - err = k.bankKeeper.BurnCoins(ctx, auction.Initiator, sdk.NewCoins(bid.Sub(auction.Bid))) - if err != nil { - return auction, err - } - - // Update Auction - auction.Bidder = bidder.Bytes() - auction.Bid = bid - if !auction.HasReceivedBids { - auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid - auction.HasReceivedBids = true - } - auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionBid, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auction.Id)), - sdk.NewAttribute(types.AttributeKeyBidder, auction.Bidder.AccAddress().String()), - sdk.NewAttribute(types.AttributeKeyBid, auction.Bid.String()), - sdk.NewAttribute(types.AttributeKeyEndTime, fmt.Sprintf("%d", auction.EndTime.Unix())), - ), - ) - - return auction, nil -} - -// PlaceForwardBidCollateral places a forward bid on a collateral auction, moving coins and returning the updated auction. -func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction types.CollateralAuction, bidder sdk.AccAddress, bid sdk.Coin) (types.CollateralAuction, error) { - // Validate new bid - if bid.Denom != auction.Bid.Denom { - return auction, sdkerrors.Wrapf(types.ErrInvalidBidDenom, "%s ≠ %s", bid.Denom, auction.Bid.Denom) - } - if auction.IsReversePhase() { - panic("cannot place forward bid on auction in reverse phase") - } - minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost - sdk.MaxInt( - sdk.NewInt(1), - sdk.NewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), - ), - ) - minNewBidAmt = sdk.MinInt(minNewBidAmt, auction.MaxBid.Amount) // allow new bids to hit MaxBid even though it may be less than the increment % - if bid.Amount.LT(minNewBidAmt) { - return auction, sdkerrors.Wrapf(types.ErrBidTooSmall, "%s < %s%s", bid, minNewBidAmt, auction.Bid.Denom) - } - if auction.MaxBid.IsLT(bid) { - return auction, sdkerrors.Wrapf(types.ErrBidTooLarge, "%s > %s", bid, auction.MaxBid) - } - - // New bidder pays back old bidder - // Catch edge cases of a bidder replacing their own bid, and the amount being zero (sending zero coins produces meaningless send events). - if !bidder.Equals(auction.Bidder.AccAddress()) && !auction.Bid.IsZero() { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - } - // Increase in bid sent to auction initiator - bidIncrement := bid.Sub(auction.Bid) - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, auction.Initiator, sdk.NewCoins(bidIncrement)) - if err != nil { - return auction, err - } - // Debt coins are sent to liquidator (until there is no CorrespondingDebt left). Amount sent is equal to bidIncrement (or whatever is left if < bidIncrement). - if auction.CorrespondingDebt.IsPositive() { - - debtAmountToReturn := sdk.MinInt(bidIncrement.Amount, auction.CorrespondingDebt.Amount) - debtToReturn := sdk.NewCoin(auction.CorrespondingDebt.Denom, debtAmountToReturn) - - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(debtToReturn)) - if err != nil { - return auction, err - } - correspondingDebt := auction.CorrespondingDebt.Sub(debtToReturn) - auction.CorrespondingDebt = correspondingDebt // debtToReturn will always be ≤ auction.CorrespondingDebt from the MinInt above - } - - // Update Auction - auction.Bidder = bidder.Bytes() - auction.Bid = bid - if !auction.HasReceivedBids { - auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid - auction.HasReceivedBids = true - } - auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionBid, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auction.Id)), - sdk.NewAttribute(types.AttributeKeyBidder, auction.Bidder.AccAddress().String()), - sdk.NewAttribute(types.AttributeKeyBid, auction.Bid.String()), - sdk.NewAttribute(types.AttributeKeyEndTime, fmt.Sprintf("%d", auction.EndTime.Unix())), - ), - ) - - return auction, nil -} - -// PlaceReverseBidCollateral places a reverse bid on a collateral auction, moving coins and returning the updated auction. -func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, auction types.CollateralAuction, bidder sdk.AccAddress, lot sdk.Coin) (types.CollateralAuction, error) { - // Validate new bid - if lot.Denom != auction.Lot.Denom { - return auction, sdkerrors.Wrapf(types.ErrInvalidLotDenom, lot.Denom, auction.Lot.Denom) - } - if !auction.IsReversePhase() { - panic("cannot place reverse bid on auction in forward phase") - } - maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost - sdk.MaxInt( - sdk.NewInt(1), - sdk.NewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), - ), - ) - if lot.Amount.GT(maxNewLotAmt) { - return auction, sdkerrors.Wrapf(types.ErrLotTooLarge, "%s > %s%s", lot, maxNewLotAmt, auction.Lot.Denom) - } - if lot.IsNegative() { - return auction, sdkerrors.Wrapf(types.ErrLotTooSmall, "%s < 0%s", lot, auction.Lot.Denom) - } - - // New bidder pays back old bidder - // Catch edge cases of a bidder replacing their own bid - if !bidder.Equals(auction.Bidder.AccAddress()) { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - } - - // Decrease in lot is sent to weighted addresses (normally the Cdp depositors) - // Note: splitting an integer amount across weighted buckets results in small errors. - lotPayouts, err := splitCoinIntoWeightedBuckets(auction.Lot.Sub(lot), types.WeightedAddresses(auction.LotReturns).Weights()) - if err != nil { - return auction, err - } - for i, payout := range lotPayouts { - // if the payout amount is 0, don't send 0 coins - if !payout.IsPositive() { - continue - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.LotReturns[i].Address.AccAddress(), sdk.NewCoins(payout)) - if err != nil { - return auction, err - } - } - - // Update Auction - auction.Bidder = bidder.Bytes() - auction.Lot = lot - if !auction.HasReceivedBids { - auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid - auction.HasReceivedBids = true - } - auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionBid, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auction.Id)), - sdk.NewAttribute(types.AttributeKeyBidder, auction.Bidder.AccAddress().String()), - sdk.NewAttribute(types.AttributeKeyLot, auction.Lot.String()), - sdk.NewAttribute(types.AttributeKeyEndTime, fmt.Sprintf("%d", auction.EndTime.Unix())), - ), - ) - - return auction, nil -} - -// PlaceBidDebt places a reverse bid on a debt auction, moving coins and returning the updated auction. -func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction types.DebtAuction, bidder sdk.AccAddress, lot sdk.Coin) (types.DebtAuction, error) { - // Validate new bid - if lot.Denom != auction.Lot.Denom { - return auction, sdkerrors.Wrapf(types.ErrInvalidLotDenom, lot.Denom, auction.Lot.Denom) - } - maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost - sdk.MaxInt( - sdk.NewInt(1), - sdk.NewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementDebt).RoundInt(), - ), - ) - if lot.Amount.GT(maxNewLotAmt) { - return auction, sdkerrors.Wrapf(types.ErrLotTooLarge, "%s > %s%s", lot, maxNewLotAmt, auction.Lot.Denom) - } - if lot.IsNegative() { - return auction, sdkerrors.Wrapf(types.ErrLotTooSmall, "%s ≤ %s%s", lot, sdk.ZeroInt(), auction.Lot.Denom) - } - - // New bidder pays back old bidder - // Catch edge cases of a bidder replacing their own bid - if !bidder.Equals(auction.Bidder.AccAddress()) { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Bid)) - if err != nil { - return auction, err - } - } - // Debt coins are sent to liquidator the first time a bid is placed. Amount sent is equal to min of Bid and amount of debt. - if auction.Bidder.AccAddress().Equals(k.accountKeeper.GetModuleAddress(auction.Initiator)) { - - debtAmountToReturn := sdk.MinInt(auction.Bid.Amount, auction.CorrespondingDebt.Amount) - debtToReturn := sdk.NewCoin(auction.CorrespondingDebt.Denom, debtAmountToReturn) - - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(debtToReturn)) - if err != nil { - return auction, err - } - correspondingDebt := auction.CorrespondingDebt.Sub(debtToReturn) - auction.CorrespondingDebt = correspondingDebt // debtToReturn will always be ≤ auction.CorrespondingDebt from the MinInt above - } - - // Update Auction - auction.Bidder = bidder.Bytes() - auction.Lot = lot - if !auction.HasReceivedBids { - auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid - auction.HasReceivedBids = true - } - auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionBid, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auction.Id)), - sdk.NewAttribute(types.AttributeKeyBidder, auction.Bidder.AccAddress().String()), - sdk.NewAttribute(types.AttributeKeyLot, auction.Lot.String()), - sdk.NewAttribute(types.AttributeKeyEndTime, fmt.Sprintf("%d", auction.EndTime.Unix())), - ), - ) - - return auction, nil -} - -// CloseAuction closes an auction and distributes funds to the highest bidder. -func (k Keeper) CloseAuction(ctx sdk.Context, auctionID uint64) error { - auction, found := k.GetAuction(ctx, auctionID) - if !found { - return sdkerrors.Wrapf(types.ErrAuctionNotFound, "%d", auctionID) - } - - if ctx.BlockTime().Before(auction.GetEndTime()) { - return sdkerrors.Wrapf(types.ErrAuctionHasNotExpired, "block time %s, auction end time %s", ctx.BlockTime().UTC(), auction.GetEndTime().UTC()) - } - - // payout to the last bidder - var err error - switch auc := auction.(type) { - case *types.SurplusAuction: - err = k.PayoutSurplusAuction(ctx, *auc) - case *types.DebtAuction: - err = k.PayoutDebtAuction(ctx, *auc) - case *types.CollateralAuction: - err = k.PayoutCollateralAuction(ctx, *auc) - default: - err = sdkerrors.Wrap(types.ErrUnrecognizedAuctionType, auc.GetType()) - } - - if err != nil { - return err - } - - k.DeleteAuction(ctx, auctionID) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeAuctionClose, - sdk.NewAttribute(types.AttributeKeyAuctionID, fmt.Sprintf("%d", auctionID)), - sdk.NewAttribute(types.AttributeKeyCloseBlock, fmt.Sprintf("%d", ctx.BlockHeight())), - ), - ) - return nil -} - -// PayoutDebtAuction pays out the proceeds for a debt auction, first minting the coins. -func (k Keeper) PayoutDebtAuction(ctx sdk.Context, auction types.DebtAuction) error { - // create the coins that are needed to pay off the debt - err := k.bankKeeper.MintCoins(ctx, auction.Initiator, sdk.NewCoins(auction.Lot)) - if err != nil { - panic(fmt.Errorf("could not mint coins: %w", err)) - } - - // send the new coins from the initiator module to the bidder - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, auction.Initiator, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Lot)) - if err != nil { - return err - } - // if there is remaining debt, return it to the calling module to manage - if !auction.CorrespondingDebt.IsPositive() { - return nil - } - - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(auction.CorrespondingDebt)) -} - -// PayoutSurplusAuction pays out the proceeds for a surplus auction. -func (k Keeper) PayoutSurplusAuction(ctx sdk.Context, auction types.SurplusAuction) error { - // Send the tokens from the auction module account where they are being managed to the bidder who won the auction - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Lot)) -} - -// PayoutCollateralAuction pays out the proceeds for a collateral auction. -func (k Keeper) PayoutCollateralAuction(ctx sdk.Context, auction types.CollateralAuction) error { - // Send the tokens from the auction module account where they are being managed to the bidder who won the auction - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, auction.Bidder.AccAddress(), sdk.NewCoins(auction.Lot)) - if err != nil { - return err - } - - // if there is remaining debt after the auction, send it back to the initiating module for management - if !auction.CorrespondingDebt.IsPositive() { - return nil - } - - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(auction.CorrespondingDebt)) -} - -// CloseExpiredAuctions iterates over all the auctions stored by until the current -// block timestamp and that are past (or at) their ending times and closes them, -// paying out to the highest bidder. -func (k Keeper) CloseExpiredAuctions(ctx sdk.Context) error { - var err error - k.IterateAuctionsByTime(ctx, ctx.BlockTime(), func(id uint64) (stop bool) { - err = k.CloseAuction(ctx, id) - if err != nil && !errors.Is(err, types.ErrAuctionNotFound) { - // stop iteration - return true - } - // reset error in case the last element had an ErrAuctionNotFound - err = nil - return false - }) - - return err -} - -// earliestTime returns the earliest of two times. -func earliestTime(t1, t2 time.Time) time.Time { - if t1.Before(t2) { - return t1 - } - return t2 // also returned if times are equal -} - -// splitCoinIntoWeightedBuckets divides up some amount of coins according to some weights. -func splitCoinIntoWeightedBuckets(coin sdk.Coin, buckets []sdk.Int) ([]sdk.Coin, error) { - amounts := splitIntIntoWeightedBuckets(coin.Amount, buckets) - result := make([]sdk.Coin, len(amounts)) - for i, a := range amounts { - result[i] = sdk.NewCoin(coin.Denom, a) - } - return result, nil -} diff --git a/deprecated/x/auction/keeper/auctions_test.go b/deprecated/x/auction/keeper/auctions_test.go deleted file mode 100644 index 5bea59f94..000000000 --- a/deprecated/x/auction/keeper/auctions_test.go +++ /dev/null @@ -1,480 +0,0 @@ -package keeper_test - -// import ( -// "testing" -// "time" - -// "github.com/stretchr/testify/require" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/app" -// auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// func fundAccount(bk bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error { -// err := bk.MintCoins(ctx, minttypes.ModuleName, coins) -// if err != nil { -// return err -// } -// err = bk.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) -// return err -// } - -// func TestSurplusAuctionBasic(t *testing.T) { -// // Setup -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// buyer := addrs[0] -// sellerModName := cdptypes.LiquidatorMacc -// sellerAddr := authtypes.NewModuleAddress(sellerModName) - -// tApp := app.NewTestApp() - -// sellerAcc := authtypes.NewEmptyModuleAccount(sellerModName, authtypes.Burner) // forward auctions burn proceeds -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(buyer, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // sellerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{buyer}, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{sellerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, sellerAddr, cs(c("token1", 100), c("token2", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Create an auction (lot: 20 token1, initialBid: 0 token2) -// auctionID, err := keeper.StartSurplusAuction(ctx, sellerModName, c("token1", 20), "token2") // lot, bid denom -// require.NoError(t, err) -// // Check seller's coins have decreased -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 100))) - -// // PlaceBid (bid: 10 token, lot: same as starting) -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, buyer, c("token2", 10))) -// // Check buyer's coins have decreased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 100), c("token2", 90))) -// // Check seller's coins have not increased (because proceeds are burned) -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 100))) - -// // increment bid same bidder -// err = keeper.PlaceBid(ctx, auctionID, buyer, c("token2", 20)) -// require.NoError(t, err) - -// // Close auction at just at auction expiry time -// ctx = ctx.WithBlockTime(ctx.BlockTime().Add(auctiontypes.DefaultBidDuration)) -// require.NoError(t, keeper.CloseAuction(ctx, auctionID)) -// // Check buyer's coins increased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 120), c("token2", 80))) -// } - -// func TestDebtAuctionBasic(t *testing.T) { -// // Setup -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// seller := addrs[0] -// buyerModName := cdptypes.LiquidatorMacc -// buyerAddr := authtypes.NewModuleAddress(buyerModName) - -// tApp := app.NewTestApp() - -// buyerAcc := authtypes.NewEmptyModuleAccount(buyerModName, authtypes.Minter) // reverse auctions mint payout -// tApp.InitializeFromGenesisStates( -// // zNewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(seller, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // buyerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{seller}, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{buyerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, buyerAddr, cs(c("debt", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Start auction -// auctionID, err := keeper.StartDebtAuction(ctx, buyerModName, c("token1", 20), c("token2", 99999), c("debt", 20)) -// require.NoError(t, err) -// // Check buyer's coins have not decreased (except for debt), as lot is minted at the end -// tApp.CheckBalance(t, ctx, buyerAddr, cs(c("debt", 80))) - -// // Place a bid -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, seller, c("token2", 10))) -// // Check seller's coins have decreased -// tApp.CheckBalance(t, ctx, seller, cs(c("token1", 80), c("token2", 100))) -// // Check buyer's coins have increased -// tApp.CheckBalance(t, ctx, buyerAddr, cs(c("token1", 20), c("debt", 100))) - -// // Close auction at just after auction expiry -// ctx = ctx.WithBlockTime(ctx.BlockTime().Add(auctiontypes.DefaultBidDuration)) -// require.NoError(t, keeper.CloseAuction(ctx, auctionID)) -// // Check seller's coins increased -// tApp.CheckBalance(t, ctx, seller, cs(c("token1", 80), c("token2", 110))) -// } - -// func TestDebtAuctionDebtRemaining(t *testing.T) { -// // Setup -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// seller := addrs[0] -// buyerModName := cdptypes.LiquidatorMacc -// buyerAddr := authtypes.NewModuleAddress(buyerModName) - -// tApp := app.NewTestApp() - -// buyerAcc := authtypes.NewEmptyModuleAccount(buyerModName, authtypes.Minter) // reverse auctions mint payout -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(seller, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // buyerAcc, -// // }), -// // app.NewAuthGenState(tApp, []sdk.AccAddress{seller, buyerAddr}, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), {}}), -// app.NewAuthGenState(tApp, []sdk.AccAddress{seller}, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{buyerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, buyerAddr, cs(c("debt", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Start auction -// auctionID, err := keeper.StartDebtAuction(ctx, buyerModName, c("token1", 10), c("token2", 99999), c("debt", 20)) -// require.NoError(t, err) -// // Check buyer's coins have not decreased (except for debt), as lot is minted at the end -// tApp.CheckBalance(t, ctx, buyerAddr, cs(c("debt", 80))) - -// // Place a bid -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, seller, c("token2", 10))) -// // Check seller's coins have decreased -// tApp.CheckBalance(t, ctx, seller, cs(c("token1", 90), c("token2", 100))) -// // Check buyer's coins have increased -// tApp.CheckBalance(t, ctx, buyerAddr, cs(c("token1", 10), c("debt", 90))) - -// // Close auction at just after auction expiry -// ctx = ctx.WithBlockTime(ctx.BlockTime().Add(auctiontypes.DefaultBidDuration)) -// require.NoError(t, keeper.CloseAuction(ctx, auctionID)) -// // Check seller's coins increased -// tApp.CheckBalance(t, ctx, seller, cs(c("token1", 90), c("token2", 110))) -// // check that debt has increased due to corresponding debt being greater than bid -// tApp.CheckBalance(t, ctx, buyerAddr, cs(c("token1", 10), c("debt", 100))) -// } - -// func TestCollateralAuctionBasic(t *testing.T) { -// // Setup -// _, addrs := app.GeneratePrivKeyAddressPairs(4) -// buyer := addrs[0] -// returnAddrs := addrs[1:] -// returnWeights := is(30, 20, 10) -// sellerModName := cdptypes.LiquidatorMacc -// sellerAddr := authtypes.NewModuleAddress(sellerModName) - -// tApp := app.NewTestApp() - -// sellerAcc := authtypes.NewEmptyModuleAccount(sellerModName) -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(buyer, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // authtypes.NewBaseAccount(returnAddrs[0], cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // authtypes.NewBaseAccount(returnAddrs[1], cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // authtypes.NewBaseAccount(returnAddrs[2], cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // sellerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{ -// buyer, -// returnAddrs[0], -// returnAddrs[1], -// returnAddrs[2], -// }, []sdk.Coins{ -// cs(c("token1", 100), c("token2", 100)), -// cs(c("token1", 100), c("token2", 100)), -// cs(c("token1", 100), c("token2", 100)), -// cs(c("token1", 100), c("token2", 100)), -// }), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{sellerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, sellerAddr, cs(c("token1", 100), c("token2", 100), c("debt", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Start auction -// auctionID, err := keeper.StartCollateralAuction(ctx, sellerModName, c("token1", 20), c("token2", 50), returnAddrs, returnWeights, c("debt", 40)) -// require.NoError(t, err) -// // Check seller's coins have decreased -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 100), c("debt", 60))) - -// // Place a forward bid -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, buyer, c("token2", 10))) -// // Check bidder's coins have decreased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 100), c("token2", 90))) -// // Check seller's coins have increased -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 110), c("debt", 70))) -// // Check return addresses have not received coins -// for _, ra := range returnAddrs { -// tApp.CheckBalance(t, ctx, ra, cs(c("token1", 100), c("token2", 100))) -// } - -// // Place a reverse bid -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, buyer, c("token2", 50))) // first bid up to max bid to switch phases -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, buyer, c("token1", 15))) -// // Check bidder's coins have decreased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 100), c("token2", 50))) -// // Check seller's coins have increased -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 150), c("debt", 100))) -// // Check return addresses have received coins -// tApp.CheckBalance(t, ctx, returnAddrs[0], cs(c("token1", 102), c("token2", 100))) -// tApp.CheckBalance(t, ctx, returnAddrs[1], cs(c("token1", 102), c("token2", 100))) -// tApp.CheckBalance(t, ctx, returnAddrs[2], cs(c("token1", 101), c("token2", 100))) - -// // Close auction at just after auction expiry -// ctx = ctx.WithBlockTime(ctx.BlockTime().Add(auctiontypes.DefaultBidDuration)) -// require.NoError(t, keeper.CloseAuction(ctx, auctionID)) -// // Check buyer's coins increased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 115), c("token2", 50))) -// } - -// func TestCollateralAuctionDebtRemaining(t *testing.T) { -// // Setup -// _, addrs := app.GeneratePrivKeyAddressPairs(4) -// buyer := addrs[0] -// returnAddrs := addrs[1:] -// returnWeights := is(30, 20, 10) -// sellerModName := cdptypes.LiquidatorMacc -// sellerAddr := authtypes.NewModuleAddress(sellerModName) - -// tApp := app.NewTestApp() -// sellerAcc := authtypes.NewEmptyModuleAccount(sellerModName) -// // require.NoError(t, sellerAcc.SetCoins(cs(c("token1", 100), c("token2", 100), c("debt", 100)))) -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(buyer, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // authtypes.NewBaseAccount(returnAddrs[0], cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // authtypes.NewBaseAccount(returnAddrs[1], cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // authtypes.NewBaseAccount(returnAddrs[2], cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // sellerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{ -// buyer, -// returnAddrs[0], -// returnAddrs[1], -// returnAddrs[2], -// }, []sdk.Coins{ -// cs(c("token1", 100), c("token2", 100)), -// cs(c("token1", 100), c("token2", 100)), -// cs(c("token1", 100), c("token2", 100)), -// cs(c("token1", 100), c("token2", 100)), -// }), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{sellerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, sellerAddr, cs(c("token1", 100), c("token2", 100), c("debt", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Start auction -// auctionID, err := keeper.StartCollateralAuction(ctx, sellerModName, c("token1", 20), c("token2", 50), returnAddrs, returnWeights, c("debt", 40)) -// require.NoError(t, err) -// // Check seller's coins have decreased -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 100), c("debt", 60))) - -// // Place a forward bid -// require.NoError(t, keeper.PlaceBid(ctx, auctionID, buyer, c("token2", 10))) -// // Check bidder's coins have decreased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 100), c("token2", 90))) -// // Check seller's coins have increased -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 110), c("debt", 70))) -// // Check return addresses have not received coins -// for _, ra := range returnAddrs { -// tApp.CheckBalance(t, ctx, ra, cs(c("token1", 100), c("token2", 100))) -// } -// ctx = ctx.WithBlockTime(ctx.BlockTime().Add(auctiontypes.DefaultBidDuration)) -// require.NoError(t, keeper.CloseAuction(ctx, auctionID)) - -// // check that buyers coins have increased -// tApp.CheckBalance(t, ctx, buyer, cs(c("token1", 120), c("token2", 90))) -// // Check return addresses have not received coins -// for _, ra := range returnAddrs { -// tApp.CheckBalance(t, ctx, ra, cs(c("token1", 100), c("token2", 100))) -// } -// // check that token2 has increased by 10, debt by 40, for a net debt increase of 30 debt -// tApp.CheckBalance(t, ctx, sellerAddr, cs(c("token1", 80), c("token2", 110), c("debt", 100))) -// } - -// func TestStartSurplusAuction(t *testing.T) { -// someTime := time.Date(1998, time.January, 1, 0, 0, 0, 0, time.UTC) -// type args struct { -// seller string -// lot sdk.Coin -// bidDenom string -// } -// testCases := []struct { -// name string -// blockTime time.Time -// args args -// expectPass bool -// expPanic bool -// }{ -// { -// "normal", -// someTime, -// args{cdptypes.LiquidatorMacc, c("stable", 10), "gov"}, -// true, false, -// }, -// { -// "no module account", -// someTime, -// args{"nonExistentModule", c("stable", 10), "gov"}, -// false, true, -// }, -// { -// "not enough coins", -// someTime, -// args{cdptypes.LiquidatorMacc, c("stable", 101), "gov"}, -// false, false, -// }, -// { -// "incorrect denom", -// someTime, -// args{cdptypes.LiquidatorMacc, c("notacoin", 10), "gov"}, -// false, false, -// }, -// } -// for _, tc := range testCases { -// t.Run(tc.name, func(t *testing.T) { -// // setup -// initialLiquidatorCoins := cs(c("stable", 100)) -// tApp := app.NewTestApp() -// sk := tApp.GetBankKeeper() - -// liqAddr := authtypes.NewModuleAddress(cdptypes.LiquidatorMacc) -// liqAcc := authtypes.NewEmptyModuleAccount(cdptypes.LiquidatorMacc, authtypes.Burner) -// tApp.InitializeFromGenesisStates( -// NewAuthGenStateFromAccs(tApp, authtypes.GenesisAccounts{liqAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}).WithBlockTime(tc.blockTime) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, liqAddr, initialLiquidatorCoins)) -// keeper := tApp.GetAuctionKeeper() - -// // run function under test -// var ( -// id uint64 -// err error -// ) -// if tc.expPanic { -// require.Panics(t, func() { _, _ = keeper.StartSurplusAuction(ctx, tc.args.seller, tc.args.lot, tc.args.bidDenom) }, tc.name) -// } else { -// id, err = keeper.StartSurplusAuction(ctx, tc.args.seller, tc.args.lot, tc.args.bidDenom) -// } - -// // check -// // sk := tApp.GetauthtypesKeeper() -// // liquidatorCoins := sk.GetModuleAccount(ctx, cdptypes.LiquidatorMacc).GetCoins() -// liquidatorCoins := sk.GetAllBalances(ctx, liqAddr) -// actualAuc, found := keeper.GetAuction(ctx, id) - -// if tc.expectPass { -// require.NoError(t, err, tc.name) -// // check coins moved -// require.Equal(t, initialLiquidatorCoins.Sub(cs(tc.args.lot)...), liquidatorCoins, tc.name) -// // check auction in store and is correct -// require.True(t, found, tc.name) -// expectedAuction := auctiontypes.SurplusAuction{BaseAuction: auctiontypes.BaseAuction{ -// Id: id, -// Initiator: tc.args.seller, -// Lot: tc.args.lot, -// Bidder: nil, -// Bid: c(tc.args.bidDenom, 0), -// HasReceivedBids: false, -// EndTime: auctiontypes.DistantFuture, -// MaxEndTime: auctiontypes.DistantFuture, -// }} -// require.Equal(t, &expectedAuction, actualAuc, tc.name) -// } else if !tc.expPanic && !tc.expectPass { -// require.Error(t, err, tc.name) -// // check coins not moved -// require.Equal(t, initialLiquidatorCoins, liquidatorCoins, tc.name) -// // check auction not in store -// require.False(t, found, tc.name) -// } -// }) -// } -// } - -// func TestCloseAuction(t *testing.T) { -// // Set up -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// buyer := addrs[0] -// sellerModName := cdptypes.LiquidatorMacc -// sellerAddr := authtypes.NewModuleAddress(sellerModName) - -// tApp := app.NewTestApp() - -// sellerAcc := authtypes.NewEmptyModuleAccount(sellerModName, authtypes.Burner) // forward auctions burn proceeds -// // require.NoError(t, sellerAcc.SetCoins(cs(c("token1", 100), c("token2", 100)))) -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(buyer, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // sellerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{buyer}, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{sellerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, sellerAddr, cs(c("token1", 100), c("token2", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Create an auction (lot: 20 token1, initialBid: 0 token2) -// id, err := keeper.StartSurplusAuction(ctx, sellerModName, c("token1", 20), "token2") // lot, bid denom -// require.NoError(t, err) - -// // Attempt to close the auction before EndTime -// require.Error(t, keeper.CloseAuction(ctx, id)) - -// // Attempt to close auction that does not exist -// require.Error(t, keeper.CloseAuction(ctx, 999)) -// } - -// func TestCloseExpiredAuctions(t *testing.T) { -// // Set up -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// buyer := addrs[0] -// sellerModName := "liquidator" -// sellerAddr := authtypes.NewModuleAddress(sellerModName) - -// tApp := app.NewTestApp() - -// sellerAcc := authtypes.NewEmptyModuleAccount(sellerModName, authtypes.Burner) // forward auctions burn proceeds -// // require.NoError(t, sellerAcc.SetCoins(cs(c("token1", 100), c("token2", 100)))) -// tApp.InitializeFromGenesisStates( -// // NewAuthGenStateFromAccs(authtypes.GenesisAccounts{ -// // authtypes.NewBaseAccount(buyer, cs(c("token1", 100), c("token2", 100)), nil, 0, 0), -// // sellerAcc, -// // }), -// app.NewAuthGenState(tApp, []sdk.AccAddress{buyer}, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}), -// app.NewAuthGenStateModAcc(tApp, []*authtypes.ModuleAccount{sellerAcc}), -// ) -// ctx := tApp.NewContext(false, tmproto.Header{}) -// require.NoError(t, fundAccount(tApp.BankKeeper, ctx, sellerAddr, cs(c("token1", 100), c("token2", 100)))) - -// keeper := tApp.GetAuctionKeeper() - -// // Start auction 1 -// _, err := keeper.StartSurplusAuction(ctx, sellerModName, c("token1", 20), "token2") // lot, bid denom -// require.NoError(t, err) - -// // Start auction 2 -// _, err = keeper.StartSurplusAuction(ctx, sellerModName, c("token1", 20), "token2") // lot, bid denom -// require.NoError(t, err) - -// // Fast forward the block time -// ctx = ctx.WithBlockTime(ctx.BlockTime().Add(auctiontypes.DefaultMaxAuctionDuration).Add(1)) - -// // Close expired auctions -// err = keeper.CloseExpiredAuctions(ctx) -// require.NoError(t, err) -// } diff --git a/deprecated/x/auction/keeper/grpc_query.go b/deprecated/x/auction/keeper/grpc_query.go deleted file mode 100644 index 73aa034d1..000000000 --- a/deprecated/x/auction/keeper/grpc_query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/deprecated/x/auction/keeper/grpc_query_auction.go b/deprecated/x/auction/keeper/grpc_query_auction.go deleted file mode 100644 index 223616014..000000000 --- a/deprecated/x/auction/keeper/grpc_query_auction.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "context" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func (k Keeper) AuctionAll(c context.Context, req *types.QueryAllAuctionRequest) (*types.QueryAllAuctionResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var auctions []*codectypes.Any - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - auctionStore := prefix.NewStore(store, types.KeyPrefix(types.AuctionKey)) - - pageRes, err := query.Paginate(auctionStore, req.Pagination, func(key []byte, value []byte) error { - var auction codectypes.Any - if err := k.cdc.Unmarshal(value, &auction); err != nil { - return err - } - - auctions = append(auctions, &auction) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllAuctionResponse{Auctions: auctions, Pagination: pageRes}, nil -} - -func (k Keeper) Auction(c context.Context, req *types.QueryGetAuctionRequest) (*types.QueryGetAuctionResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - - auction, found := k.GetAuction(ctx, req.Id) - - if !found { - return nil, status.Error(codes.NotFound, "not found") - } - auctionAny, _ := codectypes.NewAnyWithValue(auction) - - return &types.QueryGetAuctionResponse{Auction: auctionAny}, nil -} diff --git a/deprecated/x/auction/keeper/grpc_query_params.go b/deprecated/x/auction/keeper/grpc_query_params.go deleted file mode 100644 index f97ee0676..000000000 --- a/deprecated/x/auction/keeper/grpc_query_params.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var params types.Params - ctx := sdk.UnwrapSDKContext(c) - - params = k.GetParams(ctx) - - return &types.QueryParamsResponse{Params: ¶ms}, nil -} diff --git a/deprecated/x/auction/keeper/integration_test.go b/deprecated/x/auction/keeper/integration_test.go deleted file mode 100644 index 780b68050..000000000 --- a/deprecated/x/auction/keeper/integration_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/UnUniFi/chain/app" -) - -func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } - -// func i(n int64) sdk.Int { return sdk.NewInt(n) } -func is(ns ...int64) (is []sdk.Int) { - for _, n := range ns { - is = append(is, sdk.NewInt(n)) - } - return -} - -func NewAuthGenStateFromAccs(tApp app.TestApp, accounts authtypes.GenesisAccounts) app.GenesisState { - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), accounts) - return app.GenesisState{authtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(authGenesis)} -} diff --git a/deprecated/x/auction/keeper/invariants.go b/deprecated/x/auction/keeper/invariants.go deleted file mode 100644 index 74c103a1d..000000000 --- a/deprecated/x/auction/keeper/invariants.go +++ /dev/null @@ -1,134 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -// RegisterInvariants registers all staking invariants -func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { - - ir.RegisterRoute(types.ModuleName, "module-account", - ModuleAccountInvariants(k)) - ir.RegisterRoute(types.ModuleName, "valid-auctions", - ValidAuctionInvariant(k)) - ir.RegisterRoute(types.ModuleName, "valid-index", - ValidIndexInvariant(k)) -} - -// ModuleAccountInvariants checks that the module account's coins matches those stored in auctions -func ModuleAccountInvariants(k Keeper) sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - - totalAuctionCoins := sdk.NewCoins() - k.IterateAuctions(ctx, func(auction types.Auction) bool { - a, ok := auction.(types.GenesisAuction) - if !ok { - panic("stored auction type does not fulfill GenesisAuction interface") - } - totalAuctionCoins = totalAuctionCoins.Add(a.GetModuleAccountCoins()...) - return false - }) - - moduleAcc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) - moduleAccCoins := k.bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress()) - broken := !moduleAccCoins.IsEqual(totalAuctionCoins) - - invariantMessage := sdk.FormatInvariant( - types.ModuleName, - "module account", - fmt.Sprintf( - "\texpected ModuleAccount coins: %s\n"+ - "\tactual ModuleAccount coins: %s\n", - totalAuctionCoins, moduleAccCoins), - ) - return invariantMessage, broken - } -} - -// ValidAuctionInvariant verifies that all auctions in the store are independently valid -func ValidAuctionInvariant(k Keeper) sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - var validationErr error - var invalidAuction types.Auction - k.IterateAuctions(ctx, func(auction types.Auction) bool { - a, ok := auction.(types.GenesisAuction) - if !ok { - panic("stored auction type does not fulfill GenesisAuction interface") - } - - if err := a.Validate(); err != nil { - validationErr = err - invalidAuction = a - return true - } - return false - }) - - broken := validationErr != nil - invariantMessage := sdk.FormatInvariant( - types.ModuleName, - "valid auctions", - fmt.Sprintf( - "\tfound invalid auction, reason: %s\n"+ - "\tauction:\n\t%s\n", - validationErr, invalidAuction), - ) - return invariantMessage, broken - } -} - -// ValidIndexInvariant checks that all auctions in the store are also in the index and vice versa. -func ValidIndexInvariant(k Keeper) sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - /* Method: - - check all the auction IDs in the index have a corresponding auction in the store - - index is now valid but there could be extra auction in the store - - check for these extra auctions by checking num items in the store equals that of index (store keys are always unique) - - doesn't check the IDs in the auction structs match the IDs in the keys - */ - - // Check all auction IDs in the index are in the auction store - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionIDKey)) - - indexIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionByTimeKey)) - defer indexIterator.Close() - - var indexLength int - for ; indexIterator.Valid(); indexIterator.Next() { - indexLength++ - - idBytes := indexIterator.Value() - auctionBytes := store.Get(idBytes) - if auctionBytes == nil { - invariantMessage := sdk.FormatInvariant( - types.ModuleName, - "valid index", - fmt.Sprintf("\tauction with ID '%d' found in index but not in store", types.Uint64FromBytes(idBytes))) - return invariantMessage, true - } - } - - // Check length of auction store matches the length of the index - storeIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionIDKey)) - defer storeIterator.Close() - var storeLength int - for ; storeIterator.Valid(); storeIterator.Next() { - storeLength++ - } - - if storeLength != indexLength { - invariantMessage := sdk.FormatInvariant( - types.ModuleName, - "valid index", - fmt.Sprintf("\tmismatched number of items in auction store (%d) and index (%d)", storeLength, indexLength)) - return invariantMessage, true - } - - return "", false - } -} diff --git a/deprecated/x/auction/keeper/keeper.go b/deprecated/x/auction/keeper/keeper.go deleted file mode 100644 index ffc1f392c..000000000 --- a/deprecated/x/auction/keeper/keeper.go +++ /dev/null @@ -1,196 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -type ( - Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramSpace paramtypes.Subspace - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - } -) - -func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, -) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramSpace: paramSpace, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// SetNextAuctionID stores an ID to be used for the next created auction -func (k Keeper) SetNextAuctionID(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyPrefix(types.NextAuctionIDKey), types.Uint64ToBytes(id)) -} - -// GetNextAuctionID reads the next available global ID from store -func (k Keeper) GetNextAuctionID(ctx sdk.Context) (uint64, error) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyPrefix(types.NextAuctionIDKey)) - if bz == nil { - return 0, types.ErrInvalidInitialAuctionID - } - return types.Uint64FromBytes(bz), nil -} - -// IncrementNextAuctionID increments the next auction ID in the store by 1. -func (k Keeper) IncrementNextAuctionID(ctx sdk.Context) error { - id, err := k.GetNextAuctionID(ctx) - if err != nil { - return err - } - k.SetNextAuctionID(ctx, id+1) - return nil -} - -// StoreNewAuction stores an auction, adding a new ID -func (k Keeper) StoreNewAuction(ctx sdk.Context, auction types.Auction) (uint64, error) { - newAuctionID, err := k.GetNextAuctionID(ctx) - if err != nil { - return 0, err - } - auction = auction.WithID(newAuctionID) - - k.SetAuction(ctx, auction) - - err = k.IncrementNextAuctionID(ctx) - if err != nil { - return 0, err - } - return newAuctionID, nil -} - -// SetAuction puts the auction into the store, and updates any indexes. -func (k Keeper) SetAuction(ctx sdk.Context, auction types.Auction) { - // remove the auction from the byTime index if it is already in there - existingAuction, found := k.GetAuction(ctx, auction.GetID()) - if found { - k.removeFromByTimeIndex(ctx, existingAuction.GetEndTime(), existingAuction.GetID()) - } - - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKey)) - auctionAny, _ := codectypes.NewAnyWithValue(auction) - bz, _ := auctionAny.Marshal() - store.Set(types.GetAuctionKey(auction.GetID()), bz) - - k.InsertIntoByTimeIndex(ctx, auction.GetEndTime(), auction.GetID()) -} - -// GetAuction gets an auction from the store. -func (k Keeper) GetAuction(ctx sdk.Context, auctionID uint64) (types.Auction, bool) { - var auction types.Auction - - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKey)) - bz := store.Get(types.GetAuctionKey(auctionID)) - if bz == nil { - return auction, false - } - - var auctionAny codectypes.Any - auctionAny.Unmarshal(bz) - auction, err := types.UnpackAuction(&auctionAny) - if err != nil { - return nil, false - } - return auction, true -} - -// DeleteAuction removes an auction from the store, and any indexes. -func (k Keeper) DeleteAuction(ctx sdk.Context, auctionID uint64) { - auction, found := k.GetAuction(ctx, auctionID) - if found { - k.removeFromByTimeIndex(ctx, auction.GetEndTime(), auctionID) - } - - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKey)) - store.Delete(types.GetAuctionKey(auctionID)) -} - -// InsertIntoByTimeIndex adds an auction ID and end time into the byTime index. -func (k Keeper) InsertIntoByTimeIndex(ctx sdk.Context, endTime time.Time, auctionID uint64) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionByTimeKey)) - store.Set(types.GetAuctionByTimeKey(endTime, auctionID), types.Uint64ToBytes(auctionID)) -} - -// removeFromByTimeIndex removes an auction ID and end time from the byTime index. -func (k Keeper) removeFromByTimeIndex(ctx sdk.Context, endTime time.Time, auctionID uint64) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionByTimeKey)) - store.Delete(types.GetAuctionByTimeKey(endTime, auctionID)) -} - -// IterateAuctionByTime provides an iterator over auctions ordered by auction.EndTime. -// For each auction cb will be callled. If cb returns true the iterator will close and stop. -func (k Keeper) IterateAuctionsByTime(ctx sdk.Context, inclusiveCutoffTime time.Time, cb func(auctionID uint64) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionByTimeKey)) - iterator := store.Iterator( - nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.FormatTimeBytes(inclusiveCutoffTime)), // include any keys with times equal to inclusiveCutoffTime - ) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - - auctionID := types.Uint64FromBytes(iterator.Value()) - - if cb(auctionID) { - break - } - } -} - -// IterateAuctions provides an iterator over all stored auctions. -// For each auction, cb will be called. If cb returns true, the iterator will close and stop. -func (k Keeper) IterateAuctions(ctx sdk.Context, cb func(auction types.Auction) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKey)) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var auctionAny codectypes.Any - auctionAny.Unmarshal(iterator.Value()) - - auction, _ := types.UnpackAuction(&auctionAny) - - if cb(auction) { - break - } - } -} - -// GetAllAuctions returns all auctions from the store -func (k Keeper) GetAllAuctions(ctx sdk.Context) (auctions types.Auctions) { - k.IterateAuctions(ctx, func(auction types.Auction) bool { - auctions = append(auctions, auction) - return false - }) - return -} diff --git a/deprecated/x/auction/keeper/keeper_test.go b/deprecated/x/auction/keeper/keeper_test.go deleted file mode 100644 index 874370c8e..000000000 --- a/deprecated/x/auction/keeper/keeper_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package keeper_test - -// import ( -// "testing" -// "time" - -// "github.com/stretchr/testify/require" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/auction/types" -// ) - -// func SetGetDeleteAuction(t *testing.T) { -// // setup keeper, create auction -// tApp := app.NewTestApp() -// keeper := tApp.GetAuctionKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{}) -// someTime := time.Date(43, time.January, 1, 0, 0, 0, 0, time.UTC) // need to specify UTC as tz info is lost on unmarshal -// var id uint64 = 5 -// auction := types.NewSurplusAuction("some_module", c("jpu", 100), "guu", someTime).WithID(id) - -// // write and read from store -// keeper.SetAuction(ctx, auction) -// readAuction, found := keeper.GetAuction(ctx, id) - -// // check before and after match -// require.True(t, found) -// require.Equal(t, auction, readAuction) -// // check auction is in the index -// keeper.IterateAuctionsByTime(ctx, auction.GetEndTime(), func(readID uint64) bool { -// require.Equal(t, auction.GetID(), readID) -// return false -// }) - -// // delete auction -// keeper.DeleteAuction(ctx, id) - -// // check auction does not exist -// _, found = keeper.GetAuction(ctx, id) -// require.False(t, found) -// // check auction not in index -// keeper.IterateAuctionsByTime(ctx, time.Unix(999999999, 0), func(readID uint64) bool { -// require.Fail(t, "index should be empty", " found auction ID '%s", readID) -// return false -// }) -// } - -// func TestIncrementNextAuctionID(t *testing.T) { -// // setup keeper -// tApp := app.NewTestApp() -// keeper := tApp.GetAuctionKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{}) - -// // store id -// var id uint64 = 123456 -// keeper.SetNextAuctionID(ctx, id) - -// require.NoError(t, keeper.IncrementNextAuctionID(ctx)) - -// // check id was incremented -// readID, err := keeper.GetNextAuctionID(ctx) -// require.NoError(t, err) -// require.Equal(t, id+1, readID) - -// } - -// // func TestIterateAuctions(t *testing.T) { -// // // setup -// // tApp := app.NewTestApp() -// // tApp.InitializeFromGenesisStates() -// // keeper := tApp.GetAuctionKeeper() -// // ctx := tApp.NewContext(true, tmproto.Header{}) - -// // auctions := []types.Auction{ -// // types.NewSurplusAuction("sellerMod", c("denom", 12345678), "anotherdenom", time.Date(1998, time.January, 1, 0, 0, 0, 0, time.UTC)).WithID(0), -// // types.NewDebtAuction("buyerMod", c("denom", 12345678), c("anotherdenom", 12345678), time.Date(1998, time.January, 1, 0, 0, 0, 0, time.UTC), c("debt", 12345678)).WithID(1), -// // types.NewCollateralAuction("sellerMod", c("denom", 12345678), time.Date(1998, time.January, 1, 0, 0, 0, 0, time.UTC), c("anotherdenom", 12345678), nil, c("debt", 12345678)).WithID(2), -// // } -// // for _, a := range auctions { -// // keeper.SetAuction(ctx, a) -// // } - -// // // run -// // var readAuctions []types.Auction -// // keeper.IterateAuctions(ctx, func(a types.Auction) bool { -// // readAuctions = append(readAuctions, a) -// // return false -// // }) - -// // // check -// // require.Equal(t, auctions, readAuctions) -// // } - -// // func TestIterateAuctionsByTime(t *testing.T) { -// // // setup keeper -// // tApp := app.NewTestApp() -// // keeper := tApp.GetAuctionKeeper() -// // ctx := tApp.NewContext(true, tmproto.Header{}) - -// // // setup byTime index -// // byTimeIndex := []struct { -// // endTime time.Time -// // auctionID uint64 -// // }{ -// // {time.Date(0, time.January, 1, 0, 0, 0, 0, time.UTC), 9999}, // distant past -// // {time.Date(1998, time.January, 1, 11, 59, 59, 999999999, time.UTC), 1}, // just before cutoff -// // {time.Date(1998, time.January, 1, 11, 59, 59, 999999999, time.UTC), 2}, // -// // {time.Date(1998, time.January, 1, 12, 0, 0, 0, time.UTC), 3}, // equal to cutoff -// // {time.Date(1998, time.January, 1, 12, 0, 0, 0, time.UTC), 4}, // -// // {time.Date(1998, time.January, 1, 12, 0, 0, 1, time.UTC), 5}, // just after cutoff -// // {time.Date(1998, time.January, 1, 12, 0, 0, 1, time.UTC), 6}, // -// // {time.Date(9999, time.January, 1, 0, 0, 0, 0, time.UTC), 0}, // distant future -// // } -// // for _, v := range byTimeIndex { -// // keeper.InsertIntoByTimeIndex(ctx, v.endTime, v.auctionID) -// // } - -// // // read out values from index up to a cutoff time and check they are as expected -// // cutoffTime := time.Date(1998, time.January, 1, 12, 0, 0, 0, time.UTC) -// // var expectedIndex []uint64 -// // for _, v := range byTimeIndex { -// // if v.endTime.Before(cutoffTime) || v.endTime.Equal(cutoffTime) { // endTime ≤ cutoffTime -// // expectedIndex = append(expectedIndex, v.auctionID) -// // } - -// // } -// // var readIndex []uint64 -// // keeper.IterateAuctionsByTime(ctx, cutoffTime, func(id uint64) bool { -// // readIndex = append(readIndex, id) -// // return false -// // }) - -// // require.Equal(t, expectedIndex, readIndex) -// // } diff --git a/deprecated/x/auction/keeper/math.go b/deprecated/x/auction/keeper/math.go deleted file mode 100644 index 2fd9198f4..000000000 --- a/deprecated/x/auction/keeper/math.go +++ /dev/null @@ -1,80 +0,0 @@ -package keeper - -import ( - "sort" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// splitIntIntoWeightedBuckets divides an initial +ve integer among several buckets in proportion to the buckets' weights -// It uses the largest remainder method: https://en.wikipedia.org/wiki/Largest_remainder_method -// See also: https://stackoverflow.com/questions/13483430/how-to-make-rounded-percentages-add-up-to-100 -func splitIntIntoWeightedBuckets(amount sdk.Int, buckets []sdk.Int) []sdk.Int { - // Limit input to +ve numbers as algorithm hasn't been scoped to work with -ve numbers. - if amount.IsNegative() { - panic("negative amount") - } - if len(buckets) < 1 { - panic("no buckets") - } - for _, bucket := range buckets { - if bucket.IsNegative() { - panic("negative bucket") - } - } - - // 1) Split the amount by weights, recording whole number part and remainder - - totalWeights := totalInts(buckets...) - if !totalWeights.IsPositive() { - panic("total weights must sum to > 0") - } - - quotients := make([]quoRem, len(buckets)) - for i := range buckets { - // amount * ( weight/total_weight ) - q := amount.Mul(buckets[i]).Quo(totalWeights) - r := amount.Mul(buckets[i]).Mod(totalWeights) - quotients[i] = quoRem{index: i, quo: q, rem: r} - } - - // 2) Calculate total left over from remainders, and apportion it to buckets with the highest remainder (to minimize error) - - // sort by decreasing remainder order - sort.Slice(quotients, func(i, j int) bool { - return quotients[i].rem.GT(quotients[j].rem) - }) - - // calculate total left over from remainders - allocated := sdk.ZeroInt() - for _, qr := range quotients { - allocated = allocated.Add(qr.quo) - } - leftToAllocate := amount.Sub(allocated) - - // apportion according to largest remainder - results := make([]sdk.Int, len(quotients)) - for _, qr := range quotients { - results[qr.index] = qr.quo - if !leftToAllocate.IsZero() { - results[qr.index] = results[qr.index].Add(sdk.OneInt()) - leftToAllocate = leftToAllocate.Sub(sdk.OneInt()) - } - } - return results -} - -type quoRem struct { - index int - quo sdk.Int - rem sdk.Int -} - -// totalInts adds together sdk.Ints -func totalInts(is ...sdk.Int) sdk.Int { - total := sdk.ZeroInt() - for _, i := range is { - total = total.Add(i) - } - return total -} diff --git a/deprecated/x/auction/keeper/math_test.go b/deprecated/x/auction/keeper/math_test.go deleted file mode 100644 index 1412988c4..000000000 --- a/deprecated/x/auction/keeper/math_test.go +++ /dev/null @@ -1,115 +0,0 @@ -package keeper - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestSplitIntIntoWeightedBuckets(t *testing.T) { - testCases := []struct { - name string - amount sdk.Int - buckets []sdk.Int - want []sdk.Int - expectPanic bool - }{ - { - name: "0split0", - amount: i(0), - buckets: is(0), - expectPanic: true, - }, - { - name: "5splitnil", - amount: i(5), - buckets: is(), - expectPanic: true, - }, - { - name: "-2split1,1", - amount: i(-2), - buckets: is(1, 1), - expectPanic: true, - }, - { - name: "2split1,-1", - amount: i(2), - buckets: is(1, -1), - expectPanic: true, - }, - { - name: "0split0,0,0,1", - amount: i(0), - buckets: is(0, 0, 0, 1), - want: is(0, 0, 0, 0), - }, - { - name: "2split1,1", - amount: i(2), - buckets: is(1, 1), - want: is(1, 1), - }, - { - name: "100split1,9", - amount: i(100), - buckets: is(1, 9), - want: is(10, 90), - }, - { - name: "100split9,1", - amount: i(100), - buckets: is(9, 1), - want: is(90, 10), - }, - { - name: "7split1,2", - amount: i(7), - buckets: is(1, 2), - want: is(2, 5), - }, - { - name: "17split1,1,1", - amount: i(17), - buckets: is(1, 1, 1), - want: is(6, 6, 5), - }, - { - name: "10split1000000,1", - amount: i(10), - buckets: is(1000000, 1), - want: is(10, 0), - }, - { - name: "334733353split730777,31547", - amount: i(334733353), - buckets: is(730777, 31547), - want: is(320881194, 13852159), - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - var got []sdk.Int - run := func() { - got = splitIntIntoWeightedBuckets(tc.amount, tc.buckets) - } - if tc.expectPanic { - require.Panics(t, run) - } else { - require.NotPanics(t, run) - } - - require.Equal(t, tc.want, got) - }) - } -} - -func i(n int64) sdk.Int { return sdk.NewInt(n) } -func is(ns ...int64) (is []sdk.Int) { - for _, n := range ns { - is = append(is, sdk.NewInt(n)) - } - return -} diff --git a/deprecated/x/auction/keeper/params.go b/deprecated/x/auction/keeper/params.go deleted file mode 100644 index c0c1e3761..000000000 --- a/deprecated/x/auction/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/auction/types" -) - -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return params -} - -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} diff --git a/deprecated/x/auction/module.go b/deprecated/x/auction/module.go deleted file mode 100644 index ed923ad06..000000000 --- a/deprecated/x/auction/module.go +++ /dev/null @@ -1,167 +0,0 @@ -package auction - -import ( - "encoding/json" - "fmt" - - "context" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/UnUniFi/chain/deprecated/x/auction/client/cli" - "github.com/UnUniFi/chain/deprecated/x/auction/keeper" - "github.com/UnUniFi/chain/deprecated/x/auction/types" - "github.com/UnUniFi/chain/deprecated/x/cdp/client/rest" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr) -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, am.accountKeeper, am.bankKeeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) -} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/deprecated/x/auction/types/auction.pb.go b/deprecated/x/auction/types/auction.pb.go deleted file mode 100644 index 7d4881b4d..000000000 --- a/deprecated/x/auction/types/auction.pb.go +++ /dev/null @@ -1,1992 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: auction/auction.proto - -package types - -import ( - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type BaseAuction struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` - Initiator string `protobuf:"bytes,2,opt,name=initiator,proto3" json:"initiator,omitempty" yaml:"initiator"` - Lot types.Coin `protobuf:"bytes,3,opt,name=lot,proto3" json:"lot" yaml:"lot"` - Bidder github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,4,opt,name=bidder,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"bidder" yaml:"bidder"` - Bid types.Coin `protobuf:"bytes,5,opt,name=bid,proto3" json:"bid" yaml:"bid"` - HasReceivedBids bool `protobuf:"varint,6,opt,name=has_received_bids,json=hasReceivedBids,proto3" json:"has_received_bids,omitempty" yaml:"has_received_bids"` - EndTime time.Time `protobuf:"bytes,7,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time" yaml:"end_time"` - MaxEndTime time.Time `protobuf:"bytes,8,opt,name=max_end_time,json=maxEndTime,proto3,stdtime" json:"max_end_time" yaml:"max_end_time"` -} - -func (m *BaseAuction) Reset() { *m = BaseAuction{} } -func (m *BaseAuction) String() string { return proto.CompactTextString(m) } -func (*BaseAuction) ProtoMessage() {} -func (*BaseAuction) Descriptor() ([]byte, []int) { - return fileDescriptor_e3dc552ee3b806a8, []int{0} -} -func (m *BaseAuction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BaseAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BaseAuction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BaseAuction) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseAuction.Merge(m, src) -} -func (m *BaseAuction) XXX_Size() int { - return m.Size() -} -func (m *BaseAuction) XXX_DiscardUnknown() { - xxx_messageInfo_BaseAuction.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseAuction proto.InternalMessageInfo - -func (m *BaseAuction) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *BaseAuction) GetInitiator() string { - if m != nil { - return m.Initiator - } - return "" -} - -func (m *BaseAuction) GetLot() types.Coin { - if m != nil { - return m.Lot - } - return types.Coin{} -} - -func (m *BaseAuction) GetBid() types.Coin { - if m != nil { - return m.Bid - } - return types.Coin{} -} - -func (m *BaseAuction) GetHasReceivedBids() bool { - if m != nil { - return m.HasReceivedBids - } - return false -} - -func (m *BaseAuction) GetEndTime() time.Time { - if m != nil { - return m.EndTime - } - return time.Time{} -} - -func (m *BaseAuction) GetMaxEndTime() time.Time { - if m != nil { - return m.MaxEndTime - } - return time.Time{} -} - -type SurplusAuction struct { - BaseAuction `protobuf:"bytes,1,opt,name=base_auction,json=baseAuction,proto3,embedded=base_auction" json:"base_auction" yaml:"base_auction"` -} - -func (m *SurplusAuction) Reset() { *m = SurplusAuction{} } -func (m *SurplusAuction) String() string { return proto.CompactTextString(m) } -func (*SurplusAuction) ProtoMessage() {} -func (*SurplusAuction) Descriptor() ([]byte, []int) { - return fileDescriptor_e3dc552ee3b806a8, []int{1} -} -func (m *SurplusAuction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SurplusAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SurplusAuction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *SurplusAuction) XXX_Merge(src proto.Message) { - xxx_messageInfo_SurplusAuction.Merge(m, src) -} -func (m *SurplusAuction) XXX_Size() int { - return m.Size() -} -func (m *SurplusAuction) XXX_DiscardUnknown() { - xxx_messageInfo_SurplusAuction.DiscardUnknown(m) -} - -var xxx_messageInfo_SurplusAuction proto.InternalMessageInfo - -type DebtAuction struct { - BaseAuction `protobuf:"bytes,1,opt,name=base_auction,json=baseAuction,proto3,embedded=base_auction" json:"base_auction" yaml:"base_auction"` - CorrespondingDebt types.Coin `protobuf:"bytes,2,opt,name=corresponding_debt,json=correspondingDebt,proto3" json:"corresponding_debt" yaml:"corresponding_debt"` -} - -func (m *DebtAuction) Reset() { *m = DebtAuction{} } -func (m *DebtAuction) String() string { return proto.CompactTextString(m) } -func (*DebtAuction) ProtoMessage() {} -func (*DebtAuction) Descriptor() ([]byte, []int) { - return fileDescriptor_e3dc552ee3b806a8, []int{2} -} -func (m *DebtAuction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DebtAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DebtAuction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DebtAuction) XXX_Merge(src proto.Message) { - xxx_messageInfo_DebtAuction.Merge(m, src) -} -func (m *DebtAuction) XXX_Size() int { - return m.Size() -} -func (m *DebtAuction) XXX_DiscardUnknown() { - xxx_messageInfo_DebtAuction.DiscardUnknown(m) -} - -var xxx_messageInfo_DebtAuction proto.InternalMessageInfo - -func (m *DebtAuction) GetCorrespondingDebt() types.Coin { - if m != nil { - return m.CorrespondingDebt - } - return types.Coin{} -} - -type CollateralAuction struct { - BaseAuction `protobuf:"bytes,1,opt,name=base_auction,json=baseAuction,proto3,embedded=base_auction" json:"base_auction" yaml:"base_auction"` - CorrespondingDebt types.Coin `protobuf:"bytes,2,opt,name=corresponding_debt,json=correspondingDebt,proto3" json:"corresponding_debt" yaml:"corresponding_debt"` - MaxBid types.Coin `protobuf:"bytes,3,opt,name=max_bid,json=maxBid,proto3" json:"max_bid" yaml:"max_bid"` - LotReturns WeightedAddresses `protobuf:"bytes,4,rep,name=lot_returns,json=lotReturns,proto3,castrepeated=WeightedAddresses" json:"lot_returns" yaml:"lot_returns"` -} - -func (m *CollateralAuction) Reset() { *m = CollateralAuction{} } -func (m *CollateralAuction) String() string { return proto.CompactTextString(m) } -func (*CollateralAuction) ProtoMessage() {} -func (*CollateralAuction) Descriptor() ([]byte, []int) { - return fileDescriptor_e3dc552ee3b806a8, []int{3} -} -func (m *CollateralAuction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CollateralAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CollateralAuction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CollateralAuction) XXX_Merge(src proto.Message) { - xxx_messageInfo_CollateralAuction.Merge(m, src) -} -func (m *CollateralAuction) XXX_Size() int { - return m.Size() -} -func (m *CollateralAuction) XXX_DiscardUnknown() { - xxx_messageInfo_CollateralAuction.DiscardUnknown(m) -} - -var xxx_messageInfo_CollateralAuction proto.InternalMessageInfo - -func (m *CollateralAuction) GetCorrespondingDebt() types.Coin { - if m != nil { - return m.CorrespondingDebt - } - return types.Coin{} -} - -func (m *CollateralAuction) GetMaxBid() types.Coin { - if m != nil { - return m.MaxBid - } - return types.Coin{} -} - -func (m *CollateralAuction) GetLotReturns() WeightedAddresses { - if m != nil { - return m.LotReturns - } - return nil -} - -type WeightedAddress struct { - Address github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=address,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"address" yaml:"address"` - Weight github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"weight" yaml:"weight"` -} - -func (m *WeightedAddress) Reset() { *m = WeightedAddress{} } -func (m *WeightedAddress) String() string { return proto.CompactTextString(m) } -func (*WeightedAddress) ProtoMessage() {} -func (*WeightedAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_e3dc552ee3b806a8, []int{4} -} -func (m *WeightedAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WeightedAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WeightedAddress.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WeightedAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_WeightedAddress.Merge(m, src) -} -func (m *WeightedAddress) XXX_Size() int { - return m.Size() -} -func (m *WeightedAddress) XXX_DiscardUnknown() { - xxx_messageInfo_WeightedAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_WeightedAddress proto.InternalMessageInfo - -type Params struct { - MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration" yaml:"max_auction_duration"` - BidDuration time.Duration `protobuf:"bytes,2,opt,name=bid_duration,json=bidDuration,proto3,stdduration" json:"bid_duration" yaml:"bid_duration"` - IncrementSurplus github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus" yaml:"increment_surplus"` - IncrementDebt github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt" yaml:"increment_debt"` - IncrementCollateral github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral" yaml:"increment_collateral"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e3dc552ee3b806a8, []int{5} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetMaxAuctionDuration() time.Duration { - if m != nil { - return m.MaxAuctionDuration - } - return 0 -} - -func (m *Params) GetBidDuration() time.Duration { - if m != nil { - return m.BidDuration - } - return 0 -} - -func init() { - proto.RegisterType((*BaseAuction)(nil), "ununifi.auction.BaseAuction") - proto.RegisterType((*SurplusAuction)(nil), "ununifi.auction.SurplusAuction") - proto.RegisterType((*DebtAuction)(nil), "ununifi.auction.DebtAuction") - proto.RegisterType((*CollateralAuction)(nil), "ununifi.auction.CollateralAuction") - proto.RegisterType((*WeightedAddress)(nil), "ununifi.auction.WeightedAddress") - proto.RegisterType((*Params)(nil), "ununifi.auction.Params") -} - -func init() { proto.RegisterFile("auction/auction.proto", fileDescriptor_e3dc552ee3b806a8) } - -var fileDescriptor_e3dc552ee3b806a8 = []byte{ - // 902 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x41, 0x6f, 0xdb, 0xb6, - 0x1f, 0x8d, 0x12, 0xff, 0x9d, 0x98, 0x6e, 0x92, 0x9a, 0x4d, 0xff, 0x50, 0x92, 0xce, 0xf2, 0x78, - 0xd8, 0x7c, 0x99, 0x84, 0x66, 0xb7, 0x5d, 0x8a, 0xa8, 0xd9, 0xd6, 0x16, 0x18, 0x30, 0xa8, 0x2b, - 0x0a, 0x0c, 0x18, 0x54, 0x4a, 0x64, 0x6d, 0xa2, 0x12, 0x69, 0x90, 0x54, 0xeb, 0xde, 0xf6, 0x11, - 0x7a, 0xdc, 0x79, 0xc7, 0x7d, 0x8b, 0xdd, 0xba, 0xd3, 0x72, 0x1c, 0x86, 0xc1, 0x1d, 0x92, 0x6f, - 0xe0, 0x4f, 0x30, 0x48, 0xa4, 0x2c, 0xcf, 0xc6, 0x16, 0x64, 0x87, 0x1d, 0x76, 0x92, 0x4c, 0x3d, - 0xbe, 0xf7, 0xd3, 0x8f, 0xef, 0xf7, 0x64, 0x70, 0x1b, 0x17, 0xa9, 0x66, 0x82, 0x07, 0xf6, 0xea, - 0x4f, 0xa4, 0xd0, 0x02, 0xee, 0x17, 0xbc, 0xe0, 0xec, 0x39, 0xf3, 0xed, 0xf2, 0xd1, 0xc1, 0x48, - 0x8c, 0x44, 0xf5, 0x2c, 0x28, 0xef, 0x0c, 0xec, 0xc8, 0x1b, 0x09, 0x31, 0xca, 0x68, 0x50, 0xfd, - 0x4a, 0x8a, 0xe7, 0x81, 0x66, 0x39, 0x55, 0x1a, 0xe7, 0x13, 0x0b, 0xe8, 0xaf, 0x02, 0x48, 0x21, - 0x71, 0xa3, 0x73, 0xd4, 0x4f, 0x85, 0xca, 0x85, 0x0a, 0x12, 0xac, 0x68, 0xf0, 0xf2, 0x6e, 0x42, - 0x35, 0xbe, 0x1b, 0xa4, 0x82, 0xd9, 0xe7, 0xe8, 0xc7, 0x16, 0xe8, 0x86, 0x58, 0xd1, 0x53, 0x53, - 0x06, 0x7c, 0x0f, 0x6c, 0x32, 0xe2, 0x3a, 0x03, 0x67, 0xd8, 0x0a, 0x77, 0xe7, 0x33, 0xaf, 0xf3, - 0x1a, 0xe7, 0xd9, 0x27, 0x88, 0x11, 0x14, 0x6d, 0x32, 0x02, 0x4f, 0x40, 0x87, 0x71, 0xa6, 0x19, - 0xd6, 0x42, 0xba, 0x9b, 0x03, 0x67, 0xd8, 0x09, 0x0f, 0xe6, 0x33, 0xef, 0xa6, 0x45, 0xd5, 0x8f, - 0x50, 0xd4, 0xc0, 0xe0, 0x3d, 0xb0, 0x95, 0x09, 0xed, 0x6e, 0x0d, 0x9c, 0x61, 0xf7, 0xe4, 0xd0, - 0x37, 0x05, 0xf9, 0x65, 0x41, 0xbe, 0x2d, 0xc8, 0xbf, 0x2f, 0x18, 0x0f, 0xe1, 0xdb, 0x99, 0xb7, - 0x31, 0x9f, 0x79, 0xc0, 0x90, 0x65, 0x42, 0xa3, 0xa8, 0xdc, 0x09, 0x9f, 0x81, 0x76, 0xc2, 0x08, - 0xa1, 0xd2, 0x6d, 0x55, 0x8a, 0x0f, 0x4a, 0xe0, 0xaf, 0x33, 0x2f, 0x18, 0x31, 0x3d, 0x2e, 0x12, - 0x3f, 0x15, 0x79, 0xf0, 0x84, 0x3f, 0xe1, 0xec, 0x33, 0x16, 0xa4, 0x63, 0xcc, 0x78, 0xa0, 0x5f, - 0x4f, 0xa8, 0xf2, 0x1f, 0x6b, 0xc9, 0xf8, 0xe8, 0x34, 0x4d, 0x4f, 0x09, 0x91, 0x54, 0xa9, 0xf9, - 0xcc, 0xdb, 0x35, 0xdc, 0x86, 0x0e, 0x45, 0x96, 0xb7, 0x2c, 0x31, 0x61, 0xc4, 0xfd, 0xdf, 0x35, - 0x4b, 0x4c, 0xca, 0xb6, 0x94, 0x3b, 0xe1, 0x03, 0xd0, 0x1b, 0x63, 0x15, 0x4b, 0x9a, 0x52, 0xf6, - 0x92, 0x92, 0x38, 0x61, 0x44, 0xb9, 0xed, 0x81, 0x33, 0xdc, 0x09, 0xef, 0xcc, 0x67, 0x9e, 0x6b, - 0xf0, 0x6b, 0x10, 0x14, 0xed, 0x8f, 0xb1, 0x8a, 0xec, 0x52, 0xc8, 0x88, 0x82, 0x11, 0xd8, 0xa1, - 0x9c, 0xc4, 0xe5, 0x39, 0xbb, 0xdb, 0x55, 0x3d, 0x47, 0xbe, 0x39, 0x63, 0xbf, 0x3e, 0x63, 0xff, - 0xab, 0xda, 0x04, 0xe1, 0xb1, 0x2d, 0x68, 0xdf, 0x08, 0xd4, 0x3b, 0xd1, 0x9b, 0x77, 0x9e, 0x13, - 0x6d, 0x53, 0x4e, 0x4a, 0x28, 0xfc, 0x06, 0xdc, 0xc8, 0xf1, 0x34, 0x5e, 0xf0, 0xee, 0x5c, 0xc9, - 0xeb, 0x59, 0xde, 0x5b, 0x86, 0x77, 0x79, 0xb7, 0xe1, 0x06, 0x39, 0x9e, 0x7e, 0x6a, 0xe8, 0x91, - 0x04, 0x7b, 0x8f, 0x0b, 0x39, 0xc9, 0x0a, 0x55, 0xbb, 0xe8, 0x19, 0xb8, 0x51, 0x36, 0x2f, 0xb6, - 0xe6, 0xae, 0xfc, 0xd4, 0x3d, 0xb9, 0xe3, 0xaf, 0x98, 0xde, 0x5f, 0x72, 0x9e, 0x91, 0x3c, 0x9f, - 0x79, 0x4e, 0x23, 0xbb, 0xcc, 0x81, 0xa2, 0x6e, 0xd2, 0xa0, 0xd1, 0x6f, 0x0e, 0xe8, 0x9e, 0xd1, - 0x44, 0xff, 0x6b, 0x8a, 0xf0, 0x05, 0x80, 0xa9, 0x90, 0x92, 0xaa, 0x89, 0xe0, 0x84, 0xf1, 0x51, - 0x4c, 0x68, 0xa2, 0xab, 0x19, 0xf8, 0x5b, 0xcb, 0xbc, 0x6f, 0x3b, 0x79, 0x68, 0x04, 0xd6, 0x29, - 0x50, 0xd4, 0xfb, 0xd3, 0x62, 0xf9, 0x56, 0xe8, 0xfb, 0x2d, 0xd0, 0xbb, 0x2f, 0xb2, 0x0c, 0x6b, - 0x2a, 0x71, 0xf6, 0xdf, 0x7c, 0x49, 0xf8, 0x08, 0x6c, 0x97, 0xc6, 0x2a, 0x27, 0xef, 0xca, 0x70, - 0xf8, 0xbf, 0x55, 0xd8, 0x6b, 0x0c, 0x59, 0x4d, 0x5f, 0x3b, 0xc7, 0xd3, 0x90, 0x11, 0x28, 0x41, - 0x37, 0x13, 0x3a, 0x96, 0x54, 0x17, 0x92, 0x2b, 0xb7, 0x35, 0xd8, 0x1a, 0x76, 0x4f, 0x06, 0x6b, - 0x9d, 0x79, 0x4a, 0xd9, 0x68, 0xac, 0x29, 0xb1, 0x89, 0x10, 0x06, 0x96, 0x16, 0x2e, 0x32, 0xa7, - 0xa6, 0x40, 0x3f, 0xbc, 0xf3, 0x7a, 0x2b, 0x70, 0xaa, 0x22, 0x90, 0x09, 0x1d, 0x59, 0xc4, 0xcf, - 0x0e, 0xd8, 0x5f, 0x41, 0xc0, 0x14, 0x6c, 0x63, 0x73, 0x5b, 0x9d, 0x4e, 0x27, 0x7c, 0xf8, 0xcf, - 0xc3, 0xca, 0xbe, 0xab, 0xe5, 0x43, 0x51, 0xcd, 0x0c, 0x9f, 0x82, 0xf6, 0xab, 0x4a, 0xd7, 0x46, - 0xf0, 0x3d, 0xab, 0xf1, 0xc1, 0x92, 0x86, 0xcd, 0x7d, 0x73, 0xf9, 0x48, 0x91, 0x17, 0x56, 0xe7, - 0x21, 0xd7, 0x4d, 0x0e, 0x1a, 0x16, 0x14, 0x59, 0x3a, 0xf4, 0x53, 0x0b, 0xb4, 0xbf, 0xc4, 0x12, - 0xe7, 0x0a, 0x6a, 0x70, 0x50, 0x36, 0xd9, 0x36, 0x2e, 0xae, 0x3f, 0x2b, 0xd6, 0x73, 0x87, 0x6b, - 0xd9, 0x71, 0x66, 0x01, 0xe1, 0x87, 0xb6, 0xa5, 0xc7, 0xcd, 0x49, 0xad, 0x92, 0xa0, 0xef, 0xca, - 0x08, 0x81, 0x39, 0x9e, 0x5a, 0xdf, 0xd5, 0x9b, 0xcb, 0xa4, 0x4a, 0x18, 0x69, 0xd4, 0x36, 0xaf, - 0x52, 0x5b, 0x09, 0xaa, 0xe5, 0xcd, 0x46, 0xa5, 0x9b, 0x30, 0xb2, 0xa0, 0x7f, 0x05, 0x7a, 0x8c, - 0xa7, 0x92, 0xe6, 0x94, 0xeb, 0x58, 0x99, 0xcc, 0xaa, 0xbc, 0xd7, 0x09, 0x1f, 0x5d, 0xa3, 0x87, - 0x67, 0x34, 0x6d, 0x42, 0x7d, 0x8d, 0x10, 0x45, 0x37, 0x17, 0x6b, 0x36, 0x17, 0x21, 0x07, 0x7b, - 0x0d, 0xae, 0x9a, 0x29, 0xf3, 0x29, 0xfb, 0xfc, 0xda, 0xaa, 0xb7, 0x57, 0x55, 0xcd, 0x78, 0xed, - 0x2e, 0x16, 0xaa, 0xd1, 0xfa, 0xd6, 0x01, 0x07, 0x0d, 0x24, 0x5d, 0x24, 0x49, 0xf5, 0x89, 0xeb, - 0x84, 0x5f, 0x5c, 0x5b, 0xf6, 0x78, 0x55, 0xb6, 0xe1, 0x44, 0xd1, 0xad, 0xc5, 0x72, 0x93, 0x59, - 0x61, 0xf8, 0xf6, 0xa2, 0xef, 0x9c, 0x5f, 0xf4, 0x9d, 0xdf, 0x2f, 0xfa, 0xce, 0x9b, 0xcb, 0xfe, - 0xc6, 0xf9, 0x65, 0x7f, 0xe3, 0x97, 0xcb, 0xfe, 0xc6, 0xd7, 0xc3, 0xbf, 0x1c, 0x85, 0x69, 0xfd, - 0x2f, 0xc9, 0x68, 0x27, 0xed, 0xea, 0xc0, 0x3f, 0xfe, 0x23, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x8e, - 0xcd, 0x3d, 0x45, 0x09, 0x00, 0x00, -} - -func (m *BaseAuction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BaseAuction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BaseAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.MaxEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.MaxEndTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintAuction(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x42 - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintAuction(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x3a - if m.HasReceivedBids { - i-- - if m.HasReceivedBids { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - { - size, err := m.Bid.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.Bidder.Size() - i -= size - if _, err := m.Bidder.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size, err := m.Lot.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Initiator) > 0 { - i -= len(m.Initiator) - copy(dAtA[i:], m.Initiator) - i = encodeVarintAuction(dAtA, i, uint64(len(m.Initiator))) - i-- - dAtA[i] = 0x12 - } - if m.Id != 0 { - i = encodeVarintAuction(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SurplusAuction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SurplusAuction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SurplusAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.BaseAuction.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DebtAuction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DebtAuction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DebtAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.CorrespondingDebt.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.BaseAuction.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CollateralAuction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CollateralAuction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CollateralAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.LotReturns) > 0 { - for iNdEx := len(m.LotReturns) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LotReturns[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - { - size, err := m.MaxBid.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.CorrespondingDebt.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.BaseAuction.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *WeightedAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WeightedAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WeightedAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Weight.Size() - i -= size - if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Address.Size() - i -= size - if _, err := m.Address.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.IncrementCollateral.Size() - i -= size - if _, err := m.IncrementCollateral.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.IncrementDebt.Size() - i -= size - if _, err := m.IncrementDebt.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.IncrementSurplus.Size() - i -= size - if _, err := m.IncrementSurplus.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAuction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.BidDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.BidDuration):]) - if err11 != nil { - return 0, err11 - } - i -= n11 - i = encodeVarintAuction(dAtA, i, uint64(n11)) - i-- - dAtA[i] = 0x12 - n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAuctionDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAuctionDuration):]) - if err12 != nil { - return 0, err12 - } - i -= n12 - i = encodeVarintAuction(dAtA, i, uint64(n12)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintAuction(dAtA []byte, offset int, v uint64) int { - offset -= sovAuction(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BaseAuction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovAuction(uint64(m.Id)) - } - l = len(m.Initiator) - if l > 0 { - n += 1 + l + sovAuction(uint64(l)) - } - l = m.Lot.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.Bidder.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.Bid.Size() - n += 1 + l + sovAuction(uint64(l)) - if m.HasReceivedBids { - n += 2 - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) - n += 1 + l + sovAuction(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.MaxEndTime) - n += 1 + l + sovAuction(uint64(l)) - return n -} - -func (m *SurplusAuction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.BaseAuction.Size() - n += 1 + l + sovAuction(uint64(l)) - return n -} - -func (m *DebtAuction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.BaseAuction.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.CorrespondingDebt.Size() - n += 1 + l + sovAuction(uint64(l)) - return n -} - -func (m *CollateralAuction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.BaseAuction.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.CorrespondingDebt.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.MaxBid.Size() - n += 1 + l + sovAuction(uint64(l)) - if len(m.LotReturns) > 0 { - for _, e := range m.LotReturns { - l = e.Size() - n += 1 + l + sovAuction(uint64(l)) - } - } - return n -} - -func (m *WeightedAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Address.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.Weight.Size() - n += 1 + l + sovAuction(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAuctionDuration) - n += 1 + l + sovAuction(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.BidDuration) - n += 1 + l + sovAuction(uint64(l)) - l = m.IncrementSurplus.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.IncrementDebt.Size() - n += 1 + l + sovAuction(uint64(l)) - l = m.IncrementCollateral.Size() - n += 1 + l + sovAuction(uint64(l)) - return n -} - -func sovAuction(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAuction(x uint64) (n int) { - return sovAuction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BaseAuction) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BaseAuction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BaseAuction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Initiator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Initiator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lot", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Lot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Bidder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bid", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Bid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HasReceivedBids", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.HasReceivedBids = bool(v != 0) - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxEndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.MaxEndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuction(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SurplusAuction) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SurplusAuction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SurplusAuction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAuction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BaseAuction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuction(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DebtAuction) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DebtAuction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DebtAuction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAuction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BaseAuction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CorrespondingDebt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CorrespondingDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuction(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CollateralAuction) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CollateralAuction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CollateralAuction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAuction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BaseAuction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CorrespondingDebt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CorrespondingDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxBid", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LotReturns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LotReturns = append(m.LotReturns, WeightedAddress{}) - if err := m.LotReturns[len(m.LotReturns)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuction(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WeightedAddress) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WeightedAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WeightedAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Address.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuction(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxAuctionDuration", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxAuctionDuration, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidDuration", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.BidDuration, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncrementSurplus", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IncrementSurplus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncrementDebt", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IncrementDebt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncrementCollateral", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IncrementCollateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuction(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAuction(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAuction - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAuction - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAuction - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAuction - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAuction - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAuction - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAuction = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAuction = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAuction = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/auction/types/auctions.go b/deprecated/x/auction/types/auctions.go deleted file mode 100644 index 84a7895fe..000000000 --- a/deprecated/x/auction/types/auctions.go +++ /dev/null @@ -1,320 +0,0 @@ -package types - -import ( - "errors" - "fmt" - "strings" - "time" - - "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/gogo/protobuf/proto" - - ununifitypes "github.com/UnUniFi/chain/deprecated/types" -) - -const ( - CollateralAuctionType = "collateral" - SurplusAuctionType = "surplus" - DebtAuctionType = "debt" - ForwardAuctionPhase = "forward" - ReverseAuctionPhase = "reverse" -) - -// DistantFuture is a very large time value to use as initial the ending time for auctions. -// It is not set to the max time supported. This can cause problems with time comparisons, see https://stackoverflow.com/a/32620397. -// Also amino panics when encoding times ≥ the start of year 10000. -var DistantFuture = time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC) - -// Auction is an interface for handling common actions on auctions. -type Auction interface { - proto.Message - - GetID() uint64 - WithID(uint64) Auction - - GetInitiator() string - GetLot() sdk.Coin - GetBidder() sdk.AccAddress - GetBid() sdk.Coin - GetEndTime() time.Time - - GetType() string - GetPhase() string -} - -var _ Auction = (*SurplusAuction)(nil) -var _ Auction = (*DebtAuction)(nil) -var _ Auction = (*CollateralAuction)(nil) - -// Auctions is a slice of auctions. -type Auctions []Auction - -func UnpackAuction(auctionAny *types.Any) (Auction, error) { - switch auctionAny.TypeUrl { - case "/" + proto.MessageName(&SurplusAuction{}): - var auction SurplusAuction - auction.Unmarshal(auctionAny.Value) - return &auction, nil - case "/" + proto.MessageName(&DebtAuction{}): - var auction DebtAuction - auction.Unmarshal(auctionAny.Value) - return &auction, nil - case "/" + proto.MessageName(&CollateralAuction{}): - var auction CollateralAuction - auction.Unmarshal(auctionAny.Value) - return &auction, nil - default: - return nil, fmt.Errorf("this Any doesn't have Auction value") - } -} - -// GetID is a getter for auction ID. -func (a BaseAuction) GetID() uint64 { return a.Id } - -// GetBidder is a getter for auction Bidder. -func (a BaseAuction) GetBidder() sdk.AccAddress { return a.Bidder.AccAddress() } - -// GetType returns the auction type. Used to identify auctions in event attributes. -func (a BaseAuction) GetType() string { return "base" } - -// Validate verifies that the auction end time is before max end time -func (a BaseAuction) Validate() error { - // ID can be 0 for surplus, debt and collateral auctions - if strings.TrimSpace(a.Initiator) == "" { - return errors.New("auction initiator cannot be blank") - } - if !a.Lot.IsValid() { - return fmt.Errorf("invalid lot: %s", a.Lot) - } - // NOTE: bidder can be empty for Surplus and Collateral auctions - err := a.Bidder.VerifyAddressFormat() - if a.Bidder.Size() != 0 && err != nil { - return fmt.Errorf("bidder address length is %d", a.Bidder.Len()) - } - if !a.Bid.IsValid() { - return fmt.Errorf("invalid bid: %s", a.Bid) - } - if a.EndTime.Unix() <= 0 || a.MaxEndTime.Unix() <= 0 { - return errors.New("end time cannot be zero") - } - if a.EndTime.After(a.MaxEndTime) { - return fmt.Errorf("MaxEndTime < EndTime (%s < %s)", a.MaxEndTime, a.EndTime) - } - return nil -} - -// WithID returns an auction with the ID set. -func (a SurplusAuction) WithID(id uint64) Auction { a.Id = id; return &a } - -// GetType returns the auction type. Used to identify auctions in event attributes. -func (a SurplusAuction) GetType() string { return SurplusAuctionType } - -// GetModuleAccountCoins returns the total number of coins held in the module account for this auction. -// It is used in genesis initialize the module account correctly. -func (a SurplusAuction) GetModuleAccountCoins() sdk.Coins { - // a.Bid is paid out on bids, so is never stored in the module account - return sdk.NewCoins(a.Lot) -} - -// GetPhase returns the direction of a surplus auction, which never changes. -func (a SurplusAuction) GetPhase() string { return ForwardAuctionPhase } - -// NewSurplusAuction returns a new surplus auction. -func NewSurplusAuction(seller string, lot sdk.Coin, bidDenom string, endTime time.Time) SurplusAuction { - auction := SurplusAuction{BaseAuction{ - // no ID - Initiator: seller, - Lot: lot, - Bidder: nil, - Bid: sdk.NewInt64Coin(bidDenom, 0), - HasReceivedBids: false, // new auctions don't have any bids - EndTime: endTime, - MaxEndTime: endTime, - }} - return auction -} - -// WithID returns an auction with the ID set. -func (a DebtAuction) WithID(id uint64) Auction { a.Id = id; return &a } - -// GetType returns the auction type. Used to identify auctions in event attributes. -func (a DebtAuction) GetType() string { return DebtAuctionType } - -// GetModuleAccountCoins returns the total number of coins held in the module account for this auction. -// It is used in genesis initialize the module account correctly. -func (a DebtAuction) GetModuleAccountCoins() sdk.Coins { - // a.Lot is minted at auction close, so is never stored in the module account - // a.Bid is paid out on bids, so is never stored in the module account - return sdk.NewCoins(a.CorrespondingDebt) -} - -// GetPhase returns the direction of a debt auction, which never changes. -func (a DebtAuction) GetPhase() string { return ReverseAuctionPhase } - -// Validate validates the DebtAuction fields values. -func (a DebtAuction) Validate() error { - if !a.CorrespondingDebt.IsValid() { - return fmt.Errorf("invalid corresponding debt: %s", a.CorrespondingDebt) - } - return a.BaseAuction.Validate() -} - -// NewDebtAuction returns a new debt auction. -func NewDebtAuction(buyerModAccName string, bid sdk.Coin, initialLot sdk.Coin, endTime time.Time, debt sdk.Coin) DebtAuction { - // Note: Bidder is set to the initiator's module account address instead of module name. (when the first bid is placed, it is paid out to the initiator) - // Setting to the module account address bypasses calling supply.SendCoinsFromModuleToModule, instead calls SendCoinsFromModuleToAccount. - // This isn't a problem currently, but if additional logic/validation was added for sending to coins to Module Accounts, it would be bypassed. - auction := DebtAuction{ - BaseAuction: BaseAuction{ - // no ID - Initiator: buyerModAccName, - Lot: initialLot, - Bidder: authtypes.NewModuleAddress(buyerModAccName).Bytes(), // send proceeds from the first bid to the buyer. - Bid: bid, // amount that the buyer is buying - doesn't change over course of auction - HasReceivedBids: false, // new auctions don't have any bids - EndTime: endTime, - MaxEndTime: endTime, - }, - CorrespondingDebt: debt, - } - return auction -} - -// CollateralAuction is a two phase auction. -// Initially, in forward auction phase, bids can be placed up to a max bid. -// Then it switches to a reverse auction phase, where the initial amount up for auction is bid down. -// Unsold Lot is sent to LotReturns, being divided among the addresses by weight. -// Collateral auctions are normally used to sell off collateral seized from Cdps. - -// WithID returns an auction with the ID set. -func (a CollateralAuction) WithID(id uint64) Auction { a.Id = id; return &a } - -// GetType returns the auction type. Used to identify auctions in event attributes. -func (a CollateralAuction) GetType() string { return CollateralAuctionType } - -// GetModuleAccountCoins returns the total number of coins held in the module account for this auction. -// It is used in genesis initialize the module account correctly. -func (a CollateralAuction) GetModuleAccountCoins() sdk.Coins { - // a.Bid is paid out on bids, so is never stored in the module account - return sdk.NewCoins(a.Lot).Add(sdk.NewCoins(a.CorrespondingDebt)...) -} - -// IsReversePhase returns whether the auction has switched over to reverse phase or not. -// CollateralAuctions initially start in forward phase. -func (a CollateralAuction) IsReversePhase() bool { - return a.Bid.IsEqual(a.MaxBid) -} - -// GetPhase returns the direction of a collateral auction. -func (a CollateralAuction) GetPhase() string { - if a.IsReversePhase() { - return ReverseAuctionPhase - } - return ForwardAuctionPhase -} - -// Validate validates the CollateralAuction fields values. -func (a CollateralAuction) Validate() error { - if !a.CorrespondingDebt.IsValid() { - return fmt.Errorf("invalid corresponding debt: %s", a.CorrespondingDebt) - } - if !a.MaxBid.IsValid() { - return fmt.Errorf("invalid max bid: %s", a.MaxBid) - } - if err := WeightedAddresses(a.LotReturns).Validate(); err != nil { - return fmt.Errorf("invalid lot returns: %w", err) - } - return a.BaseAuction.Validate() -} - -// NewCollateralAuction returns a new collateral auction. -func NewCollateralAuction(seller string, lot sdk.Coin, endTime time.Time, maxBid sdk.Coin, lotReturns WeightedAddresses, debt sdk.Coin) CollateralAuction { - auction := CollateralAuction{ - BaseAuction: BaseAuction{ - // no ID - Initiator: seller, - Lot: lot, - Bidder: nil, - Bid: sdk.NewInt64Coin(maxBid.Denom, 0), - HasReceivedBids: false, // new auctions don't have any bids - EndTime: endTime, - MaxEndTime: endTime}, - CorrespondingDebt: debt, - MaxBid: maxBid, - LotReturns: lotReturns, - } - return auction -} - -type WeightedAddresses []WeightedAddress - -// NewWeightedAddresses returns a new list addresses with weights. -func NewWeightedAddresses(addrs []sdk.AccAddress, weights []sdk.Int) (WeightedAddresses, error) { - if len(addrs) < 1 { - return nil, fmt.Errorf("must be at least 1 weighted address") - } - - if len(addrs) != len(weights) { - return nil, fmt.Errorf("number of addresses doesn't match number of weights, %d ≠ %d", len(addrs), len(weights)) - } - - var was WeightedAddresses - - for i := range addrs { - wa := WeightedAddress{ - Address: ununifitypes.StringAccAddress(addrs[i]), - Weight: weights[i], - } - - was = append(was, wa) - } - if err := was.Validate(); err != nil { - return WeightedAddresses{}, err - } - return was, nil -} - -// Validate checks for that the weights are not negative, not all zero, and the lengths match. -func (was WeightedAddresses) Validate() error { - totalWeight := sdk.ZeroInt() - for i := range was { - if was[i].Address.AccAddress().Empty() { - return fmt.Errorf("address %d cannot be empty", i) - } - if err := was[i].Address.VerifyAddressFormat(); err != nil { - return fmt.Errorf("address %d has an address length is %d", i, was[i].Address.Len()) - } - if was[i].Weight.IsNegative() { - return fmt.Errorf("weight %d contains a negative amount: %s", i, was[i].Weight) - } - totalWeight = totalWeight.Add(was[i].Weight) - } - - if !totalWeight.IsPositive() { - return fmt.Errorf("total weight must be positive") - } - - return nil -} - -func (was WeightedAddresses) Addresses() []sdk.AccAddress { - var address []sdk.AccAddress - - for i := range was { - address = append(address, was[i].Address.AccAddress()) - } - - return address -} - -func (was WeightedAddresses) Weights() []sdk.Int { - var weights []sdk.Int - - for i := range was { - weights = append(weights, was[i].Weight) - } - - return weights -} diff --git a/deprecated/x/auction/types/auctions_test.go b/deprecated/x/auction/types/auctions_test.go deleted file mode 100644 index ad51320a2..000000000 --- a/deprecated/x/auction/types/auctions_test.go +++ /dev/null @@ -1,475 +0,0 @@ -package types - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - ununifitypes "github.com/UnUniFi/chain/deprecated/types" -) - -const ( - TestInitiatorModuleName = "liquidator" - TestLotDenom = "jpu" - TestLotAmount = 100 - TestBidDenom = "guu" - TestBidAmount = 20 - TestDebtDenom = "debt" - TestDebtAmount1 = 20 - TestDebtAmount2 = 15 - TestExtraEndTime = 10000 - TestAuctionID = 9999123 - testAccAddress1 = "ununifi1hsh64ca3q68tnvqyt8mn5knfcm7jyesr5prcns" - testAccAddress2 = "ununifi1qq6xpcc4xhzxgkw4m9n8lew8sfmt3sn2r6usnl" -) - -func init() { - sdk.GetConfig().SetBech32PrefixForAccount("ununifi", "ununifi"+sdk.PrefixPublic) -} - -func d(amount string) sdk.Dec { return sdk.MustNewDecFromStr(amount) } -func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -func i(n int64) sdk.Int { return sdk.NewInt(n) } -func is(ns ...int64) (is []sdk.Int) { - for _, n := range ns { - is = append(is, sdk.NewInt(n)) - } - return -} - -func TestNewWeightedAddresses(t *testing.T) { - addr1, err := sdk.AccAddressFromBech32(testAccAddress1) - require.NoError(t, err) - - addr2, err := sdk.AccAddressFromBech32(testAccAddress2) - require.NoError(t, err) - - tests := []struct { - name string - addresses []sdk.AccAddress - weights []sdk.Int - expPass bool - }{ - { - "normal", - []sdk.AccAddress{addr1, addr2}, - []sdk.Int{sdk.NewInt(6), sdk.NewInt(8)}, - true, - }, - { - "empty address", - []sdk.AccAddress{nil, nil}, - []sdk.Int{sdk.NewInt(6), sdk.NewInt(8)}, - false, - }, - { - "mismatched", - []sdk.AccAddress{addr1, addr2}, - []sdk.Int{sdk.NewInt(6)}, - false, - }, - { - "negative weight", - []sdk.AccAddress{addr1, addr2}, - is(6, -8), - false, - }, - { - "zero weight", - []sdk.AccAddress{addr1, addr2}, - is(0, 0), - false, - }, - } - - // Run NewWeightedAdresses tests - for _, tc := range tests { - // Attempt to instantiate new WeightedAddresses - weightedAddresses, err := NewWeightedAddresses(tc.addresses, tc.weights) - - if tc.expPass { - require.NoError(t, err) - require.Equal(t, tc.addresses, weightedAddresses.Addresses()) - require.Equal(t, tc.weights, weightedAddresses.Weights()) - } else { - require.Error(t, err) - } - } -} - -func TestBaseAuctionValidate(t *testing.T) { - addr1, err := sdk.AccAddressFromBech32(testAccAddress1) - require.NoError(t, err) - - now := time.Now() - - tests := []struct { - msg string - auction BaseAuction - expPass bool - }{ - { - "valid auction", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - true, - }, - { - "blank initiator", - BaseAuction{ - Id: 1, - Initiator: "", - }, - false, - }, - { - "invalid lot", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: sdk.Coin{Denom: "%DENOM", Amount: sdk.NewInt(1)}, - }, - false, - }, - { - "empty bidder", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress{}, - }, - false, - }, - { - "invalid bidder", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1[:10]), - }, - false, - }, - { - "invalid bid", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: sdk.Coin{Denom: "%DENOM", Amount: sdk.NewInt(1)}, - }, - false, - }, - { - "invalid end time", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: time.Unix(0, 0), - }, - false, - }, - { - "max end time > endtime", - BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now.Add(time.Minute), - MaxEndTime: now, - }, - false, - }, - } - - for _, tc := range tests { - - err := tc.auction.Validate() - - if tc.expPass { - require.NoError(t, err, tc.msg) - } else { - require.Error(t, err, tc.msg) - } - } -} - -func TestDebtAuctionValidate(t *testing.T) { - addr1, err := sdk.AccAddressFromBech32(testAccAddress1) - require.NoError(t, err) - - now := time.Now() - - tests := []struct { - msg string - auction DebtAuction - expPass bool - }{ - { - "valid auction", - DebtAuction{ - BaseAuction: BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - CorrespondingDebt: c("guu", 1), - }, - true, - }, - { - "invalid corresponding debt", - DebtAuction{ - BaseAuction: BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - CorrespondingDebt: sdk.Coin{Denom: "%DENOM", Amount: sdk.NewInt(1)}, - }, - false, - }, - } - - for _, tc := range tests { - - err := tc.auction.Validate() - - if tc.expPass { - require.NoError(t, err, tc.msg) - } else { - require.Error(t, err, tc.msg) - } - } -} - -func TestCollateralAuctionValidate(t *testing.T) { - addr1, err := sdk.AccAddressFromBech32(testAccAddress1) - require.NoError(t, err) - - now := time.Now() - - tests := []struct { - msg string - auction CollateralAuction - expPass bool - }{ - { - "valid auction", - CollateralAuction{ - BaseAuction: BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - CorrespondingDebt: c("guu", 1), - MaxBid: c("guu", 1), - LotReturns: WeightedAddresses{ - { - Address: ununifitypes.StringAccAddress(addr1), - Weight: sdk.NewInt(1), - }, - }, - }, - true, - }, - { - "invalid corresponding debt", - CollateralAuction{ - BaseAuction: BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - CorrespondingDebt: sdk.Coin{Denom: "%DENOM", Amount: sdk.NewInt(1)}, - }, - false, - }, - { - "invalid max bid", - CollateralAuction{ - BaseAuction: BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - CorrespondingDebt: c("guu", 1), - MaxBid: sdk.Coin{Denom: "%DENOM", Amount: sdk.NewInt(1)}, - }, - false, - }, - { - "invalid lot returns", - CollateralAuction{ - BaseAuction: BaseAuction{ - Id: 1, - Initiator: testAccAddress1, - Lot: c("guu", 1), - Bidder: ununifitypes.StringAccAddress(addr1), - Bid: c("guu", 1), - EndTime: now, - MaxEndTime: now, - HasReceivedBids: true, - }, - CorrespondingDebt: c("guu", 1), - MaxBid: c("guu", 1), - LotReturns: WeightedAddresses{ - { - Address: nil, - Weight: sdk.NewInt(1), - }, - }, - }, - false, - }, - } - - for _, tc := range tests { - - err := tc.auction.Validate() - - if tc.expPass { - require.NoError(t, err, tc.msg) - } else { - require.Error(t, err, tc.msg) - } - } -} - -func TestBaseAuctionGetters(t *testing.T) { - endTime := time.Now().Add(TestExtraEndTime) - - // Create a new BaseAuction (via SurplusAuction) - auction := NewSurplusAuction( - TestInitiatorModuleName, - c(TestLotDenom, TestLotAmount), - TestBidDenom, endTime, - ) - - auctionID := auction.GetID() - auctionBid := auction.GetBid() - auctionLot := auction.GetLot() - auctionEndTime := auction.GetEndTime() - auctionString := auction.String() - - require.Equal(t, auction.Id, auctionID) - require.Equal(t, auction.Bid, auctionBid) - require.Equal(t, auction.Lot, auctionLot) - require.Equal(t, auction.EndTime, auctionEndTime) - require.NotNil(t, auctionString) -} - -func TestNewSurplusAuction(t *testing.T) { - endTime := time.Now().Add(TestExtraEndTime) - - // Create a new SurplusAuction - surplusAuction := NewSurplusAuction( - TestInitiatorModuleName, - c(TestLotDenom, TestLotAmount), - TestBidDenom, endTime, - ) - - require.Equal(t, surplusAuction.Initiator, TestInitiatorModuleName) - require.Equal(t, surplusAuction.Lot, c(TestLotDenom, TestLotAmount)) - require.Equal(t, surplusAuction.Bid, c(TestBidDenom, 0)) - require.Equal(t, surplusAuction.EndTime, endTime) - require.Equal(t, surplusAuction.MaxEndTime, endTime) -} - -func TestNewDebtAuction(t *testing.T) { - endTime := time.Now().Add(TestExtraEndTime) - - // Create a new DebtAuction - debtAuction := NewDebtAuction( - TestInitiatorModuleName, - c(TestBidDenom, TestBidAmount), - c(TestLotDenom, TestLotAmount), - endTime, - c(TestDebtDenom, TestDebtAmount1), - ) - - require.Equal(t, debtAuction.Initiator, TestInitiatorModuleName) - require.Equal(t, debtAuction.Lot, c(TestLotDenom, TestLotAmount)) - require.Equal(t, debtAuction.Bid, c(TestBidDenom, TestBidAmount)) - require.Equal(t, debtAuction.EndTime, endTime) - require.Equal(t, debtAuction.MaxEndTime, endTime) - require.Equal(t, debtAuction.CorrespondingDebt, c(TestDebtDenom, TestDebtAmount1)) -} - -func TestNewCollateralAuction(t *testing.T) { - // Set up WeightedAddresses - addresses := []sdk.AccAddress{ - sdk.AccAddress([]byte(testAccAddress1)), - sdk.AccAddress([]byte(testAccAddress2)), - } - - weights := []sdk.Int{ - sdk.NewInt(6), - sdk.NewInt(8), - } - - weightedAddresses, _ := NewWeightedAddresses(addresses, weights) - - endTime := time.Now().Add(TestExtraEndTime) - - collateralAuction := NewCollateralAuction( - TestInitiatorModuleName, - c(TestLotDenom, TestLotAmount), - endTime, - c(TestBidDenom, TestBidAmount), - weightedAddresses, - c(TestDebtDenom, TestDebtAmount2), - ) - - require.Equal(t, collateralAuction.BaseAuction.Initiator, TestInitiatorModuleName) - require.Equal(t, collateralAuction.BaseAuction.Lot, c(TestLotDenom, TestLotAmount)) - require.Equal(t, collateralAuction.BaseAuction.Bid, c(TestBidDenom, 0)) - require.Equal(t, collateralAuction.BaseAuction.EndTime, endTime) - require.Equal(t, collateralAuction.BaseAuction.MaxEndTime, endTime) - require.Equal(t, collateralAuction.MaxBid, c(TestBidDenom, TestBidAmount)) - require.Equal(t, collateralAuction.LotReturns, weightedAddresses) - require.Equal(t, collateralAuction.CorrespondingDebt, c(TestDebtDenom, TestDebtAmount2)) -} diff --git a/deprecated/x/auction/types/codec.go b/deprecated/x/auction/types/codec.go deleted file mode 100644 index 9f804e93a..000000000 --- a/deprecated/x/auction/types/codec.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 - -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgPlaceBid{}, - ) - registry.RegisterImplementations((*Auction)(nil), - &SurplusAuction{}, - &DebtAuction{}, - &CollateralAuction{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) diff --git a/deprecated/x/auction/types/errors.go b/deprecated/x/auction/types/errors.go deleted file mode 100644 index f6d00ea30..000000000 --- a/deprecated/x/auction/types/errors.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/auction module sentinel errors -var ( - // ErrInvalidInitialAuctionID error for when the initial auction ID hasn't been set - ErrInvalidInitialAuctionID = sdkerrors.Register(ModuleName, 2, "initial auction ID hasn't been set") - // ErrUnrecognizedAuctionType error for unrecognized auction type - ErrUnrecognizedAuctionType = sdkerrors.Register(ModuleName, 3, "unrecognized auction type") - // ErrAuctionNotFound error for when an auction is not found - ErrAuctionNotFound = sdkerrors.Register(ModuleName, 4, "auction not found") - // ErrAuctionHasNotExpired error for attempting to close an auction that has not passed its end time - ErrAuctionHasNotExpired = sdkerrors.Register(ModuleName, 5, "auction can't be closed as curent block time has not passed auction end time") - // ErrAuctionHasExpired error for when an auction is closed and unavailable for bidding - ErrAuctionHasExpired = sdkerrors.Register(ModuleName, 6, "auction has closed") - // ErrInvalidBidDenom error for when bid denom doesn't match auction bid denom - ErrInvalidBidDenom = sdkerrors.Register(ModuleName, 7, "bid denom doesn't match auction bid denom") - // ErrInvalidLotDenom error for when lot denom doesn't match auction lot denom - ErrInvalidLotDenom = sdkerrors.Register(ModuleName, 8, "lot denom doesn't match auction lot denom") - // ErrBidTooSmall error for when bid is not greater than auction's min bid amount - ErrBidTooSmall = sdkerrors.Register(ModuleName, 9, "bid is not greater than auction's min new bid amount") - // ErrBidTooLarge error for when bid is larger than auction's maximum allowed bid - ErrBidTooLarge = sdkerrors.Register(ModuleName, 10, "bid is greater than auction's max bid") - // ErrLotTooSmall error for when lot is less than zero - ErrLotTooSmall = sdkerrors.Register(ModuleName, 11, "lot is not greater than auction's min new lot amount") - // ErrLotTooLarge error for when lot is not smaller than auction's max new lot amount - ErrLotTooLarge = sdkerrors.Register(ModuleName, 12, "lot is greater than auction's max new lot amount") -) diff --git a/deprecated/x/auction/types/events.go b/deprecated/x/auction/types/events.go deleted file mode 100644 index b93899453..000000000 --- a/deprecated/x/auction/types/events.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -// Events for the module -const ( - EventTypeAuctionStart = "auction_start" - EventTypeAuctionBid = "auction_bid" - EventTypeAuctionClose = "auction_close" - - AttributeValueCategory = ModuleName - AttributeKeyAuctionID = "auction_id" - AttributeKeyAuctionType = "auction_type" - AttributeKeyBidder = "bidder" - AttributeKeyLot = "lot" - AttributeKeyMaxBid = "max_bid" - AttributeKeyBid = "bid" - AttributeKeyEndTime = "end_time" - AttributeKeyCloseBlock = "close_block" -) diff --git a/deprecated/x/auction/types/expected_keepers.go b/deprecated/x/auction/types/expected_keepers.go deleted file mode 100644 index 89d90e3af..000000000 --- a/deprecated/x/auction/types/expected_keepers.go +++ /dev/null @@ -1,85 +0,0 @@ -package types - -import ( - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -type AccountKeeper interface { - // Return a new account with the next account number and the specified address. Does not save the new account to the store. - NewAccountWithAddress(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Return a new account with the next account number. Does not save the new account to the store. - NewAccount(sdk.Context, authtypes.AccountI) authtypes.AccountI - - // Retrieve an account from the store. - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Set an account in the store. - SetAccount(sdk.Context, authtypes.AccountI) - - // Remove an account from the store. - RemoveAccount(sdk.Context, authtypes.AccountI) - - // Iterate over all accounts, calling the provided function. Stop iteraiton when it returns false. - IterateAccounts(sdk.Context, func(authtypes.AccountI) bool) - - // Fetch the public key of an account at a specified address - GetPubKey(sdk.Context, sdk.AccAddress) (cryptotypes.PubKey, error) - - // Fetch the sequence of an account at a specified address. - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) - - GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI -} - -type BankKeeper interface { - // View - ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error - HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool - - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetAccountsBalances(ctx sdk.Context) []banktypes.Balance - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(coin sdk.Coin) (stop bool)) - IterateAllBalances(ctx sdk.Context, cb func(address sdk.AccAddress, coin sdk.Coin) (stop bool)) - - // Send - InputOutputCoins(ctx sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - - GetParams(ctx sdk.Context) banktypes.Params - SetParams(ctx sdk.Context, params banktypes.Params) error - - BlockedAddr(addr sdk.AccAddress) bool - - // - InitGenesis(sdk.Context, *banktypes.GenesisState) - ExportGenesis(sdk.Context) *banktypes.GenesisState - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error) - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) - IterateAllDenomMetaData(ctx sdk.Context, cb func(banktypes.Metadata) bool) - - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - - DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error - UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error -} diff --git a/deprecated/x/auction/types/genesis.go b/deprecated/x/auction/types/genesis.go deleted file mode 100644 index 139a8aa1d..000000000 --- a/deprecated/x/auction/types/genesis.go +++ /dev/null @@ -1,129 +0,0 @@ -package types - -import ( - "bytes" - "fmt" - - "github.com/cosmos/cosmos-sdk/codec/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultNextAuctionID is the starting poiint for auction IDs. -const DefaultNextAuctionID uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - params := DefaultParams() - return &GenesisState{ - NextAuctionId: DefaultNextAuctionID, - Params: params, - Auctions: []*types.Any{}, - // this line is used by starport scaffolding # genesis/types/default - // AuctionList: []*Auction{}, - } -} - -// NewGenesisState returns a new genesis state object for auctions module. -func NewGenesisState(nextID uint64, ap Params, ga []*types.Any) GenesisState { - return GenesisState{ - NextAuctionId: nextID, - Params: ap, - Auctions: ga, - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - // Check for duplicated ID in auction - // auctionIdMap := make(map[string]bool) - - // for _, elem := range gs.AuctionList { - // if _, ok := auctionIdMap[elem.Id]; ok { - // return fmt.Errorf("duplicated id for auction") - // } - // auctionIdMap[elem.Id] = true - // } - if err := gs.Params.Validate(); err != nil { - return err - } - - ids := map[uint64]bool{} - auctions, err := UnpackGenesisAuctions(gs.Auctions) - if err != nil { - return err - } - for _, a := range auctions { - - if err := a.Validate(); err != nil { - return fmt.Errorf("found invalid auction: %w", err) - } - - if ids[a.GetID()] { - return fmt.Errorf("found duplicate auction ID (%d)", a.GetID()) - } - ids[a.GetID()] = true - - if a.GetID() >= gs.NextAuctionId { - return fmt.Errorf("found auction ID ≥ the nextAuctionID (%d ≥ %d)", a.GetID(), gs.NextAuctionId) - } - } - return nil -} - -// Equal checks whether two GenesisState structs are equivalent. -func (gs GenesisState) Equal(gs2 GenesisState) bool { - b1 := ModuleCdc.MustMarshal(&gs) - b2 := ModuleCdc.MustMarshal(&gs2) - return bytes.Equal(b1, b2) -} - -// IsEmpty returns true if a GenesisState is empty. -func (gs GenesisState) IsEmpty() bool { - return gs.Equal(GenesisState{}) -} - -// GenesisAuction is an interface that extends the auction interface to add functionality needed for initializing auctions from genesis. -type GenesisAuction interface { - Auction - GetModuleAccountCoins() sdk.Coins - Validate() error -} - -var _ GenesisAuction = (*SurplusAuction)(nil) -var _ GenesisAuction = (*DebtAuction)(nil) -var _ GenesisAuction = (*CollateralAuction)(nil) - -// GenesisAuctions is a slice of genesis auctions. -type GenesisAuctions []GenesisAuction - -func PackGenesisAuctions(auctions GenesisAuctions) ([]*codectypes.Any, error) { - auctionAny := make([]*types.Any, len(auctions)) - for i, auc := range auctions { - any, err := types.NewAnyWithValue(auc) - if err != nil { - return nil, err - } - auctionAny[i] = any - } - - return auctionAny, nil -} - -func UnpackGenesisAuctions(auctionsAny []*types.Any) (GenesisAuctions, error) { - accounts := make(GenesisAuctions, len(auctionsAny)) - for i, any := range auctionsAny { - acc, ok := any.GetCachedValue().(GenesisAuction) - if !ok { - return nil, fmt.Errorf("expected genesis account") - } - accounts[i] = acc - } - - return accounts, nil -} diff --git a/deprecated/x/auction/types/genesis.pb.go b/deprecated/x/auction/types/genesis.pb.go deleted file mode 100644 index db9eb054e..000000000 --- a/deprecated/x/auction/types/genesis.pb.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: auction/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the auction module's genesis state. -type GenesisState struct { - NextAuctionId uint64 `protobuf:"varint,1,opt,name=next_auction_id,json=nextAuctionId,proto3" json:"next_auction_id,omitempty" yaml:"next_auction_id"` - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params" yaml:"params"` - Auctions []*types.Any `protobuf:"bytes,3,rep,name=auctions,proto3" json:"auctions,omitempty" yaml:"auctions"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_ec0c841528c842a6, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetNextAuctionId() uint64 { - if m != nil { - return m.NextAuctionId - } - return 0 -} - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetAuctions() []*types.Any { - if m != nil { - return m.Auctions - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.auction.GenesisState") -} - -func init() { proto.RegisterFile("auction/genesis.proto", fileDescriptor_ec0c841528c842a6) } - -var fileDescriptor_ec0c841528c842a6 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x31, 0x6e, 0xc2, 0x30, - 0x14, 0x86, 0xe3, 0x52, 0xa1, 0x2a, 0x14, 0x21, 0xa5, 0xd0, 0x52, 0x06, 0x07, 0x65, 0xca, 0x64, - 0x0b, 0xba, 0x75, 0x23, 0x52, 0xa9, 0xba, 0x55, 0x54, 0x2c, 0x5d, 0x90, 0x13, 0x4c, 0xb0, 0x44, - 0xec, 0x08, 0x3b, 0x15, 0xb9, 0x45, 0x8f, 0xc5, 0xc8, 0xd8, 0x29, 0x6a, 0xe1, 0x06, 0x9c, 0xa0, - 0x22, 0x76, 0x18, 0x98, 0xec, 0xf7, 0xbe, 0xff, 0x7f, 0xcf, 0xfe, 0xed, 0x0e, 0xc9, 0x22, 0xc5, - 0x04, 0xc7, 0x31, 0xe5, 0x54, 0x32, 0x89, 0xd2, 0xb5, 0x50, 0xc2, 0x69, 0x65, 0x3c, 0xe3, 0x6c, - 0xc1, 0x90, 0xc1, 0xbd, 0x76, 0x2c, 0x62, 0x51, 0x32, 0x7c, 0xba, 0x69, 0x59, 0xef, 0x31, 0x16, - 0x22, 0x5e, 0x51, 0x5c, 0x56, 0x61, 0xb6, 0xc0, 0x84, 0xe7, 0x06, 0xb9, 0x97, 0x48, 0xb1, 0x84, - 0x4a, 0x45, 0x92, 0xd4, 0x08, 0x60, 0x24, 0x64, 0x22, 0x24, 0x0e, 0x89, 0xa4, 0xf8, 0x6b, 0x10, - 0x52, 0x45, 0x06, 0x38, 0x12, 0x8c, 0x57, 0xb3, 0x35, 0x9f, 0xe9, 0xa5, 0xba, 0x30, 0xe8, 0xfc, - 0x68, 0x73, 0xea, 0xb6, 0xf7, 0x07, 0xec, 0xdb, 0x57, 0xfd, 0x8d, 0x0f, 0x45, 0x14, 0x75, 0x02, - 0xbb, 0xc5, 0xe9, 0x46, 0xcd, 0x8c, 0x6c, 0xc6, 0xe6, 0x5d, 0xd0, 0x07, 0xfe, 0x75, 0xd0, 0x3b, - 0x16, 0xee, 0x7d, 0x4e, 0x92, 0xd5, 0xb3, 0x77, 0x21, 0xf0, 0x26, 0xcd, 0x53, 0x67, 0xa4, 0x1b, - 0x6f, 0x73, 0x67, 0x6c, 0xd7, 0x53, 0xb2, 0x26, 0x89, 0xec, 0x5e, 0xf5, 0x81, 0xdf, 0x18, 0x3e, - 0xa0, 0x8b, 0x68, 0xd0, 0x7b, 0x89, 0x83, 0xce, 0xb6, 0x70, 0xad, 0x63, 0xe1, 0x36, 0xf5, 0x5c, - 0x6d, 0xf2, 0x26, 0xc6, 0xed, 0xbc, 0xd8, 0x37, 0xc6, 0x20, 0xbb, 0xb5, 0x7e, 0xcd, 0x6f, 0x0c, - 0xdb, 0x48, 0x47, 0x84, 0xaa, 0x88, 0xd0, 0x88, 0xe7, 0xc1, 0xdd, 0xb1, 0x70, 0x5b, 0x7a, 0x44, - 0xa5, 0xf7, 0x26, 0x67, 0x6b, 0x10, 0x6c, 0xf7, 0x10, 0xec, 0xf6, 0x10, 0xfc, 0xee, 0x21, 0xf8, - 0x3e, 0x40, 0x6b, 0x77, 0x80, 0xd6, 0xcf, 0x01, 0x5a, 0x9f, 0x7e, 0xcc, 0xd4, 0x32, 0x0b, 0x51, - 0x24, 0x12, 0x3c, 0xe5, 0x53, 0xce, 0xc6, 0x0c, 0x47, 0x4b, 0xc2, 0x38, 0xde, 0x54, 0x39, 0x61, - 0x95, 0xa7, 0x54, 0x86, 0xf5, 0x72, 0xe1, 0xd3, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x51, - 0xeb, 0x87, 0xfc, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Auctions) > 0 { - for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.NextAuctionId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.NextAuctionId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NextAuctionId != 0 { - n += 1 + sovGenesis(uint64(m.NextAuctionId)) - } - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.Auctions) > 0 { - for _, e := range m.Auctions { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NextAuctionId", wireType) - } - m.NextAuctionId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NextAuctionId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Auctions = append(m.Auctions, &types.Any{}) - if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/auction/types/genesis_test.go b/deprecated/x/auction/types/genesis_test.go deleted file mode 100644 index 868d14044..000000000 --- a/deprecated/x/auction/types/genesis_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var testCoin = sdk.NewInt64Coin("test", 20) - -// AuctionをAny型からAuction型に変換 -var unpackAuctions, _ = UnpackGenesisAuctions(DefaultGenesis().Auctions) - -func TestGenesisState_Validate(t *testing.T) { - testCases := []struct { - name string - nextID uint64 - auctions GenesisAuctions - expectPass bool - }{ - // {"default", DefaultGenesis().NextAuctionId, DefaultGenesis().Auctions, true}, - // {"invalid next ID", 54, GenesisAuctions{SurplusAuction{BaseAuction{ID: 105}}}, false}, - {"default", DefaultGenesis().NextAuctionId, unpackAuctions, true}, - {"invalid next ID", 54, GenesisAuctions{&SurplusAuction{BaseAuction{Id: 105}}}, false}, - { - "repeated ID", - 1000, - GenesisAuctions{ - // SurplusAuction{BaseAuction{ID: 105}}, - // DebtAuction{BaseAuction{ID: 105}, testCoin}, - &SurplusAuction{BaseAuction{Id: 105}}, - &DebtAuction{BaseAuction{Id: 105}, testCoin}, - }, - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - // gs := NewGenesisState(tc.nextID, DefaultParams(), tc.auctions) - // NewGenesisStateの引数tc.acutionをAny型に変換 - packAuction, _ := PackGenesisAuctions(tc.auctions) - gs := NewGenesisState(tc.nextID, DefaultParams(), packAuction) - - err := gs.Validate() - - if tc.expectPass { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } - -} diff --git a/deprecated/x/auction/types/keys.go b/deprecated/x/auction/types/keys.go deleted file mode 100644 index 27ca4af7f..000000000 --- a/deprecated/x/auction/types/keys.go +++ /dev/null @@ -1,59 +0,0 @@ -package types - -import ( - "encoding/binary" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName defines the module name - ModuleName = "auction" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_capability" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} - -const ( - ParamsKey = "Params-value-" - AuctionKey = "Auction-value-" - AuctionCountKey = "Auction-count-" - AuctionByTimeKey = "Auction-by-time-" - NextAuctionIDKey = "NextAuctionID-value-" -) - -// GetAuctionKey returns the bytes of an auction key -func GetAuctionKey(auctionID uint64) []byte { - return Uint64ToBytes(auctionID) -} - -// GetAuctionByTimeKey returns the key for iterating auctions by time -func GetAuctionByTimeKey(endTime time.Time, auctionID uint64) []byte { - return append(sdk.FormatTimeBytes(endTime), Uint64ToBytes(auctionID)...) -} - -// Uint64ToBytes converts a uint64 into fixed length bytes for use in store keys. -func Uint64ToBytes(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, uint64(id)) - return bz -} - -// Uint64FromBytes converts some fixed length bytes back into a uint64. -func Uint64FromBytes(bz []byte) uint64 { - return binary.BigEndian.Uint64(bz) -} diff --git a/deprecated/x/auction/types/messages_auction.go b/deprecated/x/auction/types/messages_auction.go deleted file mode 100644 index 98d79c925..000000000 --- a/deprecated/x/auction/types/messages_auction.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - "errors" - fmt "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var _ sdk.Msg = &MsgPlaceBid{} - -// NewMsgPlaceBid returns a new MsgPlaceBid. -func NewMsgPlaceBid(auctionID uint64, bidder sdk.AccAddress, amt sdk.Coin) MsgPlaceBid { - return MsgPlaceBid{ - AuctionId: auctionID, - Bidder: bidder.Bytes(), - Amount: amt, - } -} - -// Route return the message type used for routing the message. -func (msg MsgPlaceBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgPlaceBid) Type() string { return "place_bid" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgPlaceBid) ValidateBasic() error { - if msg.AuctionId == 0 { - return errors.New("auction id cannot be zero") - } - if msg.Bidder.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "bidder address cannot be empty") - } - if err := msg.Bidder.VerifyAddressFormat(); err != nil { - return fmt.Errorf("bidder address length is %d", msg.Bidder.Len()) - } - if !msg.Amount.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "bid amount %s", msg.Amount) - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgPlaceBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgPlaceBid) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Bidder.AccAddress()} -} diff --git a/deprecated/x/auction/types/messages_auction_test.go b/deprecated/x/auction/types/messages_auction_test.go deleted file mode 100644 index b1a8fb059..000000000 --- a/deprecated/x/auction/types/messages_auction_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestMsgPlaceBid_ValidateBasic(t *testing.T) { - addr, err := sdk.AccAddressFromBech32(testAccAddress1) - require.NoError(t, err) - - tests := []struct { - name string - msg MsgPlaceBid - expectPass bool - }{ - { - "normal", - NewMsgPlaceBid(1, addr, c("token", 10)), - true, - }, - { - "zero id", - NewMsgPlaceBid(0, addr, c("token", 10)), - false, - }, - { - "empty address ", - NewMsgPlaceBid(1, nil, c("token", 10)), - false, - }, - { - "zero address", - NewMsgPlaceBid(1, sdk.AccAddress(make([]byte, 0)), c("token", 10)), - false, - }, - { - "toolong address", - NewMsgPlaceBid(1, sdk.AccAddress(make([]byte, 256)), c("token", 10)), - false, - }, - { - "negative amount", - NewMsgPlaceBid(1, addr, sdk.Coin{Denom: "token", Amount: sdk.NewInt(-10)}), - false, - }, - { - "zero amount", - NewMsgPlaceBid(1, addr, c("token", 0)), - true, - }, - } - - for _, tc := range tests { - if tc.expectPass { - require.NoError(t, tc.msg.ValidateBasic(), tc.name) - } else { - require.Error(t, tc.msg.ValidateBasic(), tc.name) - } - } -} diff --git a/deprecated/x/auction/types/params.go b/deprecated/x/auction/types/params.go deleted file mode 100644 index 0b08f2a92..000000000 --- a/deprecated/x/auction/types/params.go +++ /dev/null @@ -1,181 +0,0 @@ -package types - -import ( - "bytes" - "errors" - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramstype "github.com/cosmos/cosmos-sdk/x/params/types" -) - -var emptyDec = sdk.Dec{} - -// Defaults for auction params -const ( - // DefaultMaxAuctionDuration max length of auction - DefaultMaxAuctionDuration time.Duration = 2 * 24 * time.Hour - // DefaultBidDuration how long an auction gets extended when someone bids - DefaultBidDuration time.Duration = 1 * time.Hour -) - -var ( - // DefaultIncrement is the smallest percent change a new bid must have from the old one - DefaultIncrement sdk.Dec = sdk.MustNewDecFromStr("0.05") - // ParamStoreKeyParams Param store key for auction params - KeyBidDuration = []byte("BidDuration") - KeyMaxAuctionDuration = []byte("MaxAuctionDuration") - KeyIncrementSurplus = []byte("IncrementSurplus") - KeyIncrementDebt = []byte("IncrementDebt") - KeyIncrementCollateral = []byte("IncrementCollateral") -) - -var _ paramstype.ParamSet = &Params{} - -// NewParams returns a new Params object. -func NewParams(maxAuctionDuration, bidDuration time.Duration, incrementSurplus, incrementDebt, incrementCollateral sdk.Dec) Params { - return Params{ - MaxAuctionDuration: maxAuctionDuration, - BidDuration: bidDuration, - IncrementSurplus: incrementSurplus, - IncrementDebt: incrementDebt, - IncrementCollateral: incrementCollateral, - } -} - -// DefaultParams returns the default parameters for auctions. -func DefaultParams() Params { - return NewParams( - DefaultMaxAuctionDuration, - DefaultBidDuration, - DefaultIncrement, - DefaultIncrement, - DefaultIncrement, - ) -} - -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstype.KeyTable { - return paramstype.NewKeyTable().RegisterParamSet(&Params{}) -} - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs. -func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { - return paramstype.ParamSetPairs{ - paramstype.NewParamSetPair(KeyBidDuration, &p.BidDuration, validateBidDurationParam), - paramstype.NewParamSetPair(KeyMaxAuctionDuration, &p.MaxAuctionDuration, validateMaxAuctionDurationParam), - paramstype.NewParamSetPair(KeyIncrementSurplus, &p.IncrementSurplus, validateIncrementSurplusParam), - paramstype.NewParamSetPair(KeyIncrementDebt, &p.IncrementDebt, validateIncrementDebtParam), - paramstype.NewParamSetPair(KeyIncrementCollateral, &p.IncrementCollateral, validateIncrementCollateralParam), - } -} - -// Equal returns a boolean determining if two Params types are identical. -func (p Params) Equal(p2 Params) bool { - bz1 := ModuleCdc.MustMarshalLengthPrefixed(&p) - bz2 := ModuleCdc.MustMarshalLengthPrefixed(&p2) - return bytes.Equal(bz1, bz2) -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - if err := validateBidDurationParam(p.BidDuration); err != nil { - return err - } - - if err := validateMaxAuctionDurationParam(p.MaxAuctionDuration); err != nil { - return err - } - - if p.BidDuration > p.MaxAuctionDuration { - return errors.New("bid duration param cannot be larger than max auction duration") - } - - if err := validateIncrementSurplusParam(p.IncrementSurplus); err != nil { - return err - } - - if err := validateIncrementDebtParam(p.IncrementDebt); err != nil { - return err - } - - return validateIncrementCollateralParam(p.IncrementCollateral) -} - -func validateBidDurationParam(i interface{}) error { - bidDuration, ok := i.(time.Duration) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if bidDuration < 0 { - return fmt.Errorf("bid duration cannot be negative %d", bidDuration) - } - - return nil -} - -func validateMaxAuctionDurationParam(i interface{}) error { - maxAuctionDuration, ok := i.(time.Duration) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if maxAuctionDuration < 0 { - return fmt.Errorf("max auction duration cannot be negative %d", maxAuctionDuration) - } - - return nil -} - -func validateIncrementSurplusParam(i interface{}) error { - incrementSurplus, ok := i.(sdk.Dec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if incrementSurplus == emptyDec || incrementSurplus.IsNil() { - return errors.New("surplus auction increment cannot be nil or empty") - } - - if incrementSurplus.IsNegative() { - return fmt.Errorf("surplus auction increment cannot be less than zero %s", incrementSurplus) - } - - return nil -} - -func validateIncrementDebtParam(i interface{}) error { - incrementDebt, ok := i.(sdk.Dec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if incrementDebt == emptyDec || incrementDebt.IsNil() { - return errors.New("debt auction increment cannot be nil or empty") - } - - if incrementDebt.IsNegative() { - return fmt.Errorf("debt auction increment cannot be less than zero %s", incrementDebt) - } - - return nil -} - -func validateIncrementCollateralParam(i interface{}) error { - incrementCollateral, ok := i.(sdk.Dec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if incrementCollateral == emptyDec || incrementCollateral.IsNil() { - return errors.New("collateral auction increment cannot be nil or empty") - } - - if incrementCollateral.IsNegative() { - return fmt.Errorf("collateral auction increment cannot be less than zero %s", incrementCollateral) - } - - return nil -} diff --git a/deprecated/x/auction/types/params_test.go b/deprecated/x/auction/types/params_test.go deleted file mode 100644 index 88d30f43a..000000000 --- a/deprecated/x/auction/types/params_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package types - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -func TestParams_Validate(t *testing.T) { - type fields struct { - } - testCases := []struct { - name string - Params - expectErr bool - }{ - { - "normal", - DefaultParams(), - false, - }, - { - "negativeBid", - Params{ - MaxAuctionDuration: 24 * time.Hour, - BidDuration: -1 * time.Hour, - IncrementSurplus: d("0.05"), - IncrementDebt: d("0.05"), - IncrementCollateral: d("0.05"), - }, - true, - }, - { - "negativeAuction", - Params{ - MaxAuctionDuration: -24 * time.Hour, - BidDuration: 1 * time.Hour, - IncrementSurplus: d("0.05"), - IncrementDebt: d("0.05"), - IncrementCollateral: d("0.05"), - }, - true, - }, - { - "bid>auction", - Params{ - MaxAuctionDuration: 1 * time.Hour, - BidDuration: 24 * time.Hour, - IncrementSurplus: d("0.05"), - IncrementDebt: d("0.05"), - IncrementCollateral: d("0.05"), - }, - true, - }, - { - "negative increment surplus", - Params{ - MaxAuctionDuration: 24 * time.Hour, - BidDuration: 1 * time.Hour, - IncrementSurplus: d("-0.05"), - IncrementDebt: d("0.05"), - IncrementCollateral: d("0.05"), - }, - true, - }, - { - "negative increment debt", - Params{ - MaxAuctionDuration: 24 * time.Hour, - BidDuration: 1 * time.Hour, - IncrementSurplus: d("0.05"), - IncrementDebt: d("-0.05"), - IncrementCollateral: d("0.05"), - }, - true, - }, - { - "negative increment collateral", - Params{ - MaxAuctionDuration: 24 * time.Hour, - BidDuration: 1 * time.Hour, - IncrementSurplus: d("0.05"), - IncrementDebt: d("0.05"), - IncrementCollateral: d("-0.05"), - }, - true, - }, - { - "zero value", - Params{}, - true, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.Params.Validate() - if tc.expectErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - }) - } -} diff --git a/deprecated/x/auction/types/query.pb.go b/deprecated/x/auction/types/query.pb.go deleted file mode 100644 index 2ac84f377..000000000 --- a/deprecated/x/auction/types/query.pb.go +++ /dev/null @@ -1,1381 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: auction/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - query "github.com/cosmos/cosmos-sdk/types/query" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_40c2e1a3071ed575, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_40c2e1a3071ed575, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - -// this line is used by starport scaffolding # 3 -type QueryGetAuctionRequest struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *QueryGetAuctionRequest) Reset() { *m = QueryGetAuctionRequest{} } -func (m *QueryGetAuctionRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetAuctionRequest) ProtoMessage() {} -func (*QueryGetAuctionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_40c2e1a3071ed575, []int{2} -} -func (m *QueryGetAuctionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetAuctionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetAuctionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetAuctionRequest.Merge(m, src) -} -func (m *QueryGetAuctionRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetAuctionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetAuctionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetAuctionRequest proto.InternalMessageInfo - -func (m *QueryGetAuctionRequest) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -type QueryGetAuctionResponse struct { - Auction *types.Any `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty"` -} - -func (m *QueryGetAuctionResponse) Reset() { *m = QueryGetAuctionResponse{} } -func (m *QueryGetAuctionResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetAuctionResponse) ProtoMessage() {} -func (*QueryGetAuctionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_40c2e1a3071ed575, []int{3} -} -func (m *QueryGetAuctionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetAuctionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetAuctionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetAuctionResponse.Merge(m, src) -} -func (m *QueryGetAuctionResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetAuctionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetAuctionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetAuctionResponse proto.InternalMessageInfo - -func (m *QueryGetAuctionResponse) GetAuction() *types.Any { - if m != nil { - return m.Auction - } - return nil -} - -type QueryAllAuctionRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllAuctionRequest) Reset() { *m = QueryAllAuctionRequest{} } -func (m *QueryAllAuctionRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllAuctionRequest) ProtoMessage() {} -func (*QueryAllAuctionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_40c2e1a3071ed575, []int{4} -} -func (m *QueryAllAuctionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAuctionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllAuctionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAuctionRequest.Merge(m, src) -} -func (m *QueryAllAuctionRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAuctionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAuctionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAuctionRequest proto.InternalMessageInfo - -func (m *QueryAllAuctionRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryAllAuctionResponse struct { - Auctions []*types.Any `protobuf:"bytes,1,rep,name=auctions,proto3" json:"auctions,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllAuctionResponse) Reset() { *m = QueryAllAuctionResponse{} } -func (m *QueryAllAuctionResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllAuctionResponse) ProtoMessage() {} -func (*QueryAllAuctionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_40c2e1a3071ed575, []int{5} -} -func (m *QueryAllAuctionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAuctionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllAuctionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAuctionResponse.Merge(m, src) -} -func (m *QueryAllAuctionResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAuctionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAuctionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAuctionResponse proto.InternalMessageInfo - -func (m *QueryAllAuctionResponse) GetAuctions() []*types.Any { - if m != nil { - return m.Auctions - } - return nil -} - -func (m *QueryAllAuctionResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.auction.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.auction.QueryParamsResponse") - proto.RegisterType((*QueryGetAuctionRequest)(nil), "ununifi.auction.QueryGetAuctionRequest") - proto.RegisterType((*QueryGetAuctionResponse)(nil), "ununifi.auction.QueryGetAuctionResponse") - proto.RegisterType((*QueryAllAuctionRequest)(nil), "ununifi.auction.QueryAllAuctionRequest") - proto.RegisterType((*QueryAllAuctionResponse)(nil), "ununifi.auction.QueryAllAuctionResponse") -} - -func init() { proto.RegisterFile("auction/query.proto", fileDescriptor_40c2e1a3071ed575) } - -var fileDescriptor_40c2e1a3071ed575 = []byte{ - // 506 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x6f, 0x13, 0x31, - 0x14, 0xc7, 0x73, 0x29, 0xa4, 0xc8, 0x95, 0x40, 0x72, 0x0b, 0x21, 0x07, 0x3a, 0xca, 0x81, 0xda, - 0x08, 0x09, 0x5b, 0x2d, 0x23, 0x62, 0x48, 0x86, 0x74, 0x2d, 0x91, 0xca, 0xc0, 0x02, 0xbe, 0xc4, - 0xbd, 0x5a, 0xba, 0xd8, 0xd7, 0xd8, 0x87, 0x88, 0x10, 0x4b, 0xc5, 0xc2, 0x86, 0xc4, 0x27, 0xe0, - 0x3b, 0xf0, 0x21, 0x10, 0x53, 0x25, 0x16, 0x46, 0x94, 0xf0, 0x41, 0xd0, 0xd9, 0xcf, 0x25, 0xed, - 0x11, 0xd2, 0xe9, 0x64, 0xfb, 0xbd, 0xff, 0xff, 0x77, 0xff, 0xf7, 0xd0, 0x3a, 0x2b, 0x06, 0x46, - 0x28, 0x49, 0x8f, 0x0b, 0x3e, 0x9e, 0x90, 0x7c, 0xac, 0x8c, 0xc2, 0x37, 0x0a, 0x59, 0x48, 0x71, - 0x28, 0x08, 0x3c, 0x86, 0x77, 0x53, 0xa5, 0xd2, 0x8c, 0x53, 0x96, 0x0b, 0xca, 0xa4, 0x54, 0x86, - 0x95, 0xd7, 0xda, 0x95, 0x87, 0x2d, 0x78, 0xb5, 0xa7, 0xa4, 0x38, 0xa4, 0x4c, 0x82, 0x52, 0xf8, - 0x68, 0xa0, 0xf4, 0x48, 0x69, 0x9a, 0x30, 0xcd, 0x9d, 0x05, 0x7d, 0xb3, 0x93, 0x70, 0xc3, 0x76, - 0x68, 0xce, 0x52, 0x21, 0xad, 0x8e, 0x97, 0x71, 0xb5, 0xaf, 0xec, 0x89, 0xba, 0x03, 0x3c, 0xdd, - 0xf4, 0x94, 0xf0, 0x75, 0xd7, 0xf1, 0x06, 0xc2, 0xcf, 0x4b, 0xcd, 0x7d, 0x36, 0x66, 0x23, 0xdd, - 0xe7, 0xc7, 0x05, 0xd7, 0x26, 0xee, 0xa1, 0xf5, 0x73, 0xb7, 0x3a, 0x57, 0x52, 0x73, 0x4c, 0x51, - 0x23, 0xb7, 0x37, 0xb7, 0x83, 0xcd, 0xa0, 0xbd, 0xb6, 0xdb, 0x24, 0x17, 0xfe, 0x92, 0x40, 0x03, - 0x94, 0xc5, 0x6d, 0x74, 0xcb, 0xea, 0xec, 0x71, 0xd3, 0x71, 0x15, 0xe0, 0x80, 0xaf, 0xa3, 0xba, - 0x18, 0x5a, 0x99, 0x2b, 0xfd, 0xba, 0x18, 0xc6, 0x2f, 0x50, 0xb3, 0x52, 0x09, 0xae, 0x4f, 0xd1, - 0x2a, 0xc8, 0x83, 0xed, 0x06, 0x71, 0x69, 0x11, 0x9f, 0x16, 0xe9, 0xc8, 0x49, 0x77, 0xed, 0xfb, - 0xd7, 0xc7, 0xab, 0xbe, 0xd7, 0x77, 0xc4, 0xaf, 0x81, 0xa0, 0x93, 0x65, 0x17, 0x08, 0x7a, 0x08, - 0xfd, 0xcd, 0x0f, 0x94, 0xb7, 0x08, 0x64, 0x56, 0x86, 0x4d, 0xdc, 0x3c, 0x21, 0x6c, 0xb2, 0xcf, - 0x52, 0x0e, 0xbd, 0xfd, 0xb9, 0xce, 0xf8, 0x4b, 0x00, 0xe8, 0xf3, 0x16, 0x80, 0xfe, 0x0c, 0x5d, - 0x03, 0x90, 0x32, 0xb2, 0x95, 0xcb, 0xb1, 0x9f, 0xb5, 0xe0, 0xbd, 0x73, 0x88, 0x75, 0x8b, 0xb8, - 0xbd, 0x14, 0xd1, 0x79, 0xcf, 0x33, 0xee, 0x7e, 0x5c, 0x41, 0x57, 0x2d, 0x23, 0x36, 0xa8, 0xe1, - 0x66, 0x84, 0x1f, 0x54, 0x86, 0x57, 0x5d, 0x84, 0xf0, 0xe1, 0xff, 0x8b, 0x9c, 0x55, 0x7c, 0xef, - 0xe4, 0xc7, 0xef, 0xcf, 0xf5, 0x16, 0x6e, 0x52, 0xa8, 0xf6, 0x4b, 0x46, 0xdd, 0x1e, 0xe0, 0x0f, - 0x01, 0xf2, 0xbf, 0x87, 0xb7, 0xff, 0x2d, 0x59, 0x59, 0x91, 0xb0, 0xbd, 0xbc, 0x10, 0xfc, 0xb7, - 0xac, 0xff, 0x26, 0x8e, 0x2a, 0xfe, 0x3e, 0x4a, 0xfa, 0x4e, 0x0c, 0xdf, 0xe3, 0x93, 0x00, 0x21, - 0xe8, 0xed, 0x64, 0xd9, 0x22, 0x92, 0xca, 0xaa, 0x2c, 0x22, 0xa9, 0x0e, 0x3c, 0xbe, 0x6f, 0x49, - 0xee, 0xe0, 0xd6, 0x42, 0x92, 0x6e, 0xf7, 0xdb, 0x34, 0x0a, 0x4e, 0xa7, 0x51, 0xf0, 0x6b, 0x1a, - 0x05, 0x9f, 0x66, 0x51, 0xed, 0x74, 0x16, 0xd5, 0x7e, 0xce, 0xa2, 0xda, 0xcb, 0x76, 0x2a, 0xcc, - 0x51, 0x91, 0x90, 0x81, 0x1a, 0xd1, 0x03, 0x79, 0x20, 0x45, 0x4f, 0xd0, 0xc1, 0x11, 0x13, 0x92, - 0xbe, 0x3d, 0x93, 0x31, 0x93, 0x9c, 0xeb, 0xa4, 0x61, 0xb7, 0xe7, 0xc9, 0x9f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x95, 0x64, 0xc3, 0x99, 0x7b, 0x04, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // this line is used by starport scaffolding # 2 - Auction(ctx context.Context, in *QueryGetAuctionRequest, opts ...grpc.CallOption) (*QueryGetAuctionResponse, error) - AuctionAll(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/ununifi.auction.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Auction(ctx context.Context, in *QueryGetAuctionRequest, opts ...grpc.CallOption) (*QueryGetAuctionResponse, error) { - out := new(QueryGetAuctionResponse) - err := c.cc.Invoke(ctx, "/ununifi.auction.Query/Auction", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AuctionAll(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) { - out := new(QueryAllAuctionResponse) - err := c.cc.Invoke(ctx, "/ununifi.auction.Query/AuctionAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // this line is used by starport scaffolding # 2 - Auction(context.Context, *QueryGetAuctionRequest) (*QueryGetAuctionResponse, error) - AuctionAll(context.Context, *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) Auction(ctx context.Context, req *QueryGetAuctionRequest) (*QueryGetAuctionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Auction not implemented") -} -func (*UnimplementedQueryServer) AuctionAll(ctx context.Context, req *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuctionAll not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.auction.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Auction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetAuctionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Auction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.auction.Query/Auction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Auction(ctx, req.(*QueryGetAuctionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AuctionAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllAuctionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AuctionAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.auction.Query/AuctionAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AuctionAll(ctx, req.(*QueryAllAuctionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.auction.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Auction", - Handler: _Query_Auction_Handler, - }, - { - MethodName: "AuctionAll", - Handler: _Query_AuctionAll_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "auction/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGetAuctionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetAuctionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Id != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryGetAuctionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetAuctionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Auction != nil { - { - size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllAuctionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllAuctionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllAuctionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllAuctionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Auctions) > 0 { - for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetAuctionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovQuery(uint64(m.Id)) - } - return n -} - -func (m *QueryGetAuctionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Auction != nil { - l = m.Auction.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllAuctionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllAuctionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Auctions) > 0 { - for _, e := range m.Auctions { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetAuctionRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetAuctionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetAuctionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetAuctionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Auction == nil { - m.Auction = &types.Any{} - } - if err := m.Auction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAuctionRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllAuctionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAuctionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllAuctionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Auctions = append(m.Auctions, &types.Any{}) - if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/auction/types/query.pb.gw.go b/deprecated/x/auction/types/query.pb.gw.go deleted file mode 100644 index abf82f8f1..000000000 --- a/deprecated/x/auction/types/query.pb.gw.go +++ /dev/null @@ -1,326 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: auction/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Auction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetAuctionRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := client.Auction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Auction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetAuctionRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := server.Auction(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_AuctionAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_AuctionAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAuctionRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AuctionAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.AuctionAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AuctionAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAuctionRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AuctionAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.AuctionAll(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Auction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Auction_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Auction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AuctionAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AuctionAll_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AuctionAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Auction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Auction_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Auction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AuctionAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AuctionAll_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AuctionAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "auction", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Auction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "auction", "auctions", "id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_AuctionAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "auction", "auctions"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_Auction_0 = runtime.ForwardResponseMessage - - forward_Query_AuctionAll_0 = runtime.ForwardResponseMessage -) diff --git a/deprecated/x/auction/types/tx.pb.go b/deprecated/x/auction/types/tx.pb.go deleted file mode 100644 index 031cd1bea..000000000 --- a/deprecated/x/auction/types/tx.pb.go +++ /dev/null @@ -1,622 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: auction/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgPlaceBid struct { - AuctionId uint64 `protobuf:"varint,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" yaml:"auction_id"` - Bidder github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,2,opt,name=bidder,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"bidder" yaml:"bidder"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount" yaml:"amount"` -} - -func (m *MsgPlaceBid) Reset() { *m = MsgPlaceBid{} } -func (m *MsgPlaceBid) String() string { return proto.CompactTextString(m) } -func (*MsgPlaceBid) ProtoMessage() {} -func (*MsgPlaceBid) Descriptor() ([]byte, []int) { - return fileDescriptor_085dc3627a5d85eb, []int{0} -} -func (m *MsgPlaceBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPlaceBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPlaceBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgPlaceBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPlaceBid.Merge(m, src) -} -func (m *MsgPlaceBid) XXX_Size() int { - return m.Size() -} -func (m *MsgPlaceBid) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPlaceBid.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPlaceBid proto.InternalMessageInfo - -func (m *MsgPlaceBid) GetAuctionId() uint64 { - if m != nil { - return m.AuctionId - } - return 0 -} - -func (m *MsgPlaceBid) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -type MsgPlaceBidResponse struct { -} - -func (m *MsgPlaceBidResponse) Reset() { *m = MsgPlaceBidResponse{} } -func (m *MsgPlaceBidResponse) String() string { return proto.CompactTextString(m) } -func (*MsgPlaceBidResponse) ProtoMessage() {} -func (*MsgPlaceBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_085dc3627a5d85eb, []int{1} -} -func (m *MsgPlaceBidResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPlaceBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPlaceBidResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgPlaceBidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPlaceBidResponse.Merge(m, src) -} -func (m *MsgPlaceBidResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgPlaceBidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPlaceBidResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPlaceBidResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgPlaceBid)(nil), "ununifi.auction.MsgPlaceBid") - proto.RegisterType((*MsgPlaceBidResponse)(nil), "ununifi.auction.MsgPlaceBidResponse") -} - -func init() { proto.RegisterFile("auction/tx.proto", fileDescriptor_085dc3627a5d85eb) } - -var fileDescriptor_085dc3627a5d85eb = []byte{ - // 386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xcf, 0xaa, 0xd3, 0x40, - 0x14, 0xc6, 0x33, 0x5e, 0x29, 0xde, 0xb9, 0x88, 0x1a, 0x2d, 0xd4, 0x22, 0x49, 0x09, 0x2e, 0xb2, - 0x9a, 0xe1, 0x5e, 0x5d, 0xb9, 0x6b, 0x04, 0xa9, 0x8b, 0x8a, 0x44, 0xba, 0x71, 0xa3, 0x93, 0x99, - 0xe9, 0x74, 0xa0, 0x99, 0x09, 0x99, 0x89, 0xb4, 0x6f, 0xe1, 0x63, 0x75, 0xd9, 0xa5, 0xb8, 0x08, - 0xd2, 0x3e, 0x80, 0xd0, 0x27, 0x90, 0x34, 0xd3, 0x3f, 0x14, 0xbc, 0xbb, 0x1c, 0x7e, 0xe7, 0x7c, - 0x27, 0xdf, 0x77, 0x06, 0x3e, 0x25, 0x15, 0xb5, 0x52, 0x2b, 0x6c, 0x17, 0xa8, 0x28, 0xb5, 0xd5, - 0xfe, 0x93, 0x4a, 0x55, 0x4a, 0x4e, 0x25, 0x72, 0xa4, 0xff, 0x42, 0x68, 0xa1, 0xf7, 0x0c, 0x37, - 0x5f, 0x6d, 0x5b, 0x3f, 0x14, 0x5a, 0x8b, 0x39, 0xc7, 0xfb, 0x2a, 0xab, 0xa6, 0xd8, 0xca, 0x9c, - 0x1b, 0x4b, 0xf2, 0xc2, 0x35, 0x04, 0x97, 0x0d, 0xac, 0x2a, 0x49, 0x23, 0x78, 0xe0, 0x54, 0x9b, - 0x5c, 0x1b, 0x9c, 0x11, 0xc3, 0xf1, 0x8f, 0xdb, 0x8c, 0x5b, 0x72, 0x8b, 0xa9, 0x96, 0x8e, 0x47, - 0x7f, 0x01, 0xbc, 0x19, 0x1b, 0xf1, 0x79, 0x4e, 0x28, 0x4f, 0x24, 0xf3, 0xdf, 0x42, 0xe8, 0xfe, - 0xe8, 0x9b, 0x64, 0x3d, 0x30, 0x00, 0xf1, 0xc3, 0xa4, 0xbb, 0xab, 0xc3, 0x67, 0x4b, 0x92, 0xcf, - 0xdf, 0x45, 0x27, 0x16, 0xa5, 0xd7, 0xae, 0xf8, 0xc8, 0xfc, 0xef, 0xb0, 0x93, 0x49, 0xc6, 0x78, - 0xd9, 0x7b, 0x30, 0x00, 0xf1, 0x75, 0x32, 0x5a, 0xd5, 0xa1, 0xf7, 0xbb, 0x0e, 0xb1, 0x90, 0x76, - 0x56, 0x65, 0x88, 0xea, 0x1c, 0x4f, 0xd4, 0x44, 0xc9, 0x0f, 0x12, 0xd3, 0x19, 0x91, 0x0a, 0xdb, - 0x65, 0xc1, 0x0d, 0xfa, 0x62, 0x4b, 0xa9, 0xc4, 0x90, 0xd2, 0x21, 0x63, 0x25, 0x37, 0x66, 0x57, - 0x87, 0x8f, 0xdb, 0x45, 0xad, 0x5c, 0x94, 0x3a, 0x5d, 0x7f, 0x04, 0x3b, 0x24, 0xd7, 0x95, 0xb2, - 0xbd, 0xab, 0x01, 0x88, 0x6f, 0xee, 0x5e, 0xa2, 0xd6, 0x18, 0x6a, 0x8c, 0x21, 0x67, 0x0c, 0xbd, - 0xd7, 0x52, 0x25, 0xdd, 0x66, 0xf9, 0x49, 0xa9, 0x1d, 0x8b, 0x52, 0x37, 0x1f, 0x75, 0xe1, 0xf3, - 0x33, 0xc3, 0x29, 0x37, 0x85, 0x56, 0x86, 0xdf, 0x4d, 0xe0, 0xd5, 0xd8, 0x08, 0xff, 0x13, 0x7c, - 0x74, 0xcc, 0xe2, 0x15, 0xba, 0x38, 0x12, 0x3a, 0x1b, 0xec, 0xbf, 0xbe, 0x8f, 0x1e, 0x64, 0x93, - 0x64, 0xb5, 0x09, 0xc0, 0x7a, 0x13, 0x80, 0x3f, 0x9b, 0x00, 0xfc, 0xdc, 0x06, 0xde, 0x7a, 0x1b, - 0x78, 0xbf, 0xb6, 0x81, 0xf7, 0x35, 0xfe, 0x6f, 0x36, 0x0b, 0x7c, 0x7c, 0x2e, 0x4d, 0x4a, 0x59, - 0x67, 0x7f, 0xaa, 0x37, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x59, 0x5c, 0x91, 0x5c, 0x46, 0x02, - 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) { - out := new(MsgPlaceBidResponse) - err := c.cc.Invoke(ctx, "/ununifi.auction.Msg/PlaceBid", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - PlaceBid(context.Context, *MsgPlaceBid) (*MsgPlaceBidResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) PlaceBid(ctx context.Context, req *MsgPlaceBid) (*MsgPlaceBidResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlaceBid not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_PlaceBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgPlaceBid) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).PlaceBid(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.auction.Msg/PlaceBid", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PlaceBid(ctx, req.(*MsgPlaceBid)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.auction.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "PlaceBid", - Handler: _Msg_PlaceBid_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "auction/tx.proto", -} - -func (m *MsgPlaceBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgPlaceBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Bidder.Size() - i -= size - if _, err := m.Bidder.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.AuctionId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.AuctionId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgPlaceBidResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgPlaceBidResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPlaceBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgPlaceBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AuctionId != 0 { - n += 1 + sovTx(uint64(m.AuctionId)) - } - l = m.Bidder.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgPlaceBidResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgPlaceBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPlaceBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) - } - m.AuctionId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AuctionId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Bidder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPlaceBidResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgPlaceBidResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPlaceBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/cdp/abci.go b/deprecated/x/cdp/abci.go deleted file mode 100644 index eae82e3fc..000000000 --- a/deprecated/x/cdp/abci.go +++ /dev/null @@ -1,49 +0,0 @@ -package cdp - -import ( - "errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" - "github.com/UnUniFi/chain/x/pricefeed/types" -) - -// BeginBlocker compounds the debt in outstanding cdps and liquidates cdps that are below the required collateralization ratio -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { - params := k.GetParams(ctx) - - for _, cp := range params.CollateralParams { - ok := k.UpdatePricefeedStatus(ctx, cp.SpotMarketId) - if !ok { - continue - } - - ok = k.UpdatePricefeedStatus(ctx, cp.LiquidationMarketId) - if !ok { - continue - } - - err := k.AccumulateInterest(ctx, cp.Type) - if err != nil { - panic(err) - } - - err = k.SynchronizeInterestForRiskyCdps(ctx, cp.CheckCollateralizationIndexCount, sdk.MaxSortableDec, cp.Type) - if err != nil { - panic(err) - } - - err = k.LiquidateCdps(ctx, cp.LiquidationMarketId, cp.Type, cp.LiquidationRatio, cp.CheckCollateralizationIndexCount) - if err != nil && !errors.Is(err, types.ErrNoValidPrice) { - panic(err) - } - } - - err := k.RunSurplusAndDebtAuctions(ctx) - if err != nil { - panic(err) - } -} diff --git a/deprecated/x/cdp/abci_test.go b/deprecated/x/cdp/abci_test.go deleted file mode 100644 index 1c30fbf1b..000000000 --- a/deprecated/x/cdp/abci_test.go +++ /dev/null @@ -1,189 +0,0 @@ -package cdp_test - -// import ( -// "math/rand" -// "time" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// simulation "github.com/cosmos/cosmos-sdk/types/simulation" - -// tmabcitypes "github.com/cometbft/cometbft/abci/types" -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" -// cdp "github.com/UnUniFi/chain/deprecated/x/cdp" -// cdpkeeper "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// type ModuleTestSuite struct { -// suite.Suite - -// keeper cdpkeeper.Keeper -// addrs []sdk.AccAddress -// app app.TestApp -// cdps cdptypes.Cdps -// ctx sdk.Context -// liquidations liquidationTracker -// } - -// type liquidationTracker struct { -// xrp []uint64 -// btc []uint64 -// debt int64 -// } - -// func (suite *ModuleTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// coins := []sdk.Coins{} -// tracker := liquidationTracker{} - -// for j := 0; j < 100; j++ { -// coins = append(coins, cs(c("btc", 100000000), c("xrp", 10000000000))) -// } -// _, addrs := app.GeneratePrivKeyAddressPairs(100) - -// authGS := app.NewAuthGenState( -// tApp, -// addrs, -// coins, -// ) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// suite.ctx = ctx -// suite.app = tApp -// suite.keeper = tApp.GetCDPKeeper() -// suite.cdps = cdptypes.Cdps{} -// suite.addrs = addrs -// suite.liquidations = tracker -// } - -// func (suite *ModuleTestSuite) createCdps() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// cdps := make(cdptypes.Cdps, 100) -// _, addrs := app.GeneratePrivKeyAddressPairs(100) -// coins := []sdk.Coins{} -// tracker := liquidationTracker{} - -// for j := 0; j < 100; j++ { -// coins = append(coins, cs(c("btc", 100000000), c("xrp", 10000000000))) -// } - -// authGS := app.NewAuthGenState( -// tApp, -// addrs, -// coins, -// ) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) - -// suite.ctx = ctx -// suite.app = tApp -// suite.keeper = tApp.GetCDPKeeper() - -// for j := 0; j < 100; j++ { -// collateral := "xrp" -// amount := 10000000000 -// debt := simulation.RandIntBetween(rand.New(rand.NewSource(int64(j))), 750000000, 1249000000) -// if j%2 == 0 { -// collateral = "btc" -// amount = 100000000 -// debt = simulation.RandIntBetween(rand.New(rand.NewSource(int64(j))), 2700000000, 5332000000) -// if debt >= 4000000000 { -// tracker.btc = append(tracker.btc, uint64(j+1)) -// tracker.debt += int64(debt) -// } -// } else { -// if debt >= 1000000000 { -// tracker.xrp = append(tracker.xrp, uint64(j+1)) -// tracker.debt += int64(debt) -// } -// } -// suite.Nil(suite.keeper.AddCdp(suite.ctx, addrs[j], c(collateral, int64(amount)), c("jpu", int64(debt)), collateral+"-a")) -// c, f := suite.keeper.GetCdp(suite.ctx, collateral+"-a", uint64(j+1)) -// suite.True(f) -// cdps[j] = c -// } - -// suite.cdps = cdps -// suite.addrs = addrs -// suite.liquidations = tracker -// } - -// func (suite *ModuleTestSuite) setPrice(price sdk.Dec, market string) { -// pfKeeper := suite.app.GetPriceFeedKeeper() - -// pfKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, market, price, suite.ctx.BlockTime().Add(time.Hour*3)) -// err := pfKeeper.SetCurrentPrices(suite.ctx, market) -// suite.NoError(err) -// pp, err := pfKeeper.GetCurrentPrice(suite.ctx, market) -// suite.NoError(err) -// suite.Equal(price, pp.Price) -// } -// func (suite *ModuleTestSuite) TestBeginBlock() { -// suite.createCdps() -// ak := suite.app.GetAccountKeeper() -// bk := suite.app.GetBankKeeper() -// acc := ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// originalXrpCollateral := bk.GetAllBalances(suite.ctx, acc.GetAddress()).AmountOf("xrp") -// suite.setPrice(d("0.2"), "xrp:jpy") -// cdp.BeginBlocker(suite.ctx, tmabcitypes.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// finalXrpCollateral := bk.GetAllBalances(suite.ctx, acc.GetAddress()).AmountOf("xrp") -// seizedXrpCollateral := originalXrpCollateral.Sub(finalXrpCollateral) -// xrpLiquidations := int(seizedXrpCollateral.Quo(i(10000000000)).Int64()) -// suite.Equal(10, xrpLiquidations) - -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// originalBtcCollateral := bk.GetAllBalances(suite.ctx, acc.GetAddress()).AmountOf("btc") -// suite.setPrice(d("6000"), "btc:jpy") -// cdp.BeginBlocker(suite.ctx, tmabcitypes.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// finalBtcCollateral := bk.GetAllBalances(suite.ctx, acc.GetAddress()).AmountOf("btc") -// seizedBtcCollateral := originalBtcCollateral.Sub(finalBtcCollateral) -// btcLiquidations := int(seizedBtcCollateral.Quo(i(100000000)).Int64()) -// suite.Equal(10, btcLiquidations) - -// acc = ak.GetModuleAccount(suite.ctx, auctiontypes.ModuleName) -// suite.Equal(int64(71955653865), bk.GetAllBalances(suite.ctx, acc.GetAddress()).AmountOf("debtjpu").Int64()) - -// } - -// func (suite *ModuleTestSuite) TestSeizeSingleCdpWithFees() { -// err := suite.keeper.AddCdp(suite.ctx, suite.addrs[0], c("xrp", 10000000000), c("jpu", 1000000000), "xrp-a") -// suite.NoError(err) -// suite.Equal(i(1000000000), suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu")) -// ak := suite.app.GetAccountKeeper() -// bk := suite.app.GetBankKeeper() -// cdpMacc := ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// suite.Equal(i(1000000000), bk.GetAllBalances(suite.ctx, cdpMacc.GetAddress()).AmountOf("debtjpu")) -// for i := 0; i < 100; i++ { -// suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 6)) -// cdp.BeginBlocker(suite.ctx, tmabcitypes.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) -// } - -// cdpMacc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// suite.Equal(i(1000000891), bk.GetAllBalances(suite.ctx, cdpMacc.GetAddress()).AmountOf("debtjpu")) -// cdp, _ := suite.keeper.GetCdp(suite.ctx, "xrp-a", 1) - -// err = suite.keeper.SeizeCollateral(suite.ctx, cdp) -// suite.NoError(err) -// _, found := suite.keeper.GetCdp(suite.ctx, "xrp-a", 1) -// suite.False(found) -// } - -// // func TestModuleTestSuite(t *testing.T) { -// // suite.Run(t, new(ModuleTestSuite)) -// // } diff --git a/deprecated/x/cdp/client/cli/query.go b/deprecated/x/cdp/client/cli/query.go deleted file mode 100644 index f95591e60..000000000 --- a/deprecated/x/cdp/client/cli/query.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group cdp queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListCdp()) - cmd.AddCommand(CmdShowCdp()) - - return cmd -} diff --git a/deprecated/x/cdp/client/cli/query_cdp.go b/deprecated/x/cdp/client/cli/query_cdp.go deleted file mode 100644 index af4fa221b..000000000 --- a/deprecated/x/cdp/client/cli/query_cdp.go +++ /dev/null @@ -1,128 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func CmdListCdp() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-cdp", - Short: "list all cdp", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllCdpRequest{ - Pagination: pageReq, - } - - res, err := queryClient.CdpAll(context.Background(), params) - - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowCdp() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-cdp [owner] [collateral-type]", - Short: "shows a cdp", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGetCdpRequest{ - Owner: args[0], - CollateralType: args[1], - } - - res, err := queryClient.Cdp(context.Background(), params) - - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdListAccount() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-account", - Short: "list all account", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllAccountRequest{} - - res, err := queryClient.AccountAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdListDeposit() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-deposit [owner] [collateral-type]", - Short: "list all deposit", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllDepositRequest{ - Owner: args[0], - CollateralType: args[1], - } - - res, err := queryClient.DepositAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/cdp/client/cli/query_params.go b/deprecated/x/cdp/client/cli/query_params.go deleted file mode 100644 index c41a363ac..000000000 --- a/deprecated/x/cdp/client/cli/query_params.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows a params", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/cdp/client/cli/tx.go b/deprecated/x/cdp/client/cli/tx.go deleted file mode 100644 index 3d0fb9d60..000000000 --- a/deprecated/x/cdp/client/cli/tx.go +++ /dev/null @@ -1,35 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - cmd.AddCommand( - CmdCreateCdp(), - CmdDeposit(), - CmdWithdraw(), - CmdDrawDebt(), - CmdRepayDebt(), - CmdLiquidate(), - ) - - return cmd -} diff --git a/deprecated/x/cdp/client/cli/txCdp.go b/deprecated/x/cdp/client/cli/txCdp.go deleted file mode 100644 index 6a0a7b329..000000000 --- a/deprecated/x/cdp/client/cli/txCdp.go +++ /dev/null @@ -1,249 +0,0 @@ -package cli - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func CmdCreateCdp() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-cdp [collateral] [debt] [collateral-type]", - Short: "Creates a new cdp", - Long: strings.TrimSpace( - fmt.Sprintf(`Create a new cdp, depositing some collateral and drawing some debt. -Example: -$ %s tx %s create-cdp 10ubtc 10jpu ubtc-a --from myKeyName --chain-id ununifi-5-test -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - collateral, err := sdk.ParseCoinNormalized(args[0]) - if err != nil { - return err - } - debt, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - collateralType := args[2] - - msg := types.NewMsgCreateCdp(clientCtx.GetFromAddress(), collateral, debt, collateralType) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdDeposit() *cobra.Command { - cmd := &cobra.Command{ - Use: "deposit [owner] [collateral] [collateral-type]", - Short: "Deposit", - Long: strings.TrimSpace( - fmt.Sprintf(`Deposit. -Example: -$ %s tx %s deposit [owner-address] 10ubtc ubtc-a --from myKeyName --chain-id ununifi-5-test -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - owner, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - collateral, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - collateralType := args[2] - - msg := types.NewMsgDeposit(owner, clientCtx.GetFromAddress(), collateral, collateralType) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdWithdraw() *cobra.Command { - cmd := &cobra.Command{ - Use: "withdraw [owner] [collateral] [collateral-type]", - Short: "Withdraw", - Long: strings.TrimSpace( - fmt.Sprintf(`Withdraw. -Example: -$ %s tx %s withdraw [owner-address] 10ubtc ubtc-a --from myKeyName --chain-id ununifi-5-test -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - owner, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - collateral, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - collateralType := args[2] - - msg := types.NewMsgWithdraw(owner, clientCtx.GetFromAddress(), collateral, collateralType) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdDrawDebt() *cobra.Command { - cmd := &cobra.Command{ - Use: "draw-debt [collateral-type] [principal]", - Short: "Draw debt", - Long: strings.TrimSpace( - fmt.Sprintf(`Draw debt. -Example: -$ %s tx %s draw-debt ubtc-a [principal] --from myKeyName --chain-id ununifi-5-test -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - collateralType := args[0] - - principal, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgDrawDebt(clientCtx.GetFromAddress(), collateralType, principal) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdRepayDebt() *cobra.Command { - cmd := &cobra.Command{ - Use: "repay-debt [collateral-type] [payment]", - Short: "Repay debt", - Long: strings.TrimSpace( - fmt.Sprintf(`Repay debt. -Example: -$ %s tx %s repay-debt ubtc-a [payment] --from myKeyName --chain-id ununifi-5-test -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - collateralType := args[0] - - payment, err := sdk.ParseCoinNormalized(args[1]) - if err != nil { - return err - } - - msg := types.NewMsgRepayDebt(clientCtx.GetFromAddress(), collateralType, payment) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdLiquidate() *cobra.Command { - cmd := &cobra.Command{ - Use: "liquidate [borrower] [collateral-type]", - Short: "Liquidate", - Long: strings.TrimSpace( - fmt.Sprintf(`Liquidate. -Example: -$ %s tx %s liquidate [borrower] ubtc-a --from myKeyName --chain-id ununifi-5-test -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - borrower, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - - collateralType := args[1] - - msg := types.NewMsgLiquidate(clientCtx.GetFromAddress(), borrower, collateralType) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/cdp/client/rest/rest.go b/deprecated/x/cdp/client/rest/rest.go deleted file mode 100644 index 36166bbcb..000000000 --- a/deprecated/x/cdp/client/rest/rest.go +++ /dev/null @@ -1,14 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - // this line is used by starport scaffolding # 1 -) - -// RegisterRoutes registers cdp-related REST handlers to a router -func RegisterRoutes(clientCtx client.Context, r *mux.Router) { - // this line is used by starport scaffolding # 2 - -} diff --git a/deprecated/x/cdp/genesis.go b/deprecated/x/cdp/genesis.go deleted file mode 100644 index 22cfbb17f..000000000 --- a/deprecated/x/cdp/genesis.go +++ /dev/null @@ -1,134 +0,0 @@ -package cdp - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, ak types.AccountKeeper, pk types.PricefeedKeeper, gs types.GenesisState) { - - if err := gs.Validate(); err != nil { - panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) - } - - // check if the module accounts exists - cdpModuleAcc := ak.GetModuleAccount(ctx, types.ModuleName) - if cdpModuleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) - } - liqModuleAcc := ak.GetModuleAccount(ctx, types.LiquidatorMacc) - if liqModuleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", types.LiquidatorMacc)) - } - - // validate denoms - check that any collaterals in the params are in the pricefeed, - // pricefeed MUST call InitGenesis before cdp - collateralMap := make(map[string]int) - ap := pk.GetParams(ctx) - for _, a := range ap.Markets { - collateralMap[a.MarketId] = 1 - } - - for _, col := range gs.Params.CollateralParams { - _, found := collateralMap[col.SpotMarketId] - if !found { - panic(fmt.Sprintf("%s collateral not found in pricefeed", col.Denom)) - } - // sets the status of the pricefeed in the store - // if pricefeed not active, debt operations are paused - _ = k.UpdatePricefeedStatus(ctx, col.SpotMarketId) - - _, found = collateralMap[col.LiquidationMarketId] - if !found { - panic(fmt.Sprintf("%s collateral not found in pricefeed", col.Denom)) - } - // sets the status of the pricefeed in the store - // if pricefeed not active, debt operations are paused - _ = k.UpdatePricefeedStatus(ctx, col.LiquidationMarketId) - } - - k.SetParams(ctx, gs.Params) - - for _, gat := range gs.PreviousAccumulationTimes { - k.SetInterestFactor(ctx, gat.CollateralType, gat.InterestFactor) - if gat.PreviousAccumulationTime.Unix() > 0 { - k.SetPreviousAccrualTime(ctx, gat.CollateralType, gat.PreviousAccumulationTime) - } - } - - for _, gtp := range gs.TotalPrincipals { - k.SetTotalPrincipal(ctx, gtp.CollateralType, types.DefaultStableDenom, gtp.TotalPrincipal) - } - // add cdps - for _, cdp := range gs.Cdps { - if cdp.Id == gs.StartingCdpId { - panic(fmt.Sprintf("starting cdp id is assigned to an existing cdp: %s", cdp.String())) - } - err := k.SetCdp(ctx, cdp) - if err != nil { - panic(fmt.Sprintf("error setting cdp: %v", err)) - } - k.IndexCdpByOwner(ctx, cdp) - ratio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.Id, ratio) - } - - k.SetNextCdpID(ctx, gs.StartingCdpId) - k.SetDebtDenomMap(ctx, types.NewDebtDenomMap(types.DefaultDebtParams)) - k.SetGovDenom(ctx, gs.GovDenom) - - for _, d := range gs.Deposits { - k.SetDeposit(ctx, d) - } - -} - -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { - params := k.GetParams(ctx) - - cdps := types.Cdps{} - deposits := types.Deposits{} - k.IterateAllCdps(ctx, func(cdp types.Cdp) (stop bool) { - syncedCdp := k.SynchronizeInterest(ctx, cdp) - cdps = append(cdps, syncedCdp) - k.IterateDeposits(ctx, cdp.Id, func(deposit types.Deposit) (stop bool) { - deposits = append(deposits, deposit) - return false - }) - return false - }) - - cdpID := k.GetNextCdpID(ctx) - govDenom := k.GetGovDenom(ctx) - - var previousAccumTimes types.GenesisAccumulationTimes - var totalPrincipals types.GenesisTotalPrincipals - - for _, cp := range params.CollateralParams { - interestFactor, found := k.GetInterestFactor(ctx, cp.Type) - if !found { - interestFactor = sdk.OneDec() - } - // Governance param changes happen in the end blocker. If a new collateral type is added and then the chain - // is exported before the BeginBlocker can run, previous accrual time won't be found. We can't set it to - // current block time because it is not available in the export ctx. We should panic instead of exporting - // bad state. - previousAccumTime, f := k.GetPreviousAccrualTime(ctx, cp.Type) - if !f { - panic(fmt.Sprintf("expected previous accrual time to be set in state for %s", cp.Type)) - } - previousAccumTimes = append(previousAccumTimes, types.NewGenesisAccumulationTime(cp.Type, previousAccumTime, interestFactor)) - - tp := k.GetTotalPrincipal(ctx, cp.Type, types.DefaultStableDenom) - genTotalPrincipal := types.NewGenesisTotalPrincipal(cp.Type, tp) - totalPrincipals = append(totalPrincipals, genTotalPrincipal) - } - - return types.NewGenesisState(params, cdps, deposits, cdpID, govDenom, previousAccumTimes, totalPrincipals) -} diff --git a/deprecated/x/cdp/genesis_test.go b/deprecated/x/cdp/genesis_test.go deleted file mode 100644 index 27a29baab..000000000 --- a/deprecated/x/cdp/genesis_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package cdp_test - -import ( - "strings" - "time" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/app" - cdpkeeper "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -type GenesisTestSuite struct { - suite.Suite - - ctx sdk.Context - keeper cdpkeeper.Keeper -} - -func (suite *GenesisTestSuite) TestInvalidGenState() { - type args struct { - params cdptypes.Params - cdps cdptypes.Cdps - deposits cdptypes.Deposits - startingID uint64 - govDenom string - genAccumTimes cdptypes.GenesisAccumulationTimes - genTotalPrincipals cdptypes.GenesisTotalPrincipals - } - type errArgs struct { - expectPass bool - contains string - } - type genesisTest struct { - name string - args args - errArgs errArgs - } - testCases := []struct { - name string - args args - errArgs errArgs - }{ - { - name: "empty gov denom", - args: args{ - params: cdptypes.DefaultParams(), - cdps: cdptypes.Cdps{}, - deposits: cdptypes.Deposits{}, - govDenom: "", - genAccumTimes: cdptypes.DefaultGenesis().PreviousAccumulationTimes, - genTotalPrincipals: cdptypes.DefaultGenesis().TotalPrincipals, - }, - errArgs: errArgs{ - expectPass: false, - contains: "gov denom invalid", - }, - }, - { - name: "interest factor below one", - args: args{ - params: cdptypes.DefaultParams(), - cdps: cdptypes.Cdps{}, - deposits: cdptypes.Deposits{}, - govDenom: cdptypes.DefaultGovDenom, - genAccumTimes: cdptypes.GenesisAccumulationTimes{cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec().Sub(sdk.SmallestDec()))}, - genTotalPrincipals: cdptypes.DefaultGenesis().TotalPrincipals, - }, - errArgs: errArgs{ - expectPass: false, - contains: "interest factor should be ≥ 1.0", - }, - }, - { - name: "negative total principal", - args: args{ - params: cdptypes.DefaultParams(), - cdps: cdptypes.Cdps{}, - deposits: cdptypes.Deposits{}, - govDenom: cdptypes.DefaultGovDenom, - genAccumTimes: cdptypes.DefaultGenesis().PreviousAccumulationTimes, - genTotalPrincipals: cdptypes.GenesisTotalPrincipals{cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.NewInt(-1))}, - }, - errArgs: errArgs{ - expectPass: false, - contains: "total principal should be positive", - }, - }, - } - for _, tc := range testCases { - suite.Run(tc.name, func() { - gs := cdptypes.NewGenesisState(tc.args.params, tc.args.cdps, tc.args.deposits, tc.args.startingID, - tc.args.govDenom, tc.args.genAccumTimes, tc.args.genTotalPrincipals) - err := gs.Validate() - if tc.errArgs.expectPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) - } - }) - } -} - -func (suite *GenesisTestSuite) TestValidGenState() { - tApp := app.NewTestApp() - - suite.NotPanics(func() { - tApp.InitializeFromGenesisStates( - NewPricefeedGenStateMulti(tApp), - NewCDPGenStateMulti(tApp), - ) - }) - - cdpGS := NewCDPGenStateMulti(tApp) - gs := cdptypes.GenesisState{} - tApp.AppCodec().MustUnmarshalJSON(cdpGS[cdptypes.ModuleName], &gs) - gs.Cdps = cdps() - gs.StartingCdpId = uint64(5) - appGS := app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&gs)} - - tApp = app.NewTestApp() - suite.NotPanics(func() { - tApp.InitializeFromGenesisStates( - NewPricefeedGenStateMulti(tApp), - appGS, - ) - }) -} - -// func TestGenesisTestSuite(t *testing.T) { -// suite.Run(t, new(GenesisTestSuite)) -// } diff --git a/deprecated/x/cdp/handler.go b/deprecated/x/cdp/handler.go deleted file mode 100644 index 40dc7f9fd..000000000 --- a/deprecated/x/cdp/handler.go +++ /dev/null @@ -1,43 +0,0 @@ -package cdp - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - // this line is used by starport scaffolding # 1 - case *types.MsgCreateCdp: - return handleMsgCreateCdp(ctx, k, msg) - - case *types.MsgDeposit: - return handleMsgDeposit(ctx, k, msg) - - case *types.MsgWithdraw: - return handleMsgWithdraw(ctx, k, msg) - - case *types.MsgDrawDebt: - return handleMsgDrawDebt(ctx, k, msg) - - case *types.MsgRepayDebt: - return handleMsgRepayDebt(ctx, k, msg) - - case *types.MsgLiquidate: - return handleMsgLiquidate(ctx, k, msg) - - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/deprecated/x/cdp/handler_cdp.go b/deprecated/x/cdp/handler_cdp.go deleted file mode 100644 index bdf975086..000000000 --- a/deprecated/x/cdp/handler_cdp.go +++ /dev/null @@ -1,108 +0,0 @@ -package cdp - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func handleMsgCreateCdp(ctx sdk.Context, k keeper.Keeper, msg *types.MsgCreateCdp) (*sdk.Result, error) { - err := k.AddCdp(ctx, msg.Sender.AccAddress(), msg.Collateral, msg.Principal, msg.CollateralType) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.AccAddress().String()), - ), - ) - id, _ := k.GetCdpID(ctx, msg.Sender.AccAddress(), msg.CollateralType) - return &sdk.Result{ - Data: types.GetCdpIDBytes(id), - Events: ctx.EventManager().ABCIEvents(), - }, nil -} - -func handleMsgDeposit(ctx sdk.Context, k keeper.Keeper, msg *types.MsgDeposit) (*sdk.Result, error) { - err := k.DepositCollateral(ctx, msg.Owner.AccAddress(), msg.Depositor.AccAddress(), msg.Collateral, msg.CollateralType) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Depositor.AccAddress().String()), - ), - ) - return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil -} - -func handleMsgWithdraw(ctx sdk.Context, k keeper.Keeper, msg *types.MsgWithdraw) (*sdk.Result, error) { - err := k.WithdrawCollateral(ctx, msg.Owner.AccAddress(), msg.Depositor.AccAddress(), msg.Collateral, msg.CollateralType) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Depositor.AccAddress().String()), - ), - ) - return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil -} - -func handleMsgDrawDebt(ctx sdk.Context, k keeper.Keeper, msg *types.MsgDrawDebt) (*sdk.Result, error) { - err := k.AddPrincipal(ctx, msg.Sender.AccAddress(), msg.CollateralType, msg.Principal) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.AccAddress().String()), - ), - ) - return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil -} - -func handleMsgRepayDebt(ctx sdk.Context, k keeper.Keeper, msg *types.MsgRepayDebt) (*sdk.Result, error) { - err := k.RepayPrincipal(ctx, msg.Sender.AccAddress(), msg.CollateralType, msg.Payment) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.AccAddress().String()), - ), - ) - return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil -} - -func handleMsgLiquidate(ctx sdk.Context, k keeper.Keeper, msg *types.MsgLiquidate) (*sdk.Result, error) { - err := k.AttemptKeeperLiquidation(ctx, msg.Keeper.AccAddress(), msg.Borrower.AccAddress(), msg.CollateralType) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Keeper.AccAddress().String()), - ), - ) - return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil -} diff --git a/deprecated/x/cdp/integration_test.go b/deprecated/x/cdp/integration_test.go deleted file mode 100644 index 2d3d35b25..000000000 --- a/deprecated/x/cdp/integration_test.go +++ /dev/null @@ -1,190 +0,0 @@ -package cdp_test - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - tmtime "github.com/cometbft/cometbft/types/time" - - "github.com/UnUniFi/chain/app" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" -) - -// Avoid cluttering test cases with long function names -func i(in int64) sdk.Int { return sdk.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } -func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } - -func NewPricefeedGenState(tApp app.TestApp, asset string, price sdk.Dec) app.GenesisState { - pfGenesis := pricefeedtypes.GenesisState{ - Params: pricefeedtypes.Params{ - Markets: []pricefeedtypes.Market{ - {MarketId: asset + ":jpy", BaseAsset: asset, QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - }, - }, - PostedPrices: []pricefeedtypes.PostedPrice{ - { - MarketId: asset + ":jpy", - OracleAddress: ununifitypes.StringAccAddress(sdk.AccAddress{}), - Price: price, - Expiry: time.Now().Add(1 * time.Hour), - }, - }, - } - return app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pfGenesis)} -} - -func NewCdpGenState(tApp app.TestApp, asset string, liquidationRatio sdk.Dec) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: asset, - Type: asset + "-a", - LiquidationRatio: liquidationRatio, - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(1000000000), - Prefix: 0x20, - ConversionFactor: i(6), - SpotMarketId: asset + ":jpy", - LiquidationMarketId: asset + ":jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} - -func NewPricefeedGenStateMulti(tApp app.TestApp) app.GenesisState { - pfGenesis := pricefeedtypes.GenesisState{ - Params: pricefeedtypes.Params{ - Markets: []pricefeedtypes.Market{ - {MarketId: "btc:jpy", BaseAsset: "btc", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "xrp:jpy", BaseAsset: "xrp", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - }, - }, - PostedPrices: []pricefeedtypes.PostedPrice{ - { - MarketId: "btc:jpy", - OracleAddress: ununifitypes.StringAccAddress(sdk.AccAddress{}), - Price: sdk.MustNewDecFromStr("8000.00"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "xrp:jpy", - OracleAddress: ununifitypes.StringAccAddress(sdk.AccAddress{}), - Price: sdk.MustNewDecFromStr("0.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - }, - } - return app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pfGenesis)} -} - -func NewCDPGenStateMulti(tApp app.TestApp) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(7000000000), - Prefix: 0x20, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(6), - }, - { - Denom: "btc", - Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr - LiquidationPenalty: d("0.025"), - AuctionSize: i(10000000), - Prefix: 0x21, - SpotMarketId: "btc:jpy", - LiquidationMarketId: "btc:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} - -func cdps() (cdps cdptypes.Cdps) { - _, addrs := app.GeneratePrivKeyAddressPairs(3) - c1 := cdptypes.NewCdp(uint64(1), addrs[0], sdk.NewCoin("xrp", sdk.NewInt(100000000)), "xrp-a", sdk.NewCoin("jpu", sdk.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c2 := cdptypes.NewCdp(uint64(2), addrs[1], sdk.NewCoin("xrp", sdk.NewInt(100000000)), "xrp-a", sdk.NewCoin("jpu", sdk.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c3 := cdptypes.NewCdp(uint64(3), addrs[1], sdk.NewCoin("btc", sdk.NewInt(1000000000)), "btc-a", sdk.NewCoin("jpu", sdk.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c4 := cdptypes.NewCdp(uint64(4), addrs[2], sdk.NewCoin("xrp", sdk.NewInt(1000000000)), "xrp-a", sdk.NewCoin("jpu", sdk.NewInt(50000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - cdps = append(cdps, c1, c2, c3, c4) - return -} diff --git a/deprecated/x/cdp/keeper/auctions.go b/deprecated/x/cdp/keeper/auctions.go deleted file mode 100644 index 5b8f7c910..000000000 --- a/deprecated/x/cdp/keeper/auctions.go +++ /dev/null @@ -1,183 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -const ( - // factor for setting the initial value of gov tokens to sell at debt auctions -- assuming stable token is ~1 eur, this starts the auction with a price of $0.01 KAVA - dump = 100 -) - -// AuctionCollateral creates auctions from the input deposits which attempt to raise the corresponding amount of debt -func (k Keeper) AuctionCollateral(ctx sdk.Context, deposits types.Deposits, collateralType string, debt sdk.Int, bidDenom string) error { - - auctionSize := k.getAuctionSize(ctx, collateralType) - totalCollateral := deposits.SumCollateral() - for _, deposit := range deposits { - debtCoveredByDeposit := (sdk.NewDecFromInt(deposit.Amount.Amount).Quo(sdk.NewDecFromInt(totalCollateral))).Mul(sdk.NewDecFromInt(debt)).RoundInt() - err := k.CreateAuctionsFromDeposit(ctx, deposit.Amount, collateralType, deposit.Depositor.AccAddress(), debtCoveredByDeposit, auctionSize, bidDenom) - if err != nil { - return err - } - } - return nil -} - -// CreateAuctionsFromDeposit creates auctions from the input deposit -func (k Keeper) CreateAuctionsFromDeposit( - ctx sdk.Context, collateral sdk.Coin, collateralType string, returnAddr sdk.AccAddress, debt, auctionSize sdk.Int, - principalDenom string) error { - - // number of auctions of auctionSize - numberOfAuctions := collateral.Amount.Quo(auctionSize) - debtPerAuction := debt.Mul(auctionSize).Quo(collateral.Amount) - - // last auction for remaining collateral (collateral < auctionSize) - lastAuctionCollateral := collateral.Amount.Mod(auctionSize) - lastAuctionDebt := debt.Mul(lastAuctionCollateral).Quo(collateral.Amount) - - // amount of debt that has not been allocated due to - // rounding error (unallocated debt is less than numberOfAuctions + 1) - unallocatedDebt := debt.Sub(numberOfAuctions.Mul(debtPerAuction).Add(lastAuctionDebt)) - - // rounding error for whole and last auctions in units of collateral - // higher value means a larger truncation - wholeAuctionError := debt.Mul(auctionSize).Mod(collateral.Amount) - lastAuctionError := debt.Mul(lastAuctionCollateral).Mod(collateral.Amount) - - // if last auction has larger rounding error, then allocate one debt to last auction first - // follows the largest remainder method https://en.wikipedia.org/wiki/Largest_remainder_method - if lastAuctionError.GT(wholeAuctionError) { - lastAuctionDebt = lastAuctionDebt.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) - } - - debtDenomMap := k.GetDebtDenomMap(ctx) - numAuctions := numberOfAuctions.Int64() - - // create whole auctions - for i := int64(0); i < numAuctions; i++ { - debtAmount := debtPerAuction - - // distribute unallocated debt left over starting with first auction created - if unallocatedDebt.IsPositive() { - debtAmount = debtAmount.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) - } - - penalty := k.ApplyLiquidationPenalty(ctx, collateralType, debtAmount) - - _, err := k.auctionKeeper.StartCollateralAuction( - ctx, types.LiquidatorMacc, sdk.NewCoin(collateral.Denom, auctionSize), - sdk.NewCoin(principalDenom, debtAmount.Add(penalty)), []sdk.AccAddress{returnAddr}, - []sdk.Int{auctionSize}, sdk.NewCoin(debtDenomMap[principalDenom], debtAmount), - ) - - if err != nil { - return err - } - } - - // skip last auction if there is no collateral left to auction - if !lastAuctionCollateral.IsPositive() { - return nil - } - - // if the last auction had a larger rounding error than whole auctions, - // then unallocatedDebt will be zero since we will have already distributed - // all of the unallocated debt - if unallocatedDebt.IsPositive() { - lastAuctionDebt = lastAuctionDebt.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) - } - - penalty := k.ApplyLiquidationPenalty(ctx, collateralType, lastAuctionDebt) - - _, err := k.auctionKeeper.StartCollateralAuction( - ctx, types.LiquidatorMacc, sdk.NewCoin(collateral.Denom, lastAuctionCollateral), - sdk.NewCoin(principalDenom, lastAuctionDebt.Add(penalty)), []sdk.AccAddress{returnAddr}, - []sdk.Int{lastAuctionCollateral}, sdk.NewCoin(debtDenomMap[principalDenom], lastAuctionDebt), - ) - - return err -} - -// NetSurplusAndDebt burns surplus and debt coins equal to the minimum of surplus and debt balances held by the liquidator module account -// for example, if there is 1000 debt and 100 surplus, 100 surplus and 100 debt are burned, netting to 900 debt -func (k Keeper) NetSurplusAndDebt(ctx sdk.Context) error { - dps := k.GetParams(ctx).DebtParams - debtDenomMap := k.GetDebtDenomMap(ctx) - for _, dp := range dps { - totalSurplus := k.GetTotalSurplus(ctx, types.LiquidatorMacc, dp.Denom) - debt := k.GetTotalDebt(ctx, types.LiquidatorMacc, debtDenomMap[dp.Denom]) - netAmount := sdk.MinInt(totalSurplus, debt) - if netAmount.IsZero() { - return nil - } - // burn debt coins equal to netAmount - err := k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(debtDenomMap[dp.Denom], netAmount))) - if err != nil { - return err - } - - // burn stable coins equal to min(balance, netAmount) - macc := k.accountKeeper.GetModuleAccount(ctx, types.LiquidatorMacc) - balance := k.bankKeeper.GetAllBalances(ctx, macc.GetAddress()).AmountOf(dp.Denom) - burnAmount := sdk.MinInt(balance, netAmount) - k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, burnAmount))) - } - return nil -} - -// GetTotalSurplus returns the total amount of surplus tokens held by the liquidator module account -func (k Keeper) GetTotalSurplus(ctx sdk.Context, accountName string, denom string) sdk.Int { - return k.getTotalDenom(ctx, accountName, denom) -} - -// GetTotalDebt returns the total amount of debt tokens held by the liquidator module account -func (k Keeper) GetTotalDebt(ctx sdk.Context, accountName string, deb_denom string) sdk.Int { - return k.getTotalDenom(ctx, accountName, deb_denom) -} - -func (k Keeper) getTotalDenom(ctx sdk.Context, accountName string, denom string) sdk.Int { - acc := k.accountKeeper.GetModuleAccount(ctx, accountName) - return k.bankKeeper.GetAllBalances(ctx, acc.GetAddress()).AmountOf(denom) -} - -// RunSurplusAndDebtAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter -func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error { - if err := k.NetSurplusAndDebt(ctx); err != nil { - return err - } - debtDenomMap := k.GetDebtDenomMap(ctx) - dps := k.GetParams(ctx).DebtParams - for _, dp := range dps { - remainingDebt := k.GetTotalDebt(ctx, types.LiquidatorMacc, debtDenomMap[dp.Denom]) - if remainingDebt.GTE(dp.DebtAuctionThreshold) { - debtLot := sdk.NewCoin(debtDenomMap[dp.Denom], dp.DebtAuctionLot) - bidCoin := sdk.NewCoin(dp.Denom, debtLot.Amount) - initialLot := sdk.NewCoin(k.GetGovDenom(ctx), debtLot.Amount.Mul(sdk.NewInt(dump))) - - _, err := k.auctionKeeper.StartDebtAuction(ctx, types.LiquidatorMacc, bidCoin, initialLot, debtLot) - if err != nil { - return err - } - } - - macc := k.accountKeeper.GetModuleAccount(ctx, types.LiquidatorMacc) - surplus := k.bankKeeper.GetAllBalances(ctx, macc.GetAddress()).AmountOf(dp.Denom) - if !surplus.GTE(dp.SurplusAuctionThreshold) { - continue - } - - surplusLot := sdk.NewCoin(dp.Denom, sdk.MinInt(dp.SurplusAuctionLot, surplus)) - _, err := k.auctionKeeper.StartSurplusAuction(ctx, types.LiquidatorMacc, surplusLot, k.GetGovDenom(ctx)) - if err != nil { - return err - } - } - return nil -} diff --git a/deprecated/x/cdp/keeper/auctions_internal_test.go b/deprecated/x/cdp/keeper/auctions_internal_test.go deleted file mode 100644 index b2a6552a1..000000000 --- a/deprecated/x/cdp/keeper/auctions_internal_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k Keeper) TestGetTotalDenom(ctx sdk.Context, accountName string, denom string) sdk.Int { - return k.getTotalDenom(ctx, accountName, denom) -} diff --git a/deprecated/x/cdp/keeper/auctions_test.go b/deprecated/x/cdp/keeper/auctions_test.go deleted file mode 100644 index 215f40352..000000000 --- a/deprecated/x/cdp/keeper/auctions_test.go +++ /dev/null @@ -1,207 +0,0 @@ -package keeper_test - -// import ( -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/UnUniFi/chain/app" -// auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" - -// cdpkeeper "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - -// "github.com/stretchr/testify/suite" - -// "github.com/cometbft/cometbft/crypto" -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" -// ) - -// type AuctionTestSuite struct { -// suite.Suite - -// keeper cdpkeeper.Keeper -// app app.TestApp -// ctx sdk.Context -// addrs []sdk.AccAddress -// } - -// func (suite *AuctionTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// taddr := sdk.AccAddress(crypto.AddressHash([]byte("KavaTestUser1"))) -// authGS := app.NewAuthGenState(tApp, []sdk.AccAddress{taddr}, []sdk.Coins{cs(c("jpu", 51000000000), c("euu", 21000000000))}) -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// keeper := tApp.GetCDPKeeper() -// suite.app = tApp -// suite.ctx = ctx -// suite.keeper = keeper -// suite.addrs = []sdk.AccAddress{taddr} -// } - -// func (suite *AuctionTestSuite) TestNetDebtSurplus() { -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// err := sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 100))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debteuu", 100))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", 10))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("euu", 20))) -// suite.NoError(err) -// suite.NotPanics(func() { suite.keeper.NetSurplusAndDebt(suite.ctx) }) -// acc := ak.GetModuleAccount(suite.ctx, cdptypes.LiquidatorMacc) -// suite.Equal(cs(c("debtjpu", 90), c("debteuu", 80)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) -// } - -// func (suite *AuctionTestSuite) TestCollateralAuction() { -// sk := suite.app.GetBankKeeper() -// err := sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 21000000000), c("bnb", 190000000000))) -// suite.Require().NoError(err) -// testDeposit := cdptypes.NewDeposit(1, suite.addrs[0], c("bnb", 190000000000)) -// err = suite.keeper.AuctionCollateral(suite.ctx, cdptypes.Deposits{testDeposit}, "bnb-a", i(21000000000), "jpu") -// suite.Require().NoError(err) -// } - -// func (suite *AuctionTestSuite) TestSurplusAuction() { -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// var jpuNum int64 = 600_000_000_000 -// var euuNum int64 = 900_000_000_000 -// var debtJpuNum int64 = 100_000_000_000 -// var debtEuuNum int64 = 200_000_000_000 -// var err error -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", jpuNum))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", debtJpuNum))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("euu", euuNum))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debteuu", debtEuuNum))) -// suite.NoError(err) -// suite.keeper.RunSurplusAndDebtAuctions(suite.ctx) -// acc := ak.GetModuleAccount(suite.ctx, auctiontypes.ModuleName) -// suite.Equal(cs(c("jpu", 10_000_000_000), c("euu", 10_000_000_000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.LiquidatorMacc) -// suite.Equal(cs(c("jpu", 490_000_000_000), c("euu", 690_000_000_000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) -// } - -// func (suite *AuctionTestSuite) TestDebtAuction() { -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// var jpuNum int64 = 100_000_000_000 -// var euuNum int64 = 200_000_000_000 -// var debtJpuNum int64 = 200_000_000_000 -// var debtEuuNum int64 = 900_000_000_000 -// err := sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", jpuNum))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", debtJpuNum))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("euu", euuNum))) -// suite.NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debteuu", debtEuuNum))) -// suite.NoError(err) -// suite.keeper.RunSurplusAndDebtAuctions(suite.ctx) -// acc := ak.GetModuleAccount(suite.ctx, auctiontypes.ModuleName) -// suite.Equal(cs(c("debtjpu", 10_000_000_000), c("debteuu", 10_000_000_000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.LiquidatorMacc) -// suite.Equal(cs(c("debtjpu", 90_000_000_000), c("debteuu", 690_000_000_000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) -// } - -// func (suite *AuctionTestSuite) TestGetTotalSurplus() { -// sk := suite.app.GetBankKeeper() - -// // liquidator account has zero coins -// suite.Require().Equal(sdk.NewInt(0), suite.keeper.GetTotalSurplus(suite.ctx, cdptypes.LiquidatorMacc, "jpu")) - -// // mint some coins -// err := sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", 100e6))) -// suite.Require().NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", 200e6))) -// suite.Require().NoError(err) - -// // liquidator account has 300e6 total jpu -// suite.Require().Equal(sdk.NewInt(300e6), suite.keeper.GetTotalSurplus(suite.ctx, cdptypes.LiquidatorMacc, "jpu")) - -// // mint some debt -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 500e6))) -// suite.Require().NoError(err) - -// // liquidator account still has 300e6 total jpu -- debt balance is ignored -// suite.Require().Equal(sdk.NewInt(300e6), suite.keeper.GetTotalSurplus(suite.ctx, cdptypes.LiquidatorMacc, "jpu")) - -// // burn some jpu -// err = sk.BurnCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", 50e6))) -// suite.Require().NoError(err) - -// // liquidator jpu decreases -// suite.Require().Equal(sdk.NewInt(250e6), suite.keeper.GetTotalSurplus(suite.ctx, cdptypes.LiquidatorMacc, "jpu")) -// } - -// func (suite *AuctionTestSuite) TestGetTotalDebt() { -// sk := suite.app.GetBankKeeper() - -// // liquidator account has zero debt -// suite.Require().Equal(sdk.NewInt(0), suite.keeper.GetTotalSurplus(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) - -// // mint some debt -// err := sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 100e6))) -// suite.Require().NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 200e6))) -// suite.Require().NoError(err) - -// // liquidator account has 300e6 total debt -// suite.Require().Equal(sdk.NewInt(300e6), suite.keeper.GetTotalDebt(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) - -// // mint some jpu -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", 500e6))) -// suite.Require().NoError(err) - -// // liquidator account still has 300e6 total debt -- jpu balance is ignored -// suite.Require().Equal(sdk.NewInt(300e6), suite.keeper.GetTotalDebt(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) - -// // burn some debt -// err = sk.BurnCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 50e6))) -// suite.Require().NoError(err) - -// // liquidator debt decreases -// suite.Require().Equal(sdk.NewInt(250e6), suite.keeper.GetTotalDebt(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) -// } - -// func (suite *AuctionTestSuite) TestGetTotalDenom() { -// sk := suite.app.GetBankKeeper() - -// // liquidator account has zero debt -// suite.Require().Equal(sdk.NewInt(0), suite.keeper.TestGetTotalDenom(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) - -// // mint some debt -// err := sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 100e6))) -// suite.Require().NoError(err) -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 200e6))) -// suite.Require().NoError(err) - -// // liquidator account has 300e6 total debt -// suite.Require().Equal(sdk.NewInt(300e6), suite.keeper.TestGetTotalDenom(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) - -// // mint some jpu -// err = sk.MintCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("jpu", 500e6))) -// suite.Require().NoError(err) - -// // liquidator account still has 300e6 total debt -- jpu balance is ignored -// suite.Require().Equal(sdk.NewInt(300e6), suite.keeper.TestGetTotalDenom(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) - -// // burn some debt -// err = sk.BurnCoins(suite.ctx, cdptypes.LiquidatorMacc, cs(c("debtjpu", 50e6))) -// suite.Require().NoError(err) - -// // liquidator debt decreases -// suite.Require().Equal(sdk.NewInt(250e6), suite.keeper.TestGetTotalDenom(suite.ctx, cdptypes.LiquidatorMacc, "debtjpu")) -// } - -// // func TestAuctionTestSuite(t *testing.T) { -// // suite.Run(t, new(AuctionTestSuite)) -// // } diff --git a/deprecated/x/cdp/keeper/cdps.go b/deprecated/x/cdp/keeper/cdps.go deleted file mode 100644 index d1be7a9d7..000000000 --- a/deprecated/x/cdp/keeper/cdps.go +++ /dev/null @@ -1,629 +0,0 @@ -package keeper - -import ( - "encoding/json" - "fmt" - "sort" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// AddCdp adds a cdp for a specific owner and collateral type -func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) error { - // validation - err := k.ValidateCollateral(ctx, collateral, collateralType) - if err != nil { - return err - } - err = k.ValidateBalance(ctx, collateral, owner) - if err != nil { - return err - } - _, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) - if found { - return sdkerrors.Wrapf(types.ErrCdpAlreadyExists, "owner %s, denom %s", owner, collateral.Denom) - } - err = k.ValidatePrincipalAdd(ctx, principal) - if err != nil { - return err - } - - err = k.ValidateDebtLimit(ctx, collateralType, principal) - if err != nil { - return err - } - err = k.ValidateCollateralizationRatio(ctx, collateral, collateralType, principal, sdk.NewCoin(principal.Denom, sdk.ZeroInt())) - if err != nil { - return err - } - - // send coins from the owners account to the cdp module - id := k.GetNextCdpID(ctx) - interestFactor, found := k.GetInterestFactor(ctx, collateralType) - if !found { - interestFactor = sdk.OneDec() - k.SetInterestFactor(ctx, collateralType, interestFactor) - - } - cdp := types.NewCdp(id, owner, collateral, collateralType, principal, ctx.BlockHeader().Time, interestFactor) - deposit := types.NewDeposit(cdp.Id, owner, collateral) - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, sdk.NewCoins(collateral)) - if err != nil { - return err - } - - // mint the principal and send to the owners account - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(principal)) - if err != nil { - panic(err) - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(principal)) - if err != nil { - panic(err) - } - - // mint the corresponding amount of debt coins - debtDenomMap := k.GetDebtDenomMap(ctx) - err = k.MintDebtCoins(ctx, types.ModuleName, debtDenomMap[principal.Denom], principal) - if err != nil { - panic(err) - } - - // update total principal for input collateral type - k.IncrementTotalPrincipal(ctx, collateralType, principal) - - // set the cdp, deposit, and indexes in the store - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, collateral, cdp.Type, principal) - err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) - if err != nil { - return err - } - k.IndexCdpByOwner(ctx, cdp) - k.SetDeposit(ctx, deposit) - k.SetNextCdpID(ctx, id+1) - - k.hooks.AfterCdpCreated(ctx, cdp) - - // emit events for cdp creation, deposit, and draw - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCreateCdp, - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpDeposit, - sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpDraw, - sdk.NewAttribute(sdk.AttributeKeyAmount, principal.String()), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - - return nil -} - -// UpdateCdpAndCollateralRatioIndex updates the state of an existing cdp in the store by replacing the old index values and updating the store to the latest cdp object values -func (k Keeper) UpdateCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.Cdp, ratio sdk.Dec) error { - err := k.removeOldCollateralRatioIndex(ctx, cdp.Type, cdp.Id) - if err != nil { - return err - } - - err = k.SetCdp(ctx, cdp) - if err != nil { - return err - } - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.Id, ratio) - return nil -} - -// DeleteCdpAndCollateralRatioIndex deletes an existing cdp in the store by removing the old index value and deleting the cdp object from the store -func (k Keeper) DeleteCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.Cdp) error { - err := k.removeOldCollateralRatioIndex(ctx, cdp.Type, cdp.Id) - if err != nil { - return err - } - - return k.DeleteCdp(ctx, cdp) -} - -// SetCdpAndCollateralRatioIndex sets the cdp and collateral ratio index in the store -func (k Keeper) SetCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.Cdp, ratio sdk.Dec) error { - err := k.SetCdp(ctx, cdp) - if err != nil { - return err - } - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.Id, ratio) - return nil -} - -func (k Keeper) removeOldCollateralRatioIndex(ctx sdk.Context, ctype string, id uint64) error { - storedCdp, found := k.GetCdp(ctx, ctype, id) - if !found { - return sdkerrors.Wrapf(types.ErrCdpNotFound, "%d", storedCdp.Id) - } - oldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, storedCdp.Collateral, storedCdp.Type, storedCdp.GetTotalPrincipal()) - k.RemoveCdpCollateralRatioIndex(ctx, storedCdp.Type, storedCdp.Id, oldCollateralToDebtRatio) - return nil -} - -// MintDebtCoins mints debt coins in the cdp module account -func (k Keeper) MintDebtCoins(ctx sdk.Context, moduleAccount string, denom string, principalCoins sdk.Coin) error { - debtCoins := sdk.NewCoins(sdk.NewCoin(denom, principalCoins.Amount)) - return k.bankKeeper.MintCoins(ctx, moduleAccount, debtCoins) -} - -// BurnDebtCoins burns debt coins from the cdp module account -func (k Keeper) BurnDebtCoins(ctx sdk.Context, moduleAccount string, denom string, paymentCoins sdk.Coin) error { - macc := k.accountKeeper.GetModuleAccount(ctx, moduleAccount) - maxBurnableAmount := k.bankKeeper.GetAllBalances(ctx, macc.GetAddress()).AmountOf(denom) - // check that the requested burn is not greater than the mod account balance - debtCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.MinInt(paymentCoins.Amount, maxBurnableAmount))) - return k.bankKeeper.BurnCoins(ctx, moduleAccount, debtCoins) -} - -// GetCdpID returns the id of the cdp corresponding to a specific owner and collateral denom -func (k Keeper) GetCdpID(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (uint64, bool) { - - cdpIDs, found := k.GetCdpIdsByOwner(ctx, owner) - if !found { - return 0, false - } - for _, id := range cdpIDs { - _, found = k.GetCdp(ctx, collateralType, id) - if found { - return id, true - } - } - return 0, false - -} - -// GetCdpIdsByOwner returns all the ids of cdps corresponding to a particular owner -func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) (cdpIDs []uint64, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpIDOwnerIndex)) - bz := store.Get(owner) - if bz == nil { - return []uint64{}, false - } - json.Unmarshal(bz, &cdpIDs) - return cdpIDs, true -} - -// GetCdpByOwnerAndCollateralType queries cdps owned by owner and returns the cdp with matching denom -func (k Keeper) GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (types.Cdp, bool) { - cdpIDs, found := k.GetCdpIdsByOwner(ctx, owner) - if !found { - return types.Cdp{}, false - } - for _, id := range cdpIDs { - cdp, found := k.GetCdp(ctx, collateralType, id) - if found { - return cdp, true - } - } - return types.Cdp{}, false -} - -// GetCdp returns the cdp associated with a particular collateral denom and id -func (k Keeper) GetCdp(ctx sdk.Context, collateralType string, cdpID uint64) (types.Cdp, bool) { - // get store - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpKey)) - db, found := k.GetCollateralTypePrefix(ctx, collateralType) - if !found { - return types.Cdp{}, false - } - // get Cdp - bz := store.Get(types.CdpKeySuffix(db, cdpID)) - // unmarshal - if bz == nil { - return types.Cdp{}, false - } - var cdp types.Cdp - k.cdc.MustUnmarshalLengthPrefixed(bz, &cdp) - return cdp, true -} - -// SetCdp sets a cdp in the store -func (k Keeper) SetCdp(ctx sdk.Context, cdp types.Cdp) error { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpKey)) - denomByte, found := k.GetCollateralTypePrefix(ctx, cdp.Type) - if !found { - return sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom) - } - bz := k.cdc.MustMarshalLengthPrefixed(&cdp) - store.Set(types.CdpKeySuffix(denomByte, cdp.Id), bz) - return nil -} - -// DeleteCdp deletes a cdp from the store -func (k Keeper) DeleteCdp(ctx sdk.Context, cdp types.Cdp) error { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpKey)) - db, found := k.GetCollateralTypePrefix(ctx, cdp.Type) - if !found { - return sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom) - } - store.Delete(types.CdpKeySuffix(db, cdp.Id)) - return nil - -} - -// GetAllCdps returns all cdps from the store -func (k Keeper) GetAllCdps(ctx sdk.Context) (cdps types.Cdps) { - k.IterateAllCdps(ctx, func(cdp types.Cdp) bool { - cdps = append(cdps, cdp) - return false - }) - return -} - -// GetAllCdpsByCollateralType returns all cdps of a particular collateral type from the store -func (k Keeper) GetAllCdpsByCollateralType(ctx sdk.Context, collateralType string) (cdps types.Cdps) { - k.IterateCdpsByCollateralType(ctx, collateralType, func(cdp types.Cdp) bool { - cdps = append(cdps, cdp) - return false - }) - return -} - -// GetAllCdpsByCollateralTypeAndRatio returns all cdps of a particular collateral type and below a certain collateralization ratio -func (k Keeper) GetAllCdpsByCollateralTypeAndRatio(ctx sdk.Context, collateralType string, targetRatio sdk.Dec) (cdps types.Cdps) { - k.IterateCdpsByCollateralRatio(ctx, collateralType, targetRatio, func(cdp types.Cdp) bool { - cdps = append(cdps, cdp) - return false - }) - return -} - -// SetNextCdpID sets the highest cdp id in the store -func (k Keeper) SetNextCdpID(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyPrefix(types.NextCdpID), types.GetCdpIDBytes(id)) -} - -// GetNextCdpID returns the highest cdp id from the store -func (k Keeper) GetNextCdpID(ctx sdk.Context) (id uint64) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyPrefix(types.NextCdpID)) - if bz == nil { - panic("starting cdp id not set in genesis") - } - id = types.GetCdpIDFromBytes(bz) - return -} - -// IndexCdpByOwner sets the cdp id in the store, indexed by the owner -func (k Keeper) IndexCdpByOwner(ctx sdk.Context, cdp types.Cdp) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpIDOwnerIndex)) - cdpIDs, found := k.GetCdpIdsByOwner(ctx, cdp.Owner.AccAddress()) - - if !found { - idBytes, _ := json.Marshal([]uint64{cdp.Id}) - store.Set(cdp.Owner, idBytes) - return - } - cdpIDs = append(cdpIDs, cdp.Id) - sort.Slice(cdpIDs, func(i, j int) bool { return cdpIDs[i] < cdpIDs[j] }) - bz, _ := json.Marshal(cdpIDs) - store.Set(cdp.Owner, bz) -} - -// RemoveCdpOwnerIndex deletes the cdp id from the store's index of cdps by owner -func (k Keeper) RemoveCdpOwnerIndex(ctx sdk.Context, cdp types.Cdp) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpIDOwnerIndex)) - cdpIDs, found := k.GetCdpIdsByOwner(ctx, cdp.Owner.AccAddress()) - if !found { - return - } - updatedCdpIds := []uint64{} - for _, id := range cdpIDs { - if id != cdp.Id { - updatedCdpIds = append(updatedCdpIds, id) - } - } - if len(updatedCdpIds) == 0 { - store.Delete(cdp.Owner) - return - } - bz, _ := json.Marshal(updatedCdpIds) - store.Set(cdp.Owner, bz) -} - -// IndexCdpByCollateralRatio sets the cdp id in the store, indexed by the collateral type and collateral to debt ratio -func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdk.Dec) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpIDCollateralRatioIndex)) - db, found := k.GetCollateralTypePrefix(ctx, collateralType) - if !found { - panic(fmt.Sprintf("denom %s prefix not found", collateralType)) - } - store.Set(types.CollateralRatioKey(db, id, collateralRatio), types.GetCdpIDBytes(id)) -} - -// RemoveCdpCollateralRatioIndex deletes the cdp id from the store's index of cdps by collateral type and collateral to debt ratio -func (k Keeper) RemoveCdpCollateralRatioIndex(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdk.Dec) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpIDCollateralRatioIndex)) - db, found := k.GetCollateralTypePrefix(ctx, collateralType) - if !found { - panic(fmt.Sprintf("denom %s prefix not found", collateralType)) - } - store.Delete(types.CollateralRatioKey(db, id, collateralRatio)) -} - -// GetDebtDenom returns the denom of debt in the system -func (k Keeper) GetDebtDenomMap(ctx sdk.Context) types.DebtDenomMap { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyPrefix(types.DebtDenom)) - return types.NewDebtDenomMapFromByte(bz) -} - -// GetGovDenom returns the denom of the governance token -func (k Keeper) GetGovDenom(ctx sdk.Context) string { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyPrefix(types.GovDenom)) - return string(bz) -} - -// SetDebtDenoms set the denom of debt in the system -func (k Keeper) SetDebtDenomMap(ctx sdk.Context, debt_denom_map types.DebtDenomMap) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyPrefix(types.DebtDenom), debt_denom_map.Byte()) -} - -// SetGovDenom set the denom of the governance token in the system -func (k Keeper) SetGovDenom(ctx sdk.Context, denom string) { - if denom == "" { - panic("gov denom not set in genesis") - } - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyPrefix(types.GovDenom), []byte(denom)) -} - -// ValidateCollateral validates that a collateral is valid for use in cdps -func (k Keeper) ValidateCollateral(ctx sdk.Context, collateral sdk.Coin, collateralType string) error { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - return sdkerrors.Wrap(types.ErrCollateralNotSupported, collateral.Denom) - } - if cp.Denom != collateral.Denom { - return sdkerrors.Wrapf(types.ErrInvalidCollateral, "collateral type: %s expected denom: %s got: %s", collateralType, cp.Denom, collateral.Denom) - } - ok := k.GetMarketStatus(ctx, cp.SpotMarketId) - if !ok { - return sdkerrors.Wrap(types.ErrPricefeedDown, collateral.Denom) - } - ok = k.GetMarketStatus(ctx, cp.LiquidationMarketId) - if !ok { - return sdkerrors.Wrap(types.ErrPricefeedDown, collateral.Denom) - } - return nil -} - -// ValidatePrincipalAdd validates that an asset is valid for use as debt when creating a new cdp -func (k Keeper) ValidatePrincipalAdd(ctx sdk.Context, principal sdk.Coin) error { - dp, found := k.GetDebtParam(ctx, principal.Denom) - if !found { - return sdkerrors.Wrap(types.ErrDebtNotSupported, principal.Denom) - } - if principal.Amount.LT(dp.DebtFloor) { - return sdkerrors.Wrapf(types.ErrBelowDebtFloor, "proposed %s < minimum %s", principal, dp.DebtFloor) - } - return nil -} - -// ValidatePrincipalDraw validates that an asset is valid for use as debt when drawing debt off an existing cdp -func (k Keeper) ValidatePrincipalDraw(ctx sdk.Context, principal sdk.Coin, expectedDenom string) error { - if principal.Denom != expectedDenom { - return sdkerrors.Wrapf(types.ErrInvalidDebtRequest, "proposed %s, expected %s", principal.Denom, expectedDenom) - } - _, found := k.GetDebtParam(ctx, principal.Denom) - if !found { - return sdkerrors.Wrap(types.ErrDebtNotSupported, principal.Denom) - } - return nil -} - -// ValidateDebtLimit validates that the input debt amount does not exceed the global debt limit or the debt limit for that collateral -func (k Keeper) ValidateDebtLimit(ctx sdk.Context, collateralType string, principal sdk.Coin) error { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - return sdkerrors.Wrap(types.ErrCollateralNotSupported, collateralType) - } - totalPrincipal := k.GetTotalPrincipal(ctx, collateralType, principal.Denom).Add(principal.Amount) - collateralLimit := cp.DebtLimit.Amount - if totalPrincipal.GT(collateralLimit) { - return sdkerrors.Wrapf(types.ErrExceedsDebtLimit, "debt increase %s > collateral debt limit %s", sdk.NewCoins(sdk.NewCoin(principal.Denom, totalPrincipal)), sdk.NewCoins(sdk.NewCoin(principal.Denom, collateralLimit))) - } - dp, exists := k.GetDebtParams(ctx).FindGlobalDebtLimitDenom(principal.Denom) - if !exists { - return sdkerrors.Wrapf(types.ErrDebtNotSupported, "not found debt params global deb limit %s", principal.Denom) - } - if totalPrincipal.GT(dp.GlobalDebtLimit.Amount) { - return sdkerrors.Wrapf(types.ErrExceedsDebtLimit, "debt increase %s > global debt limit %s", sdk.NewCoin(principal.Denom, totalPrincipal), sdk.NewCoin(principal.Denom, dp.GlobalDebtLimit.Amount)) - } - return nil -} - -// ValidateCollateralizationRatio validate that adding the input principal doesn't put the cdp below the liquidation ratio -func (k Keeper) ValidateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin) error { - collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, collateral, collateralType, principal, fees, spot) - if err != nil { - return err - } - liquidationRatio := k.getLiquidationRatio(ctx, collateralType) - if collateralizationRatio.LT(liquidationRatio) { - return sdkerrors.Wrapf(types.ErrInvalidCollateralRatio, "collateral %s, collateral ratio %s, liquidation ratio %s", collateral.Denom, collateralizationRatio, liquidationRatio) - } - return nil -} - -// ValidateBalance validates that the input account has sufficient spendable funds -func (k Keeper) ValidateBalance(ctx sdk.Context, amount sdk.Coin, sender sdk.AccAddress) error { - acc := k.accountKeeper.GetAccount(ctx, sender) - if acc == nil { - return sdkerrors.Wrapf(types.ErrAccountNotFound, "address: %s", sender) - } - spendableBalance := k.bankKeeper.SpendableCoins(ctx, acc.GetAddress()).AmountOf(amount.Denom) - if spendableBalance.LT(amount.Amount) { - return sdkerrors.Wrapf(types.ErrInsufficientBalance, "%s < %s", sdk.NewCoin(amount.Denom, spendableBalance), amount) - } - - return nil -} - -// CalculateCollateralToDebtRatio returns the collateral to debt ratio of the input collateral and debt amounts -func (k Keeper) CalculateCollateralToDebtRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, debt sdk.Coin) sdk.Dec { - debtTotal := k.convertDebtToBaseUnits(ctx, debt) - - if debtTotal.IsZero() || debtTotal.GTE(types.MaxSortableDec) { - return types.MaxSortableDec.Sub(sdk.SmallestDec()) - } - - collateralBaseUnits := k.convertCollateralToBaseUnits(ctx, collateral, collateralType) - return collateralBaseUnits.Quo(debtTotal) -} - -// LoadAugmentedCdp creates a new augmented Cdp from an existing Cdp -func (k Keeper) LoadAugmentedCdp(ctx sdk.Context, cdp types.Cdp) types.AugmentedCdp { - // sync the latest interest of the cdp - interestAccumulated := k.CalculateNewInterest(ctx, cdp) - cdp.AccumulatedFees = cdp.AccumulatedFees.Add(interestAccumulated) - // update cdp fields to match synced accumulated fees - prevAccrualTime, found := k.GetPreviousAccrualTime(ctx, cdp.Type) - if found { - cdp.FeesUpdated = prevAccrualTime - } - globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) - if found { - cdp.InterestFactor = globalInterestFactor - } - // calculate collateralization ratio - collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral, cdp.Type, cdp.Principal, cdp.AccumulatedFees, liquidation) - if err != nil { - return types.AugmentedCdp{Cdp: cdp} - } - // convert collateral value to debt coin - totalDebt := cdp.GetTotalPrincipal().Amount - collateralValueInDebtDenom := sdk.NewDecFromInt(totalDebt).Mul(collateralizationRatio) - collateralValueInDebt := sdk.NewCoin(cdp.Principal.Denom, collateralValueInDebtDenom.RoundInt()) - // create new augmuented cdp - augmentedCdp := types.NewAugmentedCdp(cdp, collateralValueInDebt, collateralizationRatio) - return augmentedCdp -} - -// CalculateCollateralizationRatio returns the collateralization ratio of the input collateral to the input debt plus fees -func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin, pfType pricefeedType) (sdk.Dec, error) { - if collateral.IsZero() { - return sdk.ZeroDec(), nil - } - var marketID string - switch pfType { - case spot: - marketID = k.getSpotMarketID(ctx, collateralType) - case liquidation: - marketID = k.getliquidationMarketID(ctx, collateralType) - default: - return sdk.Dec{}, pfType.IsValid() - } - - price, err := k.PricefeedKeeper.GetCurrentPrice(ctx, marketID) - if err != nil { - return sdk.Dec{}, err - } - collateralBaseUnits := k.convertCollateralToBaseUnits(ctx, collateral, collateralType) - collateralValue := collateralBaseUnits.Mul(price.Price) - - prinicpalBaseUnits := k.convertDebtToBaseUnits(ctx, principal) - principalTotal := prinicpalBaseUnits - feeBaseUnits := k.convertDebtToBaseUnits(ctx, fees) - principalTotal = principalTotal.Add(feeBaseUnits) - - collateralRatio := collateralValue.Quo(principalTotal) - return collateralRatio, nil -} - -// CalculateCollateralizationRatioFromAbsoluteRatio takes a coin's denom and an absolute ratio and returns the respective collateralization ratio -func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralType string, absoluteRatio sdk.Dec, pfType pricefeedType) (sdk.Dec, error) { - // get price of collateral - var marketID string - switch pfType { - case spot: - marketID = k.getSpotMarketID(ctx, collateralType) - case liquidation: - marketID = k.getliquidationMarketID(ctx, collateralType) - default: - return sdk.Dec{}, pfType.IsValid() - } - - price, err := k.PricefeedKeeper.GetCurrentPrice(ctx, marketID) - if err != nil { - return sdk.Dec{}, err - } - // convert absolute ratio to collateralization ratio - respectiveCollateralRatio := absoluteRatio.Quo(price.Price) - return respectiveCollateralRatio, nil -} - -// SetMarketStatus sets the status of the input market, true means the market is up and running, false means it is down -func (k Keeper) SetMarketStatus(ctx sdk.Context, marketID string, up bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PricefeedStatusKey)) - bz, _ := json.Marshal(up) - store.Set([]byte(marketID), bz) - return -} - -// GetMarketStatus returns true if the market has a price, otherwise false -func (k Keeper) GetMarketStatus(ctx sdk.Context, marketID string) (up bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PricefeedStatusKey)) - bz := store.Get([]byte(marketID)) - json.Unmarshal(bz, &up) - return -} - -// UpdatePricefeedStatus determines if the price of an asset is available and updates the global status of the market -func (k Keeper) UpdatePricefeedStatus(ctx sdk.Context, marketID string) (ok bool) { - _, err := k.PricefeedKeeper.GetCurrentPrice(ctx, marketID) - if err != nil { - k.SetMarketStatus(ctx, marketID, false) - return false - } - k.SetMarketStatus(ctx, marketID, true) - return true -} - -// converts the input collateral to base units (ie multiplies the input by 10^(-ConversionFactor)) -func (k Keeper) convertCollateralToBaseUnits(ctx sdk.Context, collateral sdk.Coin, collateralType string) (baseUnits sdk.Dec) { - cp, _ := k.GetCollateral(ctx, collateralType) - return sdk.NewDecFromInt(collateral.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), cp.ConversionFactor.Int64())) -} - -// converts the input debt to base units (ie multiplies the input by 10^(-ConversionFactor)) -func (k Keeper) convertDebtToBaseUnits(ctx sdk.Context, debt sdk.Coin) (baseUnits sdk.Dec) { - dp, _ := k.GetDebtParam(ctx, debt.Denom) - return sdk.NewDecFromInt(debt.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), dp.ConversionFactor.Int64())) -} - -type pricefeedType string - -const ( - spot pricefeedType = "spot" - liquidation = "liquidation" -) - -func (pft pricefeedType) IsValid() error { - switch pft { - case spot, liquidation: - return nil - } - return fmt.Errorf("invalid pricefeed type: %s", pft) -} diff --git a/deprecated/x/cdp/keeper/cdps_test.go b/deprecated/x/cdp/keeper/cdps_test.go deleted file mode 100644 index f92356f75..000000000 --- a/deprecated/x/cdp/keeper/cdps_test.go +++ /dev/null @@ -1,360 +0,0 @@ -package keeper_test - -// import ( -// "errors" -// "testing" -// "time" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// type CdpTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// app app.TestApp -// ctx sdk.Context -// } - -// func (suite *CdpTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// tApp.InitializeFromGenesisStates( -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// keeper := tApp.GetCDPKeeper() -// suite.app = tApp -// suite.ctx = ctx -// suite.keeper = keeper -// } - -// func fundAccount(bk bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error { -// err := bk.MintCoins(ctx, minttypes.ModuleName, coins) -// if err != nil { -// return err -// } -// err = bk.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) -// return err -// } - -// func (suite *CdpTestSuite) TestAddCdp() { -// _, addrs := app.GeneratePrivKeyAddressPairs(2) -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.NewAccountWithAddress(suite.ctx, addrs[0]) -// sk.GetAllBalances(suite.ctx, acc.GetAddress()) -// fundAccount(suite.app.BankKeeper, suite.ctx, acc.GetAddress(), cs(c("xrp", 200000000), c("btc", 500000000))) -// ak.SetAccount(suite.ctx, acc) -// err := suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 200000000), c("jpu", 10000000), "btc-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrInvalidCollateral)) -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 200000000), c("jpu", 26000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrInvalidCollateralRatio)) -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 500000000), c("jpu", 26000000), "xrp-a") -// suite.Error(err) // insufficient balance -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 200000000), c("xjpy", 10000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrDebtNotSupported)) - -// acc2 := ak.NewAccountWithAddress(suite.ctx, addrs[1]) -// fundAccount(suite.app.BankKeeper, suite.ctx, acc2.GetAddress(), cs(c("btc", 500000000000))) -// ak.SetAccount(suite.ctx, acc2) -// err = suite.keeper.AddCdp(suite.ctx, addrs[1], c("btc", 500000000000), c("jpu", 500000000001), "btc-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrExceedsDebtLimit)) - -// ctx := suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Hour * 2)) -// pk := suite.app.GetPriceFeedKeeper() -// err = pk.SetCurrentPrices(ctx, "xrp:jpy") -// suite.Error(err) -// ok := suite.keeper.UpdatePricefeedStatus(ctx, "xrp:jpy") -// suite.False(ok) -// err = suite.keeper.AddCdp(ctx, addrs[0], c("xrp", 100000000), c("jpu", 10000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrPricefeedDown)) - -// err = pk.SetCurrentPrices(suite.ctx, "xrp:jpy") -// ok = suite.keeper.UpdatePricefeedStatus(suite.ctx, "xrp:jpy") -// suite.True(ok) -// suite.NoError(err) -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 100000000), c("jpu", 10000000), "xrp-a") -// suite.NoError(err) -// id := suite.keeper.GetNextCdpID(suite.ctx) -// suite.Equal(uint64(2), id) -// tp := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu") -// suite.Equal(i(10000000), tp) - -// macc := ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// suite.Equal(cs(c("debtjpu", 10000000), c("xrp", 100000000)), sk.GetAllBalances(suite.ctx, macc.GetAddress())) -// acc = ak.GetAccount(suite.ctx, addrs[0]) -// suite.Equal(cs(c("jpu", 10000000), c("xrp", 100000000), c("btc", 500000000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("btc", 500000000), c("jpu", 26667000000), "btc-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrInvalidCollateralRatio)) - -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("btc", 500000000), c("jpu", 100000000), "btc-a") -// suite.NoError(err) -// id = suite.keeper.GetNextCdpID(suite.ctx) -// suite.Equal(uint64(3), id) -// tp = suite.keeper.GetTotalPrincipal(suite.ctx, "btc-a", "jpu") -// suite.Equal(i(100000000), tp) -// macc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// suite.Equal(cs(c("debtjpu", 110000000), c("xrp", 100000000), c("btc", 500000000)), sk.GetAllBalances(suite.ctx, macc.GetAddress())) -// acc = ak.GetAccount(suite.ctx, addrs[0]) -// suite.Equal(cs(c("jpu", 110000000), c("xrp", 100000000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("lol", 100), c("jpu", 10), "lol-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCollateralNotSupported)) -// err = suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 100), c("jpu", 10), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCdpAlreadyExists)) -// } - -// func (suite *CdpTestSuite) TestAddGetCdp() { -// _, addrs := app.GeneratePrivKeyAddressPairs(2) -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.NewAccountWithAddress(suite.ctx, addrs[0]) -// sk.GetAllBalances(suite.ctx, acc.GetAddress()) -// fundAccount(suite.app.BankKeeper, suite.ctx, acc.GetAddress(), cs(c("xrp", 200000000), c("btc", 500000000))) -// ak.SetAccount(suite.ctx, acc) -// err := suite.keeper.AddCdp(suite.ctx, addrs[0], c("btc", 100000000), c("jpu", 10000000), "btc-a") -// suite.NoError(err) -// id := suite.keeper.GetNextCdpID(suite.ctx) -// suite.Equal(uint64(2), id) -// _, found := suite.keeper.GetCdp(suite.ctx, "btc-a", 1) -// suite.True(found) -// _, found2 := suite.keeper.GetCdpByOwnerAndCollateralType(suite.ctx, addrs[0], "btc-a") -// suite.True(found2) -// } - -// func (suite *CdpTestSuite) TestGetSetCollateralTypeByte() { -// _, found := suite.keeper.GetCollateralTypePrefix(suite.ctx, "lol-a") -// suite.False(found) -// db, found := suite.keeper.GetCollateralTypePrefix(suite.ctx, "xrp-a") -// suite.True(found) -// suite.Equal(byte(0x20), db) -// } - -// func (suite *CdpTestSuite) TestGetDebtDenomMap() { -// denomMap := cdptypes.NewDebtDenomMap(cdptypes.DefaultDebtParams) -// suite.keeper.SetDebtDenomMap(suite.ctx, denomMap) -// t := suite.keeper.GetDebtDenomMap(suite.ctx) -// suite.Equal(denomMap, t) - -// empty := cdptypes.DebtDenomMap{} -// suite.keeper.SetDebtDenomMap(suite.ctx, empty) -// t = suite.keeper.GetDebtDenomMap(suite.ctx) -// suite.Equal(empty, t) -// } - -// func (suite *CdpTestSuite) TestGetNextCdpID() { -// id := suite.keeper.GetNextCdpID(suite.ctx) -// suite.Equal(cdptypes.DefaultCdpStartingID, id) -// } - -// func (suite *CdpTestSuite) TestGetSetCdp() { -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// cdp := cdptypes.NewCdp(cdptypes.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("jpu", 1), tmtime.Canonical(time.Now()), sdk.NewDec(0)) -// err := suite.keeper.SetCdp(suite.ctx, cdp) -// suite.NoError(err) - -// t, found := suite.keeper.GetCdp(suite.ctx, "xrp-a", cdptypes.DefaultCdpStartingID) -// suite.True(found) -// suite.Equal(cdp, t) -// _, found = suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.False(found) -// suite.keeper.DeleteCdp(suite.ctx, cdp) -// _, found = suite.keeper.GetCdp(suite.ctx, "btc-a", cdptypes.DefaultCdpStartingID) -// suite.False(found) -// } - -// func (suite *CdpTestSuite) TestGetSetCdpId() { -// _, addrs := app.GeneratePrivKeyAddressPairs(2) -// cdp := cdptypes.NewCdp(cdptypes.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("jpu", 1), tmtime.Canonical(time.Now()), sdk.NewDec(0)) -// err := suite.keeper.SetCdp(suite.ctx, cdp) -// suite.NoError(err) -// suite.keeper.IndexCdpByOwner(suite.ctx, cdp) -// id, found := suite.keeper.GetCdpID(suite.ctx, addrs[0], "xrp-a") -// suite.True(found) -// suite.Equal(cdptypes.DefaultCdpStartingID, id) -// _, found = suite.keeper.GetCdpID(suite.ctx, addrs[0], "lol-a") -// suite.False(found) -// _, found = suite.keeper.GetCdpID(suite.ctx, addrs[1], "xrp-a") -// suite.False(found) -// } - -// func (suite *CdpTestSuite) TestGetSetCdpByOwnerAndCollateralType() { -// _, addrs := app.GeneratePrivKeyAddressPairs(2) -// cdp := cdptypes.NewCdp(cdptypes.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("jpu", 1), tmtime.Canonical(time.Now()), sdk.NewDec(0)) -// err := suite.keeper.SetCdp(suite.ctx, cdp) -// suite.NoError(err) -// suite.keeper.IndexCdpByOwner(suite.ctx, cdp) -// t, found := suite.keeper.GetCdpByOwnerAndCollateralType(suite.ctx, addrs[0], "xrp-a") -// suite.True(found) -// suite.Equal(cdp, t) -// _, found = suite.keeper.GetCdpByOwnerAndCollateralType(suite.ctx, addrs[0], "lol-a") -// suite.False(found) -// _, found = suite.keeper.GetCdpByOwnerAndCollateralType(suite.ctx, addrs[1], "xrp-a") -// suite.False(found) -// suite.NotPanics(func() { suite.keeper.IndexCdpByOwner(suite.ctx, cdp) }) -// } - -// func (suite *CdpTestSuite) TestCalculateCollateralToDebtRatio() { -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// cdp := cdptypes.NewCdp(cdptypes.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("jpu", 1), tmtime.Canonical(time.Now()), sdk.NewDec(0)) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) -// suite.Equal(sdk.MustNewDecFromStr("3.0"), cr) -// cdp = cdptypes.NewCdp(cdptypes.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("jpu", 2), tmtime.Canonical(time.Now()), sdk.NewDec(0)) -// cr = suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) -// suite.Equal(sdk.MustNewDecFromStr("0.5"), cr) -// } - -// func (suite *CdpTestSuite) TestSetCdpByCollateralRatio() { -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// cdp := cdptypes.NewCdp(cdptypes.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("jpu", 1), tmtime.Canonical(time.Now()), sdk.NewDec(0)) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) -// suite.NotPanics(func() { suite.keeper.IndexCdpByCollateralRatio(suite.ctx, cdp.Type, cdp.Id, cr) }) -// } - -// func (suite *CdpTestSuite) TestIterateCdps() { -// cdps := cdps() -// for _, c := range cdps { -// err := suite.keeper.SetCdp(suite.ctx, c) -// suite.NoError(err) -// suite.keeper.IndexCdpByOwner(suite.ctx, c) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, c.Collateral, c.Type, c.Principal) -// suite.keeper.IndexCdpByCollateralRatio(suite.ctx, c.Type, c.Id, cr) -// } -// t := suite.keeper.GetAllCdps(suite.ctx) -// suite.Equal(8, len(t)) -// } - -// func (suite *CdpTestSuite) TestIterateCdpsByCollateralType() { -// cdps := cdps() -// for _, c := range cdps { -// err := suite.keeper.SetCdp(suite.ctx, c) -// suite.NoError(err) -// suite.keeper.IndexCdpByOwner(suite.ctx, c) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, c.Collateral, c.Type, c.Principal) -// suite.keeper.IndexCdpByCollateralRatio(suite.ctx, c.Type, c.Id, cr) -// } -// xrpCdps := suite.keeper.GetAllCdpsByCollateralType(suite.ctx, "xrp-a") -// suite.Equal(3, len(xrpCdps)) -// xrpCdps = suite.keeper.GetAllCdpsByCollateralType(suite.ctx, "xrp-b") -// suite.Equal(3, len(xrpCdps)) -// btcCdps := suite.keeper.GetAllCdpsByCollateralType(suite.ctx, "btc-a") -// suite.Equal(1, len(btcCdps)) -// btcCdps = suite.keeper.GetAllCdpsByCollateralType(suite.ctx, "btc-b") -// suite.Equal(1, len(btcCdps)) -// suite.keeper.DeleteCdp(suite.ctx, cdps[0]) -// suite.keeper.RemoveCdpOwnerIndex(suite.ctx, cdps[0]) -// xrpCdps = suite.keeper.GetAllCdpsByCollateralType(suite.ctx, "xrp-a") -// suite.Equal(2, len(xrpCdps)) -// suite.keeper.DeleteCdp(suite.ctx, cdps[1]) -// suite.keeper.RemoveCdpOwnerIndex(suite.ctx, cdps[1]) -// ids, found := suite.keeper.GetCdpIdsByOwner(suite.ctx, cdps[1].Owner.AccAddress()) -// suite.True(found) -// suite.Equal(1, len(ids)) -// suite.Equal(uint64(3), ids[0]) -// } - -// func (suite *CdpTestSuite) TestIterateCdpsByCollateralRatio() { -// cdps := cdps() -// for _, c := range cdps { -// err := suite.keeper.SetCdp(suite.ctx, c) -// suite.NoError(err) -// suite.keeper.IndexCdpByOwner(suite.ctx, c) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, c.Collateral, c.Type, c.Principal) -// suite.keeper.IndexCdpByCollateralRatio(suite.ctx, c.Type, c.Id, cr) -// } -// xrpCdps := suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25")) -// suite.Equal(0, len(xrpCdps)) -// xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25").Add(sdk.SmallestDec())) -// suite.Equal(1, len(xrpCdps)) -// xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdk.SmallestDec())) -// suite.Equal(2, len(xrpCdps)) -// xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("100.0").Add(sdk.SmallestDec())) -// suite.Equal(3, len(xrpCdps)) -// suite.keeper.DeleteCdp(suite.ctx, cdps[0]) -// suite.keeper.RemoveCdpOwnerIndex(suite.ctx, cdps[0]) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdps[0].Collateral, cdps[0].Type, cdps[0].Principal) -// suite.keeper.RemoveCdpCollateralRatioIndex(suite.ctx, cdps[0].Type, cdps[0].Id, cr) -// xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdk.SmallestDec())) -// suite.Equal(1, len(xrpCdps)) -// } - -// func (suite *CdpTestSuite) TestValidateCollateral() { -// c := sdk.NewCoin("xrp", sdk.NewInt(1)) -// err := suite.keeper.ValidateCollateral(suite.ctx, c, "xrp-a") -// suite.NoError(err) -// c = sdk.NewCoin("lol", sdk.NewInt(1)) -// err = suite.keeper.ValidateCollateral(suite.ctx, c, "lol-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCollateralNotSupported)) -// } - -// func (suite *CdpTestSuite) TestValidatePrincipal() { -// d := sdk.NewCoin("jpu", sdk.NewInt(10000000)) -// err := suite.keeper.ValidatePrincipalAdd(suite.ctx, d) -// suite.NoError(err) -// d = sdk.NewCoin("xjpy", sdk.NewInt(1)) -// err = suite.keeper.ValidatePrincipalAdd(suite.ctx, d) -// suite.Require().True(errors.Is(err, cdptypes.ErrDebtNotSupported)) -// d = sdk.NewCoin("jpu", sdk.NewInt(1000000000001)) -// err = suite.keeper.ValidateDebtLimit(suite.ctx, "xrp-a", d) -// suite.Require().True(errors.Is(err, cdptypes.ErrExceedsDebtLimit)) -// d = sdk.NewCoin("jpu", sdk.NewInt(100000000)) -// err = suite.keeper.ValidateDebtLimit(suite.ctx, "xrp-a", d) -// suite.NoError(err) -// } - -// func (suite *CdpTestSuite) TestCalculateCollateralizationRatio() { -// c := cdps()[1] -// err := suite.keeper.SetCdp(suite.ctx, c) -// suite.NoError(err) -// suite.keeper.IndexCdpByOwner(suite.ctx, c) -// cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, c.Collateral, c.Type, c.Principal) -// suite.keeper.IndexCdpByCollateralRatio(suite.ctx, c.Type, c.Id, cr) -// cr, err = suite.keeper.CalculateCollateralizationRatio(suite.ctx, c.Collateral, c.Type, c.Principal, c.AccumulatedFees, "spot") -// suite.NoError(err) -// suite.Equal(d("2.5"), cr) -// c.AccumulatedFees = sdk.NewCoin("jpu", i(10000000)) -// cr, err = suite.keeper.CalculateCollateralizationRatio(suite.ctx, c.Collateral, c.Type, c.Principal, c.AccumulatedFees, "spot") -// suite.NoError(err) -// suite.Equal(d("1.25"), cr) -// } - -// func (suite *CdpTestSuite) TestMintBurnDebtCoins() { -// cd := cdps()[1] -// denomMap := suite.keeper.GetDebtDenomMap(suite.ctx) -// err := suite.keeper.MintDebtCoins(suite.ctx, cdptypes.ModuleName, denomMap[cd.Principal.Denom], cd.Principal) -// suite.NoError(err) -// suite.Require().Panics(func() { -// _ = suite.keeper.MintDebtCoins(suite.ctx, "notamodule", denomMap[cd.Principal.Denom], cd.Principal) -// }) - -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// suite.Equal(cs(c("debtjpu", 10000000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// err = suite.keeper.BurnDebtCoins(suite.ctx, cdptypes.ModuleName, denomMap[cd.Principal.Denom], cd.Principal) -// suite.NoError(err) -// suite.Require().Panics(func() { -// _ = suite.keeper.BurnDebtCoins(suite.ctx, "notamodule", denomMap[cd.Principal.Denom], cd.Principal) -// }) -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// suite.Equal(sdk.Coins{}, sk.GetAllBalances(suite.ctx, acc.GetAddress())) -// } - -// func TestCdpTestSuite(t *testing.T) { -// suite.Run(t, new(CdpTestSuite)) -// } diff --git a/deprecated/x/cdp/keeper/deposit.go b/deprecated/x/cdp/keeper/deposit.go deleted file mode 100644 index c018e8ff3..000000000 --- a/deprecated/x/cdp/keeper/deposit.go +++ /dev/null @@ -1,167 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// DepositCollateral adds collateral to a cdp -func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { - // check that collateral exists and has a functioning pricefeed - err := k.ValidateCollateral(ctx, collateral, collateralType) - if err != nil { - return err - } - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) - if !found { - return sdkerrors.Wrapf(types.ErrCdpNotFound, "owner %s, collateral %s", owner, collateralType) - } - err = k.ValidateBalance(ctx, collateral, depositor) - if err != nil { - return err - } - k.hooks.BeforeCdpModified(ctx, cdp) - cdp = k.SynchronizeInterest(ctx, cdp) - - deposit, found := k.GetDeposit(ctx, cdp.Id, depositor) - if found { - deposit.Amount = deposit.Amount.Add(collateral) - } else { - deposit = types.NewDeposit(cdp.Id, depositor, collateral) - } - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositor, types.ModuleName, sdk.NewCoins(collateral)) - if err != nil { - return err - } - - k.SetDeposit(ctx, deposit) - - cdp.Collateral = cdp.Collateral.Add(collateral) - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpDeposit, - sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - - return k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) -} - -// WithdrawCollateral removes collateral from a cdp if it does not put the cdp below the liquidation ratio -func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { - err := k.ValidateCollateral(ctx, collateral, collateralType) - if err != nil { - return err - } - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) - if !found { - return sdkerrors.Wrapf(types.ErrCdpNotFound, "owner %s, collateral %s", owner, collateral.Denom) - } - deposit, found := k.GetDeposit(ctx, cdp.Id, depositor) - if !found { - return sdkerrors.Wrapf(types.ErrDepositNotFound, "depositor %s, collateral %s %s", depositor, collateral.Denom, collateralType) - } - if collateral.Amount.GT(deposit.Amount.Amount) { - return sdkerrors.Wrapf(types.ErrInvalidWithdrawAmount, "collateral %s, deposit %s", collateral, deposit.Amount) - } - k.hooks.BeforeCdpModified(ctx, cdp) - cdp = k.SynchronizeInterest(ctx, cdp) - - collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral.Sub(collateral), cdp.Type, cdp.Principal, cdp.AccumulatedFees, spot) - if err != nil { - return err - } - liquidationRatio := k.getLiquidationRatio(ctx, cdp.Type) - if collateralizationRatio.LT(liquidationRatio) { - return sdkerrors.Wrapf(types.ErrInvalidCollateralRatio, "collateral %s, collateral ratio %s, liquidation ration %s", collateral.Denom, collateralizationRatio, liquidationRatio) - } - - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depositor, sdk.NewCoins(collateral)) - if err != nil { - panic(err) - } - - cdp.Collateral = cdp.Collateral.Sub(collateral) - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - err = k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) - if err != nil { - return err - } - - deposit.Amount = deposit.Amount.Sub(collateral) - // delete deposits if amount is 0 - if deposit.Amount.IsZero() { - k.DeleteDeposit(ctx, deposit.CdpId, deposit.Depositor.AccAddress()) - } else { - k.SetDeposit(ctx, deposit) - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpWithdrawal, - sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - - return nil -} - -// GetDeposit returns the deposit of a depositor on a particular cdp from the store -func (k Keeper) GetDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddress) (deposit types.Deposit, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DepositKey)) - bz := store.Get(types.DepositKeySuffix(cdpID, depositor)) - if bz == nil { - return deposit, false - } - k.cdc.MustUnmarshalLengthPrefixed(bz, &deposit) - return deposit, true - -} - -// SetDeposit sets the deposit in the store -func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DepositKey)) - bz := k.cdc.MustMarshalLengthPrefixed(&deposit) - store.Set(types.DepositKeySuffix(deposit.CdpId, deposit.Depositor.AccAddress()), bz) - -} - -// DeleteDeposit deletes a deposit from the store -func (k Keeper) DeleteDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddress) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DepositKey)) - store.Delete(types.DepositKeySuffix(cdpID, depositor)) -} - -// IterateDeposits iterates over the all the deposits of a cdp and performs a callback function -func (k Keeper) IterateDeposits(ctx sdk.Context, cdpID uint64, cb func(deposit types.Deposit) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DepositKey)) - iterator := sdk.KVStorePrefixIterator(store, types.GetCdpIDBytes(cdpID)) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var deposit types.Deposit - k.cdc.MustUnmarshalLengthPrefixed(iterator.Value(), &deposit) - - if cb(deposit) { - break - } - } -} - -// GetDeposits returns all the deposits to a cdp -func (k Keeper) GetDeposits(ctx sdk.Context, cdpID uint64) (deposits types.Deposits) { - k.IterateDeposits(ctx, cdpID, func(deposit types.Deposit) bool { - deposits = append(deposits, deposit) - return false - }) - return -} diff --git a/deprecated/x/cdp/keeper/deposit_test.go b/deprecated/x/cdp/keeper/deposit_test.go deleted file mode 100644 index da148ec24..000000000 --- a/deprecated/x/cdp/keeper/deposit_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package keeper_test - -// import ( -// "errors" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// type DepositTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// app app.TestApp -// ctx sdk.Context -// addrs []sdk.AccAddress -// } - -// func (suite *DepositTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// _, addrs := app.GeneratePrivKeyAddressPairs(10) -// authGS := app.NewAuthGenState( -// tApp, -// addrs[0:2], -// []sdk.Coins{ -// cs(c("xrp", 500000000), c("btc", 500000000)), -// cs(c("xrp", 200000000))}) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// keeper := tApp.GetCDPKeeper() -// suite.app = tApp -// suite.keeper = keeper -// suite.ctx = ctx -// suite.addrs = addrs -// err := suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 400000000), c("jpu", 10000000), "xrp-a") -// suite.NoError(err) -// } - -// func (suite *DepositTestSuite) TestGetSetDeposit() { -// d, found := suite.keeper.GetDeposit(suite.ctx, uint64(1), suite.addrs[0]) -// suite.True(found) -// td := cdptypes.NewDeposit(uint64(1), suite.addrs[0], c("xrp", 400000000)) -// suite.True(d.Equals(td)) -// ds := suite.keeper.GetDeposits(suite.ctx, uint64(1)) -// suite.Equal(1, len(ds)) -// suite.True(ds[0].Equals(td)) -// suite.keeper.DeleteDeposit(suite.ctx, uint64(1), suite.addrs[0]) -// _, found = suite.keeper.GetDeposit(suite.ctx, uint64(1), suite.addrs[0]) -// suite.False(found) -// ds = suite.keeper.GetDeposits(suite.ctx, uint64(1)) -// suite.Equal(0, len(ds)) -// } - -// func (suite *DepositTestSuite) TestDepositCollateral() { -// err := suite.keeper.DepositCollateral(suite.ctx, suite.addrs[0], suite.addrs[0], c("xrp", 10000000), "xrp-a") -// suite.NoError(err) -// d, found := suite.keeper.GetDeposit(suite.ctx, uint64(1), suite.addrs[0]) -// suite.True(found) -// td := cdptypes.NewDeposit(uint64(1), suite.addrs[0], c("xrp", 410000000)) -// suite.True(d.Equals(td)) -// ds := suite.keeper.GetDeposits(suite.ctx, uint64(1)) -// suite.Equal(1, len(ds)) -// suite.True(ds[0].Equals(td)) -// cd, _ := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(1)) -// suite.Equal(c("xrp", 410000000), cd.Collateral) -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.GetAccount(suite.ctx, suite.addrs[0]) -// suite.Equal(i(90000000), sk.GetBalance(suite.ctx, acc.GetAddress(), "xrp").Amount) - -// err = suite.keeper.DepositCollateral(suite.ctx, suite.addrs[0], suite.addrs[0], c("btc", 1), "btc-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCdpNotFound)) - -// err = suite.keeper.DepositCollateral(suite.ctx, suite.addrs[1], suite.addrs[0], c("xrp", 1), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCdpNotFound)) - -// err = suite.keeper.DepositCollateral(suite.ctx, suite.addrs[0], suite.addrs[1], c("xrp", 10000000), "xrp-a") -// suite.NoError(err) -// d, found = suite.keeper.GetDeposit(suite.ctx, uint64(1), suite.addrs[1]) -// suite.True(found) -// td = cdptypes.NewDeposit(uint64(1), suite.addrs[1], c("xrp", 10000000)) -// suite.True(d.Equals(td)) -// ds = suite.keeper.GetDeposits(suite.ctx, uint64(1)) -// suite.Equal(2, len(ds)) -// suite.True(ds[1].Equals(td)) -// } - -// func (suite *DepositTestSuite) TestWithdrawCollateral() { -// err := suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[0], suite.addrs[0], c("xrp", 400000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrInvalidCollateralRatio)) -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[0], suite.addrs[0], c("xrp", 321000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrInvalidCollateralRatio)) -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[1], suite.addrs[0], c("xrp", 10000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCdpNotFound)) - -// cd, _ := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(1)) -// cd.AccumulatedFees = c("jpu", 1) -// err = suite.keeper.SetCdp(suite.ctx, cd) -// suite.NoError(err) -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[0], suite.addrs[0], c("xrp", 320000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrInvalidCollateralRatio)) - -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[0], suite.addrs[0], c("xrp", 10000000), "xrp-a") -// suite.NoError(err) -// dep, _ := suite.keeper.GetDeposit(suite.ctx, uint64(1), suite.addrs[0]) -// td := cdptypes.NewDeposit(uint64(1), suite.addrs[0], c("xrp", 390000000)) -// suite.True(dep.Equals(td)) -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.GetAccount(suite.ctx, suite.addrs[0]) -// suite.Equal(i(110000000), sk.GetBalance(suite.ctx, acc.GetAddress(), "xrp").Amount) - -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[0], suite.addrs[1], c("xrp", 10000000), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrDepositNotFound)) -// } - -// // func TestDepositTestSuite(t *testing.T) { -// // suite.Run(t, new(DepositTestSuite)) -// // } diff --git a/deprecated/x/cdp/keeper/draw.go b/deprecated/x/cdp/keeper/draw.go deleted file mode 100644 index d9fb66452..000000000 --- a/deprecated/x/cdp/keeper/draw.go +++ /dev/null @@ -1,245 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// AddPrincipal adds debt to a cdp if the additional debt does not put the cdp below the liquidation ratio -func (k Keeper) AddPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralType string, principal sdk.Coin) error { - // validation - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) - if !found { - return sdkerrors.Wrapf(types.ErrCdpNotFound, "owner %s, denom %s", owner, collateralType) - } - err := k.ValidatePrincipalDraw(ctx, principal, cdp.Principal.Denom) - if err != nil { - return err - } - - err = k.ValidateDebtLimit(ctx, cdp.Type, principal) - if err != nil { - return err - } - k.hooks.BeforeCdpModified(ctx, cdp) - cdp = k.SynchronizeInterest(ctx, cdp) - - err = k.ValidateCollateralizationRatio(ctx, cdp.Collateral, cdp.Type, cdp.Principal.Add(principal), cdp.AccumulatedFees) - if err != nil { - return err - } - - // mint the principal and send it to the cdp owner - err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(principal)) - if err != nil { - panic(err) - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(principal)) - if err != nil { - panic(err) - } - - // mint the corresponding amount of debt coins in the cdp module account - debtDenomMap := k.GetDebtDenomMap(ctx) - err = k.MintDebtCoins(ctx, types.ModuleName, debtDenomMap[principal.Denom], principal) - if err != nil { - panic(err) - } - - // emit cdp draw event - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpDraw, - sdk.NewAttribute(sdk.AttributeKeyAmount, principal.String()), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - - // update cdp state - cdp.Principal = cdp.Principal.Add(principal) - - // increment total principal for the input collateral type - k.IncrementTotalPrincipal(ctx, cdp.Type, principal) - - // set cdp state and indexes in the store - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - return k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) -} - -// RepayPrincipal removes debt from the cdp -// If all debt is repaid, the collateral is returned to depositors and the cdp is removed from the store -func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error { - // validation - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) - if !found { - return sdkerrors.Wrapf(types.ErrCdpNotFound, "owner %s, denom %s", owner, collateralType) - } - - err := k.ValidatePaymentCoins(ctx, cdp, payment) - if err != nil { - return err - } - - err = k.ValidateBalance(ctx, payment, owner) - if err != nil { - return err - } - k.hooks.BeforeCdpModified(ctx, cdp) - cdp = k.SynchronizeInterest(ctx, cdp) - - // Note: assumes cdp.Principal and cdp.AccumulatedFees don't change during calculations - totalPrincipal := cdp.GetTotalPrincipal() - - // calculate fee and principal payment - feePayment, principalPayment := k.calculatePayment(ctx, totalPrincipal, cdp.AccumulatedFees, payment) - - err = k.validatePrincipalPayment(ctx, cdp, principalPayment) - if err != nil { - return err - } - // send the payment from the sender to the cpd module - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, sdk.NewCoins(feePayment.Add(principalPayment))) - if err != nil { - return err - } - - // burn the payment coins - err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(feePayment.Add(principalPayment))) - if err != nil { - panic(err) - } - - // burn the corresponding amount of debt coins - debtDenomMap := k.GetDebtDenomMap(ctx) - cdpDebt := k.getModAccountDebt(ctx, types.ModuleName, debtDenomMap[principalPayment.Denom]) - paymentAmount := feePayment.Add(principalPayment).Amount - - coinsToBurn := sdk.NewCoin(debtDenomMap[principalPayment.Denom], paymentAmount) - - if paymentAmount.GT(cdpDebt) { - coinsToBurn = sdk.NewCoin(debtDenomMap[principalPayment.Denom], cdpDebt) - } - - err = k.BurnDebtCoins(ctx, types.ModuleName, debtDenomMap[principalPayment.Denom], coinsToBurn) - - if err != nil { - panic(err) - } - - // emit repayment event - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpRepay, - sdk.NewAttribute(sdk.AttributeKeyAmount, feePayment.Add(principalPayment).String()), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - - // remove the old collateral:debt ratio index - - // update cdp state - if !principalPayment.IsZero() { - cdp.Principal = cdp.Principal.Sub(principalPayment) - } - cdp.AccumulatedFees = cdp.AccumulatedFees.Sub(feePayment) - - // decrement the total principal for the input collateral type - k.DecrementTotalPrincipal(ctx, cdp.Type, feePayment.Add(principalPayment)) - - // if the debt is fully paid, return collateral to depositors, - // and remove the cdp and indexes from the store - if cdp.Principal.IsZero() && cdp.AccumulatedFees.IsZero() { - k.ReturnCollateral(ctx, cdp) - k.RemoveCdpOwnerIndex(ctx, cdp) - err := k.DeleteCdpAndCollateralRatioIndex(ctx, cdp) - if err != nil { - return err - } - - // emit cdp close event - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpClose, - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - ), - ) - return nil - } - - // set cdp state and update indexes - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - return k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) -} - -// ValidatePaymentCoins validates that the input coins are valid for repaying debt -func (k Keeper) ValidatePaymentCoins(ctx sdk.Context, cdp types.Cdp, payment sdk.Coin) error { - debt := cdp.GetTotalPrincipal() - if payment.Denom != debt.Denom { - return sdkerrors.Wrapf(types.ErrInvalidPayment, "cdp %d: expected %s, got %s", cdp.Id, debt.Denom, payment.Denom) - } - _, found := k.GetDebtParam(ctx, payment.Denom) - if !found { - return sdkerrors.Wrapf(types.ErrInvalidPayment, "payment denom %s not found", payment.Denom) - } - return nil -} - -// ReturnCollateral returns collateral to depositors on a cdp and removes deposits from the store -func (k Keeper) ReturnCollateral(ctx sdk.Context, cdp types.Cdp) { - deposits := k.GetDeposits(ctx, cdp.Id) - for _, deposit := range deposits { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, deposit.Depositor.AccAddress(), sdk.NewCoins(deposit.Amount)) - if err != nil { - panic(err) - } - k.DeleteDeposit(ctx, cdp.Id, deposit.Depositor.AccAddress()) - } -} - -// calculatePayment divides the input payment into the portions that will be used to repay fees and principal -// owed - Principal + AccumulatedFees -// fees - AccumulatedFees -// CONTRACT: owned and payment denoms must be checked before calling this function. -func (k Keeper) calculatePayment(ctx sdk.Context, owed, fees, payment sdk.Coin) (sdk.Coin, sdk.Coin) { - // divides repayment into principal and fee components, with fee payment applied first. - - feePayment := sdk.NewCoin(payment.Denom, sdk.ZeroInt()) - principalPayment := sdk.NewCoin(payment.Denom, sdk.ZeroInt()) - var overpayment sdk.Coin - // return zero value coins if payment amount is invalid - if !payment.Amount.IsPositive() { - return feePayment, principalPayment - } - // check for over payment - if payment.Amount.GT(owed.Amount) { - overpayment = payment.Sub(owed) - payment = payment.Sub(overpayment) - } - // if no fees, 100% of payment is principal payment - if fees.IsZero() { - return feePayment, payment - } - // pay fees before repaying principal - if payment.Amount.GT(fees.Amount) { - feePayment = fees - principalPayment = payment.Sub(fees) - } else { - feePayment = payment - } - return feePayment, principalPayment -} - -// validatePrincipalPayment checks that the payment is either full or does not put the cdp below the debt floor -// CONTRACT: payment denom must be checked before calling this function. -func (k Keeper) validatePrincipalPayment(ctx sdk.Context, cdp types.Cdp, payment sdk.Coin) error { - proposedBalance := cdp.Principal.Amount.Sub(payment.Amount) - dp, _ := k.GetDebtParam(ctx, payment.Denom) - if proposedBalance.GT(sdk.ZeroInt()) && proposedBalance.LT(dp.DebtFloor) { - return sdkerrors.Wrapf(types.ErrBelowDebtFloor, "proposed %s < minimum %s", sdk.NewCoin(payment.Denom, proposedBalance), dp.DebtFloor) - } - return nil -} diff --git a/deprecated/x/cdp/keeper/draw_test.go b/deprecated/x/cdp/keeper/draw_test.go deleted file mode 100644 index 1dce7053c..000000000 --- a/deprecated/x/cdp/keeper/draw_test.go +++ /dev/null @@ -1,196 +0,0 @@ -package keeper_test - -// import ( -// "errors" -// "time" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// type DrawTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// app app.TestApp -// ctx sdk.Context -// addrs []sdk.AccAddress -// } - -// func (suite *DrawTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// _, addrs := app.GeneratePrivKeyAddressPairs(3) -// authGS := app.NewAuthGenState( -// tApp, -// addrs, -// []sdk.Coins{ -// cs(c("xrp", 500000000), c("btc", 500000000), c("jpu", 10000000000)), -// cs(c("xrp", 200000000)), -// cs(c("xrp", 10000000000000), c("jpu", 100000000000))}) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// keeper := tApp.GetCDPKeeper() -// suite.app = tApp -// suite.keeper = keeper -// suite.ctx = ctx -// suite.addrs = addrs -// err := suite.keeper.AddCdp(suite.ctx, addrs[0], c("xrp", 400000000), c("jpu", 10000000), "xrp-a") -// suite.NoError(err) -// } - -// func (suite *DrawTestSuite) TestAddRepayPrincipal() { - -// err := suite.keeper.AddPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("jpu", 10000000)) -// suite.NoError(err) - -// t, found := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(1)) -// suite.True(found) -// suite.Equal(c("jpu", 20000000), t.Principal) -// ctd := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, t.Collateral, "xrp-a", t.Principal.Add(t.AccumulatedFees)) -// suite.Equal(d("20.0"), ctd) -// ts := suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0")) -// suite.Equal(0, len(ts)) -// ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0").Add(sdk.SmallestDec())) -// suite.Equal(ts[0], t) -// tp := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu") -// suite.Equal(i(20000000), tp) -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.GetModuleAccount(suite.ctx, types.ModuleName) -// suite.Equal(cs(c("xrp", 400000000), c("debtjpu", 20000000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// err = suite.keeper.AddPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("sjpy", 10000000)) -// suite.Require().True(errors.Is(err, types.ErrInvalidDebtRequest)) - -// err = suite.keeper.AddPrincipal(suite.ctx, suite.addrs[1], "xrp-a", c("jpu", 10000000)) -// suite.Require().True(errors.Is(err, types.ErrCdpNotFound)) -// err = suite.keeper.AddPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("xjpy", 10000000)) -// suite.Require().True(errors.Is(err, types.ErrInvalidDebtRequest)) -// err = suite.keeper.AddPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("jpu", 311000000)) -// suite.Require().True(errors.Is(err, types.ErrInvalidCollateralRatio)) - -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("jpu", 10000000)) -// suite.NoError(err) - -// t, found = suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(1)) -// suite.True(found) -// suite.Equal(c("jpu", 10000000), t.Principal) - -// ctd = suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, t.Collateral, "xrp-a", t.Principal.Add(t.AccumulatedFees)) -// suite.Equal(d("40.0"), ctd) -// ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0")) -// suite.Equal(0, len(ts)) -// ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0").Add(sdk.SmallestDec())) -// suite.Equal(ts[0], t) -// ak = suite.app.GetAccountKeeper() -// sk = suite.app.GetBankKeeper() -// acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) -// suite.Equal(cs(c("xrp", 400000000), c("debtjpu", 10000000)), sk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("xjpy", 10000000)) -// suite.Require().True(errors.Is(err, types.ErrInvalidPayment)) -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[1], "xrp-a", c("xjpy", 10000000)) -// suite.Require().True(errors.Is(err, types.ErrCdpNotFound)) - -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("jpu", 9000000)) -// suite.Require().True(errors.Is(err, types.ErrBelowDebtFloor)) -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("jpu", 10000000)) -// suite.NoError(err) - -// _, found = suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(1)) -// suite.False(found) -// ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", types.MaxSortableDec) -// suite.Equal(0, len(ts)) -// ts = suite.keeper.GetAllCdpsByCollateralType(suite.ctx, "xrp-a") -// suite.Equal(0, len(ts)) -// ak = suite.app.GetAccountKeeper() -// sk = suite.app.GetBankKeeper() -// acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) -// suite.Equal(sdk.Coins{}, sk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// } - -// func (suite *DrawTestSuite) TestRepayPrincipalOverpay() { -// err := suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[0], "xrp-a", c("jpu", 20000000)) -// suite.NoError(err) -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.GetAccount(suite.ctx, suite.addrs[0]) -// suite.Equal(i(10000000000), sk.GetBalance(suite.ctx, acc.GetAddress(), "jpu").Amount) -// _, found := suite.keeper.GetCdp(suite.ctx, "xrp-a", 1) -// suite.False(found) -// } - -// /* Note: This test existed only on v0.11.1. On v0.13.0, this test is removed. So, I guess this test is unnecessary. -// func (suite *DrawTestSuite) TestAddRepayPrincipalFees() { -// err := suite.keeper.AddCdp(suite.ctx, suite.addrs[2], c("xrp", 1000000000000), c("jpu", 100000000000), "xrp-a") -// suite.NoError(err) -// suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Minute * 10)) -// err = suite.keeper.AccumulateInterest(suite.ctx, "xrp-a") -// suite.NoError(err) -// err = suite.keeper.SynchronizeInterestForRiskyCdps(suite.ctx, sdk.Int{}, sdk.MaxSortableDec, "xrp-a") -// suite.NoError(err) -// err = suite.keeper.AddPrincipal(suite.ctx, suite.addrs[2], "xrp-a", c("jpu", 10000000)) -// suite.NoError(err) -// t, _ := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.Equal(c("jpu", 92827), t.AccumulatedFees) -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[2], "xrp-a", c("jpu", 100)) -// suite.NoError(err) -// t, _ = suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.Equal(c("jpu", 92727), t.AccumulatedFees) -// err = suite.keeper.RepayPrincipal(suite.ctx, suite.addrs[2], "xrp-a", c("jpu", 100010092727)) -// suite.NoError(err) -// _, f := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.False(f) - -// err = suite.keeper.AddCdp(suite.ctx, suite.addrs[2], c("xrp", 1000000000000), c("jpu", 100000000), "xrp-a") -// suite.NoError(err) - -// suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 31536000)) // move forward one year in time -// err = suite.keeper.AccumulateInterest(suite.ctx, "xrp-a") -// suite.NoError(err) -// err = suite.keeper.SynchronizeInterestForRiskyCdps(suite.ctx, sdk.Int{}, sdk.MaxSortableDec, "xrp-a") -// suite.NoError(err) -// err = suite.keeper.AddPrincipal(suite.ctx, suite.addrs[2], "xrp-a", c("jpu", 100000000)) -// suite.NoError(err) -// t, _ = suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(3)) -// suite.Equal(c("jpu", 5000000), t.AccumulatedFees) -// } -// */ - -// func (suite *DrawTestSuite) TestPricefeedFailure() { -// ctx := suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Hour * 2)) -// pfk := suite.app.GetPriceFeedKeeper() -// pfk.SetCurrentPrices(ctx, "xrp:jpy") -// err := suite.keeper.AddPrincipal(ctx, suite.addrs[0], "xrp-a", c("jpu", 10000000)) -// suite.Error(err) -// err = suite.keeper.RepayPrincipal(ctx, suite.addrs[0], "xrp-a", c("jpu", 10000000)) -// suite.NoError(err) -// } - -// func (suite *DrawTestSuite) TestModuleAccountFailure() { -// suite.Panics(func() { -// ctx := suite.ctx.WithBlockHeader(suite.ctx.BlockHeader()) -// ak := suite.app.GetAccountKeeper() -// acc := ak.GetModuleAccount(ctx, types.ModuleName) -// bk := suite.app.GetBankKeeper() -// bk.BurnCoins(ctx, types.ModuleName, bk.GetAllBalances(ctx, acc.GetAddress())) -// suite.keeper.RepayPrincipal(ctx, suite.addrs[0], "xrp-a", c("jpu", 10000000)) -// }) -// } - -// // func TestDrawTestSuite(t *testing.T) { -// // suite.Run(t, new(DrawTestSuite)) -// // } diff --git a/deprecated/x/cdp/keeper/grpc_query.go b/deprecated/x/cdp/keeper/grpc_query.go deleted file mode 100644 index abb653be5..000000000 --- a/deprecated/x/cdp/keeper/grpc_query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/deprecated/x/cdp/keeper/grpc_query_cdp.go b/deprecated/x/cdp/keeper/grpc_query_cdp.go deleted file mode 100644 index 69eceadb4..000000000 --- a/deprecated/x/cdp/keeper/grpc_query_cdp.go +++ /dev/null @@ -1,112 +0,0 @@ -package keeper - -import ( - "context" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func (k Keeper) CdpAll(c context.Context, req *types.QueryAllCdpRequest) (*types.QueryAllCdpResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var augmentedCdps types.AugmentedCdps - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - cdpStore := prefix.NewStore(store, types.KeyPrefix(types.CdpKey)) - - pageRes, err := query.Paginate(cdpStore, req.Pagination, func(key []byte, value []byte) error { - var cdp types.Cdp - if err := k.cdc.UnmarshalLengthPrefixed(value, &cdp); err != nil { - return err - } - augmentedCdp := k.LoadAugmentedCdp(ctx, cdp) - augmentedCdps = append(augmentedCdps, augmentedCdp) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllCdpResponse{Cdp: augmentedCdps, Pagination: pageRes}, nil -} - -func (k Keeper) Cdp(c context.Context, req *types.QueryGetCdpRequest) (*types.QueryGetCdpResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - - ownerAddress, err := sdk.AccAddressFromBech32(req.Owner) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", req.Owner) - } - - _, valid := k.GetCollateralTypePrefix(ctx, req.CollateralType) - if !valid { - return nil, status.Errorf(codes.NotFound, "invalid collateral type: %s", req.CollateralType) - } - - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, ownerAddress, req.CollateralType) - - if !found { - return nil, status.Error(codes.NotFound, "cdp not found") - } - augmentedCdp := k.LoadAugmentedCdp(ctx, cdp) - - return &types.QueryGetCdpResponse{Cdp: augmentedCdp}, nil -} - -func (k Keeper) AccountAll(c context.Context, req *types.QueryAllAccountRequest) (*types.QueryAllAccountResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - cdpAccAccount := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) - liquidatorAccAccount := k.accountKeeper.GetModuleAccount(ctx, types.LiquidatorMacc) - - accounts := []authtypes.ModuleAccount{ - *cdpAccAccount.(*authtypes.ModuleAccount), - *liquidatorAccAccount.(*authtypes.ModuleAccount), - } - - var accountsAny []*codectypes.Any - - for _, acc := range accounts { - accAny, _ := codectypes.NewAnyWithValue(&acc) - accountsAny = append(accountsAny, accAny) - } - - return &types.QueryAllAccountResponse{Accounts: accountsAny}, nil -} - -func (k Keeper) DepositAll(c context.Context, req *types.QueryAllDepositRequest) (*types.QueryAllDepositResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, sdk.AccAddress(req.Owner), req.CollateralType) - - if !found { - return nil, status.Error(codes.NotFound, "cdp not found") - } - - deposits := k.GetDeposits(ctx, cdp.Id) - - return &types.QueryAllDepositResponse{Deposits: deposits}, nil -} diff --git a/deprecated/x/cdp/keeper/grpc_query_params.go b/deprecated/x/cdp/keeper/grpc_query_params.go deleted file mode 100644 index 596da33ba..000000000 --- a/deprecated/x/cdp/keeper/grpc_query_params.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var params types.Params - ctx := sdk.UnwrapSDKContext(c) - - params = k.GetParams(ctx) - - return &types.QueryParamsResponse{Params: ¶ms}, nil -} diff --git a/deprecated/x/cdp/keeper/hooks.go b/deprecated/x/cdp/keeper/hooks.go deleted file mode 100644 index 09668eb92..000000000 --- a/deprecated/x/cdp/keeper/hooks.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// Implements StakingHooks interface -var _ types.CdpHooks = Keeper{} - -// AfterCdpCreated - call hook if registered -func (k Keeper) AfterCdpCreated(ctx sdk.Context, cdp types.Cdp) { - if k.hooks != nil { - k.hooks.AfterCdpCreated(ctx, cdp) - } -} - -// BeforeCdpModified - call hook if registered -func (k Keeper) BeforeCdpModified(ctx sdk.Context, cdp types.Cdp) { - if k.hooks != nil { - k.hooks.BeforeCdpModified(ctx, cdp) - } -} diff --git a/deprecated/x/cdp/keeper/integration_test.go b/deprecated/x/cdp/keeper/integration_test.go deleted file mode 100644 index c86b686d6..000000000 --- a/deprecated/x/cdp/keeper/integration_test.go +++ /dev/null @@ -1,427 +0,0 @@ -package keeper_test - -import ( - "time" - - tmtime "github.com/cometbft/cometbft/types/time" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/app" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" -) - -// Avoid cluttering test cases with long function names -func i(in int64) sdk.Int { return sdk.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } -func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } - -func NewPricefeedGenState(tApp app.TestApp, asset string, price sdk.Dec) app.GenesisState { - pfGenesis := pricefeedtypes.GenesisState{ - Params: pricefeedtypes.Params{ - Markets: []pricefeedtypes.Market{ - {MarketId: asset + ":jpy", BaseAsset: asset, QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: asset + ":eur", BaseAsset: asset, QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - }, - }, - PostedPrices: []pricefeedtypes.PostedPrice{ - { - MarketId: asset + ":jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: price, - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: asset + ":eur", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: price, - Expiry: time.Now().Add(1 * time.Hour), - }, - }, - } - return app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pfGenesis)} -} - -func NewCDPGenState(tApp app.TestApp, asset string, liquidationRatio sdk.Dec) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: asset, - Type: asset + "-a", - LiquidationRatio: liquidationRatio, - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(100), - Prefix: 0x20, - SpotMarketId: asset + ":jpy", - LiquidationMarketId: asset + ":jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(6), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} - -func NewPricefeedGenStateMulti(tApp app.TestApp) app.GenesisState { - pfGenesis := pricefeedtypes.GenesisState{ - Params: pricefeedtypes.Params{ - Markets: []pricefeedtypes.Market{ - {MarketId: "btc:jpy", BaseAsset: "btc", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "xrp:jpy", BaseAsset: "xrp", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "bnb:jpy", BaseAsset: "bnb", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "bjpy:jpy", BaseAsset: "bjpy", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - - {MarketId: "btc:eur", BaseAsset: "btc", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "xrp:eur", BaseAsset: "xrp", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "bnb:eur", BaseAsset: "bnb", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "bjpy:eur", BaseAsset: "bjpy", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - }, - }, - PostedPrices: []pricefeedtypes.PostedPrice{ - { - MarketId: "btc:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "xrp:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "bnb:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "bjpy:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.OneDec(), - Expiry: time.Now().Add(1 * time.Hour), - }, - - { - MarketId: "btc:eur", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "xrp:eur", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "bnb:eur", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "bjpy:eur", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.OneDec(), - Expiry: time.Now().Add(1 * time.Hour), - }, - }, - } - return app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pfGenesis)} -} -func NewCDPGenStateMulti(tApp app.TestApp) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(7000000000), - Prefix: 0x20, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(6), - }, - { - Denom: "btc", - Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr - LiquidationPenalty: d("0.025"), - AuctionSize: i(10000000), - Prefix: 0x21, - SpotMarketId: "btc:jpy", - LiquidationMarketId: "btc:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(50000000000), - Prefix: 0x22, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - { - Denom: "bjpy", - Type: "bjpy-a", - LiquidationRatio: d("1.01"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(10000000000), - Prefix: 0x23, - SpotMarketId: "bjpy:jpy", - LiquidationMarketId: "bjpy:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - { - Denom: "xrp", - Type: "xrp-b", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), - DebtLimit: sdk.NewInt64Coin("euu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(7000000000), - Prefix: 0x24, - SpotMarketId: "xrp:eur", - LiquidationMarketId: "xrp:eur", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(6), - }, - { - Denom: "btc", - Type: "btc-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr - LiquidationPenalty: d("0.025"), - AuctionSize: i(10000000), - Prefix: 0x25, - SpotMarketId: "btc:eur", - LiquidationMarketId: "btc:eur", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - { - Denom: "bnb", - Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(50000000000), - Prefix: 0x26, - SpotMarketId: "bnb:eur", - LiquidationMarketId: "bnb:eur", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - { - Denom: "bjpy", - Type: "bjpy-b", - LiquidationRatio: d("1.01"), - DebtLimit: sdk.NewInt64Coin("euu", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(10000000000), - Prefix: 0x27, - SpotMarketId: "bjpy:eur", - LiquidationMarketId: "bjpy:eur", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bjpy-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), - - cdptypes.NewGenesisAccumulationTime("btc-b", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-b", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bjpy-b", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-b", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bjpy-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), - - cdptypes.NewGenesisTotalPrincipal("btc-b", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-b", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bjpy-b", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-b", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} - -func NewCDPGenStateHighDebtLimit(tApp app.TestApp) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), - DebtLimit: sdk.NewInt64Coin("jpu", 50000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(7000000000), - Prefix: 0x20, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(6), - }, - { - Denom: "btc", - Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 50000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr - LiquidationPenalty: d("0.025"), - AuctionSize: i(10000000), - Prefix: 0x21, - SpotMarketId: "btc:jpy", - LiquidationMarketId: "btc:jpy", - KeeperRewardPercentage: d("0.01"), - CheckCollateralizationIndexCount: i(10), - ConversionFactor: i(8), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 100000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} - -func cdps() (cdps cdptypes.Cdps) { - _, addrs := app.GeneratePrivKeyAddressPairs(6) - c1 := cdptypes.NewCdp(uint64(1), addrs[0], sdk.NewCoin("xrp", sdk.NewInt(10000000)), "xrp-a", sdk.NewCoin("jpu", sdk.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c2 := cdptypes.NewCdp(uint64(2), addrs[1], sdk.NewCoin("xrp", sdk.NewInt(100000000)), "xrp-a", sdk.NewCoin("jpu", sdk.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c3 := cdptypes.NewCdp(uint64(3), addrs[1], sdk.NewCoin("btc", sdk.NewInt(1000000000)), "btc-a", sdk.NewCoin("jpu", sdk.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c4 := cdptypes.NewCdp(uint64(4), addrs[2], sdk.NewCoin("xrp", sdk.NewInt(1000000000)), "xrp-a", sdk.NewCoin("jpu", sdk.NewInt(500000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c5 := cdptypes.NewCdp(uint64(1), addrs[3], sdk.NewCoin("xrp", sdk.NewInt(10000000)), "xrp-b", sdk.NewCoin("euu", sdk.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c6 := cdptypes.NewCdp(uint64(2), addrs[4], sdk.NewCoin("xrp", sdk.NewInt(100000000)), "xrp-b", sdk.NewCoin("euu", sdk.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c7 := cdptypes.NewCdp(uint64(3), addrs[4], sdk.NewCoin("btc", sdk.NewInt(1000000000)), "btc-b", sdk.NewCoin("euu", sdk.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c8 := cdptypes.NewCdp(uint64(4), addrs[5], sdk.NewCoin("xrp", sdk.NewInt(1000000000)), "xrp-b", sdk.NewCoin("euu", sdk.NewInt(500000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - - cdps = append(cdps, c1, c2, c3, c4, c5, c6, c7, c8) - return -} diff --git a/deprecated/x/cdp/keeper/interest.go b/deprecated/x/cdp/keeper/interest.go deleted file mode 100644 index f6c14608b..000000000 --- a/deprecated/x/cdp/keeper/interest.go +++ /dev/null @@ -1,167 +0,0 @@ -package keeper - -import ( - "fmt" - "math" - - sdkmath "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -var ( - scalingFactor = 1e18 - secondsPerYear = 31536000 -) - -// AccumulateInterest calculates the new interest that has accrued for the input collateral type based on the total amount of principal -// that has been created with that collateral type and the amount of time that has passed since interest was last accumulated -func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { - previousAccrualTime, found := k.GetPreviousAccrualTime(ctx, ctype) - if !found { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) - return nil - } - - timeElapsed := int64(math.RoundToEven( - ctx.BlockTime().Sub(previousAccrualTime).Seconds(), - )) - if timeElapsed == 0 { - return nil - } - - totalPrincipalPrior := k.GetTotalPrincipal(ctx, ctype, types.DefaultStableDenom) - if totalPrincipalPrior.IsZero() || totalPrincipalPrior.IsNegative() { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) - return nil - } - - interestFactorPrior, foundInterestFactorPrior := k.GetInterestFactor(ctx, ctype) - if !foundInterestFactorPrior { - k.SetInterestFactor(ctx, ctype, sdk.OneDec()) - // set previous accrual time exit early because interest accumulated will be zero - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) - return nil - } - - borrowRateSpy := k.getFeeRate(ctx, ctype) - if borrowRateSpy.Equal(sdk.OneDec()) { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) - return nil - } - interestFactor := CalculateInterestFactor(borrowRateSpy, sdk.NewInt(timeElapsed)) - interestAccumulated := (interestFactor.Mul(sdk.NewDecFromInt(totalPrincipalPrior))).RoundInt().Sub(totalPrincipalPrior) - if interestAccumulated.IsZero() { - // in the case accumulated interest rounds to zero, exit early without updating accrual time - return nil - } - debtDenomMap := k.GetDebtDenomMap(ctx) - err := k.MintDebtCoins(ctx, types.ModuleName, debtDenomMap[types.DefaultStableDenom], sdk.NewCoin(types.DefaultStableDenom, interestAccumulated)) - if err != nil { - return err - } - - dp, found := k.GetDebtParam(ctx, types.DefaultStableDenom) - if !found { - panic(fmt.Sprintf("Debt parameters for %s not found", types.DefaultStableDenom)) - } - - newFeesSurplus := interestAccumulated - - // mint surplus coins to the liquidator module account. - if newFeesSurplus.IsPositive() { - err := k.bankKeeper.MintCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSurplus))) - if err != nil { - return err - } - } - - interestFactorNew := interestFactorPrior.Mul(interestFactor) - totalPrincipalNew := totalPrincipalPrior.Add(interestAccumulated) - - k.SetTotalPrincipal(ctx, ctype, types.DefaultStableDenom, totalPrincipalNew) - k.SetInterestFactor(ctx, ctype, interestFactorNew) - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) - - return nil -} - -// CalculateInterestFactor calculates the simple interest scaling factor, -// which is equal to: (per-second interest rate ** number of seconds elapsed) -// Will return 1.000x, multiply by principal to get new principal with added interest -func CalculateInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdk.Int) sdk.Dec { - scalingFactorUint := sdk.NewUint(uint64(scalingFactor)) - scalingFactorInt := sdk.NewInt(int64(scalingFactor)) - - // Convert per-second interest rate to a uint scaled by 1e18 - interestMantissa := sdkmath.NewUintFromBigInt(perSecondInterestRate.MulInt(scalingFactorInt).RoundInt().BigInt()) - // Convert seconds elapsed to uint (*not scaled*) - secondsElapsedUint := sdkmath.NewUintFromBigInt(secondsElapsed.BigInt()) - - // Calculate the interest factor as a uint scaled by 1e18 - interestFactorMantissa := sdkmath.RelativePow(interestMantissa, secondsElapsedUint, scalingFactorUint) - - // Convert interest factor to an unscaled sdk.Dec - return sdk.NewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) -} - -// SynchronizeInterest updates the input cdp object to reflect the current accumulated interest, updates the cdp state in the store, -// and returns the updated cdp object -func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.Cdp) types.Cdp { - globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) - if !found { - k.SetInterestFactor(ctx, cdp.Type, sdk.OneDec()) - cdp.InterestFactor = sdk.OneDec() - cdp.FeesUpdated = ctx.BlockTime() - k.SetCdp(ctx, cdp) - return cdp - } - - accumulatedInterest := k.CalculateNewInterest(ctx, cdp) - prevAccrualTime, found := k.GetPreviousAccrualTime(ctx, cdp.Type) - if !found { - return cdp - } - if accumulatedInterest.IsZero() { - // accumulated interest is zero if apy is zero or are if the total fees for all cdps round to zero - if cdp.FeesUpdated.Equal(prevAccrualTime) { - // if all fees are rounding to zero, don't update FeesUpdated - return cdp - } - // if apy is zero, we need to update FeesUpdated - cdp.FeesUpdated = prevAccrualTime - k.SetCdp(ctx, cdp) - } - - cdp.AccumulatedFees = cdp.AccumulatedFees.Add(accumulatedInterest) - cdp.FeesUpdated = prevAccrualTime - cdp.InterestFactor = globalInterestFactor - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) - return cdp -} - -// CalculateNewInterest returns the amount of interest that has accrued to the cdp since its interest was last synchronized -func (k Keeper) CalculateNewInterest(ctx sdk.Context, cdp types.Cdp) sdk.Coin { - globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) - if !found { - return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdk.ZeroInt()) - } - cdpInterestFactor := globalInterestFactor.Quo(cdp.InterestFactor) - if cdpInterestFactor.Equal(sdk.OneDec()) { - return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdk.ZeroInt()) - } - accumulatedInterest := sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) - return sdk.NewCoin(cdp.AccumulatedFees.Denom, accumulatedInterest) -} - -// SynchronizeInterestForRiskyCdps synchronizes the interest for the slice of cdps with the lowest collateral:debt ratio -func (k Keeper) SynchronizeInterestForRiskyCdps(ctx sdk.Context, slice sdk.Int, targetRatio sdk.Dec, collateralType string) error { - cdps := k.GetSliceOfCdpsByRatioAndType(ctx, slice, targetRatio, collateralType) - for _, cdp := range cdps { - k.SynchronizeInterest(ctx, cdp) - } - return nil -} diff --git a/deprecated/x/cdp/keeper/keeper.go b/deprecated/x/cdp/keeper/keeper.go deleted file mode 100644 index befdb9766..000000000 --- a/deprecated/x/cdp/keeper/keeper.go +++ /dev/null @@ -1,240 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -type ( - Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramSpace paramtypes.Subspace - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - auctionKeeper types.AuctionKeeper - PricefeedKeeper types.PricefeedKeeper - hooks types.CdpHooks - maccPerms map[string][]string - } -) - -func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - auctionKeeper types.AuctionKeeper, PricefeedKeeper types.PricefeedKeeper, maccPerms map[string][]string) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramSpace: paramSpace, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - auctionKeeper: auctionKeeper, - PricefeedKeeper: PricefeedKeeper, - hooks: nil, - maccPerms: maccPerms, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// SetHooks sets the cdp keeper hooks -func (k *Keeper) SetHooks(hooks types.CdpHooks) *Keeper { - if k.hooks != nil { - panic("cannot set validator hooks twice") - } - k.hooks = hooks - return k -} - -// CdpDenomIndexIterator returns an sdk.Iterator for all cdps with matching collateral denom -func (k Keeper) CdpDenomIndexIterator(ctx sdk.Context, collateralType string) sdk.Iterator { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpKey)) - db, found := k.GetCollateralTypePrefix(ctx, collateralType) - if !found { - panic(fmt.Sprintf("denom %s prefix not found", collateralType)) - } - return sdk.KVStorePrefixIterator(store, types.DenomIterKey(db)) -} - -// CdpCollateralRatioIndexIterator returns an sdk.Iterator for all cdps that have collateral denom -// matching denom and collateral:debt ratio LESS THAN targetRatio -func (k Keeper) CdpCollateralRatioIndexIterator(ctx sdk.Context, collateralType string, targetRatio sdk.Dec) sdk.Iterator { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpIDCollateralRatioIndex)) - db, found := k.GetCollateralTypePrefix(ctx, collateralType) - if !found { - panic(fmt.Sprintf("denom %s prefix not found", collateralType)) - } - return store.Iterator(types.CollateralRatioIterKey(db, sdk.ZeroDec()), types.CollateralRatioIterKey(db, targetRatio)) -} - -// IterateAllCdps iterates over all cdps and performs a callback function -func (k Keeper) IterateAllCdps(ctx sdk.Context, cb func(cdp types.Cdp) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var cdp types.Cdp - k.cdc.MustUnmarshalLengthPrefixed(iterator.Value(), &cdp) - - if cb(cdp) { - break - } - } -} - -// IterateCdpsByCollateralType iterates over cdps with matching denom and performs a callback function -func (k Keeper) IterateCdpsByCollateralType(ctx sdk.Context, collateralType string, cb func(cdp types.Cdp) (stop bool)) { - iterator := k.CdpDenomIndexIterator(ctx, collateralType) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var cdp types.Cdp - k.cdc.MustUnmarshalLengthPrefixed(iterator.Value(), &cdp) - if cb(cdp) { - break - } - } -} - -// IterateCdpsByCollateralRatio iterate over cdps with collateral denom equal to denom and -// collateral:debt ratio LESS THAN targetRatio and performs a callback function. -func (k Keeper) IterateCdpsByCollateralRatio(ctx sdk.Context, collateralType string, targetRatio sdk.Dec, cb func(cdp types.Cdp) (stop bool)) { - iterator := k.CdpCollateralRatioIndexIterator(ctx, collateralType, targetRatio) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - _, id, _ := types.SplitCollateralRatioKey(iterator.Key()) - cdp, found := k.GetCdp(ctx, collateralType, id) - if !found { - panic(fmt.Sprintf("cdp %d does not exist", id)) - } - if cb(cdp) { - break - } - - } -} - -// GetSliceOfCdpsByRatioAndType returns a slice of cdps of size equal to the input cutoffCount -// sorted by target ratio in ascending order (ie, the lowest collateral:debt ratio cdps are returned first) -func (k Keeper) GetSliceOfCdpsByRatioAndType(ctx sdk.Context, cutoffCount sdk.Int, targetRatio sdk.Dec, collateralType string) (cdps types.Cdps) { - count := sdk.ZeroInt() - k.IterateCdpsByCollateralRatio(ctx, collateralType, targetRatio, func(cdp types.Cdp) bool { - cdps = append(cdps, cdp) - count = count.Add(sdk.OneInt()) - if count.GTE(cutoffCount) { - return true - } - return false - }) - return cdps -} - -// GetPreviousAccrualTime returns the last time an individual market accrued interest -func (k Keeper) GetPreviousAccrualTime(ctx sdk.Context, ctype string) (previousAccrualTime time.Time, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousAccrualTime)) - bz := store.Get([]byte(ctype)) - if bz == nil { - return time.Time{}, false - } - previousAccrualTime.UnmarshalBinary(bz) - - return previousAccrualTime, true -} - -// SetPreviousAccrualTime sets the most recent accrual time for a particular market -func (k Keeper) SetPreviousAccrualTime(ctx sdk.Context, ctype string, previousAccrualTime time.Time) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousAccrualTime)) - bz, _ := previousAccrualTime.MarshalBinary() - store.Set([]byte(ctype), bz) -} - -// GetInterestFactor returns the current interest factor for an individual collateral type -func (k Keeper) GetInterestFactor(ctx sdk.Context, ctype string) (interestFactor sdk.Dec, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InterestFactor)) - bz := store.Get([]byte(ctype)) - if bz == nil { - return sdk.ZeroDec(), false - } - interestFactor.Unmarshal(bz) - - return interestFactor, true -} - -// SetInterestFactor sets the current interest factor for an individual collateral type -func (k Keeper) SetInterestFactor(ctx sdk.Context, ctype string, interestFactor sdk.Dec) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InterestFactor)) - bz, _ := interestFactor.Marshal() - store.Set([]byte(ctype), bz) -} - -// IncrementTotalPrincipal increments the total amount of debt that has been drawn with that collateral type -func (k Keeper) IncrementTotalPrincipal(ctx sdk.Context, collateralType string, principal sdk.Coin) { - total := k.GetTotalPrincipal(ctx, collateralType, principal.Denom) - total = total.Add(principal.Amount) - k.SetTotalPrincipal(ctx, collateralType, principal.Denom, total) -} - -// DecrementTotalPrincipal decrements the total amount of debt that has been drawn for a particular collateral type -func (k Keeper) DecrementTotalPrincipal(ctx sdk.Context, collateralType string, principal sdk.Coin) { - total := k.GetTotalPrincipal(ctx, collateralType, principal.Denom) - // NOTE: negative total principal can happen in tests due to rounding errors - // in fee calculation - total = sdk.MaxInt(total.Sub(principal.Amount), sdk.ZeroInt()) - k.SetTotalPrincipal(ctx, collateralType, principal.Denom, total) -} - -// GetTotalPrincipal returns the total amount of principal that has been drawn for a particular collateral -func (k Keeper) GetTotalPrincipal(ctx sdk.Context, collateralType, principalDenom string) (total sdk.Int) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PrincipalKey)) - bz := store.Get([]byte(collateralType + principalDenom)) - if bz == nil { - k.SetTotalPrincipal(ctx, collateralType, principalDenom, sdk.ZeroInt()) - return sdk.ZeroInt() - } - total.Unmarshal(bz) - - return total -} - -// SetTotalPrincipal sets the total amount of principal that has been drawn for the input collateral -func (k Keeper) SetTotalPrincipal(ctx sdk.Context, collateralType, principalDenom string, total sdk.Int) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PrincipalKey)) - _, found := k.GetCollateralTypePrefix(ctx, collateralType) - if !found { - panic(fmt.Sprintf("collateral not found: %s", collateralType)) - } - bz, _ := total.Marshal() - store.Set([]byte(collateralType+principalDenom), bz) -} - -// getModuleAccountCoins gets the total coin balance of this coin currently held by module accounts -func (k Keeper) getModuleAccountCoins(ctx sdk.Context, denom string) sdk.Coins { - totalModCoinBalance := sdk.NewCoins(sdk.NewCoin(denom, sdk.ZeroInt())) - for macc := range k.maccPerms { - _macc := k.accountKeeper.GetModuleAccount(ctx, macc) - modCoinBalance := k.bankKeeper.GetAllBalances(ctx, _macc.GetAddress()).AmountOf(denom) - if modCoinBalance.IsPositive() { - totalModCoinBalance = totalModCoinBalance.Add(sdk.NewCoin(denom, modCoinBalance)) - } - } - return totalModCoinBalance -} diff --git a/deprecated/x/cdp/keeper/keeper_bench_test.go b/deprecated/x/cdp/keeper/keeper_bench_test.go deleted file mode 100644 index 8e478cb2a..000000000 --- a/deprecated/x/cdp/keeper/keeper_bench_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package keeper_test - -// import ( -// "testing" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// // saving the result to a module level variable ensures the compiler doesn't optimize the test away -// var coinsResult sdk.Coins -// var coinResult sdk.Coin - -// // Note - the iteration benchmarks take a long time to stabilize, to get stable results use: -// // go test -benchmem -bench ^(BenchmarkAccountIteration)$ -benchtime 60s -timeout 2h -// // go test -benchmem -bench ^(BenchmarkCdpIteration)$ -benchtime 60s -timeout 2h - -// func BenchmarkAccountIteration(b *testing.B) { -// benchmarks := []struct { -// name string -// numberAccounts int -// coins bool -// }{ -// {name: "10000 Accounts, No Coins", numberAccounts: 10000, coins: false}, -// {name: "100000 Accounts, No Coins", numberAccounts: 100000, coins: false}, -// {name: "1000000 Accounts, No Coins", numberAccounts: 1000000, coins: false}, -// {name: "10000 Accounts, With Coins", numberAccounts: 10000, coins: true}, -// {name: "100000 Accounts, With Coins", numberAccounts: 100000, coins: true}, -// {name: "1000000 Accounts, With Coins", numberAccounts: 1000000, coins: true}, -// } -// coins := sdk.Coins{ -// sdk.NewCoin("xrp", sdk.NewInt(1000000000)), -// sdk.NewCoin("jpu", sdk.NewInt(1000000000)), -// } - -// for _, bm := range benchmarks { -// b.Run(bm.name, func(b *testing.B) { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// ak := tApp.GetAccountKeeper() -// sk := tApp.GetBankKeeper() -// tApp.InitializeFromGenesisStates() -// for i := 0; i < bm.numberAccounts; i++ { -// arr := []byte{byte((i & 0xFF0000) >> 16), byte((i & 0xFF00) >> 8), byte(i & 0xFF)} -// addr := sdk.AccAddress(arr) -// acc := ak.NewAccountWithAddress(ctx, addr) -// if bm.coins { -// fundAccount(tApp.BankKeeper, ctx, acc.GetAddress(), coins) -// } -// ak.SetAccount(ctx, acc) -// } -// // reset timer ensures we don't count setup time -// b.ResetTimer() -// for i := 0; i < b.N; i++ { -// ak.IterateAccounts(ctx, -// func(acc authtypes.AccountI) (stop bool) { -// coins := sk.GetAllBalances(ctx, acc.GetAddress()) -// coinsResult = coins -// return false -// }) -// } -// }) -// } -// } - -// func createCdps(n int) (app.TestApp, sdk.Context, keeper.Keeper) { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// _, addrs := app.GeneratePrivKeyAddressPairs(n) -// coins := []sdk.Coins{} -// for i := 0; i < n; i++ { -// coins = append(coins, cs(c("btc", 100000000))) -// } -// authGS := app.NewAuthGenState( -// tApp, addrs, coins) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// cdpKeeper := tApp.GetCDPKeeper() -// for i := 0; i < n; i++ { -// err := cdpKeeper.AddCdp(ctx, addrs[i], coins[i][0], c("jpu", 100000000), "btc-a") -// if err != nil { -// panic("failed to create cdp") -// } -// } -// return tApp, ctx, cdpKeeper -// } - -// func BenchmarkCdpIteration(b *testing.B) { -// benchmarks := []struct { -// name string -// numberCdps int -// }{ -// {"1000 Cdps", 1000}, -// {"10000 Cdps", 10000}, -// {"100000 Cdps", 100000}, -// } -// for _, bm := range benchmarks { -// b.Run(bm.name, func(b *testing.B) { -// _, ctx, cdpKeeper := createCdps(bm.numberCdps) -// b.ResetTimer() -// for i := 0; i < b.N; i++ { -// cdpKeeper.IterateAllCdps(ctx, func(c cdptypes.Cdp) (stop bool) { -// coinResult = c.Principal -// return false -// }) -// } -// }) -// } - -// } - -// var errResult error - -// func BenchmarkCdpCreation(b *testing.B) { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// _, addrs := app.GeneratePrivKeyAddressPairs(b.N) -// coins := []sdk.Coins{} -// for i := 0; i < b.N; i++ { -// coins = append(coins, cs(c("btc", 100000000))) -// } -// authGS := app.NewAuthGenState( -// tApp, addrs, coins) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// cdpKeeper := tApp.GetCDPKeeper() -// b.ResetTimer() -// for i := 0; i < b.N; i++ { -// err := cdpKeeper.AddCdp(ctx, addrs[i], coins[i][0], c("jpu", 100000000), "btc-a") -// if err != nil { -// b.Error("unexpected error") -// } -// errResult = err -// } -// } diff --git a/deprecated/x/cdp/keeper/keeper_test.go b/deprecated/x/cdp/keeper/keeper_test.go deleted file mode 100644 index 9bd01428e..000000000 --- a/deprecated/x/cdp/keeper/keeper_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package keeper_test - -// import ( -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/stretchr/testify/suite" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// ) - -// type KeeperTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// app app.TestApp -// ctx sdk.Context -// } - -// func (suite *KeeperTestSuite) SetupTest() { -// suite.ResetChain() -// } - -// func (suite *KeeperTestSuite) ResetChain() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// keeper := tApp.GetCDPKeeper() - -// suite.app = tApp -// suite.ctx = ctx -// suite.keeper = keeper -// } - -// /* -// func (suite *KeeperTestSuite) TestGetSetSavingsRateDistributed() { -// suite.ResetChain() - -// // Set savings rate distributed value -// savingsRateDist := sdk.NewInt(555000555000) -// suite.keeper.SetSavingsRateDistributed(suite.ctx, savingsRateDist) - -// // Check store's savings rate distributed value -// s := suite.keeper.GetSavingsRateDistributed(suite.ctx) -// suite.Equal(savingsRateDist, s) -// } -// */ diff --git a/deprecated/x/cdp/keeper/params.go b/deprecated/x/cdp/keeper/params.go deleted file mode 100644 index 7ee1e1a48..000000000 --- a/deprecated/x/cdp/keeper/params.go +++ /dev/null @@ -1,121 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return params -} - -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} - -// GetCollateral returns the collateral param with corresponding denom -func (k Keeper) GetCollateral(ctx sdk.Context, collateralType string) (types.CollateralParam, bool) { - params := k.GetParams(ctx) - for _, cp := range params.CollateralParams { - if cp.Type == collateralType { - return cp, true - } - } - return types.CollateralParam{}, false -} - -// GetCollateralTypes returns an array of collateral types -func (k Keeper) GetCollateralTypes(ctx sdk.Context) []string { - params := k.GetParams(ctx) - var denoms []string - for _, cp := range params.CollateralParams { - denoms = append(denoms, cp.Type) - } - return denoms -} - -// GetDebtParams returns the debt params -func (k Keeper) GetDebtParams(ctx sdk.Context) types.DebtParams { - return types.DebtParams(k.GetParams(ctx).DebtParams) -} - -// GetDebtParam returns the debt param with matching denom -func (k Keeper) GetDebtParam(ctx sdk.Context, denom string) (types.DebtParam, bool) { - dps := types.DebtParams(k.GetParams(ctx).DebtParams) - return dps.FindDenom(denom) -} - -// GetCollateralTypePrefix returns the prefix of the matching denom -func (k Keeper) GetCollateralTypePrefix(ctx sdk.Context, collateralType string) (byte, bool) { - params := k.GetParams(ctx) - for _, cp := range params.CollateralParams { - if cp.Type == collateralType { - return byte(cp.Prefix), true - } - } - return 0x00, false -} - -// private methods assume collateral has been validated, panic if the input is invalid -func (k Keeper) getDenomFromByte(ctx sdk.Context, db byte) string { - params := k.GetParams(ctx) - for _, cp := range params.CollateralParams { - if byte(cp.Prefix) == db { - return cp.Denom - } - } - panic(fmt.Sprintf("no collateral denom with prefix %b", db)) -} - -func (k Keeper) getSpotMarketID(ctx sdk.Context, collateralType string) string { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - panic(fmt.Sprintf("collateral not found: %s", collateralType)) - } - return cp.SpotMarketId -} - -func (k Keeper) getliquidationMarketID(ctx sdk.Context, collateralType string) string { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - panic(fmt.Sprintf("collateral not found: %s", collateralType)) - } - return cp.LiquidationMarketId -} - -func (k Keeper) getLiquidationRatio(ctx sdk.Context, collateralType string) sdk.Dec { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - panic(fmt.Sprintf("collateral not found: %s", collateralType)) - } - return cp.LiquidationRatio -} - -func (k Keeper) getLiquidationPenalty(ctx sdk.Context, collateralType string) sdk.Dec { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - panic(fmt.Sprintf("collateral not found: %s", collateralType)) - } - return cp.LiquidationPenalty -} - -func (k Keeper) getAuctionSize(ctx sdk.Context, collateralType string) sdk.Int { - cp, found := k.GetCollateral(ctx, collateralType) - if !found { - panic(fmt.Sprintf("collateral not found: %s", collateralType)) - } - return cp.AuctionSize -} - -// GetFeeRate returns the per second fee rate for the input denom -func (k Keeper) getFeeRate(ctx sdk.Context, collateralType string) (fee sdk.Dec) { - collalateralParam, found := k.GetCollateral(ctx, collateralType) - if !found { - panic(fmt.Sprintf("could not get fee rate for %s, collateral not found", collateralType)) - } - return collalateralParam.StabilityFee -} diff --git a/deprecated/x/cdp/keeper/seize.go b/deprecated/x/cdp/keeper/seize.go deleted file mode 100644 index 66408bd31..000000000 --- a/deprecated/x/cdp/keeper/seize.go +++ /dev/null @@ -1,171 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// AttemptKeeperLiquidation liquidates the cdp with the input collateral type and owner if it is below the required collateralization ratio -// if the cdp is liquidated, the keeper that sent the transaction is rewarded a percentage of the collateral according to that collateral types' -// keeper reward percentage. -func (k Keeper) AttemptKeeperLiquidation(ctx sdk.Context, keeper, owner sdk.AccAddress, collateralType string) error { - cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) - if !found { - return sdkerrors.Wrapf(types.ErrCdpNotFound, "owner %s, denom %s", owner, collateralType) - } - k.hooks.BeforeCdpModified(ctx, cdp) - cdp = k.SynchronizeInterest(ctx, cdp) - - err := k.ValidateLiquidation(ctx, cdp.Collateral, cdp.Type, cdp.Principal, cdp.AccumulatedFees) - if err != nil { - return err - } - cdp, err = k.payoutKeeperLiquidationReward(ctx, keeper, cdp) - if err != nil { - return err - } - return k.SeizeCollateral(ctx, cdp) -} - -// SeizeCollateral liquidates the collateral in the input cdp. -// the following operations are performed: -// 1. Collateral for all deposits is sent from the cdp module to the liquidator module account -// 2. The liquidation penalty is applied -// 3. Debt coins are sent from the cdp module to the liquidator module account -// 4. The total amount of principal outstanding for that collateral type is decremented -// (this is the equivalent of saying that fees are no longer accumulated by a cdp once it gets liquidated) -func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.Cdp) error { - // Calculate the previous collateral ratio - oldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - - // Move debt coins from cdp to liquidator account - deposits := k.GetDeposits(ctx, cdp.Id) - debt := cdp.GetTotalPrincipal().Amount - debtDenomMap := k.GetDebtDenomMap(ctx) - modAccountDebt := k.getModAccountDebt(ctx, types.ModuleName, debtDenomMap[cdp.Principal.Denom]) - debt = sdk.MinInt(debt, modAccountDebt) - debtCoin := sdk.NewCoin(debtDenomMap[cdp.Principal.Denom], debt) - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.LiquidatorMacc, sdk.NewCoins(debtCoin)) - if err != nil { - return err - } - - // liquidate deposits and send collateral from cdp to liquidator - for _, dep := range deposits { - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.LiquidatorMacc, sdk.NewCoins(dep.Amount)) - if err != nil { - return err - } - k.DeleteDeposit(ctx, dep.CdpId, dep.Depositor.AccAddress()) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCdpLiquidation, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.Id)), - sdk.NewAttribute(types.AttributeKeyDeposit, dep.String()), - ), - ) - } - - err = k.AuctionCollateral(ctx, deposits, cdp.Type, debt, cdp.Principal.Denom) - if err != nil { - return err - } - - // Decrement total principal for this collateral type - coinsToDecrement := cdp.GetTotalPrincipal() - k.DecrementTotalPrincipal(ctx, cdp.Type, coinsToDecrement) - - // Delete Cdp from state - k.RemoveCdpOwnerIndex(ctx, cdp) - k.RemoveCdpCollateralRatioIndex(ctx, cdp.Type, cdp.Id, oldCollateralToDebtRatio) - return k.DeleteCdp(ctx, cdp) -} - -// LiquidateCdps seizes collateral from all Cdps below the input liquidation ratio -func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType string, liquidationRatio sdk.Dec, count sdk.Int) error { - price, err := k.PricefeedKeeper.GetCurrentPrice(ctx, marketID) - if err != nil { - return err - } - priceDivLiqRatio := price.Price.Quo(liquidationRatio) - if priceDivLiqRatio.IsZero() { - priceDivLiqRatio = sdk.SmallestDec() - } - // price = $0.5 - // liquidation ratio = 1.5 - // normalizedRatio = (1/(0.5/1.5)) = 3 - normalizedRatio := sdk.OneDec().Quo(priceDivLiqRatio) - cdpsToLiquidate := k.GetSliceOfCdpsByRatioAndType(ctx, count, normalizedRatio, collateralType) - for _, c := range cdpsToLiquidate { - k.hooks.BeforeCdpModified(ctx, c) - err := k.SeizeCollateral(ctx, c) - if err != nil { - return err - } - } - return nil -} - -// ApplyLiquidationPenalty multiplies the input debt amount by the liquidation penalty -func (k Keeper) ApplyLiquidationPenalty(ctx sdk.Context, collateralType string, debt sdk.Int) sdk.Int { - penalty := k.getLiquidationPenalty(ctx, collateralType) - return sdk.NewDecFromInt(debt).Mul(penalty).RoundInt() -} - -// ValidateLiquidation validate that adding the input principal puts the cdp below the liquidation ratio -func (k Keeper) ValidateLiquidation(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin) error { - collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, collateral, collateralType, principal, fees, spot) - if err != nil { - return err - } - liquidationRatio := k.getLiquidationRatio(ctx, collateralType) - if collateralizationRatio.GT(liquidationRatio) { - return sdkerrors.Wrapf(types.ErrNotLiquidatable, "collateral %s, collateral ratio %s, liquidation ratio %s", collateral.Denom, collateralizationRatio, liquidationRatio) - } - return nil -} - -func (k Keeper) getModAccountDebt(ctx sdk.Context, accountName string, deb_denom string) sdk.Int { - macc := k.accountKeeper.GetModuleAccount(ctx, accountName) - return k.bankKeeper.GetAllBalances(ctx, macc.GetAddress()).AmountOf(deb_denom) -} - -func (k Keeper) payoutKeeperLiquidationReward(ctx sdk.Context, keeper sdk.AccAddress, cdp types.Cdp) (types.Cdp, error) { - collateralParam, found := k.GetCollateral(ctx, cdp.Type) - if !found { - return types.Cdp{}, sdkerrors.Wrapf(types.ErrInvalidCollateral, "%s", cdp.Type) - } - reward := sdk.NewDecFromInt(cdp.Collateral.Amount).Mul(collateralParam.KeeperRewardPercentage).RoundInt() - rewardCoin := sdk.NewCoin(cdp.Collateral.Denom, reward) - paidReward := false - deposits := k.GetDeposits(ctx, cdp.Id) - for _, dep := range deposits { - if dep.Amount.IsGTE(rewardCoin) { - dep.Amount = dep.Amount.Sub(rewardCoin) - k.SetDeposit(ctx, dep) - paidReward = true - break - } - } - if !paidReward { - return cdp, nil - } - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, keeper, sdk.NewCoins(rewardCoin)) - if err != nil { - return types.Cdp{}, err - } - - cdp.Collateral = cdp.Collateral.Sub(rewardCoin) - ratio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - err = k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, ratio) - if err != nil { - return types.Cdp{}, err - } - return cdp, nil -} diff --git a/deprecated/x/cdp/keeper/seize_test.go b/deprecated/x/cdp/keeper/seize_test.go deleted file mode 100644 index daa3964dc..000000000 --- a/deprecated/x/cdp/keeper/seize_test.go +++ /dev/null @@ -1,210 +0,0 @@ -package keeper_test - -// import ( -// "errors" -// "math/rand" -// "time" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// simulation "github.com/cosmos/cosmos-sdk/types/simulation" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// auctiontypes "github.com/UnUniFi/chain/deprecated/x/auction/types" -// "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// ) - -// type SeizeTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// addrs []sdk.AccAddress -// app app.TestApp -// cdps cdptypes.Cdps -// ctx sdk.Context -// liquidations liquidationTracker -// } - -// type liquidationTracker struct { -// xrp []uint64 -// btc []uint64 -// debt int64 -// } - -// func (suite *SeizeTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// coins := []sdk.Coins{} -// tracker := liquidationTracker{} - -// for j := 0; j < 100; j++ { -// coins = append(coins, cs(c("btc", 100000000), c("xrp", 10000000000))) -// } -// _, addrs := app.GeneratePrivKeyAddressPairs(100) - -// authGS := app.NewAuthGenState( -// tApp, addrs, coins) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) -// suite.ctx = ctx -// suite.app = tApp -// suite.keeper = tApp.GetCDPKeeper() -// suite.cdps = cdptypes.Cdps{} -// suite.addrs = addrs -// suite.liquidations = tracker -// } - -// func (suite *SeizeTestSuite) createCdps() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) -// cdps := make(cdptypes.Cdps, 100) -// _, addrs := app.GeneratePrivKeyAddressPairs(100) -// coins := []sdk.Coins{} -// tracker := liquidationTracker{} - -// for j := 0; j < 100; j++ { -// coins = append(coins, cs(c("btc", 100000000), c("xrp", 10000000000))) -// } - -// authGS := app.NewAuthGenState( -// tApp, addrs, coins) -// tApp.InitializeFromGenesisStates( -// authGS, -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// ) - -// suite.ctx = ctx -// suite.app = tApp -// suite.keeper = tApp.GetCDPKeeper() -// randSource := rand.New(rand.NewSource(int64(777))) -// for j := 0; j < 100; j++ { -// collateral := "xrp" -// amount := 10000000000 -// debt := simulation.RandIntBetween(randSource, 750000000, 1249000000) -// if j%2 == 0 { -// collateral = "btc" -// amount = 100000000 -// debt = simulation.RandIntBetween(randSource, 2700000000, 5332000000) -// if debt >= 4000000000 { -// tracker.btc = append(tracker.btc, uint64(j+1)) -// tracker.debt += int64(debt) -// } -// } else { -// if debt >= 1000000000 { -// tracker.xrp = append(tracker.xrp, uint64(j+1)) -// tracker.debt += int64(debt) -// } -// } -// err := suite.keeper.AddCdp(suite.ctx, addrs[j], c(collateral, int64(amount)), c("jpu", int64(debt)), collateral+"-a") -// suite.NoError(err) -// c, f := suite.keeper.GetCdp(suite.ctx, collateral+"-a", uint64(j+1)) -// suite.True(f) -// cdps[j] = c -// } - -// suite.cdps = cdps -// suite.addrs = addrs -// suite.liquidations = tracker -// } - -// func (suite *SeizeTestSuite) setPrice(price sdk.Dec, market string) { -// pfKeeper := suite.app.GetPriceFeedKeeper() - -// pfKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, market, price, suite.ctx.BlockTime().Add(time.Hour*3)) -// err := pfKeeper.SetCurrentPrices(suite.ctx, market) -// suite.NoError(err) -// pp, err := pfKeeper.GetCurrentPrice(suite.ctx, market) -// suite.NoError(err) -// suite.Equal(price, pp.Price) -// } - -// func (suite *SeizeTestSuite) TestSeizeCollateral() { -// suite.createCdps() -// sk := suite.app.GetBankKeeper() -// cdp, found := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.True(found) -// p := cdp.Principal.Amount -// cl := cdp.Collateral.Amount -// tpb := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu") -// err := suite.keeper.SeizeCollateral(suite.ctx, cdp) -// suite.NoError(err) -// tpa := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu") -// suite.Equal(tpb.Sub(tpa), p) -// auctionKeeper := suite.app.GetAuctionKeeper() -// _, found = auctionKeeper.GetAuction(suite.ctx, auctiontypes.DefaultNextAuctionID) -// suite.True(found) -// ak := suite.app.GetAccountKeeper() -// auctionMacc := ak.GetModuleAccount(suite.ctx, auctiontypes.ModuleName) -// suite.Equal(cs(c("debtjpu", p.Int64()), c("xrp", cl.Int64())), sk.GetAllBalances(suite.ctx, auctionMacc.GetAddress())) -// acc := ak.GetAccount(suite.ctx, suite.addrs[1]) -// suite.Equal(p.Int64(), sk.GetBalance(suite.ctx, acc.GetAddress(), "jpu").Amount.Int64()) -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[1], suite.addrs[1], c("xrp", 10), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCdpNotFound)) -// } - -// func (suite *SeizeTestSuite) TestSeizeCollateralMultiDeposit() { -// suite.createCdps() -// sk := suite.app.GetBankKeeper() -// cdp, found := suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.True(found) -// err := suite.keeper.DepositCollateral(suite.ctx, suite.addrs[1], suite.addrs[0], c("xrp", 6999000000), "xrp-a") -// suite.NoError(err) -// cdp, found = suite.keeper.GetCdp(suite.ctx, "xrp-a", uint64(2)) -// suite.True(found) -// deposits := suite.keeper.GetDeposits(suite.ctx, cdp.Id) -// suite.Equal(2, len(deposits)) -// p := cdp.Principal.Amount -// cl := cdp.Collateral.Amount -// tpb := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu") -// err = suite.keeper.SeizeCollateral(suite.ctx, cdp) -// suite.NoError(err) -// tpa := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "jpu") -// suite.Equal(tpb.Sub(tpa), p) -// ak := suite.app.GetAccountKeeper() -// auctionMacc := ak.GetModuleAccount(suite.ctx, auctiontypes.ModuleName) -// suite.Equal(cs(c("debtjpu", p.Int64()), c("xrp", cl.Int64())), sk.GetAllBalances(suite.ctx, auctionMacc.GetAddress())) -// acc := ak.GetAccount(suite.ctx, suite.addrs[1]) -// suite.Equal(p.Int64(), sk.GetBalance(suite.ctx, acc.GetAddress(), "jpu").Amount.Int64()) -// err = suite.keeper.WithdrawCollateral(suite.ctx, suite.addrs[1], suite.addrs[1], c("xrp", 10), "xrp-a") -// suite.Require().True(errors.Is(err, cdptypes.ErrCdpNotFound)) -// } - -// func (suite *SeizeTestSuite) TestLiquidateCdps() { -// suite.createCdps() -// ak := suite.app.GetAccountKeeper() -// sk := suite.app.GetBankKeeper() -// acc := ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// originalXrpCollateral := sk.GetBalance(suite.ctx, acc.GetAddress(), "xrp").Amount -// suite.setPrice(d("0.2"), "xrp:jpy") -// p, found := suite.keeper.GetCollateral(suite.ctx, "xrp-a") -// suite.True(found) -// suite.keeper.LiquidateCdps(suite.ctx, "xrp:jpy", "xrp-a", p.LiquidationRatio, p.CheckCollateralizationIndexCount) -// acc = ak.GetModuleAccount(suite.ctx, cdptypes.ModuleName) -// finalXrpCollateral := sk.GetBalance(suite.ctx, acc.GetAddress(), "xrp").Amount -// seizedXrpCollateral := originalXrpCollateral.Sub(finalXrpCollateral) -// xrpLiquidations := int(seizedXrpCollateral.Quo(i(10000000000)).Int64()) -// suite.Equal(10 /*len(suite.liquidations.xrp)*/, xrpLiquidations) -// } - -// func (suite *SeizeTestSuite) TestApplyLiquidationPenalty() { -// penalty := suite.keeper.ApplyLiquidationPenalty(suite.ctx, "xrp-a", i(1000)) -// suite.Equal(i(50), penalty) -// penalty = suite.keeper.ApplyLiquidationPenalty(suite.ctx, "btc-a", i(1000)) -// suite.Equal(i(25), penalty) -// penalty = suite.keeper.ApplyLiquidationPenalty(suite.ctx, "xrp-a", i(675760172)) -// suite.Equal(i(33788009), penalty) -// suite.Panics(func() { suite.keeper.ApplyLiquidationPenalty(suite.ctx, "lol-a", i(1000)) }) -// } - -// // func TestSeizeTestSuite(t *testing.T) { -// // suite.Run(t, new(SeizeTestSuite)) -// // } diff --git a/deprecated/x/cdp/module.go b/deprecated/x/cdp/module.go deleted file mode 100644 index f70f65fc0..000000000 --- a/deprecated/x/cdp/module.go +++ /dev/null @@ -1,170 +0,0 @@ -package cdp - -import ( - "encoding/json" - "fmt" - - "context" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/UnUniFi/chain/deprecated/x/cdp/client/cli" - "github.com/UnUniFi/chain/deprecated/x/cdp/client/rest" - "github.com/UnUniFi/chain/deprecated/x/cdp/keeper" - "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr) -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - PricefeedKeeper types.PricefeedKeeper -} - -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - PricefeedKeeper types.PricefeedKeeper) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - PricefeedKeeper: PricefeedKeeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, am.accountKeeper, am.PricefeedKeeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(&genState) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, req, am.keeper) -} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/deprecated/x/cdp/types/cdp.go b/deprecated/x/cdp/types/cdp.go deleted file mode 100644 index c79cd91f1..000000000 --- a/deprecated/x/cdp/types/cdp.go +++ /dev/null @@ -1,124 +0,0 @@ -package types - -import ( - "errors" - fmt "fmt" - "strings" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewCdp creates a new Cdp object -func NewCdp(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal sdk.Coin, time time.Time, interestFactor sdk.Dec) Cdp { - fees := sdk.NewCoin(principal.Denom, sdk.ZeroInt()) - return Cdp{ - Id: id, - Owner: owner.Bytes(), - Type: collateralType, - Collateral: collateral, - Principal: principal, - AccumulatedFees: fees, - FeesUpdated: time, - InterestFactor: interestFactor, - } -} - -// NewCdpWithFees creates a new Cdp object, for use during migration -func NewCdpWithFees(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal, fees sdk.Coin, time time.Time, interestFactor sdk.Dec) Cdp { - return Cdp{ - Id: id, - Owner: owner.Bytes(), - Type: collateralType, - Collateral: collateral, - Principal: principal, - AccumulatedFees: fees, - FeesUpdated: time, - InterestFactor: interestFactor, - } -} - -// Validate performs a basic validation of the Cdp fields. -func (cdp Cdp) Validate() error { - if cdp.Id == 0 { - return errors.New("cdp id cannot be 0") - } - if cdp.Owner.AccAddress().Empty() { - return errors.New("cdp owner cannot be empty") - } - if !cdp.Collateral.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "collateral %s", cdp.Collateral) - } - if !cdp.Principal.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "principal %s", cdp.Principal) - } - if !cdp.AccumulatedFees.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "accumulated fees %s", cdp.AccumulatedFees) - } - if cdp.FeesUpdated.Unix() <= 0 { - return errors.New("cdp updated fee time cannot be zero") - } - if strings.TrimSpace(cdp.Type) == "" { - return fmt.Errorf("cdp type cannot be empty") - } - return nil -} - -// GetTotalPrincipal returns the total principle for the cdp -func (cdp Cdp) GetTotalPrincipal() sdk.Coin { - return cdp.Principal.Add(cdp.AccumulatedFees) -} - -// Cdps a collection of Cdp objects -type Cdps []Cdp - -// String implements stringer -func (cdps Cdps) String() string { - out := "" - for _, cdp := range cdps { - out += cdp.String() + "\n" - } - return out -} - -// Validate validates each Cdp -func (cdps Cdps) Validate() error { - for _, cdp := range cdps { - if err := cdp.Validate(); err != nil { - return err - } - } - return nil -} - -// NewAugmentedCdp creates a new AugmentedCdp object -func NewAugmentedCdp(cdp Cdp, collateralValue sdk.Coin, collateralizationRatio sdk.Dec) AugmentedCdp { - augmentedCdp := AugmentedCdp{ - Cdp: Cdp{ - Id: cdp.Id, - Owner: cdp.Owner, - Type: cdp.Type, - Collateral: cdp.Collateral, - Principal: cdp.Principal, - AccumulatedFees: cdp.AccumulatedFees, - FeesUpdated: cdp.FeesUpdated, - InterestFactor: cdp.InterestFactor, - }, - CollateralValue: collateralValue, - CollateralizationRatio: collateralizationRatio, - } - return augmentedCdp -} - -// AugmentedCdps a collection of AugmentedCdp objects -type AugmentedCdps []AugmentedCdp - -// String implements stringer -func (augcdps AugmentedCdps) String() string { - out := "" - for _, augcdp := range augcdps { - out += augcdp.String() + "\n" - } - return out -} diff --git a/deprecated/x/cdp/types/cdp.pb.go b/deprecated/x/cdp/types/cdp.pb.go deleted file mode 100644 index e4f0cb178..000000000 --- a/deprecated/x/cdp/types/cdp.pb.go +++ /dev/null @@ -1,2888 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cdp/cdp.proto - -package types - -import ( - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Cdp struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` - Owner github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,2,opt,name=owner,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"owner" yaml:"owner"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty" yaml:"type"` - Collateral types.Coin `protobuf:"bytes,4,opt,name=collateral,proto3" json:"collateral" yaml:"collateral"` - Principal types.Coin `protobuf:"bytes,5,opt,name=principal,proto3" json:"principal" yaml:"principal"` - AccumulatedFees types.Coin `protobuf:"bytes,6,opt,name=accumulated_fees,json=accumulatedFees,proto3" json:"accumulated_fees" yaml:"accumulated_fees"` - FeesUpdated time.Time `protobuf:"bytes,7,opt,name=fees_updated,json=feesUpdated,proto3,stdtime" json:"fees_updated" yaml:"fees_updated"` - InterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=interest_factor,json=interestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_factor" yaml:"interest_factor"` -} - -func (m *Cdp) Reset() { *m = Cdp{} } -func (m *Cdp) String() string { return proto.CompactTextString(m) } -func (*Cdp) ProtoMessage() {} -func (*Cdp) Descriptor() ([]byte, []int) { - return fileDescriptor_105e3b742c3b95d7, []int{0} -} -func (m *Cdp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Cdp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Cdp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Cdp) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cdp.Merge(m, src) -} -func (m *Cdp) XXX_Size() int { - return m.Size() -} -func (m *Cdp) XXX_DiscardUnknown() { - xxx_messageInfo_Cdp.DiscardUnknown(m) -} - -var xxx_messageInfo_Cdp proto.InternalMessageInfo - -func (m *Cdp) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *Cdp) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *Cdp) GetCollateral() types.Coin { - if m != nil { - return m.Collateral - } - return types.Coin{} -} - -func (m *Cdp) GetPrincipal() types.Coin { - if m != nil { - return m.Principal - } - return types.Coin{} -} - -func (m *Cdp) GetAccumulatedFees() types.Coin { - if m != nil { - return m.AccumulatedFees - } - return types.Coin{} -} - -func (m *Cdp) GetFeesUpdated() time.Time { - if m != nil { - return m.FeesUpdated - } - return time.Time{} -} - -type Deposit struct { - CdpId uint64 `protobuf:"varint,1,opt,name=cdp_id,json=cdpId,proto3" json:"cdp_id,omitempty" yaml:"cdp_id"` - Depositor github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"depositor" yaml:"depositor"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount" yaml:"amount"` -} - -func (m *Deposit) Reset() { *m = Deposit{} } -func (m *Deposit) String() string { return proto.CompactTextString(m) } -func (*Deposit) ProtoMessage() {} -func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_105e3b742c3b95d7, []int{1} -} -func (m *Deposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Deposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Deposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Deposit.Merge(m, src) -} -func (m *Deposit) XXX_Size() int { - return m.Size() -} -func (m *Deposit) XXX_DiscardUnknown() { - xxx_messageInfo_Deposit.DiscardUnknown(m) -} - -var xxx_messageInfo_Deposit proto.InternalMessageInfo - -func (m *Deposit) GetCdpId() uint64 { - if m != nil { - return m.CdpId - } - return 0 -} - -func (m *Deposit) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -type AugmentedCdp struct { - Cdp `protobuf:"bytes,1,opt,name=cdp,proto3,embedded=cdp" json:"cdp" yaml:"cdp"` - CollateralValue types.Coin `protobuf:"bytes,2,opt,name=collateral_value,json=collateralValue,proto3" json:"collateral_value" yaml:"collateral_value"` - CollateralizationRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=collateralization_ratio,json=collateralizationRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"collateralization_ratio" yaml:"collateralization_ratio"` -} - -func (m *AugmentedCdp) Reset() { *m = AugmentedCdp{} } -func (m *AugmentedCdp) String() string { return proto.CompactTextString(m) } -func (*AugmentedCdp) ProtoMessage() {} -func (*AugmentedCdp) Descriptor() ([]byte, []int) { - return fileDescriptor_105e3b742c3b95d7, []int{2} -} -func (m *AugmentedCdp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AugmentedCdp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AugmentedCdp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AugmentedCdp) XXX_Merge(src proto.Message) { - xxx_messageInfo_AugmentedCdp.Merge(m, src) -} -func (m *AugmentedCdp) XXX_Size() int { - return m.Size() -} -func (m *AugmentedCdp) XXX_DiscardUnknown() { - xxx_messageInfo_AugmentedCdp.DiscardUnknown(m) -} - -var xxx_messageInfo_AugmentedCdp proto.InternalMessageInfo - -func (m *AugmentedCdp) GetCollateralValue() types.Coin { - if m != nil { - return m.CollateralValue - } - return types.Coin{} -} - -type Params struct { - CollateralParams []CollateralParam `protobuf:"bytes,1,rep,name=collateral_params,json=collateralParams,proto3" json:"collateral_params" yaml:"collateral_params"` - DebtParams []DebtParam `protobuf:"bytes,2,rep,name=debt_params,json=debtParams,proto3" json:"debt_params" yaml:"debt_param"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_105e3b742c3b95d7, []int{3} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetCollateralParams() []CollateralParam { - if m != nil { - return m.CollateralParams - } - return nil -} - -func (m *Params) GetDebtParams() []DebtParam { - if m != nil { - return m.DebtParams - } - return nil -} - -type CollateralParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty" yaml:"type"` - LiquidationRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_ratio" yaml:"liquidation_ratio"` - DebtLimit types.Coin `protobuf:"bytes,4,opt,name=debt_limit,json=debtLimit,proto3" json:"debt_limit" yaml:"debt_limit"` - StabilityFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stability_fee" yaml:"stability_fee"` - AuctionSize github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=auction_size,json=auctionSize,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"auction_size" yaml:"auction_size"` - LiquidationPenalty github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_penalty" yaml:"liquidation_penalty"` - Prefix uint32 `protobuf:"varint,8,opt,name=prefix,proto3" json:"prefix,omitempty" yaml:"prefix"` - SpotMarketId string `protobuf:"bytes,9,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty" yaml:"spot_market_id"` - LiquidationMarketId string `protobuf:"bytes,10,opt,name=liquidation_market_id,json=liquidationMarketId,proto3" json:"liquidation_market_id,omitempty" yaml:"liquidation_market_id"` - KeeperRewardPercentage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"keeper_reward_percentage" yaml:"keeper_reward_percentage"` - CheckCollateralizationIndexCount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=check_collateralization_index_count,json=checkCollateralizationIndexCount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"check_collateralization_index_count" yaml:"check_collateralization_index_count"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,13,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor" yaml:"conversion_factor"` -} - -func (m *CollateralParam) Reset() { *m = CollateralParam{} } -func (m *CollateralParam) String() string { return proto.CompactTextString(m) } -func (*CollateralParam) ProtoMessage() {} -func (*CollateralParam) Descriptor() ([]byte, []int) { - return fileDescriptor_105e3b742c3b95d7, []int{4} -} -func (m *CollateralParam) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CollateralParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CollateralParam.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CollateralParam) XXX_Merge(src proto.Message) { - xxx_messageInfo_CollateralParam.Merge(m, src) -} -func (m *CollateralParam) XXX_Size() int { - return m.Size() -} -func (m *CollateralParam) XXX_DiscardUnknown() { - xxx_messageInfo_CollateralParam.DiscardUnknown(m) -} - -var xxx_messageInfo_CollateralParam proto.InternalMessageInfo - -func (m *CollateralParam) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *CollateralParam) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *CollateralParam) GetDebtLimit() types.Coin { - if m != nil { - return m.DebtLimit - } - return types.Coin{} -} - -func (m *CollateralParam) GetPrefix() uint32 { - if m != nil { - return m.Prefix - } - return 0 -} - -func (m *CollateralParam) GetSpotMarketId() string { - if m != nil { - return m.SpotMarketId - } - return "" -} - -func (m *CollateralParam) GetLiquidationMarketId() string { - if m != nil { - return m.LiquidationMarketId - } - return "" -} - -type DebtParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - ReferenceAsset string `protobuf:"bytes,2,opt,name=reference_asset,json=referenceAsset,proto3" json:"reference_asset,omitempty" yaml:"reference_asset"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor" yaml:"conversion_factor"` - DebtFloor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=debt_floor,json=debtFloor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_floor" yaml:"debt_floor"` - GlobalDebtLimit types.Coin `protobuf:"bytes,5,opt,name=global_debt_limit,json=globalDebtLimit,proto3" json:"global_debt_limit" yaml:"global_debt_limit"` - DebtDenom string `protobuf:"bytes,6,opt,name=debt_denom,json=debtDenom,proto3" json:"debt_denom,omitempty" yaml:"debt_denom"` - SurplusAuctionThreshold github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=surplus_auction_threshold,json=surplusAuctionThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"surplus_auction_threshold" yaml:"surplus_auction_threshold"` - SurplusAuctionLot github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=surplus_auction_lot,json=surplusAuctionLot,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"surplus_auction_lot" yaml:"surplus_auction_lot"` - DebtAuctionThreshold github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=debt_auction_threshold,json=debtAuctionThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_auction_threshold" yaml:"debt_auction_threshold"` - DebtAuctionLot github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,10,opt,name=debt_auction_lot,json=debtAuctionLot,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_auction_lot" yaml:"debt_auction_lot"` - CircuitBreaker bool `protobuf:"varint,11,opt,name=circuit_breaker,json=circuitBreaker,proto3" json:"circuit_breaker,omitempty" yaml:"circuit_breaker"` -} - -func (m *DebtParam) Reset() { *m = DebtParam{} } -func (m *DebtParam) String() string { return proto.CompactTextString(m) } -func (*DebtParam) ProtoMessage() {} -func (*DebtParam) Descriptor() ([]byte, []int) { - return fileDescriptor_105e3b742c3b95d7, []int{5} -} -func (m *DebtParam) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DebtParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DebtParam.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DebtParam) XXX_Merge(src proto.Message) { - xxx_messageInfo_DebtParam.Merge(m, src) -} -func (m *DebtParam) XXX_Size() int { - return m.Size() -} -func (m *DebtParam) XXX_DiscardUnknown() { - xxx_messageInfo_DebtParam.DiscardUnknown(m) -} - -var xxx_messageInfo_DebtParam proto.InternalMessageInfo - -func (m *DebtParam) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *DebtParam) GetReferenceAsset() string { - if m != nil { - return m.ReferenceAsset - } - return "" -} - -func (m *DebtParam) GetGlobalDebtLimit() types.Coin { - if m != nil { - return m.GlobalDebtLimit - } - return types.Coin{} -} - -func (m *DebtParam) GetDebtDenom() string { - if m != nil { - return m.DebtDenom - } - return "" -} - -func (m *DebtParam) GetCircuitBreaker() bool { - if m != nil { - return m.CircuitBreaker - } - return false -} - -func init() { - proto.RegisterType((*Cdp)(nil), "ununifi.cdp.Cdp") - proto.RegisterType((*Deposit)(nil), "ununifi.cdp.Deposit") - proto.RegisterType((*AugmentedCdp)(nil), "ununifi.cdp.AugmentedCdp") - proto.RegisterType((*Params)(nil), "ununifi.cdp.Params") - proto.RegisterType((*CollateralParam)(nil), "ununifi.cdp.CollateralParam") - proto.RegisterType((*DebtParam)(nil), "ununifi.cdp.DebtParam") -} - -func init() { proto.RegisterFile("cdp/cdp.proto", fileDescriptor_105e3b742c3b95d7) } - -var fileDescriptor_105e3b742c3b95d7 = []byte{ - // 1384 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xce, 0x26, 0x4d, 0x5a, 0x8f, 0x93, 0x38, 0x99, 0x36, 0x89, 0x63, 0xb5, 0x5e, 0x6b, 0x8a, - 0xaa, 0x80, 0x84, 0xad, 0x16, 0x4e, 0x3d, 0x80, 0x62, 0x87, 0xd0, 0x40, 0x10, 0xe9, 0x34, 0xe5, - 0x80, 0x80, 0xd5, 0x7a, 0x67, 0xec, 0x8c, 0xbc, 0xde, 0xd9, 0xee, 0xce, 0xb6, 0x4d, 0x05, 0x47, - 0x0e, 0xa8, 0x12, 0xea, 0xff, 0xe0, 0x37, 0x70, 0x44, 0x2a, 0xb7, 0x1e, 0x11, 0x07, 0x83, 0xda, - 0x0b, 0x67, 0xdf, 0xb8, 0xa1, 0xf9, 0xf0, 0x7a, 0x6d, 0xa7, 0x0d, 0x8b, 0xc4, 0xc9, 0xde, 0xe7, - 0x9d, 0xf7, 0x79, 0x3f, 0xf7, 0xd9, 0x5d, 0xb0, 0xe2, 0x91, 0xb0, 0xe1, 0x91, 0xb0, 0x1e, 0x46, - 0x5c, 0x70, 0x58, 0x4c, 0x82, 0x24, 0x60, 0x1d, 0x56, 0xf7, 0x48, 0x58, 0xb9, 0xd2, 0xe5, 0x5d, - 0xae, 0xf0, 0x86, 0xfc, 0xa7, 0x8f, 0x54, 0xec, 0x2e, 0xe7, 0x5d, 0x9f, 0x36, 0xd4, 0x55, 0x3b, - 0xe9, 0x34, 0x04, 0xeb, 0xd3, 0x58, 0xb8, 0x7d, 0xc3, 0x51, 0xa9, 0x7a, 0x3c, 0xee, 0xf3, 0xb8, - 0xd1, 0x76, 0x63, 0xda, 0x78, 0x78, 0xb3, 0x4d, 0x85, 0x7b, 0xb3, 0xe1, 0x71, 0x16, 0x68, 0x3b, - 0x7a, 0xba, 0x08, 0x16, 0x5a, 0x24, 0x84, 0xd7, 0xc0, 0x3c, 0x23, 0x65, 0xab, 0x66, 0xed, 0x5c, - 0x68, 0xae, 0x0c, 0x07, 0x76, 0xe1, 0xd4, 0xed, 0xfb, 0xb7, 0x11, 0x23, 0x08, 0xcf, 0x33, 0x02, - 0xbf, 0x06, 0x8b, 0xfc, 0x51, 0x40, 0xa3, 0xf2, 0x7c, 0xcd, 0xda, 0x29, 0x34, 0x3f, 0x7e, 0x3e, - 0xb0, 0xe7, 0x7e, 0x1f, 0xd8, 0x8d, 0x2e, 0x13, 0x27, 0x49, 0xbb, 0xee, 0xf1, 0x7e, 0xe3, 0x7e, - 0x70, 0x3f, 0x60, 0xfb, 0xac, 0xe1, 0x9d, 0xb8, 0x2c, 0x68, 0x88, 0xd3, 0x90, 0xc6, 0xf5, 0x7b, - 0x22, 0x62, 0x41, 0x77, 0xd7, 0xf3, 0x76, 0x09, 0x89, 0x68, 0x1c, 0x0f, 0x07, 0xf6, 0xb2, 0x26, - 0x56, 0x6c, 0x08, 0x6b, 0x56, 0x78, 0x1d, 0x5c, 0x90, 0x0e, 0xe5, 0x05, 0xc5, 0x5e, 0x1a, 0x0e, - 0xec, 0xa2, 0x3e, 0x26, 0x51, 0x84, 0x95, 0x11, 0x1e, 0x03, 0xe0, 0x71, 0xdf, 0x77, 0x05, 0x8d, - 0x5c, 0xbf, 0x7c, 0xa1, 0x66, 0xed, 0x14, 0x6f, 0x6d, 0xd7, 0x75, 0x7d, 0x75, 0x59, 0x5f, 0xdd, - 0xd4, 0x57, 0x6f, 0x71, 0x16, 0x34, 0xb7, 0x65, 0x8e, 0xc3, 0x81, 0xbd, 0xae, 0x99, 0xc6, 0xae, - 0x08, 0x67, 0x78, 0xe0, 0x5d, 0x50, 0x08, 0x23, 0x16, 0x78, 0x2c, 0x74, 0xfd, 0xf2, 0xe2, 0x79, - 0xa4, 0x65, 0x43, 0xba, 0xa6, 0x49, 0x53, 0x4f, 0x84, 0xc7, 0x2c, 0x90, 0x82, 0x35, 0xd7, 0xf3, - 0x92, 0x7e, 0x22, 0x63, 0x10, 0xa7, 0x43, 0x69, 0x5c, 0x5e, 0x3a, 0x8f, 0xd9, 0x36, 0xcc, 0x5b, - 0x9a, 0x79, 0x9a, 0x00, 0xe1, 0x52, 0x06, 0xda, 0xa7, 0x34, 0x86, 0xdf, 0x80, 0x65, 0x69, 0x71, - 0x92, 0x90, 0x48, 0xac, 0x7c, 0x51, 0x85, 0xa8, 0xd4, 0xf5, 0x4a, 0xd4, 0x47, 0x2b, 0x51, 0x3f, - 0x1e, 0xad, 0x44, 0x1a, 0xe3, 0xb2, 0x8e, 0x91, 0xf5, 0x46, 0xcf, 0xfe, 0xb0, 0x2d, 0x5c, 0x94, - 0xd0, 0x7d, 0x8d, 0xc0, 0x07, 0xa0, 0xc4, 0x02, 0x41, 0x23, 0x1a, 0x0b, 0xa7, 0xe3, 0x7a, 0x82, - 0x47, 0xe5, 0x4b, 0x6a, 0x3e, 0x77, 0xcc, 0xf4, 0x6f, 0x64, 0xa6, 0x6f, 0xd6, 0x4c, 0xff, 0xbc, - 0x1b, 0x93, 0x9e, 0xd9, 0x80, 0x3d, 0xea, 0x0d, 0x07, 0xf6, 0xa6, 0xd9, 0xa6, 0x49, 0x3a, 0x84, - 0x57, 0x47, 0xc8, 0xbe, 0x06, 0xfe, 0xb2, 0xc0, 0xc5, 0x3d, 0x1a, 0xf2, 0x98, 0x09, 0xb8, 0x03, - 0x96, 0x3c, 0x12, 0x3a, 0xe9, 0x56, 0xae, 0x0f, 0x07, 0xf6, 0x8a, 0x99, 0xa5, 0xc2, 0x11, 0x5e, - 0xf4, 0x48, 0x78, 0x40, 0x20, 0x03, 0x05, 0xa2, 0x9d, 0xf8, 0x68, 0x41, 0x3f, 0xfd, 0xef, 0x0b, - 0x6a, 0x46, 0x9b, 0x32, 0x22, 0x3c, 0x66, 0x87, 0x77, 0xc0, 0x92, 0xdb, 0xe7, 0x49, 0x20, 0xd4, - 0xaa, 0xbe, 0x71, 0xa0, 0x1b, 0xa6, 0xd9, 0x26, 0x67, 0xed, 0x86, 0xb0, 0xf1, 0x47, 0x3f, 0xcf, - 0x83, 0xe5, 0xdd, 0xa4, 0xdb, 0xa7, 0x81, 0xa0, 0x44, 0xde, 0x81, 0xb7, 0xc1, 0x82, 0x47, 0x42, - 0x55, 0x6c, 0xf1, 0xd6, 0x5a, 0x3d, 0x73, 0xef, 0xd7, 0x5b, 0x24, 0x6c, 0x6e, 0x4a, 0xba, 0x17, - 0x03, 0xdb, 0x1a, 0x0e, 0x6c, 0x90, 0xb6, 0x01, 0x61, 0xe9, 0x24, 0x37, 0x6e, 0xbc, 0xd2, 0xce, - 0x43, 0xd7, 0x4f, 0xa8, 0x6a, 0x44, 0x9e, 0x8d, 0x9b, 0x26, 0x40, 0xb8, 0x34, 0x86, 0xbe, 0x90, - 0x08, 0xfc, 0xc1, 0x02, 0x5b, 0x63, 0x8c, 0x3d, 0x71, 0x05, 0xe3, 0x81, 0x13, 0xc9, 0x1f, 0x73, - 0xeb, 0x1e, 0xe5, 0x5e, 0x8d, 0xea, 0x74, 0xf4, 0x09, 0x5a, 0x84, 0x37, 0x67, 0x2c, 0x58, 0x19, - 0x7e, 0xb5, 0xc0, 0xd2, 0x91, 0x1b, 0xb9, 0xfd, 0x18, 0xf6, 0xc0, 0x7a, 0x26, 0xf9, 0x50, 0x81, - 0x65, 0xab, 0xb6, 0xb0, 0x53, 0xbc, 0x75, 0x75, 0xb2, 0x8f, 0xe9, 0x29, 0xe5, 0xd9, 0xac, 0x99, - 0x0e, 0x94, 0x67, 0x3a, 0xa0, 0x49, 0x10, 0xce, 0xb4, 0xd5, 0x04, 0xc3, 0xa0, 0x48, 0x68, 0x5b, - 0x8c, 0xc2, 0xcc, 0xab, 0x30, 0x9b, 0x13, 0x61, 0xf6, 0x68, 0x5b, 0xe8, 0x00, 0x53, 0x1a, 0x34, - 0x76, 0x44, 0x18, 0x90, 0xd1, 0xa9, 0x18, 0xfd, 0x5d, 0x00, 0xa5, 0xa9, 0xdc, 0xe0, 0x0d, 0xb0, - 0x48, 0x68, 0xc0, 0xfb, 0x6a, 0x21, 0x0a, 0xcd, 0xb5, 0xb1, 0x74, 0x2a, 0x18, 0x61, 0x6d, 0x4e, - 0xa5, 0x73, 0xfe, 0x4d, 0xd2, 0xf9, 0x08, 0xac, 0xfb, 0xec, 0x41, 0xc2, 0xc8, 0xec, 0xc4, 0x3e, - 0xc9, 0x3d, 0x31, 0xd3, 0xad, 0x19, 0x42, 0x84, 0xd7, 0x32, 0x98, 0x9a, 0x12, 0xbc, 0x07, 0x54, - 0x9d, 0x8e, 0xcf, 0xfa, 0x4c, 0xe4, 0xd6, 0xec, 0xb1, 0xab, 0xba, 0x09, 0xdb, 0xe2, 0x50, 0xfe, - 0x87, 0x3d, 0xb0, 0x12, 0x0b, 0xb7, 0xcd, 0x7c, 0x26, 0x4e, 0xa5, 0x38, 0x2a, 0xd9, 0x2e, 0x34, - 0xf7, 0x73, 0x57, 0x72, 0x45, 0x87, 0x99, 0x20, 0x43, 0x78, 0x39, 0xbd, 0xde, 0xa7, 0x14, 0x9e, - 0x80, 0x65, 0x37, 0xf1, 0x54, 0x95, 0x31, 0x7b, 0x42, 0x95, 0x90, 0x17, 0x9a, 0x1f, 0xe5, 0x88, - 0x75, 0x10, 0x88, 0xb1, 0xe6, 0x66, 0xb9, 0x10, 0x2e, 0x9a, 0xcb, 0x7b, 0xec, 0x09, 0x85, 0xdf, - 0x81, 0xcb, 0xd9, 0x9e, 0x86, 0x34, 0x70, 0x7d, 0x71, 0xaa, 0x64, 0xbd, 0xd0, 0x3c, 0xcc, 0x5d, - 0x5c, 0x65, 0x76, 0x4c, 0x86, 0x12, 0x61, 0x98, 0x41, 0x8f, 0x34, 0x08, 0xdf, 0x06, 0x4b, 0x61, - 0x44, 0x3b, 0xec, 0xb1, 0x52, 0xf9, 0x95, 0xac, 0xde, 0x6a, 0x1c, 0x61, 0x73, 0x00, 0x7e, 0x08, - 0x56, 0xe3, 0x90, 0x0b, 0xa7, 0xef, 0x46, 0x3d, 0x2a, 0xa4, 0x44, 0x17, 0x54, 0x92, 0xdb, 0xc3, - 0x81, 0xbd, 0x61, 0x7a, 0x3a, 0x61, 0x97, 0x4d, 0x0d, 0xb9, 0xf8, 0x4c, 0x5d, 0x1f, 0x10, 0x78, - 0x0c, 0x36, 0xb2, 0x79, 0x8d, 0x79, 0x80, 0xe2, 0xa9, 0x0d, 0x07, 0xf6, 0xd5, 0xd9, 0xf4, 0x33, - 0x74, 0xd9, 0x4e, 0xa5, 0xac, 0x4f, 0x2d, 0x50, 0xee, 0x51, 0x1a, 0xd2, 0xc8, 0x89, 0xe8, 0x23, - 0x37, 0x22, 0x4e, 0x48, 0x23, 0x8f, 0x06, 0xc2, 0xed, 0xd2, 0x72, 0x51, 0x31, 0xdf, 0xcd, 0xdd, - 0x46, 0x5b, 0xe7, 0xf1, 0x3a, 0x5e, 0x84, 0x37, 0xb5, 0x09, 0x2b, 0xcb, 0x51, 0x6a, 0x80, 0x3f, - 0x59, 0xe0, 0xba, 0x77, 0x42, 0xbd, 0x9e, 0x33, 0xab, 0x6d, 0x2c, 0x20, 0xf4, 0xb1, 0xe3, 0xa9, - 0x07, 0xc9, 0xb2, 0x4a, 0xec, 0xab, 0xdc, 0x0b, 0xf5, 0x8e, 0x11, 0xad, 0xf3, 0x43, 0x20, 0x5c, - 0x53, 0xa7, 0x5a, 0xd3, 0x87, 0x0e, 0xe4, 0x99, 0x96, 0x3c, 0x22, 0x15, 0xc2, 0xe3, 0xc1, 0x43, - 0x1a, 0xc5, 0xd2, 0xd9, 0x3c, 0xee, 0x57, 0x72, 0x2b, 0x84, 0x4e, 0x2d, 0xd5, 0xd3, 0x29, 0x42, - 0xa5, 0xa7, 0x23, 0xcc, 0x3c, 0xf2, 0x7f, 0xb9, 0x04, 0x0a, 0xa9, 0x60, 0xfe, 0x6b, 0xd5, 0x6b, - 0x81, 0x52, 0x44, 0x3b, 0x34, 0xa2, 0x81, 0x47, 0x1d, 0x37, 0x8e, 0xa9, 0x30, 0x02, 0x58, 0x19, - 0xbf, 0x6d, 0x4c, 0x1d, 0x40, 0x78, 0x35, 0x45, 0x76, 0x25, 0x70, 0x76, 0xcd, 0x0b, 0xff, 0x7f, - 0xcd, 0xb0, 0x6d, 0x54, 0xb1, 0xe3, 0x73, 0x1e, 0x29, 0x55, 0x2c, 0x34, 0x5b, 0xb9, 0x23, 0x66, - 0x45, 0x52, 0x31, 0x19, 0x91, 0xdc, 0x97, 0xff, 0x61, 0x17, 0xac, 0x77, 0x7d, 0xde, 0x76, 0x7d, - 0x27, 0x23, 0xc0, 0xe7, 0xbe, 0xdf, 0x4e, 0x3d, 0x11, 0x67, 0x18, 0x10, 0x2e, 0x69, 0x6c, 0x2f, - 0x55, 0xe3, 0xf7, 0x4d, 0x31, 0x7a, 0x6e, 0x5a, 0x1e, 0x37, 0xa6, 0xd2, 0x33, 0xc3, 0x53, 0xe9, - 0xed, 0xa9, 0x01, 0xfe, 0x68, 0x81, 0xed, 0x38, 0x89, 0x42, 0x3f, 0x89, 0x9d, 0x91, 0x26, 0x8a, - 0x93, 0x88, 0xc6, 0x27, 0xdc, 0x27, 0x46, 0xf3, 0x70, 0xee, 0x96, 0xd4, 0x8c, 0xf8, 0xbc, 0x8e, - 0x18, 0xe1, 0x2d, 0x63, 0xdb, 0xd5, 0xa6, 0xe3, 0x91, 0x05, 0x7e, 0x0b, 0x2e, 0x4f, 0xbb, 0xf9, - 0x5c, 0x98, 0x37, 0xde, 0xc3, 0xdc, 0x99, 0x54, 0xce, 0xce, 0xc4, 0xe7, 0x02, 0xe1, 0xf5, 0xc9, - 0x1c, 0x0e, 0xb9, 0x80, 0xdf, 0x5b, 0x60, 0x53, 0x75, 0x6a, 0xb6, 0x17, 0x5a, 0x5a, 0x3f, 0xcf, - 0x9d, 0xc1, 0xb5, 0x4c, 0xff, 0xcf, 0x68, 0xc4, 0x15, 0x69, 0x98, 0xe9, 0x42, 0x0c, 0xd6, 0x26, - 0x1c, 0x64, 0x0b, 0xb4, 0x26, 0x1f, 0xe4, 0x4e, 0x60, 0xeb, 0x8c, 0x04, 0x54, 0xfd, 0xab, 0x99, - 0xd0, 0xb2, 0xf8, 0x16, 0x28, 0x79, 0x2c, 0xf2, 0x12, 0x26, 0x9c, 0x76, 0x44, 0xdd, 0x1e, 0x8d, - 0x94, 0x5a, 0x5f, 0xca, 0xde, 0xcc, 0x53, 0x07, 0x10, 0x5e, 0x35, 0x48, 0x53, 0x03, 0xcd, 0x0f, - 0x9e, 0xbf, 0xac, 0x5a, 0x2f, 0x5e, 0x56, 0xad, 0x3f, 0x5f, 0x56, 0xad, 0x67, 0xaf, 0xaa, 0x73, - 0x2f, 0x5e, 0x55, 0xe7, 0x7e, 0x7b, 0x55, 0x9d, 0xfb, 0xf2, 0xad, 0xd7, 0x7e, 0x03, 0x3c, 0x96, - 0x1f, 0xdb, 0x3a, 0xe7, 0xf6, 0x92, 0xfa, 0x5e, 0x7a, 0xef, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x9d, 0x2b, 0xe8, 0xbd, 0x84, 0x0f, 0x00, 0x00, -} - -func (m *Cdp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Cdp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Cdp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.InterestFactor.Size() - i -= size - if _, err := m.InterestFactor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.FeesUpdated, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.FeesUpdated):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintCdp(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x3a - { - size, err := m.AccumulatedFees.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size, err := m.Principal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintCdp(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x1a - } - { - size := m.Owner.Size() - i -= size - if _, err := m.Owner.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Id != 0 { - i = encodeVarintCdp(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Deposit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Deposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Depositor.Size() - i -= size - if _, err := m.Depositor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.CdpId != 0 { - i = encodeVarintCdp(dAtA, i, uint64(m.CdpId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AugmentedCdp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AugmentedCdp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AugmentedCdp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.CollateralizationRatio.Size() - i -= size - if _, err := m.CollateralizationRatio.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.CollateralValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Cdp.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DebtParams) > 0 { - for iNdEx := len(m.DebtParams) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DebtParams[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.CollateralParams) > 0 { - for iNdEx := len(m.CollateralParams) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CollateralParams[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *CollateralParam) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CollateralParam) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CollateralParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.ConversionFactor.Size() - i -= size - if _, err := m.ConversionFactor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6a - { - size := m.CheckCollateralizationIndexCount.Size() - i -= size - if _, err := m.CheckCollateralizationIndexCount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - { - size := m.KeeperRewardPercentage.Size() - i -= size - if _, err := m.KeeperRewardPercentage.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - if len(m.LiquidationMarketId) > 0 { - i -= len(m.LiquidationMarketId) - copy(dAtA[i:], m.LiquidationMarketId) - i = encodeVarintCdp(dAtA, i, uint64(len(m.LiquidationMarketId))) - i-- - dAtA[i] = 0x52 - } - if len(m.SpotMarketId) > 0 { - i -= len(m.SpotMarketId) - copy(dAtA[i:], m.SpotMarketId) - i = encodeVarintCdp(dAtA, i, uint64(len(m.SpotMarketId))) - i-- - dAtA[i] = 0x4a - } - if m.Prefix != 0 { - i = encodeVarintCdp(dAtA, i, uint64(m.Prefix)) - i-- - dAtA[i] = 0x40 - } - { - size := m.LiquidationPenalty.Size() - i -= size - if _, err := m.LiquidationPenalty.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - { - size := m.AuctionSize.Size() - i -= size - if _, err := m.AuctionSize.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size := m.StabilityFee.Size() - i -= size - if _, err := m.StabilityFee.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size, err := m.DebtLimit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.LiquidationRatio.Size() - i -= size - if _, err := m.LiquidationRatio.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintCdp(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x12 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintCdp(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DebtParam) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DebtParam) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DebtParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CircuitBreaker { - i-- - if m.CircuitBreaker { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - { - size := m.DebtAuctionLot.Size() - i -= size - if _, err := m.DebtAuctionLot.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - { - size := m.DebtAuctionThreshold.Size() - i -= size - if _, err := m.DebtAuctionThreshold.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - { - size := m.SurplusAuctionLot.Size() - i -= size - if _, err := m.SurplusAuctionLot.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - { - size := m.SurplusAuctionThreshold.Size() - i -= size - if _, err := m.SurplusAuctionThreshold.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - if len(m.DebtDenom) > 0 { - i -= len(m.DebtDenom) - copy(dAtA[i:], m.DebtDenom) - i = encodeVarintCdp(dAtA, i, uint64(len(m.DebtDenom))) - i-- - dAtA[i] = 0x32 - } - { - size, err := m.GlobalDebtLimit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.DebtFloor.Size() - i -= size - if _, err := m.DebtFloor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.ConversionFactor.Size() - i -= size - if _, err := m.ConversionFactor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCdp(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ReferenceAsset) > 0 { - i -= len(m.ReferenceAsset) - copy(dAtA[i:], m.ReferenceAsset) - i = encodeVarintCdp(dAtA, i, uint64(len(m.ReferenceAsset))) - i-- - dAtA[i] = 0x12 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintCdp(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintCdp(dAtA []byte, offset int, v uint64) int { - offset -= sovCdp(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Cdp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovCdp(uint64(m.Id)) - } - l = m.Owner.Size() - n += 1 + l + sovCdp(uint64(l)) - l = len(m.Type) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = m.Collateral.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.Principal.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.AccumulatedFees.Size() - n += 1 + l + sovCdp(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.FeesUpdated) - n += 1 + l + sovCdp(uint64(l)) - l = m.InterestFactor.Size() - n += 1 + l + sovCdp(uint64(l)) - return n -} - -func (m *Deposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CdpId != 0 { - n += 1 + sovCdp(uint64(m.CdpId)) - } - l = m.Depositor.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovCdp(uint64(l)) - return n -} - -func (m *AugmentedCdp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Cdp.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.CollateralValue.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.CollateralizationRatio.Size() - n += 1 + l + sovCdp(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CollateralParams) > 0 { - for _, e := range m.CollateralParams { - l = e.Size() - n += 1 + l + sovCdp(uint64(l)) - } - } - if len(m.DebtParams) > 0 { - for _, e := range m.DebtParams { - l = e.Size() - n += 1 + l + sovCdp(uint64(l)) - } - } - return n -} - -func (m *CollateralParam) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = m.LiquidationRatio.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.DebtLimit.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.StabilityFee.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.AuctionSize.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.LiquidationPenalty.Size() - n += 1 + l + sovCdp(uint64(l)) - if m.Prefix != 0 { - n += 1 + sovCdp(uint64(m.Prefix)) - } - l = len(m.SpotMarketId) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = len(m.LiquidationMarketId) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = m.KeeperRewardPercentage.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.CheckCollateralizationIndexCount.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.ConversionFactor.Size() - n += 1 + l + sovCdp(uint64(l)) - return n -} - -func (m *DebtParam) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = len(m.ReferenceAsset) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = m.ConversionFactor.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.DebtFloor.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.GlobalDebtLimit.Size() - n += 1 + l + sovCdp(uint64(l)) - l = len(m.DebtDenom) - if l > 0 { - n += 1 + l + sovCdp(uint64(l)) - } - l = m.SurplusAuctionThreshold.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.SurplusAuctionLot.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.DebtAuctionThreshold.Size() - n += 1 + l + sovCdp(uint64(l)) - l = m.DebtAuctionLot.Size() - n += 1 + l + sovCdp(uint64(l)) - if m.CircuitBreaker { - n += 2 - } - return n -} - -func sovCdp(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCdp(x uint64) (n int) { - return sovCdp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Cdp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Cdp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Cdp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Principal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccumulatedFees", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.AccumulatedFees.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeesUpdated", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.FeesUpdated, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterestFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InterestFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCdp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCdp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Deposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Deposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CdpId", wireType) - } - m.CdpId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CdpId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Depositor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCdp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCdp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AugmentedCdp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AugmentedCdp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AugmentedCdp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cdp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Cdp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CollateralValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralizationRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CollateralizationRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCdp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCdp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralParams = append(m.CollateralParams, CollateralParam{}) - if err := m.CollateralParams[len(m.CollateralParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DebtParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DebtParams = append(m.DebtParams, DebtParam{}) - if err := m.DebtParams[len(m.DebtParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCdp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCdp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CollateralParam) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CollateralParam: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CollateralParam: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LiquidationRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DebtLimit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DebtLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StabilityFee", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.StabilityFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuctionSize", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.AuctionSize.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationPenalty", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LiquidationPenalty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - m.Prefix = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Prefix |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SpotMarketId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SpotMarketId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationMarketId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LiquidationMarketId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeeperRewardPercentage", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.KeeperRewardPercentage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CheckCollateralizationIndexCount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CheckCollateralizationIndexCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConversionFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConversionFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCdp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCdp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DebtParam) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DebtParam: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DebtParam: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReferenceAsset", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ReferenceAsset = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConversionFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConversionFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DebtFloor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DebtFloor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalDebtLimit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.GlobalDebtLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DebtDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DebtDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SurplusAuctionThreshold", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SurplusAuctionThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SurplusAuctionLot", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SurplusAuctionLot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DebtAuctionThreshold", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DebtAuctionThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DebtAuctionLot", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCdp - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCdp - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DebtAuctionLot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CircuitBreaker", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCdp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CircuitBreaker = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipCdp(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCdp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCdp(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCdp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCdp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCdp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCdp - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCdp - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCdp - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCdp = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCdp = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCdp = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/cdp/types/cdp_test.go b/deprecated/x/cdp/types/cdp_test.go deleted file mode 100644 index 68cd7a3d5..000000000 --- a/deprecated/x/cdp/types/cdp_test.go +++ /dev/null @@ -1,182 +0,0 @@ -package types_test - -import ( - "math/rand" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cometbft/cometbft/crypto/secp256k1" - tmtime "github.com/cometbft/cometbft/types/time" - - ununifitypes "github.com/UnUniFi/chain/deprecated/types" - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -type CdpValidationSuite struct { - suite.Suite - - addrs []sdk.AccAddress -} - -func (suite *CdpValidationSuite) SetupTest() { - r := rand.New(rand.NewSource(12345)) - privkeySeed := make([]byte, 15) - r.Read(privkeySeed) - addr := sdk.AccAddress(secp256k1.GenPrivKeySecp256k1(privkeySeed).PubKey().Address()) - suite.addrs = []sdk.AccAddress{addr} -} - -func (suite *CdpValidationSuite) TestCdpValidation() { - type errArgs struct { - expectPass bool - contains string - } - testCases := []struct { - name string - cdp cdptypes.Cdp - errArgs errArgs - }{ - { - name: "valid cdp", - cdp: cdptypes.NewCdp(1, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("jpu", 100000), tmtime.Now(), sdk.Dec{}), - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "invalid cdp id", - cdp: cdptypes.NewCdp(0, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("jpu", 100000), tmtime.Now(), sdk.Dec{}), - errArgs: errArgs{ - expectPass: false, - contains: "cdp id cannot be 0", - }, - }, - { - name: "invalid collateral", - cdp: cdptypes.Cdp{1, ununifitypes.StringAccAddress(suite.addrs[0]), "bnb-a", sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(0)}, tmtime.Now(), sdk.Dec{}}, - errArgs: errArgs{ - expectPass: false, - contains: "collateral 100: invalid coins", - }, - }, - { - name: "invalid prinicpal", - cdp: cdptypes.Cdp{1, ununifitypes.StringAccAddress(suite.addrs[0]), "xrp-a", sdk.Coin{Denom: "xrp", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(0)}, tmtime.Now(), sdk.Dec{}}, - errArgs: errArgs{ - expectPass: false, - contains: "principal 100: invalid coins", - }, - }, - { - name: "invalid fees", - cdp: cdptypes.Cdp{1, ununifitypes.StringAccAddress(suite.addrs[0]), "xrp-a", sdk.Coin{Denom: "xrp", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "", Amount: sdk.NewInt(0)}, tmtime.Now(), sdk.Dec{}}, - errArgs: errArgs{ - expectPass: false, - contains: "accumulated fees 0: invalid coins", - }, - }, - { - name: "invalid fees updated", - cdp: cdptypes.Cdp{1, ununifitypes.StringAccAddress(suite.addrs[0]), "xrp-a", sdk.Coin{Denom: "xrp", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(0)}, time.Time{}, sdk.Dec{}}, - errArgs: errArgs{ - expectPass: false, - contains: "cdp updated fee time cannot be zero", - }, - }, - { - name: "invalid type", - cdp: cdptypes.Cdp{1, ununifitypes.StringAccAddress(suite.addrs[0]), "", sdk.Coin{Denom: "xrp", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(100)}, sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(0)}, tmtime.Now(), sdk.Dec{}}, - errArgs: errArgs{ - expectPass: false, - contains: "cdp type cannot be empty", - }, - }, - } - - for _, tc := range testCases { - suite.Run(tc.name, func() { - err := tc.cdp.Validate() - if tc.errArgs.expectPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err, tc.name) - suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) - } - }) - } -} - -func (suite *CdpValidationSuite) TestDepositValidation() { - type errArgs struct { - expectPass bool - contains string - } - testCases := []struct { - name string - deposit cdptypes.Deposit - errArgs errArgs - }{ - { - name: "valid deposit", - deposit: cdptypes.NewDeposit(1, suite.addrs[0], sdk.NewInt64Coin("bnb", 1000000)), - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "invalid cdp id", - deposit: cdptypes.NewDeposit(0, suite.addrs[0], sdk.NewInt64Coin("bnb", 1000000)), - errArgs: errArgs{ - expectPass: false, - contains: "deposit's cdp id cannot be 0", - }, - }, - { - name: "empty depositor", - deposit: cdptypes.NewDeposit(1, sdk.AccAddress{}, sdk.NewInt64Coin("bnb", 1000000)), - errArgs: errArgs{ - expectPass: false, - contains: "depositor cannot be empty", - }, - }, - { - name: "invalid deposit coins", - deposit: cdptypes.NewDeposit(1, suite.addrs[0], sdk.Coin{Denom: "Invalid Denom", Amount: sdk.NewInt(1000000)}), - errArgs: errArgs{ - expectPass: false, - contains: "deposit 1000000Invalid Denom: invalid coins", - }, - }, - } - for _, tc := range testCases { - suite.Run(tc.name, func() { - err := tc.deposit.Validate() - if tc.errArgs.expectPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err, tc.name) - suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) - } - }) - } -} - -func (suite *CdpValidationSuite) TestCdpGetTotalPrinciple() { - principal := sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(100500)} - accumulatedFees := sdk.Coin{Denom: "jpu", Amount: sdk.NewInt(25000)} - - cdp := cdptypes.Cdp{Principal: principal, AccumulatedFees: accumulatedFees} - - suite.Require().Equal(cdp.GetTotalPrincipal(), principal.Add(accumulatedFees)) -} - -func TestCdpValidationSuite(t *testing.T) { - suite.Run(t, new(CdpValidationSuite)) -} diff --git a/deprecated/x/cdp/types/codec.go b/deprecated/x/cdp/types/codec.go deleted file mode 100644 index 7ddb06504..000000000 --- a/deprecated/x/cdp/types/codec.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 - -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateCdp{}, - &MsgDeposit{}, - &MsgDrawDebt{}, - &MsgLiquidate{}, - &MsgRepayDebt{}, - &MsgWithdraw{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) diff --git a/deprecated/x/cdp/types/deposit.go b/deprecated/x/cdp/types/deposit.go deleted file mode 100644 index 91bf91189..000000000 --- a/deprecated/x/cdp/types/deposit.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - "errors" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewDeposit creates a new Deposit object -func NewDeposit(cdpID uint64, depositor sdk.AccAddress, amount sdk.Coin) Deposit { - return Deposit{cdpID, depositor.Bytes(), amount} -} - -// Validate performs a basic validation of the deposit fields. -func (d Deposit) Validate() error { - if d.CdpId == 0 { - return errors.New("deposit's cdp id cannot be 0") - } - if d.Depositor.AccAddress().Empty() { - return errors.New("depositor cannot be empty") - } - if !d.Amount.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "deposit %s", d.Amount) - } - return nil -} - -// Deposits a collection of Deposit objects -type Deposits []Deposit - -// String implements fmt.Stringer -func (ds Deposits) String() string { - if len(ds) == 0 { - return "[]" - } - out := fmt.Sprintf("Deposits for Cdp %d:", ds[0].CdpId) - for _, dep := range ds { - out += fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount) - } - return out -} - -// Validate validates each deposit -func (ds Deposits) Validate() error { - for _, d := range ds { - if err := d.Validate(); err != nil { - return err - } - } - return nil -} - -// Equals returns whether two deposits are equal. -func (d Deposit) Equals(comp Deposit) bool { - return d.Depositor.AccAddress().Equals(comp.Depositor.AccAddress()) && d.CdpId == comp.CdpId && d.Amount.IsEqual(comp.Amount) -} - -// Empty returns whether a deposit is empty. -func (d Deposit) Empty() bool { - return d.Equals(Deposit{}) -} - -// SumCollateral returns the total amount of collateral in the input deposits -func (ds Deposits) SumCollateral() (sum sdk.Int) { - sum = sdk.ZeroInt() - for _, d := range ds { - if !d.Amount.IsZero() { - sum = sum.Add(d.Amount.Amount) - } - } - return -} diff --git a/deprecated/x/cdp/types/errors.go b/deprecated/x/cdp/types/errors.go deleted file mode 100644 index 84d8d6483..000000000 --- a/deprecated/x/cdp/types/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/cdp module sentinel errors - -var ( - // ErrCdpAlreadyExists error for duplicate cdps - ErrCdpAlreadyExists = sdkerrors.Register(ModuleName, 2, "cdp already exists") - // ErrInvalidCollateralLength error for invalid collateral input length - ErrInvalidCollateralLength = sdkerrors.Register(ModuleName, 3, "only one collateral type per cdp") - // ErrCollateralNotSupported error for unsupported collateral - ErrCollateralNotSupported = sdkerrors.Register(ModuleName, 4, "collateral not supported") - // ErrDebtNotSupported error for unsupported debt - ErrDebtNotSupported = sdkerrors.Register(ModuleName, 5, "debt not supported") - // ErrExceedsDebtLimit error for attempted draws that exceed debt limit - ErrExceedsDebtLimit = sdkerrors.Register(ModuleName, 6, "proposed debt increase would exceed debt limit") - // ErrInvalidCollateralRatio error for attempted draws that are below liquidation ratio - ErrInvalidCollateralRatio = sdkerrors.Register(ModuleName, 7, "proposed collateral ratio is below liquidation ratio") - // ErrCdpNotFound error cdp not found - ErrCdpNotFound = sdkerrors.Register(ModuleName, 8, "cdp not found") - // ErrDepositNotFound error for deposit not found - ErrDepositNotFound = sdkerrors.Register(ModuleName, 9, "deposit not found") - // ErrInvalidDeposit error for invalid deposit - ErrInvalidDeposit = sdkerrors.Register(ModuleName, 10, "invalid deposit") - // ErrInvalidPayment error for invalid payment - ErrInvalidPayment = sdkerrors.Register(ModuleName, 11, "invalid payment") - //ErrDepositNotAvailable error for withdrawing deposits in liquidation - ErrDepositNotAvailable = sdkerrors.Register(ModuleName, 12, "deposit in liquidation") - // ErrInvalidWithdrawAmount error for invalid withdrawal amount - ErrInvalidWithdrawAmount = sdkerrors.Register(ModuleName, 13, "withdrawal amount exceeds deposit") - //ErrCdpNotAvailable error for depositing to a Cdp in liquidation - ErrCdpNotAvailable = sdkerrors.Register(ModuleName, 14, "cannot modify cdp in liquidation") - // ErrBelowDebtFloor error for creating a cdp with debt below the minimum - ErrBelowDebtFloor = sdkerrors.Register(ModuleName, 15, "proposed cdp debt is below minimum") - // ErrLoadingAugmentedCdp error loading augmented cdp - ErrLoadingAugmentedCdp = sdkerrors.Register(ModuleName, 16, "augmented cdp could not be loaded from cdp") - // ErrInvalidDebtRequest error for invalid principal input length - ErrInvalidDebtRequest = sdkerrors.Register(ModuleName, 17, "only one principal type per cdp") - // ErrDenomPrefixNotFound error for denom prefix not found - ErrDenomPrefixNotFound = sdkerrors.Register(ModuleName, 18, "denom prefix not found") - // ErrPricefeedDown error for when a price for the input denom is not found - ErrPricefeedDown = sdkerrors.Register(ModuleName, 19, "no price found for collateral") - // ErrInvalidCollateral error for when the input collateral denom does not match the expected collateral denom - ErrInvalidCollateral = sdkerrors.Register(ModuleName, 20, "invalid collateral for input collateral type") - // ErrAccountNotFound error for when no account is found for an input address - ErrAccountNotFound = sdkerrors.Register(ModuleName, 21, "account not found") - // ErrInsufficientBalance error for when an account does not have enough funds - ErrInsufficientBalance = sdkerrors.Register(ModuleName, 22, "insufficient balance") - // ErrNotLiquidatable error for when an cdp is not liquidatable - ErrNotLiquidatable = sdkerrors.Register(ModuleName, 23, "cdp collateral ratio not below liquidation ratio") -) diff --git a/deprecated/x/cdp/types/events.go b/deprecated/x/cdp/types/events.go deleted file mode 100644 index 793fe55a7..000000000 --- a/deprecated/x/cdp/types/events.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -// Event types for cdp module -const ( - EventTypeCreateCdp = "create_cdp" - EventTypeCdpDeposit = "cdp_deposit" - EventTypeCdpDraw = "cdp_draw" - EventTypeCdpRepay = "cdp_repayment" - EventTypeCdpClose = "cdp_close" - EventTypeCdpWithdrawal = "cdp_withdrawal" - EventTypeCdpLiquidation = "cdp_liquidation" - EventTypeBeginBlockerFatal = "cdp_begin_block_error" - - AttributeKeyCdpID = "cdp_id" - AttributeKeyDeposit = "deposit" - AttributeValueCategory = "cdp" - AttributeKeyError = "error_message" -) diff --git a/deprecated/x/cdp/types/expected_keepers.go b/deprecated/x/cdp/types/expected_keepers.go deleted file mode 100644 index a9e8a73bc..000000000 --- a/deprecated/x/cdp/types/expected_keepers.go +++ /dev/null @@ -1,112 +0,0 @@ -package types - -import ( - "time" - - pftypes "github.com/UnUniFi/chain/x/pricefeed/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -// AccountKeeper expected interface for the account keeper (noalias) -type AccountKeeper interface { - // Return a new account with the next account number and the specified address. Does not save the new account to the store. - NewAccountWithAddress(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Return a new account with the next account number. Does not save the new account to the store. - NewAccount(sdk.Context, authtypes.AccountI) authtypes.AccountI - - // Retrieve an account from the store. - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Set an account in the store. - SetAccount(sdk.Context, authtypes.AccountI) - - // Remove an account from the store. - RemoveAccount(sdk.Context, authtypes.AccountI) - - // Iterate over all accounts, calling the provided function. Stop iteraiton when it returns false. - IterateAccounts(sdk.Context, func(authtypes.AccountI) bool) - - // Fetch the public key of an account at a specified address - GetPubKey(sdk.Context, sdk.AccAddress) (cryptotypes.PubKey, error) - - // Fetch the sequence of an account at a specified address. - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) - - GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI -} - -type BankKeeper interface { - // View - ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error - HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool - - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetAccountsBalances(ctx sdk.Context) []banktypes.Balance - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(coin sdk.Coin) (stop bool)) - IterateAllBalances(ctx sdk.Context, cb func(address sdk.AccAddress, coin sdk.Coin) (stop bool)) - - // Send - InputOutputCoins(ctx sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - - GetParams(ctx sdk.Context) banktypes.Params - SetParams(ctx sdk.Context, params banktypes.Params) error - - BlockedAddr(addr sdk.AccAddress) bool - - // - InitGenesis(sdk.Context, *banktypes.GenesisState) - ExportGenesis(sdk.Context) *banktypes.GenesisState - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error) - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) - IterateAllDenomMetaData(ctx sdk.Context, cb func(banktypes.Metadata) bool) - - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - - DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error - UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error -} - -// AuctionKeeper expected interface for the auction keeper (noalias) -type AuctionKeeper interface { - StartSurplusAuction(ctx sdk.Context, seller string, lot sdk.Coin, bidDenom string) (uint64, error) - StartDebtAuction(ctx sdk.Context, buyer string, bid sdk.Coin, initialLot sdk.Coin, debt sdk.Coin) (uint64, error) - StartCollateralAuction(ctx sdk.Context, seller string, lot sdk.Coin, maxBid sdk.Coin, lotReturnAddrs []sdk.AccAddress, lotReturnWeights []sdk.Int, debt sdk.Coin) (uint64, error) -} - -// PricefeedKeeper defines the expected interface for the pricefeed (noalias) -type PricefeedKeeper interface { - GetCurrentPrice(sdk.Context, string) (pftypes.CurrentPrice, error) - GetParams(sdk.Context) pftypes.Params - // These are used for testing TODO replace mockApp with keeper in tests to remove these - SetParams(sdk.Context, pftypes.Params) - SetPrice(sdk.Context, sdk.AccAddress, string, sdk.Dec, time.Time) (pftypes.PostedPrice, error) - SetCurrentPrices(sdk.Context, string) error -} - -// CdpHooks event hooks for other keepers to run code in response to Cdp modifications -type CdpHooks interface { - AfterCdpCreated(ctx sdk.Context, cdp Cdp) - BeforeCdpModified(ctx sdk.Context, cdp Cdp) -} diff --git a/deprecated/x/cdp/types/genesis.go b/deprecated/x/cdp/types/genesis.go deleted file mode 100644 index 7e5270f95..000000000 --- a/deprecated/x/cdp/types/genesis.go +++ /dev/null @@ -1,167 +0,0 @@ -package types - -import ( - "bytes" - fmt "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - DefaultParams(), - Cdps{}, - Deposits{}, - DefaultCdpStartingID, - DefaultGovDenom, - GenesisAccumulationTimes{}, - GenesisTotalPrincipals{}, - // this line is used by starport scaffolding # genesis/types/default - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - // Check for duplicated ID in cdp - // cdpIdMap := make(map[string]bool) - - // for _, elem := range gs.CdpList { - // if _, ok := cdpIdMap[elem.Id]; ok { - // return fmt.Errorf("duplicated id for cdp") - // } - // cdpIdMap[elem.Id] = true - // } - - // return nil - - if err := gs.Params.Validate(); err != nil { - return err - } - - if err := Cdps(gs.Cdps).Validate(); err != nil { - return err - } - - if err := Deposits(gs.Deposits).Validate(); err != nil { - return err - } - - if err := GenesisAccumulationTimes(gs.PreviousAccumulationTimes).Validate(); err != nil { - return err - } - - if err := GenesisTotalPrincipals(gs.TotalPrincipals).Validate(); err != nil { - return err - } - - if err := sdk.ValidateDenom(gs.GovDenom); err != nil { - return fmt.Errorf(fmt.Sprintf("gov denom invalid: %v", err)) - } - - return nil -} - -func NewGenesisState(params Params, cdps Cdps, deposits Deposits, startingCdpID uint64, - govDenom string, prevAccumTimes GenesisAccumulationTimes, - totalPrincipals GenesisTotalPrincipals) GenesisState { - return GenesisState{ - Params: params, - Cdps: cdps, - Deposits: deposits, - StartingCdpId: startingCdpID, - GovDenom: govDenom, - PreviousAccumulationTimes: prevAccumTimes, - TotalPrincipals: totalPrincipals, - } -} - -func validateSavingsRateDistributed(i interface{}) error { - savingsRateDist, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if savingsRateDist.IsNegative() { - return fmt.Errorf("savings rate distributed should not be negative: %s", savingsRateDist) - } - - return nil -} - -// Equal checks whether two gov GenesisState structs are equivalent -func (gs GenesisState) Equal(gs2 GenesisState) bool { - b1 := ModuleCdc.MustMarshal(&gs) - b2 := ModuleCdc.MustMarshal(&gs2) - return bytes.Equal(b1, b2) -} - -// IsEmpty returns true if a GenesisState is empty -func (gs GenesisState) IsEmpty() bool { - return gs.Equal(GenesisState{}) -} - -// NewGenesisTotalPrincipal returns a new GenesisTotalPrincipal -func NewGenesisTotalPrincipal(ctype string, principal sdk.Int) GenesisTotalPrincipal { - return GenesisTotalPrincipal{ - CollateralType: ctype, - TotalPrincipal: principal, - } -} - -// GenesisTotalPrincipals slice of GenesisTotalPrincipal -type GenesisTotalPrincipals []GenesisTotalPrincipal - -// Validate performs validation of GenesisTotalPrincipal -func (gtp GenesisTotalPrincipal) Validate() error { - if gtp.TotalPrincipal.IsNegative() { - return fmt.Errorf("total principal should be positive, is %s for %s", gtp.TotalPrincipal, gtp.CollateralType) - } - return nil -} - -// Validate performs validation of GenesisTotalPrincipals -func (gtps GenesisTotalPrincipals) Validate() error { - for _, gtp := range gtps { - if err := gtp.Validate(); err != nil { - return err - } - } - return nil -} - -// NewGenesisAccumulationTime returns a new GenesisAccumulationTime -func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdk.Dec) GenesisAccumulationTime { - return GenesisAccumulationTime{ - CollateralType: ctype, - PreviousAccumulationTime: prevTime, - InterestFactor: factor, - } -} - -// GenesisAccumulationTimes slice of GenesisAccumulationTime -type GenesisAccumulationTimes []GenesisAccumulationTime - -// Validate performs validation of GenesisAccumulationTimes -func (gats GenesisAccumulationTimes) Validate() error { - for _, gat := range gats { - if err := gat.Validate(); err != nil { - return err - } - } - return nil -} - -// Validate performs validation of GenesisAccumulationTime -func (gat GenesisAccumulationTime) Validate() error { - if gat.InterestFactor.LT(sdk.OneDec()) { - return fmt.Errorf("interest factor should be ≥ 1.0, is %s for %s", gat.InterestFactor, gat.CollateralType) - } - return nil -} diff --git a/deprecated/x/cdp/types/genesis.pb.go b/deprecated/x/cdp/types/genesis.pb.go deleted file mode 100644 index 23bdf5350..000000000 --- a/deprecated/x/cdp/types/genesis.pb.go +++ /dev/null @@ -1,1174 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cdp/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the cdp module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - Cdps []Cdp `protobuf:"bytes,2,rep,name=cdps,proto3" json:"cdps" yaml:"cdps"` - Deposits []Deposit `protobuf:"bytes,3,rep,name=deposits,proto3" json:"deposits" yaml:"deposits"` - StartingCdpId uint64 `protobuf:"varint,4,opt,name=starting_cdp_id,json=startingCdpId,proto3" json:"starting_cdp_id,omitempty" yaml:"starting_cdp_id"` - GovDenom string `protobuf:"bytes,5,opt,name=gov_denom,json=govDenom,proto3" json:"gov_denom,omitempty" yaml:"gov_denom"` - PreviousAccumulationTimes []GenesisAccumulationTime `protobuf:"bytes,6,rep,name=previous_accumulation_times,json=previousAccumulationTimes,proto3" json:"previous_accumulation_times" yaml:"previous_accumulation_times"` - TotalPrincipals []GenesisTotalPrincipal `protobuf:"bytes,7,rep,name=total_principals,json=totalPrincipals,proto3" json:"total_principals" yaml:"total_principals"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_6792b73c0d9625b5, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetCdps() []Cdp { - if m != nil { - return m.Cdps - } - return nil -} - -func (m *GenesisState) GetDeposits() []Deposit { - if m != nil { - return m.Deposits - } - return nil -} - -func (m *GenesisState) GetStartingCdpId() uint64 { - if m != nil { - return m.StartingCdpId - } - return 0 -} - -func (m *GenesisState) GetGovDenom() string { - if m != nil { - return m.GovDenom - } - return "" -} - -func (m *GenesisState) GetPreviousAccumulationTimes() []GenesisAccumulationTime { - if m != nil { - return m.PreviousAccumulationTimes - } - return nil -} - -func (m *GenesisState) GetTotalPrincipals() []GenesisTotalPrincipal { - if m != nil { - return m.TotalPrincipals - } - return nil -} - -type GenesisAccumulationTime struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time" yaml:"previous_accumulation_time"` - InterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=interest_factor,json=interestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_factor" yaml:"interest_factor"` -} - -func (m *GenesisAccumulationTime) Reset() { *m = GenesisAccumulationTime{} } -func (m *GenesisAccumulationTime) String() string { return proto.CompactTextString(m) } -func (*GenesisAccumulationTime) ProtoMessage() {} -func (*GenesisAccumulationTime) Descriptor() ([]byte, []int) { - return fileDescriptor_6792b73c0d9625b5, []int{1} -} -func (m *GenesisAccumulationTime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisAccumulationTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisAccumulationTime.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisAccumulationTime) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisAccumulationTime.Merge(m, src) -} -func (m *GenesisAccumulationTime) XXX_Size() int { - return m.Size() -} -func (m *GenesisAccumulationTime) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisAccumulationTime.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisAccumulationTime proto.InternalMessageInfo - -func (m *GenesisAccumulationTime) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -func (m *GenesisAccumulationTime) GetPreviousAccumulationTime() time.Time { - if m != nil { - return m.PreviousAccumulationTime - } - return time.Time{} -} - -type GenesisTotalPrincipal struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - TotalPrincipal github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_principal,json=totalPrincipal,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_principal" yaml:"total_principal"` -} - -func (m *GenesisTotalPrincipal) Reset() { *m = GenesisTotalPrincipal{} } -func (m *GenesisTotalPrincipal) String() string { return proto.CompactTextString(m) } -func (*GenesisTotalPrincipal) ProtoMessage() {} -func (*GenesisTotalPrincipal) Descriptor() ([]byte, []int) { - return fileDescriptor_6792b73c0d9625b5, []int{2} -} -func (m *GenesisTotalPrincipal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisTotalPrincipal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisTotalPrincipal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisTotalPrincipal) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisTotalPrincipal.Merge(m, src) -} -func (m *GenesisTotalPrincipal) XXX_Size() int { - return m.Size() -} -func (m *GenesisTotalPrincipal) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisTotalPrincipal.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisTotalPrincipal proto.InternalMessageInfo - -func (m *GenesisTotalPrincipal) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.cdp.GenesisState") - proto.RegisterType((*GenesisAccumulationTime)(nil), "ununifi.cdp.GenesisAccumulationTime") - proto.RegisterType((*GenesisTotalPrincipal)(nil), "ununifi.cdp.GenesisTotalPrincipal") -} - -func init() { proto.RegisterFile("cdp/genesis.proto", fileDescriptor_6792b73c0d9625b5) } - -var fileDescriptor_6792b73c0d9625b5 = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x4e, 0xdb, 0x4c, - 0x14, 0x8d, 0x21, 0x1f, 0x1f, 0x4c, 0x0a, 0xa1, 0x06, 0x8a, 0x9b, 0x4a, 0x76, 0x3a, 0x42, 0x55, - 0x54, 0x09, 0x5b, 0xd0, 0x55, 0xbb, 0xa8, 0x54, 0x83, 0x68, 0xd9, 0x21, 0x37, 0x6c, 0xba, 0xb1, - 0x26, 0xe3, 0xc1, 0x8c, 0x6a, 0xcf, 0x0c, 0x9e, 0x71, 0x54, 0x9e, 0xa0, 0x5b, 0x1e, 0x8b, 0x5d, - 0x51, 0x57, 0x55, 0x2b, 0xa5, 0x15, 0xbc, 0x01, 0x4f, 0x50, 0xf9, 0x8f, 0x24, 0x16, 0x51, 0x55, - 0xa9, 0xab, 0x4c, 0xee, 0x3d, 0xe7, 0xdc, 0x7b, 0xee, 0x9d, 0x31, 0x78, 0x88, 0x03, 0xe1, 0x84, - 0x84, 0x11, 0x49, 0xa5, 0x2d, 0x12, 0xae, 0xb8, 0xde, 0x4a, 0x59, 0xca, 0xe8, 0x09, 0xb5, 0x71, - 0x20, 0x3a, 0xeb, 0x21, 0x0f, 0x79, 0x1e, 0x77, 0xb2, 0x53, 0x01, 0xe9, 0x58, 0x21, 0xe7, 0x61, - 0x44, 0x9c, 0xfc, 0xdf, 0x20, 0x3d, 0x71, 0x14, 0x8d, 0x89, 0x54, 0x28, 0x16, 0x25, 0xc0, 0xc4, - 0x5c, 0xc6, 0x5c, 0x3a, 0x03, 0x24, 0x89, 0x33, 0xdc, 0x19, 0x10, 0x85, 0x76, 0x1c, 0xcc, 0x29, - 0x2b, 0xf3, 0xcb, 0x59, 0x59, 0x1c, 0x94, 0x70, 0xf8, 0xb5, 0x09, 0x1e, 0xbc, 0x2d, 0x9a, 0x78, - 0xaf, 0x90, 0x22, 0xba, 0x0b, 0x16, 0x04, 0x4a, 0x50, 0x2c, 0x0d, 0xad, 0xab, 0xf5, 0x5a, 0xbb, - 0x6b, 0xf6, 0x44, 0x53, 0xf6, 0x51, 0x9e, 0x72, 0x37, 0x2e, 0x47, 0x56, 0xe3, 0x76, 0x64, 0x2d, - 0x9f, 0xa3, 0x38, 0x7a, 0x05, 0x0b, 0x02, 0xf4, 0x4a, 0xa6, 0xfe, 0x12, 0x34, 0x71, 0x20, 0xa4, - 0x31, 0xd7, 0x9d, 0xef, 0xb5, 0x76, 0x57, 0xa7, 0x14, 0xf6, 0x02, 0xe1, 0xae, 0x95, 0xf4, 0x56, - 0x41, 0xcf, 0xb0, 0xd0, 0xcb, 0x29, 0xfa, 0x21, 0x58, 0x0c, 0x88, 0xe0, 0x92, 0x2a, 0x69, 0xcc, - 0xe7, 0xf4, 0xf5, 0x29, 0xfa, 0x7e, 0x91, 0x74, 0x37, 0x4b, 0x89, 0x76, 0x21, 0x51, 0x71, 0xa0, - 0x77, 0x47, 0xd7, 0x5d, 0xd0, 0x96, 0x0a, 0x25, 0x8a, 0xb2, 0xd0, 0xc7, 0x81, 0xf0, 0x69, 0x60, - 0x34, 0xbb, 0x5a, 0xaf, 0xe9, 0x76, 0x6e, 0x47, 0xd6, 0xa3, 0x82, 0x57, 0x03, 0x40, 0x6f, 0xb9, - 0x8a, 0xec, 0x05, 0xe2, 0x30, 0xd0, 0x77, 0xc0, 0x52, 0xc8, 0x87, 0x7e, 0x40, 0x18, 0x8f, 0x8d, - 0xff, 0xba, 0x5a, 0x6f, 0xc9, 0x5d, 0xbf, 0x1d, 0x59, 0xab, 0x05, 0xfb, 0x2e, 0x05, 0xbd, 0xc5, - 0x90, 0x0f, 0xf7, 0xb3, 0xa3, 0x7e, 0xa1, 0x81, 0x27, 0x22, 0x21, 0x43, 0xca, 0x53, 0xe9, 0x23, - 0x8c, 0xd3, 0x38, 0x8d, 0x90, 0xa2, 0x9c, 0xf9, 0xf9, 0xaa, 0x8c, 0x85, 0xdc, 0xd5, 0xd6, 0x94, - 0xab, 0x72, 0x03, 0x6f, 0x26, 0xd0, 0x7d, 0x1a, 0x13, 0xf7, 0x79, 0xe9, 0x12, 0x96, 0x73, 0x9e, - 0x2d, 0x0b, 0xbd, 0xc7, 0x55, 0xb6, 0xae, 0x22, 0x75, 0x06, 0x56, 0x15, 0x57, 0x28, 0xf2, 0x45, - 0x42, 0x19, 0xa6, 0x02, 0x45, 0xd2, 0xf8, 0x3f, 0x6f, 0x03, 0xde, 0xd7, 0x46, 0x3f, 0xc3, 0x1e, - 0x55, 0x50, 0xd7, 0x2a, 0x9b, 0xd8, 0x2c, 0x9a, 0xa8, 0x2b, 0x41, 0xaf, 0xad, 0xa6, 0x08, 0x12, - 0xfe, 0x98, 0x03, 0x9b, 0x33, 0x2c, 0xe9, 0x7b, 0xa0, 0x8d, 0x79, 0x14, 0x21, 0x45, 0x12, 0x14, - 0xf9, 0xea, 0x5c, 0x90, 0xfc, 0xa2, 0x2d, 0x4d, 0x6e, 0xa5, 0x06, 0x80, 0xde, 0xca, 0x38, 0xd2, - 0x3f, 0x17, 0x44, 0xff, 0xac, 0x81, 0xce, 0xec, 0x61, 0x18, 0x73, 0xf9, 0xcd, 0xed, 0xd8, 0xc5, - 0x5b, 0xb1, 0xab, 0xb7, 0x62, 0xf7, 0xab, 0xb7, 0xe2, 0x6e, 0x97, 0x9e, 0x9e, 0xfe, 0x69, 0xb0, - 0xf0, 0xe2, 0xa7, 0xa5, 0x79, 0xc6, 0xac, 0xd9, 0xea, 0x67, 0xa0, 0x4d, 0x99, 0x22, 0x09, 0x91, - 0xca, 0x3f, 0x41, 0x58, 0xf1, 0xc4, 0x98, 0xcf, 0xed, 0xbc, 0xcb, 0x2a, 0x7c, 0x1f, 0x59, 0xcf, - 0x42, 0xaa, 0x4e, 0xd3, 0x81, 0x8d, 0x79, 0xec, 0x94, 0x4f, 0xb3, 0xf8, 0xd9, 0x96, 0xc1, 0x47, - 0x27, 0xb3, 0x27, 0xed, 0x7d, 0x82, 0xc7, 0xe6, 0x6b, 0x72, 0xd0, 0x5b, 0xa9, 0x22, 0x07, 0x45, - 0xe0, 0x8b, 0x06, 0x36, 0xee, 0xdd, 0xd4, 0xbf, 0x99, 0xed, 0x19, 0x68, 0xd7, 0x56, 0x9c, 0xcf, - 0xf3, 0xef, 0x1c, 0x1d, 0x32, 0x35, 0x2e, 0x59, 0x93, 0x83, 0xde, 0xca, 0xf4, 0x85, 0x71, 0x5f, - 0x5f, 0x5e, 0x9b, 0xda, 0xd5, 0xb5, 0xa9, 0xfd, 0xba, 0x36, 0xb5, 0x8b, 0x1b, 0xb3, 0x71, 0x75, - 0x63, 0x36, 0xbe, 0xdd, 0x98, 0x8d, 0x0f, 0x5b, 0x13, 0xb5, 0x8e, 0xd9, 0x31, 0xa3, 0x07, 0xd4, - 0xc1, 0xa7, 0x88, 0x32, 0xe7, 0x53, 0xf6, 0x11, 0x2b, 0xaa, 0x0d, 0x16, 0xf2, 0x0d, 0xbf, 0xf8, - 0x1d, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x31, 0x92, 0xae, 0x53, 0x05, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TotalPrincipals) > 0 { - for iNdEx := len(m.TotalPrincipals) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TotalPrincipals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.PreviousAccumulationTimes) > 0 { - for iNdEx := len(m.PreviousAccumulationTimes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PreviousAccumulationTimes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.GovDenom) > 0 { - i -= len(m.GovDenom) - copy(dAtA[i:], m.GovDenom) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.GovDenom))) - i-- - dAtA[i] = 0x2a - } - if m.StartingCdpId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.StartingCdpId)) - i-- - dAtA[i] = 0x20 - } - if len(m.Deposits) > 0 { - for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Cdps) > 0 { - for iNdEx := len(m.Cdps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Cdps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GenesisAccumulationTime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisAccumulationTime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisAccumulationTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.InterestFactor.Size() - i -= size - if _, err := m.InterestFactor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.PreviousAccumulationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousAccumulationTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGenesis(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GenesisTotalPrincipal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisTotalPrincipal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisTotalPrincipal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.TotalPrincipal.Size() - i -= size - if _, err := m.TotalPrincipal.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.Cdps) > 0 { - for _, e := range m.Cdps { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.StartingCdpId != 0 { - n += 1 + sovGenesis(uint64(m.StartingCdpId)) - } - l = len(m.GovDenom) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.PreviousAccumulationTimes) > 0 { - for _, e := range m.PreviousAccumulationTimes { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.TotalPrincipals) > 0 { - for _, e := range m.TotalPrincipals { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *GenesisAccumulationTime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousAccumulationTime) - n += 1 + l + sovGenesis(uint64(l)) - l = m.InterestFactor.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *GenesisTotalPrincipal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = m.TotalPrincipal.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cdps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cdps = append(m.Cdps, Cdp{}) - if err := m.Cdps[len(m.Cdps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Deposits = append(m.Deposits, Deposit{}) - if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartingCdpId", wireType) - } - m.StartingCdpId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartingCdpId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GovDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GovDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreviousAccumulationTimes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PreviousAccumulationTimes = append(m.PreviousAccumulationTimes, GenesisAccumulationTime{}) - if err := m.PreviousAccumulationTimes[len(m.PreviousAccumulationTimes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPrincipals", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TotalPrincipals = append(m.TotalPrincipals, GenesisTotalPrincipal{}) - if err := m.TotalPrincipals[len(m.TotalPrincipals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisAccumulationTime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisAccumulationTime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisAccumulationTime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreviousAccumulationTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.PreviousAccumulationTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterestFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InterestFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisTotalPrincipal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisTotalPrincipal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisTotalPrincipal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPrincipal", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TotalPrincipal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/cdp/types/genesis_test.go b/deprecated/x/cdp/types/genesis_test.go deleted file mode 100644 index ee9046909..000000000 --- a/deprecated/x/cdp/types/genesis_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestEqualProposalID(t *testing.T) { - state1 := GenesisState{} - state2 := GenesisState{} - require.Equal(t, state1, state2) - - // Proposals - state1.StartingCdpId = 1 - require.NotEqual(t, state1, state2) - require.False(t, state1.Equal(state2)) - - state2.StartingCdpId = 1 - require.Equal(t, state1, state2) - require.True(t, state1.Equal(state2)) -} diff --git a/deprecated/x/cdp/types/hooks.go b/deprecated/x/cdp/types/hooks.go deleted file mode 100644 index 291396f1c..000000000 --- a/deprecated/x/cdp/types/hooks.go +++ /dev/null @@ -1,25 +0,0 @@ -package types - -import sdk "github.com/cosmos/cosmos-sdk/types" - -// MultiCdpHooks combine multiple cdp hooks, all hook functions are run in array sequence -type MultiCdpHooks []CdpHooks - -// NewMultiCdpHooks returns a new MultiCdpHooks -func NewMultiCdpHooks(hooks ...CdpHooks) MultiCdpHooks { - return hooks -} - -// BeforeCdpModified runs before a cdp is modified -func (h MultiCdpHooks) BeforeCdpModified(ctx sdk.Context, cdp Cdp) { - for i := range h { - h[i].BeforeCdpModified(ctx, cdp) - } -} - -// AfterCdpCreated runs before a cdp is created -func (h MultiCdpHooks) AfterCdpCreated(ctx sdk.Context, cdp Cdp) { - for i := range h { - h[i].AfterCdpCreated(ctx, cdp) - } -} diff --git a/deprecated/x/cdp/types/keys.go b/deprecated/x/cdp/types/keys.go deleted file mode 100644 index 9c3ca9b8e..000000000 --- a/deprecated/x/cdp/types/keys.go +++ /dev/null @@ -1,164 +0,0 @@ -package types - -import ( - "bytes" - "encoding/binary" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName defines the module name - ModuleName = "cdp" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_capability" - - // LiquidatorMacc module account for liquidator - LiquidatorMacc = "liquidator" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} - -const ( - ParamsKey = "Params-value-" - CdpKey = "Cdp-value-" - // CdpCountKey = "Cdp-count-" - CdpIDKey = "CdpID-value-" - CdpIDOwnerIndex = "CdpID-Owner-index-" - CdpIDCollateralRatioIndex = "CdpID-CollateralRatio-index-" - NextCdpID = "NextCdpID" - DebtDenom = "DebtDenom" - GovDenom = "GovDenom" - DepositKey = "Deposit-value-" - PrincipalKey = "Principal-value-" - PricefeedStatusKey = "PricefeedStatus-value-" - PreviousAccrualTime = "PreviousAccrualTime-" - InterestFactor = "InterestFactor-" -) - -var sep = []byte(":") - -// GetCdpIDBytes returns the byte representation of the cdpID -func GetCdpIDBytes(cdpID uint64) (cdpIDBz []byte) { - cdpIDBz = make([]byte, 8) - binary.BigEndian.PutUint64(cdpIDBz, cdpID) - return -} - -// GetCdpIDFromBytes returns cdpID in uint64 format from a byte array -func GetCdpIDFromBytes(bz []byte) (cdpID uint64) { - return binary.BigEndian.Uint64(bz) -} - -// CdpKeySuffix key of a specific cdp in the store -func CdpKeySuffix(denomByte byte, cdpID uint64) []byte { - return createKey([]byte{denomByte}, sep, GetCdpIDBytes(cdpID)) -} - -// SplitCdpKey returns the component parts of a cdp key -func SplitCdpKey(key []byte) (byte, uint64) { - split := bytes.Split(key, sep) - return split[0][0], GetCdpIDFromBytes(split[1]) -} - -// DenomIterKey returns the key for iterating over cdps of a certain denom in the store -func DenomIterKey(denomByte byte) []byte { - return append([]byte{denomByte}, sep...) -} - -// SplitDenomIterKey returns the component part of a key for iterating over cdps by denom -func SplitDenomIterKey(key []byte) byte { - split := bytes.Split(key, sep) - return split[0][0] -} - -// DepositKeySuffix key of a specific deposit in the store -func DepositKeySuffix(cdpID uint64, depositor sdk.AccAddress) []byte { - return createKey(GetCdpIDBytes(cdpID), sep, depositor) -} - -// SplitDepositKey returns the component parts of a deposit key -func SplitDepositKey(key []byte) (uint64, sdk.AccAddress) { - cdpID := GetCdpIDFromBytes(key[0:8]) - addr := key[9:] - return cdpID, addr -} - -// DepositIterKey returns the prefix key for iterating over deposits to a cdp -func DepositIterKey(cdpID uint64) []byte { - return GetCdpIDBytes(cdpID) -} - -// SplitDepositIterKey returns the component parts of a key for iterating over deposits on a cdp -func SplitDepositIterKey(key []byte) (cdpID uint64) { - return GetCdpIDFromBytes(key) -} - -// CollateralRatioBytes returns the liquidation ratio as sortable bytes -func CollateralRatioBytes(ratio sdk.Dec) []byte { - ok := ValidSortableDec(ratio) - if !ok { - // set to max sortable if input is too large. - ratio = sdk.OneDec().Quo(sdk.SmallestDec()) - } - return SortableDecBytes(ratio) -} - -// CollateralRatioKey returns the key for querying a cdp by its liquidation ratio -func CollateralRatioKey(denomByte byte, cdpID uint64, ratio sdk.Dec) []byte { - ratioBytes := CollateralRatioBytes(ratio) - idBytes := GetCdpIDBytes(cdpID) - - return createKey([]byte{denomByte}, sep, ratioBytes, sep, idBytes) -} - -// SplitCollateralRatioKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio -func SplitCollateralRatioKey(key []byte) (denom byte, cdpID uint64, ratio sdk.Dec) { - - cdpID = GetCdpIDFromBytes(key[len(key)-8:]) - split := bytes.Split(key[:len(key)-8], sep) - denom = split[0][0] - - ratio, err := ParseDecBytes(split[1]) - if err != nil { - panic(err) - } - return -} - -// CollateralRatioIterKey returns the key for iterating over cdps by denom and liquidation ratio -func CollateralRatioIterKey(denomByte byte, ratio sdk.Dec) []byte { - ratioBytes := CollateralRatioBytes(ratio) - return createKey([]byte{denomByte}, sep, ratioBytes) -} - -// SplitCollateralRatioIterKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio -func SplitCollateralRatioIterKey(key []byte) (denom byte, ratio sdk.Dec) { - split := bytes.Split(key, sep) - denom = split[0][0] - - ratio, err := ParseDecBytes(split[1]) - if err != nil { - panic(err) - } - return -} - -func createKey(bytes ...[]byte) (r []byte) { - for _, b := range bytes { - r = append(r, b...) - } - return -} diff --git a/deprecated/x/cdp/types/keys_test.go b/deprecated/x/cdp/types/keys_test.go deleted file mode 100644 index b67d84163..000000000 --- a/deprecated/x/cdp/types/keys_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cometbft/cometbft/crypto/ed25519" -) - -var addr = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - -func TestKeys(t *testing.T) { - key := CdpKeySuffix(0x01, 2) - db, id := SplitCdpKey(key) - require.Equal(t, int(id), 2) - require.Equal(t, byte(0x01), db) - - denomKey := DenomIterKey(0x01) - db = SplitDenomIterKey(denomKey) - require.Equal(t, byte(0x01), db) - - depositKey := DepositKeySuffix(2, addr) - id, a := SplitDepositKey(depositKey) - require.Equal(t, 2, int(id)) - require.Equal(t, a, addr) - - depositIterKey := DepositIterKey(2) - id = SplitDepositIterKey(depositIterKey) - require.Equal(t, 2, int(id)) - - require.Panics(t, func() { SplitDepositIterKey([]byte{0x03}) }) - - collateralKey := CollateralRatioKey(0x01, 2, sdk.MustNewDecFromStr("1.50")) - db, id, ratio := SplitCollateralRatioKey(collateralKey) - require.Equal(t, byte(0x01), db) - require.Equal(t, int(id), 2) - require.Equal(t, ratio, sdk.MustNewDecFromStr("1.50")) - - bigRatio := sdk.OneDec().Quo(sdk.SmallestDec()).Mul(sdk.OneDec().Add(sdk.OneDec())) - collateralKey = CollateralRatioKey(0x01, 2, bigRatio) - db, id, ratio = SplitCollateralRatioKey(collateralKey) - require.Equal(t, ratio, MaxSortableDec) - - collateralIterKey := CollateralRatioIterKey(0x01, sdk.MustNewDecFromStr("1.50")) - db, ratio = SplitCollateralRatioIterKey(collateralIterKey) - require.Equal(t, byte(0x01), db) - require.Equal(t, ratio, sdk.MustNewDecFromStr("1.50")) - - require.Panics(t, func() { SplitCollateralRatioKey(badRatioKey()) }) - require.Panics(t, func() { SplitCollateralRatioIterKey(badRatioIterKey()) }) - -} - -func badRatioKey() []byte { - r := append(append(append(append([]byte{0x01}, sep...), []byte("nonsense")...), sep...), []byte{0xff}...) - return r -} - -func badRatioIterKey() []byte { - r := append(append([]byte{0x01}, sep...), []byte("nonsense")...) - return r -} diff --git a/deprecated/x/cdp/types/messages_cdp.go b/deprecated/x/cdp/types/messages_cdp.go deleted file mode 100644 index e504a9af2..000000000 --- a/deprecated/x/cdp/types/messages_cdp.go +++ /dev/null @@ -1,271 +0,0 @@ -package types - -import ( - "errors" - fmt "fmt" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var ( - _ sdk.Msg = &MsgCreateCdp{} - _ sdk.Msg = &MsgDeposit{} - _ sdk.Msg = &MsgWithdraw{} - _ sdk.Msg = &MsgDrawDebt{} - _ sdk.Msg = &MsgRepayDebt{} - _ sdk.Msg = &MsgLiquidate{} -) - -// NewMsgCreateCdp returns a new MsgPlaceBid. -func NewMsgCreateCdp(sender sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) MsgCreateCdp { - return MsgCreateCdp{ - Sender: sender.Bytes(), - Collateral: collateral, - Principal: principal, - CollateralType: collateralType, - } -} - -// Route return the message type used for routing the message. -func (msg MsgCreateCdp) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgCreateCdp) Type() string { return "create_cdp" } - -// ValidateBasic does a simple validation check that doesn't require access to any other information. -func (msg MsgCreateCdp) ValidateBasic() error { - if msg.Sender.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") - } - if msg.Collateral.IsZero() || !msg.Collateral.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "collateral amount %s", msg.Collateral) - } - if msg.Principal.IsZero() || !msg.Principal.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "principal amount %s", msg.Principal) - } - if strings.TrimSpace(msg.CollateralType) == "" { - return fmt.Errorf("collateral type cannot be empty") - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgCreateCdp) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgCreateCdp) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// NewMsgDeposit returns a new MsgDeposit -func NewMsgDeposit(owner sdk.AccAddress, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) MsgDeposit { - return MsgDeposit{ - Owner: owner.Bytes(), - Depositor: depositor.Bytes(), - Collateral: collateral, - CollateralType: collateralType, - } -} - -// Route return the message type used for routing the message. -func (msg MsgDeposit) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgDeposit) Type() string { return "deposit_cdp" } - -// ValidateBasic does a simple validation check that doesn't require access to any other information. -func (msg MsgDeposit) ValidateBasic() error { - if msg.Owner.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "owner address cannot be empty") - } - if msg.Depositor.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") - } - if !msg.Collateral.IsValid() || msg.Collateral.IsZero() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "collateral amount %s", msg.Collateral) - } - if strings.TrimSpace(msg.CollateralType) == "" { - return fmt.Errorf("collateral type cannot be empty") - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgDeposit) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgDeposit) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Depositor.AccAddress()} -} - -// NewMsgWithdraw returns a new MsgDeposit -func NewMsgWithdraw(owner sdk.AccAddress, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) MsgWithdraw { - return MsgWithdraw{ - Owner: owner.Bytes(), - Depositor: depositor.Bytes(), - Collateral: collateral, - CollateralType: collateralType, - } -} - -// Route return the message type used for routing the message. -func (msg MsgWithdraw) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgWithdraw) Type() string { return "withdraw_cdp" } - -// ValidateBasic does a simple validation check that doesn't require access to any other information. -func (msg MsgWithdraw) ValidateBasic() error { - if msg.Owner.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "owner address cannot be empty") - } - if msg.Depositor.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") - } - if !msg.Collateral.IsValid() || msg.Collateral.IsZero() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "collateral amount %s", msg.Collateral) - } - if strings.TrimSpace(msg.CollateralType) == "" { - return fmt.Errorf("collateral type cannot be empty") - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgWithdraw) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgWithdraw) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Depositor.AccAddress()} -} - -// NewMsgDrawDebt returns a new MsgDrawDebt -func NewMsgDrawDebt(sender sdk.AccAddress, collateralType string, principal sdk.Coin) MsgDrawDebt { - return MsgDrawDebt{ - Sender: sender.Bytes(), - CollateralType: collateralType, - Principal: principal, - } -} - -// Route return the message type used for routing the message. -func (msg MsgDrawDebt) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgDrawDebt) Type() string { return "draw_cdp" } - -// ValidateBasic does a simple validation check that doesn't require access to any other information. -func (msg MsgDrawDebt) ValidateBasic() error { - if msg.Sender.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") - } - if strings.TrimSpace(msg.CollateralType) == "" { - return errors.New("cdp collateral type cannot be blank") - } - if msg.Principal.IsZero() || !msg.Principal.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "principal amount %s", msg.Principal) - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgDrawDebt) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgDrawDebt) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// NewMsgRepayDebt returns a new MsgRepayDebt -func NewMsgRepayDebt(sender sdk.AccAddress, collateralType string, payment sdk.Coin) MsgRepayDebt { - return MsgRepayDebt{ - Sender: sender.Bytes(), - CollateralType: collateralType, - Payment: payment, - } -} - -// Route return the message type used for routing the message. -func (msg MsgRepayDebt) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgRepayDebt) Type() string { return "repay_cdp" } - -// ValidateBasic does a simple validation check that doesn't require access to any other information. -func (msg MsgRepayDebt) ValidateBasic() error { - if msg.Sender.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") - } - if strings.TrimSpace(msg.CollateralType) == "" { - return errors.New("cdp collateral type cannot be blank") - } - if msg.Payment.IsZero() || !msg.Payment.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "payment amount %s", msg.Payment) - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgRepayDebt) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgRepayDebt) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// NewMsgLiquidate returns a new MsgLiquidate -func NewMsgLiquidate(keeper, borrower sdk.AccAddress, ctype string) MsgLiquidate { - return MsgLiquidate{ - Keeper: keeper.Bytes(), - Borrower: borrower.Bytes(), - CollateralType: ctype, - } -} - -// Route return the message type used for routing the message. -func (msg MsgLiquidate) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgLiquidate) Type() string { return "liquidate" } - -// ValidateBasic does a simple validation check that doesn't require access to any other information. -func (msg MsgLiquidate) ValidateBasic() error { - if msg.Keeper.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "keeper address cannot be empty") - } - if msg.Borrower.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "borrower address cannot be empty") - } - if strings.TrimSpace(msg.CollateralType) == "" { - return sdkerrors.Wrap(ErrInvalidCollateral, "collateral type cannot be empty") - } - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgLiquidate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgLiquidate) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Keeper.AccAddress()} -} diff --git a/deprecated/x/cdp/types/messages_cdp_test.go b/deprecated/x/cdp/types/messages_cdp_test.go deleted file mode 100644 index e4bf6bbb5..000000000 --- a/deprecated/x/cdp/types/messages_cdp_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - coinsSingle = sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000) - coinsZero = sdk.NewCoin(sdk.DefaultBondDenom, sdk.ZeroInt()) - addrs = []sdk.AccAddress{ - sdk.AccAddress("test1"), - sdk.AccAddress("test2"), - } -) - -func TestMsgCreateCDP(t *testing.T) { - tests := []struct { - description string - sender sdk.AccAddress - collateral sdk.Coin - principal sdk.Coin - collateralType string - expectPass bool - }{ - {"create cdp", addrs[0], coinsSingle, coinsSingle, "type-a", true}, - {"create cdp no collateral", addrs[0], coinsZero, coinsSingle, "type-a", false}, - {"create cdp no debt", addrs[0], coinsSingle, coinsZero, "type-a", false}, - {"create cdp empty owner", sdk.AccAddress{}, coinsSingle, coinsSingle, "type-a", false}, - {"create cdp empty type", addrs[0], coinsSingle, coinsSingle, "", false}, - } - - for _, tc := range tests { - msg := NewMsgCreateCdp( - tc.sender, - tc.collateral, - tc.principal, - tc.collateralType, - ) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", tc.description) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", tc.description) - } - } -} - -func TestMsgDeposit(t *testing.T) { - tests := []struct { - description string - sender sdk.AccAddress - depositor sdk.AccAddress - collateral sdk.Coin - collateralType string - expectPass bool - }{ - {"deposit", addrs[0], addrs[1], coinsSingle, "type-a", true}, - {"deposit same owner", addrs[0], addrs[0], coinsSingle, "type-a", true}, - {"deposit no collateral", addrs[0], addrs[1], coinsZero, "type-a", false}, - {"deposit empty owner", sdk.AccAddress{}, addrs[1], coinsSingle, "type-a", false}, - {"deposit empty depositor", addrs[0], sdk.AccAddress{}, coinsSingle, "type-a", false}, - {"deposit empty type", addrs[0], addrs[0], coinsSingle, "", false}, - } - - for _, tc := range tests { - msg := NewMsgDeposit( - tc.sender, - tc.depositor, - tc.collateral, - tc.collateralType, - ) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", tc.description) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", tc.description) - } - } -} - -func TestMsgWithdraw(t *testing.T) { - tests := []struct { - description string - sender sdk.AccAddress - depositor sdk.AccAddress - collateral sdk.Coin - collateralType string - expectPass bool - }{ - {"withdraw", addrs[0], addrs[1], coinsSingle, "type-a", true}, - {"withdraw", addrs[0], addrs[0], coinsSingle, "type-a", true}, - {"withdraw no collateral", addrs[0], addrs[1], coinsZero, "type-a", false}, - {"withdraw empty owner", sdk.AccAddress{}, addrs[1], coinsSingle, "type-a", false}, - {"withdraw empty depositor", addrs[0], sdk.AccAddress{}, coinsSingle, "type-a", false}, - {"withdraw empty type", addrs[0], addrs[0], coinsSingle, "", false}, - } - - for _, tc := range tests { - msg := NewMsgWithdraw( - tc.sender, - tc.depositor, - tc.collateral, - tc.collateralType, - ) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", tc.description) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", tc.description) - } - } -} - -func TestMsgDrawDebt(t *testing.T) { - tests := []struct { - description string - sender sdk.AccAddress - collateralType string - principal sdk.Coin - expectPass bool - }{ - {"draw debt", addrs[0], sdk.DefaultBondDenom, coinsSingle, true}, - {"draw debt no debt", addrs[0], sdk.DefaultBondDenom, coinsZero, false}, - {"draw debt empty owner", sdk.AccAddress{}, sdk.DefaultBondDenom, coinsSingle, false}, - {"draw debt empty denom", sdk.AccAddress{}, "", coinsSingle, false}, - } - - for _, tc := range tests { - msg := NewMsgDrawDebt( - tc.sender, - tc.collateralType, - tc.principal, - ) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", tc.description) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", tc.description) - } - } -} - -func TestMsgRepayDebt(t *testing.T) { - tests := []struct { - description string - sender sdk.AccAddress - denom string - payment sdk.Coin - expectPass bool - }{ - {"repay debt", addrs[0], sdk.DefaultBondDenom, coinsSingle, true}, - {"repay debt no payment", addrs[0], sdk.DefaultBondDenom, coinsZero, false}, - {"repay debt empty owner", sdk.AccAddress{}, sdk.DefaultBondDenom, coinsSingle, false}, - {"repay debt empty denom", sdk.AccAddress{}, "", coinsSingle, false}, - } - - for _, tc := range tests { - msg := NewMsgRepayDebt( - tc.sender, - tc.denom, - tc.payment, - ) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", tc.description) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", tc.description) - } - } -} diff --git a/deprecated/x/cdp/types/params.go b/deprecated/x/cdp/types/params.go deleted file mode 100644 index f494968fe..000000000 --- a/deprecated/x/cdp/types/params.go +++ /dev/null @@ -1,432 +0,0 @@ -package types - -import ( - "fmt" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - paramstype "github.com/cosmos/cosmos-sdk/x/params/types" -) - -// Parameter keys -var ( - KeyGlobalDebtLimit = []byte("GlobalDebtLimit") - KeyCollateralParams = []byte("CollateralParams") - KeyDebtParam = []byte("DebtParam") - KeyCircuitBreaker = []byte("CircuitBreaker") - KeyDebtThreshold = []byte("DebtThreshold") - KeyDebtLot = []byte("DebtLot") - KeySurplusThreshold = []byte("SurplusThreshold") - KeySurplusLot = []byte("SurplusLot") - DefaultCollateralParams = CollateralParams{} - DefaultDebtParams = DebtParams{ - DebtParam{ - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin(DefaultStableDenom, sdk.ZeroInt()), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - DebtParam{ - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("euu", sdk.ZeroInt()), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - } - DefaultCdpStartingID = uint64(1) - DefaultGovDenom = "uguu" - DefaultStableDenom = "jpu" - minCollateralPrefix = 0 - maxCollateralPrefix = 255 - stabilityFeeMax = sdk.MustNewDecFromStr("1.000000051034942716") // 500% APR -) - -// NewParams returns a new params object -func NewParams( - collateralParams CollateralParams, debtParams DebtParams, -) Params { - return Params{ - CollateralParams: collateralParams, - DebtParams: debtParams, - } -} - -// DefaultParams returns default params for cdp module -func DefaultParams() Params { - return NewParams( - DefaultCollateralParams, DefaultDebtParams, - ) -} - -// NewCollateralParam returns a new CollateralParam -func NewCollateralParam( - denom, ctype string, liqRatio sdk.Dec, debtLimit sdk.Coin, stabilityFee sdk.Dec, auctionSize sdk.Int, - liqPenalty sdk.Dec, prefix byte, spotMarketID, liquidationMarketID string, keeperReward sdk.Dec, checkIndexCount sdk.Int, conversionFactor sdk.Int) CollateralParam { - return CollateralParam{ - Denom: denom, - Type: ctype, - LiquidationRatio: liqRatio, - DebtLimit: debtLimit, - StabilityFee: stabilityFee, - AuctionSize: auctionSize, - LiquidationPenalty: liqPenalty, - Prefix: uint32(prefix), - SpotMarketId: spotMarketID, - LiquidationMarketId: liquidationMarketID, - KeeperRewardPercentage: keeperReward, - CheckCollateralizationIndexCount: checkIndexCount, - ConversionFactor: conversionFactor, - } -} - -// CollateralParams array of CollateralParam -type CollateralParams []CollateralParam - -// String implements fmt.Stringer -func (cps CollateralParams) String() string { - out := "Collateral Params\n" - for _, cp := range cps { - out += fmt.Sprintf("%s\n", cp.String()) - } - return out -} - -// NewDebtParam returns a new DebtParam -func NewDebtParam(denom, refAsset string, conversionFactor, debtFloor sdk.Int, globalDebtLimit sdk.Coin) DebtParam { - return DebtParam{ - Denom: denom, - ReferenceAsset: refAsset, - ConversionFactor: conversionFactor, - DebtFloor: debtFloor, - GlobalDebtLimit: globalDebtLimit, - } -} - -// DebtParams array of DebtParam -type DebtParams []DebtParam - -// String implements fmt.Stringer -func (dps DebtParams) String() string { - out := "Debt Params\n" - for _, dp := range dps { - out += fmt.Sprintf("%v\n", dp) - } - return out -} - -// find the element that returns TRUE in the injected function -func (dps DebtParams) find(f func(DebtParam, string) bool, search_denom string) (DebtParam, bool) { - for _, debtParam := range dps { - if (DebtParam{}) != debtParam { - if f(debtParam, search_denom) { - return debtParam, true - } - } - } - return DebtParam{}, false -} - -// Returns an element with a denom that matches search_denom -func (dps DebtParams) FindDenom(search_denom string) (DebtParam, bool) { - findDenom := func(ele DebtParam, target string) bool { - return ele.Denom == target - } - return dps.find(findDenom, search_denom) -} - -// Returns an element with a GlobalDebtLimit.Denom that matches search_denom -func (dps DebtParams) FindGlobalDebtLimitDenom(search_denom string) (DebtParam, bool) { - FindGlobalDebtLimitDenomDenom := func(ele DebtParam, target string) bool { - return ele.GlobalDebtLimit.Denom == target - } - return dps.find(FindGlobalDebtLimitDenomDenom, search_denom) -} - -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstype.KeyTable { - return paramstype.NewKeyTable().RegisterParamSet(&Params{}) -} - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -// pairs of auth module's parameters. -// nolint -func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { - return paramstype.ParamSetPairs{ - paramstype.NewParamSetPair(KeyCollateralParams, &p.CollateralParams, validateCollateralParams), - paramstype.NewParamSetPair(KeyDebtParam, &p.DebtParams, validateDebtParams), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - - if err := validateCollateralParams(p.CollateralParams); err != nil { - return err - } - - if err := validateDebtParams(p.DebtParams); err != nil { - return err - } - - if len(p.CollateralParams) == 0 { // default value OK - return nil - } - - for _, debtParam := range p.DebtParams { - if (DebtParam{}) != debtParam { - if debtParam.Denom != debtParam.GlobalDebtLimit.Denom { - return fmt.Errorf("debt denom %s does not match global debt denom %s", - debtParam.Denom, debtParam.GlobalDebtLimit.Denom) - } - } - } - - // validate collateral params - collateralTypeDupMap := make(map[string]bool) - collateralParamsDebtLimitMap := make(map[string]sdk.Int) - - for _, cp := range p.CollateralParams { - // Collateral type eg busd-a should be unique, but denom can be same eg busd - _, typeExists := collateralTypeDupMap[cp.Type] - if typeExists { - return fmt.Errorf("duplicate collateral type %s", cp.Denom) - } - collateralTypeDupMap[cp.Type] = true - - collateralParamsDebtLimit, denomLimitExists := collateralParamsDebtLimitMap[cp.DebtLimit.Denom] - if !denomLimitExists { - collateralParamsDebtLimit = sdk.ZeroInt() - } - - debtParams := DebtParams(p.DebtParams) - debtParam, exists := debtParams.FindGlobalDebtLimitDenom(cp.DebtLimit.Denom) - - if !exists { - return fmt.Errorf("collateral debt limit denom %s does not match global debt limit denoms.", cp.DebtLimit.Denom) - } - - collateralParamsDebtLimitMap[cp.DebtLimit.Denom] = collateralParamsDebtLimit.Add(cp.DebtLimit.Amount) - - if cp.DebtLimit.Amount.GT(debtParam.GlobalDebtLimit.Amount) { - return fmt.Errorf("collateral debt limit %s exceeds global debt limit: %s denom: %s", - cp.DebtLimit, debtParam.GlobalDebtLimit.Amount, debtParam.GlobalDebtLimit.Denom) - } - } - - for _, debtParam := range p.DebtParams { - collateralParamsDebtLimit, exists := collateralParamsDebtLimitMap[debtParam.GlobalDebtLimit.Denom] - if !exists { - continue - } - if collateralParamsDebtLimit.GT(debtParam.GlobalDebtLimit.Amount) { - return fmt.Errorf("sum of collateral debt limits %s exceeds global debt limit %s denom: %s", - collateralParamsDebtLimit, debtParam.GlobalDebtLimit.Amount, debtParam.GlobalDebtLimit.Denom) - } - } - - return nil -} - -func validateGlobalDebtLimitParam(i interface{}) error { - globalDebtLimit, ok := i.(sdk.Coin) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if !globalDebtLimit.IsValid() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, "global debt limit %s", globalDebtLimit.String()) - } - - return nil -} - -func validateCollateralParams(i interface{}) error { - collateralParams, ok := i.(CollateralParams) - if !ok { - collateralParams, ok = i.([]CollateralParam) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - } - - prefixDupMap := make(map[int]bool) - typeDupMap := make(map[string]bool) - for _, cp := range collateralParams { - if err := sdk.ValidateDenom(cp.Denom); err != nil { - return fmt.Errorf("collateral denom invalid %s", cp.Denom) - } - - if strings.TrimSpace(cp.SpotMarketId) == "" { - return fmt.Errorf("spot market id cannot be blank %s", cp.String()) - } - - if strings.TrimSpace(cp.Type) == "" { - return fmt.Errorf("collateral type cannot be blank %s", cp.String()) - } - - if strings.TrimSpace(cp.LiquidationMarketId) == "" { - return fmt.Errorf("liquidation market id cannot be blank %s", cp.String()) - } - - prefix := int(cp.Prefix) - if prefix < minCollateralPrefix || prefix > maxCollateralPrefix { - return fmt.Errorf("invalid prefix for collateral denom %s: %b", cp.Denom, cp.Prefix) - } - - _, found := prefixDupMap[prefix] - if found { - return fmt.Errorf("duplicate prefix for collateral denom %s: %v", cp.Denom, []byte{byte(cp.Prefix)}) - } - - prefixDupMap[prefix] = true - - _, found = typeDupMap[cp.Type] - if found { - return fmt.Errorf("duplicate cdp collateral type: %s", cp.Type) - } - typeDupMap[cp.Type] = true - - if !cp.DebtLimit.IsValid() { - return fmt.Errorf("debt limit for all collaterals should be positive, is %s for %s", cp.DebtLimit, cp.Denom) - } - - if cp.LiquidationPenalty.LT(sdk.ZeroDec()) || cp.LiquidationPenalty.GT(sdk.OneDec()) { - return fmt.Errorf("liquidation penalty should be between 0 and 1, is %s for %s", cp.LiquidationPenalty, cp.Denom) - } - if !cp.AuctionSize.IsPositive() { - return fmt.Errorf("auction size should be positive, is %s for %s", cp.AuctionSize, cp.Denom) - } - if cp.StabilityFee.LT(sdk.OneDec()) || cp.StabilityFee.GT(stabilityFeeMax) { - return fmt.Errorf("stability fee must be ≥ 1.0, ≤ %s, is %s for %s", stabilityFeeMax, cp.StabilityFee, cp.Denom) - } - if cp.KeeperRewardPercentage.IsNegative() || cp.KeeperRewardPercentage.GT(sdk.OneDec()) { - return fmt.Errorf("keeper reward percentage should be between 0 and 1, is %s for %s", cp.KeeperRewardPercentage, cp.Denom) - } - if cp.CheckCollateralizationIndexCount.IsNegative() { - return fmt.Errorf("keeper reward percentage should be positive, is %s for %s", cp.CheckCollateralizationIndexCount, cp.Denom) - } - } - - return nil -} - -func validateDebtParams(i interface{}) error { - debtParams, ok := i.(DebtParams) - if !ok { - debtParams, ok = i.([]DebtParam) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - } - for _, debtParam := range debtParams { - if err := sdk.ValidateDenom(debtParam.Denom); err != nil { - return fmt.Errorf("debtParam Denom invalid %s", debtParam.Denom) - } - - if err := validateGlobalDebtLimitParam(debtParam.GlobalDebtLimit); err != nil { - return err - } - - if err := sdk.ValidateDenom(debtParam.DebtDenom); err != nil { - return fmt.Errorf("debtParam DebtDenom invalid %s", debtParam.DebtDenom) - } - - if err := validateCircuitBreakerParam(debtParam.CircuitBreaker); err != nil { - return err - } - - if err := validateSurplusAuctionThresholdParam(debtParam.SurplusAuctionThreshold); err != nil { - return err - } - - if err := validateSurplusAuctionLotParam(debtParam.SurplusAuctionLot); err != nil { - return err - } - - if err := validateDebtAuctionThresholdParam(debtParam.DebtAuctionThreshold); err != nil { - return err - } - - if err := validateDebtAuctionLotParam(debtParam.DebtAuctionLot); err != nil { - return err - } - } - - return nil -} - -func validateCircuitBreakerParam(i interface{}) error { - _, ok := i.(bool) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateSurplusAuctionThresholdParam(i interface{}) error { - sat, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if !sat.IsPositive() { - return fmt.Errorf("surplus auction threshold should be positive: %s", sat) - } - - return nil -} - -func validateSurplusAuctionLotParam(i interface{}) error { - sal, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if !sal.IsPositive() { - return fmt.Errorf("surplus auction lot should be positive: %s", sal) - } - - return nil -} - -func validateDebtAuctionThresholdParam(i interface{}) error { - dat, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if !dat.IsPositive() { - return fmt.Errorf("debt auction threshold should be positive: %s", dat) - } - - return nil -} - -func validateDebtAuctionLotParam(i interface{}) error { - dal, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if !dal.IsPositive() { - return fmt.Errorf("debt auction lot should be positive: %s", dal) - } - - return nil -} diff --git a/deprecated/x/cdp/types/params_test.go b/deprecated/x/cdp/types/params_test.go deleted file mode 100644 index 16541708e..000000000 --- a/deprecated/x/cdp/types/params_test.go +++ /dev/null @@ -1,1515 +0,0 @@ -package types_test - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -type ParamsTestSuite struct { - suite.Suite -} - -func (suite *ParamsTestSuite) SetupTest() { -} - -func (suite *ParamsTestSuite) TestParamValidation() { - type args struct { - collateralParams cdptypes.CollateralParams - debtParams cdptypes.DebtParams - } - type errArgs struct { - expectPass bool - contains string - } - - testCases := []struct { - name string - args args - errArgs errArgs - }{ - { - name: "default", - args: args{ - collateralParams: cdptypes.DefaultCollateralParams, - debtParams: cdptypes.DefaultDebtParams, - }, - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "valid single-collateral", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "invalid single-collateral mismatched debt denoms", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "sjpy", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debtsjpy", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "does not match global debt denom", - }, - }, - { - name: "invalid single-collateral mismatched debt denoms", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "does not match global debt denom", - }, - }, - { - name: "invalid single-collateral over debt limit", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "exceeds global debt limit", - }, - }, - { - name: "invalid single-collateral over debt limit ver euu", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:eur", - LiquidationMarketId: "bnb:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 21000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 1000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "exceeds global debt limit", - }, - }, - { - name: "valid multi-collateral", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "bnb", - Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x22, - SpotMarketId: "bnb:eur", - LiquidationMarketId: "bnb:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x23, - SpotMarketId: "xrp:eur", - LiquidationMarketId: "xrp:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "xxx", - ReferenceAsset: "yyy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("xxx", 2000000000000), - DebtDenom: "debtxxx", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 4000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "invalid multi-collateral over first debt limit", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "sum of collateral debt limits", - }, - }, - { - name: "invalid multi-collateral over last debt limit", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "bnb", - Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x22, - SpotMarketId: "bnb:eur", - LiquidationMarketId: "bnb:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x23, - SpotMarketId: "xrp:eur", - LiquidationMarketId: "xrp:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "xxx", - ReferenceAsset: "yyy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("xxx", 2000000000000), - DebtDenom: "debtxxx", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "sum of collateral debt limits", - }, - }, - { - name: "invalid multi-collateral over all debt limit", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "bnb", - Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x22, - SpotMarketId: "bnb:eur", - LiquidationMarketId: "bnb:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x23, - SpotMarketId: "xrp:eur", - LiquidationMarketId: "xrp:eur", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "xxx", - ReferenceAsset: "yyy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("xxx", 2000000000000), - DebtDenom: "debtxxx", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "sum of collateral debt limits", - }, - }, - { - name: "invalid multi-collateral multiple debt denoms", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("sjpy", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 4000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "does not match global debt limit denom", - }, - }, - { - name: "invalid multi-collateral duplicate type", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("sjpy", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(6), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DefaultDebtParams, - }, - errArgs: errArgs{ - expectPass: false, - contains: "duplicate cdp collateral type", - }, - }, - { - name: "invalid collateral params empty denom", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "collateral denom invalid", - }, - }, - { - name: "invalid collateral params empty market id", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "", - LiquidationMarketId: "", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "market id cannot be blank", - }, - }, - { - name: "invalid collateral params duplicate denom + type", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "duplicate cdp collateral type", - }, - }, - { - name: "valid collateral params duplicate denom + different type", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "bnb", - Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x21, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "invalid collateral params duplicate prefix", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "duplicate prefix for collateral denom", - }, - }, - { - name: "invalid collateral params nil debt limit", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.Coin{}, - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "debt limit for all collaterals should be positive", - }, - }, - { - name: "invalid collateral params liquidation ratio out of range", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("1.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "liquidation penalty should be between 0 and 1", - }, - }, - { - name: "invalid collateral params auction size zero", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.ZeroInt(), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "auction size should be positive", - }, - }, - { - name: "invalid collateral params stability fee out of range", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.1"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "stability fee must be ≥ 1.0", - }, - }, - { - name: "invalid debt param empty denom", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - DebtDenom: "debteuu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "debtParam Denom invalid", - }, - }, - { - name: "invalid debt param empty debt denom", - args: args{ - collateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(50000000000), - Prefix: 0x20, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - ConversionFactor: sdk.NewInt(8), - CheckCollateralizationIndexCount: sdk.NewInt(10), - }, - }, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - { - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("euu", 2000000000000), - DebtDenom: "", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "debtParam DebtDenom invalid", - }, - }, - { - name: "nil debt limit", - args: args{ - collateralParams: cdptypes.DefaultCollateralParams, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.Coin{}, - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "global debt limit : invalid coins", - }, - }, - { - name: "zero surplus auction threshold", - args: args{ - collateralParams: cdptypes.DefaultCollateralParams, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.ZeroInt(), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "surplus auction threshold should be positive", - }, - }, - { - name: "zero debt auction threshold", - args: args{ - collateralParams: cdptypes.DefaultCollateralParams, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.ZeroInt(), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "debt auction threshold should be positive", - }, - }, - { - name: "zero surplus auction lot", - args: args{ - collateralParams: cdptypes.DefaultCollateralParams, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.ZeroInt(), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "surplus auction lot should be positive", - }, - }, - { - name: "zero debt auction lot", - args: args{ - collateralParams: cdptypes.DefaultCollateralParams, - debtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.ZeroInt(), - CircuitBreaker: false, - }, - }, - }, - errArgs: errArgs{ - expectPass: false, - contains: "debt auction lot should be positive", - }, - }, - } - for _, tc := range testCases { - suite.Run(tc.name, func() { - params := cdptypes.NewParams( - tc.args.collateralParams, - tc.args.debtParams, - ) - err := params.Validate() - if tc.errArgs.expectPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) - } - }) - } -} - -func TestParamsTestSuite(t *testing.T) { - suite.Run(t, new(ParamsTestSuite)) -} - -func findTestSetup() (cdptypes.DebtParams, cdptypes.DebtParam, cdptypes.DebtParam) { - type dps = cdptypes.DebtParams - type dp = cdptypes.DebtParam - jpu_debt := dp{ - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("jpux", sdk.NewInt(100)), - DebtDenom: "debtjpu", - } - euu_debt := dp{ - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("euux", sdk.NewInt(500)), - DebtDenom: "debteuu", - } - dummy_debt := dp{ - Denom: "dum", - ReferenceAsset: "du", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("dum", sdk.NewInt(500)), - DebtDenom: "debtdum", - } - t1 := dps{jpu_debt, euu_debt, dummy_debt} - return t1, jpu_debt, euu_debt -} -func TestFindDenom(t *testing.T) { - type dp = cdptypes.DebtParam - t1, jpu_debt, euu_debt := findTestSetup() - - result, exits := t1.FindDenom("jpu") - except := jpu_debt - assert.Equalf(t, true, exits, "not exists") - assert.NotEqualf(t, euu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.Equalf(t, except, result, "not equal, except: %v\n result: %v", except, result) - - result, exits = t1.FindDenom("euu") - except = euu_debt - assert.Equalf(t, true, exits, "not exists") - assert.NotEqualf(t, jpu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.Equalf(t, except, result, "not equal, except: %v\n result: %v", except, result) - - // not match test - result, exits = t1.FindDenom("xxx") - except = dp{} - assert.Equalf(t, false, exits, "not exists") - assert.NotEqualf(t, euu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.NotEqualf(t, jpu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.Equalf(t, except, result, "not equal, except: %v\n result: %v", except, result) -} - -func TestFindGlobalDebtLimitDenom(t *testing.T) { - type dp = cdptypes.DebtParam - t1, jpu_debt, euu_debt := findTestSetup() - - result, exits := t1.FindGlobalDebtLimitDenom("jpux") - except := jpu_debt - assert.Equalf(t, true, exits, "not exists") - assert.NotEqualf(t, euu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.Equalf(t, except, result, "not equal, except: %v\n result: %v", except, result) - - result, exits = t1.FindGlobalDebtLimitDenom("euux") - except = euu_debt - assert.Equalf(t, true, exits, "not exists") - assert.NotEqualf(t, jpu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.Equalf(t, except, result, "not equal, except: %v\n result: %v", except, result) - - // not match test - result, exits = t1.FindDenom("xxx") - except = dp{} - assert.Equalf(t, false, exits, "not exists") - assert.NotEqualf(t, euu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.NotEqualf(t, jpu_debt, result, "except not equal, except: %v\n result: %v", except, result) - assert.Equalf(t, except, result, "not equal, except: %v\n result: %v", except, result) -} diff --git a/deprecated/x/cdp/types/query.pb.go b/deprecated/x/cdp/types/query.pb.go deleted file mode 100644 index 81a53c39c..000000000 --- a/deprecated/x/cdp/types/query.pb.go +++ /dev/null @@ -1,2225 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cdp/query.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/codec/types" - query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - -// this line is used by starport scaffolding # 3 -type QueryGetCdpRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - CollateralType string `protobuf:"bytes,2,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` -} - -func (m *QueryGetCdpRequest) Reset() { *m = QueryGetCdpRequest{} } -func (m *QueryGetCdpRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetCdpRequest) ProtoMessage() {} -func (*QueryGetCdpRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{2} -} -func (m *QueryGetCdpRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetCdpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetCdpRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetCdpRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCdpRequest.Merge(m, src) -} -func (m *QueryGetCdpRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetCdpRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCdpRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetCdpRequest proto.InternalMessageInfo - -func (m *QueryGetCdpRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *QueryGetCdpRequest) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type QueryGetCdpResponse struct { - Cdp AugmentedCdp `protobuf:"bytes,1,opt,name=cdp,proto3" json:"cdp"` -} - -func (m *QueryGetCdpResponse) Reset() { *m = QueryGetCdpResponse{} } -func (m *QueryGetCdpResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetCdpResponse) ProtoMessage() {} -func (*QueryGetCdpResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{3} -} -func (m *QueryGetCdpResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetCdpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetCdpResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetCdpResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCdpResponse.Merge(m, src) -} -func (m *QueryGetCdpResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetCdpResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCdpResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetCdpResponse proto.InternalMessageInfo - -func (m *QueryGetCdpResponse) GetCdp() AugmentedCdp { - if m != nil { - return m.Cdp - } - return AugmentedCdp{} -} - -type QueryAllCdpRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllCdpRequest) Reset() { *m = QueryAllCdpRequest{} } -func (m *QueryAllCdpRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllCdpRequest) ProtoMessage() {} -func (*QueryAllCdpRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{4} -} -func (m *QueryAllCdpRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllCdpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllCdpRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllCdpRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllCdpRequest.Merge(m, src) -} -func (m *QueryAllCdpRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllCdpRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllCdpRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllCdpRequest proto.InternalMessageInfo - -func (m *QueryAllCdpRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryAllCdpResponse struct { - Cdp []AugmentedCdp `protobuf:"bytes,1,rep,name=cdp,proto3" json:"cdp"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllCdpResponse) Reset() { *m = QueryAllCdpResponse{} } -func (m *QueryAllCdpResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllCdpResponse) ProtoMessage() {} -func (*QueryAllCdpResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{5} -} -func (m *QueryAllCdpResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllCdpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllCdpResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllCdpResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllCdpResponse.Merge(m, src) -} -func (m *QueryAllCdpResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllCdpResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllCdpResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllCdpResponse proto.InternalMessageInfo - -func (m *QueryAllCdpResponse) GetCdp() []AugmentedCdp { - if m != nil { - return m.Cdp - } - return nil -} - -func (m *QueryAllCdpResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryAllAccountRequest struct { -} - -func (m *QueryAllAccountRequest) Reset() { *m = QueryAllAccountRequest{} } -func (m *QueryAllAccountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllAccountRequest) ProtoMessage() {} -func (*QueryAllAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{6} -} -func (m *QueryAllAccountRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAccountRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAccountRequest.Merge(m, src) -} -func (m *QueryAllAccountRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAccountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAccountRequest proto.InternalMessageInfo - -type QueryAllAccountResponse struct { - Accounts []*types.Any `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` -} - -func (m *QueryAllAccountResponse) Reset() { *m = QueryAllAccountResponse{} } -func (m *QueryAllAccountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllAccountResponse) ProtoMessage() {} -func (*QueryAllAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{7} -} -func (m *QueryAllAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAccountResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAccountResponse.Merge(m, src) -} -func (m *QueryAllAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAccountResponse proto.InternalMessageInfo - -func (m *QueryAllAccountResponse) GetAccounts() []*types.Any { - if m != nil { - return m.Accounts - } - return nil -} - -type QueryAllDepositRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - CollateralType string `protobuf:"bytes,2,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` -} - -func (m *QueryAllDepositRequest) Reset() { *m = QueryAllDepositRequest{} } -func (m *QueryAllDepositRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllDepositRequest) ProtoMessage() {} -func (*QueryAllDepositRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{8} -} -func (m *QueryAllDepositRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllDepositRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllDepositRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllDepositRequest.Merge(m, src) -} -func (m *QueryAllDepositRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllDepositRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllDepositRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllDepositRequest proto.InternalMessageInfo - -func (m *QueryAllDepositRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *QueryAllDepositRequest) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type QueryAllDepositResponse struct { - Deposits []Deposit `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"` -} - -func (m *QueryAllDepositResponse) Reset() { *m = QueryAllDepositResponse{} } -func (m *QueryAllDepositResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllDepositResponse) ProtoMessage() {} -func (*QueryAllDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15b26084609686f, []int{9} -} -func (m *QueryAllDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllDepositResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllDepositResponse.Merge(m, src) -} -func (m *QueryAllDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllDepositResponse proto.InternalMessageInfo - -func (m *QueryAllDepositResponse) GetDeposits() []Deposit { - if m != nil { - return m.Deposits - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.cdp.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.cdp.QueryParamsResponse") - proto.RegisterType((*QueryGetCdpRequest)(nil), "ununifi.cdp.QueryGetCdpRequest") - proto.RegisterType((*QueryGetCdpResponse)(nil), "ununifi.cdp.QueryGetCdpResponse") - proto.RegisterType((*QueryAllCdpRequest)(nil), "ununifi.cdp.QueryAllCdpRequest") - proto.RegisterType((*QueryAllCdpResponse)(nil), "ununifi.cdp.QueryAllCdpResponse") - proto.RegisterType((*QueryAllAccountRequest)(nil), "ununifi.cdp.QueryAllAccountRequest") - proto.RegisterType((*QueryAllAccountResponse)(nil), "ununifi.cdp.QueryAllAccountResponse") - proto.RegisterType((*QueryAllDepositRequest)(nil), "ununifi.cdp.QueryAllDepositRequest") - proto.RegisterType((*QueryAllDepositResponse)(nil), "ununifi.cdp.QueryAllDepositResponse") -} - -func init() { proto.RegisterFile("cdp/query.proto", fileDescriptor_d15b26084609686f) } - -var fileDescriptor_d15b26084609686f = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xdf, 0x4e, 0x13, 0x41, - 0x14, 0xc6, 0xbb, 0x20, 0x0d, 0x0e, 0x51, 0xe2, 0xb4, 0x08, 0x54, 0x2d, 0x64, 0x25, 0x62, 0x34, - 0xee, 0x08, 0x26, 0x5e, 0x9a, 0x94, 0x1a, 0xd0, 0x78, 0x21, 0x54, 0x89, 0x89, 0x31, 0x31, 0xd3, - 0xdd, 0x61, 0xd9, 0x64, 0x3b, 0x33, 0x74, 0x76, 0xd1, 0x86, 0x70, 0xe3, 0x13, 0x68, 0xbc, 0xd1, - 0x37, 0xf0, 0x51, 0xb8, 0x24, 0xf1, 0xc6, 0x2b, 0x63, 0xc0, 0x07, 0x31, 0x3b, 0x73, 0x96, 0xed, - 0x40, 0xeb, 0x9f, 0xc4, 0x2b, 0xd8, 0x33, 0x67, 0xbe, 0xef, 0xd7, 0x33, 0xdf, 0x41, 0x93, 0x7e, - 0x20, 0xc9, 0x4e, 0xca, 0xba, 0x3d, 0x4f, 0x76, 0x45, 0x22, 0xf0, 0x44, 0xca, 0x53, 0x1e, 0x6d, - 0x45, 0x9e, 0x1f, 0xc8, 0x5a, 0x35, 0x14, 0xa1, 0xd0, 0x75, 0x92, 0xfd, 0x67, 0x5a, 0x6a, 0x57, - 0x43, 0x21, 0xc2, 0x98, 0x11, 0x2a, 0x23, 0x42, 0x39, 0x17, 0x09, 0x4d, 0x22, 0xc1, 0x15, 0x9c, - 0xce, 0xc2, 0xa9, 0xfe, 0x6a, 0xa7, 0x5b, 0x84, 0x72, 0xd0, 0xae, 0xdd, 0xf2, 0x85, 0xea, 0x08, - 0x45, 0xda, 0x54, 0x31, 0x63, 0x4a, 0x76, 0x97, 0xda, 0x2c, 0xa1, 0x4b, 0x44, 0xd2, 0x30, 0xe2, - 0x5a, 0x07, 0x7a, 0x2f, 0x64, 0x60, 0x7e, 0x20, 0xcd, 0xa7, 0x5b, 0x45, 0x78, 0x23, 0xbb, 0xb0, - 0x4e, 0xbb, 0xb4, 0xa3, 0x5a, 0x6c, 0x27, 0x65, 0x2a, 0x71, 0x57, 0x50, 0xc5, 0xaa, 0x2a, 0x29, - 0xb8, 0x62, 0xf8, 0x36, 0x2a, 0x4b, 0x5d, 0x99, 0x71, 0xe6, 0x9d, 0x9b, 0x13, 0xcb, 0x15, 0xaf, - 0xef, 0x47, 0x79, 0xd0, 0x0c, 0x2d, 0xee, 0x33, 0x50, 0x5e, 0x63, 0x49, 0x33, 0x90, 0xa0, 0x8c, - 0xab, 0x68, 0x4c, 0xbc, 0xe1, 0xac, 0xab, 0x15, 0xce, 0xb7, 0xcc, 0x07, 0x5e, 0x44, 0x93, 0xbe, - 0x88, 0x63, 0x9a, 0xb0, 0x2e, 0x8d, 0x5f, 0x27, 0x3d, 0xc9, 0x66, 0x46, 0xf4, 0xf9, 0xc5, 0xa2, - 0xfc, 0xbc, 0x27, 0x99, 0xfb, 0x08, 0xc0, 0x72, 0x51, 0x00, 0x5b, 0x42, 0xa3, 0x7e, 0x20, 0x81, - 0x6a, 0xd6, 0xa2, 0x6a, 0xa4, 0x61, 0x87, 0xf1, 0x84, 0x05, 0xcd, 0x40, 0xae, 0x9c, 0x3b, 0xf8, - 0x3e, 0x57, 0x6a, 0x65, 0xbd, 0xee, 0x2b, 0xc0, 0x6b, 0xc4, 0x71, 0x1f, 0xde, 0x2a, 0x42, 0xc5, - 0xc4, 0x40, 0xef, 0x86, 0x67, 0xc6, 0xeb, 0x65, 0xe3, 0xf5, 0xcc, 0x9b, 0xc2, 0x78, 0xbd, 0x75, - 0x1a, 0x32, 0xb8, 0xdb, 0xea, 0xbb, 0xe9, 0x7e, 0x70, 0x00, 0x34, 0x97, 0x3f, 0x0d, 0x3a, 0xfa, - 0xb7, 0xa0, 0x78, 0xcd, 0x42, 0x1a, 0xd1, 0x48, 0x8b, 0x7f, 0x44, 0x32, 0x7e, 0x16, 0xd3, 0x0c, - 0xba, 0x9c, 0x23, 0x35, 0x7c, 0x5f, 0xa4, 0x3c, 0xc9, 0x9f, 0xfb, 0x09, 0x9a, 0x3e, 0x73, 0x02, - 0xc0, 0x77, 0xd1, 0x38, 0x35, 0x25, 0x05, 0xd4, 0x55, 0xcf, 0x04, 0xd1, 0xcb, 0x83, 0xe8, 0x35, - 0x78, 0xaf, 0x75, 0xd2, 0xe5, 0xbe, 0x28, 0x6c, 0x1e, 0x32, 0x29, 0x54, 0x94, 0xfc, 0xa7, 0xb7, - 0xdf, 0x28, 0x28, 0x4f, 0x84, 0x81, 0xf2, 0x3e, 0x1a, 0x0f, 0x4c, 0xa9, 0xa0, 0xec, 0x9f, 0x2d, - 0xf4, 0xc3, 0x58, 0x4f, 0x7a, 0x97, 0x3f, 0x8d, 0xa1, 0x31, 0xad, 0x89, 0xb7, 0x51, 0xd9, 0xe4, - 0x17, 0xcf, 0x59, 0x37, 0xcf, 0x2e, 0x47, 0x6d, 0x7e, 0x78, 0x83, 0xc1, 0x71, 0xaf, 0xbc, 0xfb, - 0xfa, 0xf3, 0xe3, 0xc8, 0x14, 0xae, 0x10, 0xe8, 0xcc, 0x16, 0x8e, 0x98, 0xbd, 0xc0, 0x9f, 0x1d, - 0x34, 0xda, 0x0c, 0xe4, 0x20, 0x1f, 0x6b, 0x55, 0x06, 0xf9, 0xd8, 0xb1, 0x77, 0x9f, 0x6a, 0x9f, - 0xc7, 0x78, 0xcd, 0xf2, 0xf1, 0x03, 0xa9, 0x88, 0x9e, 0xad, 0x22, 0x7b, 0xfa, 0xef, 0x3e, 0x29, - 0x46, 0x79, 0x27, 0x9b, 0xb0, 0x22, 0x7b, 0xa7, 0x66, 0xbe, 0x9f, 0x5d, 0xc3, 0x5b, 0xa8, 0xdc, - 0x0c, 0x64, 0x23, 0x8e, 0x07, 0xd1, 0x59, 0x9b, 0x32, 0x88, 0xce, 0xce, 0xba, 0x3b, 0xab, 0xe9, - 0x2a, 0xf8, 0xd2, 0x19, 0x3a, 0xbc, 0x8b, 0x10, 0x04, 0x2d, 0xf3, 0xba, 0x3e, 0x50, 0xca, 0xce, - 0x68, 0x6d, 0xe1, 0xf7, 0x4d, 0xe0, 0x79, 0x4d, 0x7b, 0x4e, 0xe3, 0x29, 0xcb, 0x33, 0xcf, 0x26, - 0xfe, 0xe2, 0x20, 0x04, 0x59, 0x18, 0x6e, 0x6c, 0xa7, 0x76, 0x88, 0xf1, 0xa9, 0x04, 0x0e, 0x79, - 0x8a, 0x3c, 0x68, 0xff, 0xfe, 0x1c, 0x2b, 0x0f, 0x0e, 0x8e, 0xea, 0xce, 0xe1, 0x51, 0xdd, 0xf9, - 0x71, 0x54, 0x77, 0xde, 0x1f, 0xd7, 0x4b, 0x87, 0xc7, 0xf5, 0xd2, 0xb7, 0xe3, 0x7a, 0xe9, 0xe5, - 0x42, 0x18, 0x25, 0xdb, 0x69, 0xdb, 0xf3, 0x45, 0x87, 0x6c, 0xf2, 0x4d, 0x1e, 0xad, 0x46, 0xc4, - 0xdf, 0xa6, 0x11, 0x27, 0x6f, 0xb5, 0xa9, 0x56, 0x6c, 0x97, 0xf5, 0x7a, 0xde, 0xfb, 0x15, 0x00, - 0x00, 0xff, 0xff, 0xea, 0x09, 0xc3, 0x3a, 0x89, 0x06, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // this line is used by starport scaffolding # 2 - Cdp(ctx context.Context, in *QueryGetCdpRequest, opts ...grpc.CallOption) (*QueryGetCdpResponse, error) - CdpAll(ctx context.Context, in *QueryAllCdpRequest, opts ...grpc.CallOption) (*QueryAllCdpResponse, error) - AccountAll(ctx context.Context, in *QueryAllAccountRequest, opts ...grpc.CallOption) (*QueryAllAccountResponse, error) - DepositAll(ctx context.Context, in *QueryAllDepositRequest, opts ...grpc.CallOption) (*QueryAllDepositResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Cdp(ctx context.Context, in *QueryGetCdpRequest, opts ...grpc.CallOption) (*QueryGetCdpResponse, error) { - out := new(QueryGetCdpResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Query/Cdp", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) CdpAll(ctx context.Context, in *QueryAllCdpRequest, opts ...grpc.CallOption) (*QueryAllCdpResponse, error) { - out := new(QueryAllCdpResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Query/CdpAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AccountAll(ctx context.Context, in *QueryAllAccountRequest, opts ...grpc.CallOption) (*QueryAllAccountResponse, error) { - out := new(QueryAllAccountResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Query/AccountAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DepositAll(ctx context.Context, in *QueryAllDepositRequest, opts ...grpc.CallOption) (*QueryAllDepositResponse, error) { - out := new(QueryAllDepositResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Query/DepositAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // this line is used by starport scaffolding # 2 - Cdp(context.Context, *QueryGetCdpRequest) (*QueryGetCdpResponse, error) - CdpAll(context.Context, *QueryAllCdpRequest) (*QueryAllCdpResponse, error) - AccountAll(context.Context, *QueryAllAccountRequest) (*QueryAllAccountResponse, error) - DepositAll(context.Context, *QueryAllDepositRequest) (*QueryAllDepositResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) Cdp(ctx context.Context, req *QueryGetCdpRequest) (*QueryGetCdpResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Cdp not implemented") -} -func (*UnimplementedQueryServer) CdpAll(ctx context.Context, req *QueryAllCdpRequest) (*QueryAllCdpResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CdpAll not implemented") -} -func (*UnimplementedQueryServer) AccountAll(ctx context.Context, req *QueryAllAccountRequest) (*QueryAllAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AccountAll not implemented") -} -func (*UnimplementedQueryServer) DepositAll(ctx context.Context, req *QueryAllDepositRequest) (*QueryAllDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DepositAll not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Cdp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetCdpRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Cdp(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Query/Cdp", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Cdp(ctx, req.(*QueryGetCdpRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_CdpAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllCdpRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CdpAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Query/CdpAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CdpAll(ctx, req.(*QueryAllCdpRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AccountAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AccountAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Query/AccountAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AccountAll(ctx, req.(*QueryAllAccountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DepositAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllDepositRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DepositAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Query/DepositAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DepositAll(ctx, req.(*QueryAllDepositRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.cdp.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Cdp", - Handler: _Query_Cdp_Handler, - }, - { - MethodName: "CdpAll", - Handler: _Query_CdpAll_Handler, - }, - { - MethodName: "AccountAll", - Handler: _Query_AccountAll_Handler, - }, - { - MethodName: "DepositAll", - Handler: _Query_DepositAll_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cdp/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGetCdpRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetCdpRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetCdpRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGetCdpResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetCdpResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetCdpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Cdp.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryAllCdpRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllCdpRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllCdpRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllCdpResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllCdpResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllCdpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Cdp) > 0 { - for iNdEx := len(m.Cdp) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Cdp[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryAllAccountRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllAccountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllAccountResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Accounts) > 0 { - for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryAllDepositRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllDepositRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllDepositResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Deposits) > 0 { - for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetCdpRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetCdpResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Cdp.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAllCdpRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllCdpResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Cdp) > 0 { - for _, e := range m.Cdp { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllAccountRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Accounts) > 0 { - for _, e := range m.Accounts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryAllDepositRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllDepositResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetCdpRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetCdpRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCdpRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetCdpResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetCdpResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCdpResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cdp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Cdp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllCdpRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllCdpRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllCdpRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllCdpResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllCdpResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllCdpResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cdp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cdp = append(m.Cdp, AugmentedCdp{}) - if err := m.Cdp[len(m.Cdp)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAccountRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllAccountRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAccountResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Accounts = append(m.Accounts, &types.Any{}) - if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllDepositRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllDepositRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllDepositResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Deposits = append(m.Deposits, Deposit{}) - if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/cdp/types/query.pb.gw.go b/deprecated/x/cdp/types/query.pb.gw.go deleted file mode 100644 index 3e7432635..000000000 --- a/deprecated/x/cdp/types/query.pb.gw.go +++ /dev/null @@ -1,530 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cdp/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Cdp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetCdpRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["owner"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") - } - - protoReq.Owner, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) - } - - val, ok = pathParams["collateral_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "collateral_type") - } - - protoReq.CollateralType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "collateral_type", err) - } - - msg, err := client.Cdp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Cdp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetCdpRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["owner"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") - } - - protoReq.Owner, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) - } - - val, ok = pathParams["collateral_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "collateral_type") - } - - protoReq.CollateralType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "collateral_type", err) - } - - msg, err := server.Cdp(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_CdpAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_CdpAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllCdpRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CdpAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.CdpAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_CdpAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllCdpRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CdpAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.CdpAll(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AccountAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAccountRequest - var metadata runtime.ServerMetadata - - msg, err := client.AccountAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AccountAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAccountRequest - var metadata runtime.ServerMetadata - - msg, err := server.AccountAll(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_DepositAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllDepositRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["owner"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") - } - - protoReq.Owner, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) - } - - val, ok = pathParams["collateral_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "collateral_type") - } - - protoReq.CollateralType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "collateral_type", err) - } - - msg, err := client.DepositAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DepositAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllDepositRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["owner"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") - } - - protoReq.Owner, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) - } - - val, ok = pathParams["collateral_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "collateral_type") - } - - protoReq.CollateralType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "collateral_type", err) - } - - msg, err := server.DepositAll(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Cdp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Cdp_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Cdp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_CdpAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_CdpAll_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CdpAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AccountAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AccountAll_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AccountAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DepositAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_DepositAll_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DepositAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Cdp_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Cdp_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Cdp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_CdpAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_CdpAll_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CdpAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AccountAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AccountAll_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AccountAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DepositAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_DepositAll_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DepositAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "cdp", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Cdp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 1}, []string{"ununifi", "cdp", "cdps", "owners", "owner", "collateral-types", "collateral_type"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_CdpAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "cdp", "cdps"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_AccountAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "cdp", "accounts"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_DepositAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"ununifi", "cdp", "deposits", "owners", "owner", "collateral-types", "collateral_type"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_Cdp_0 = runtime.ForwardResponseMessage - - forward_Query_CdpAll_0 = runtime.ForwardResponseMessage - - forward_Query_AccountAll_0 = runtime.ForwardResponseMessage - - forward_Query_DepositAll_0 = runtime.ForwardResponseMessage -) diff --git a/deprecated/x/cdp/types/tx.pb.go b/deprecated/x/cdp/types/tx.pb.go deleted file mode 100644 index 77d39e137..000000000 --- a/deprecated/x/cdp/types/tx.pb.go +++ /dev/null @@ -1,2923 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cdp/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgCreateCdp struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - Collateral types.Coin `protobuf:"bytes,2,opt,name=collateral,proto3" json:"collateral" yaml:"collateral"` - Principal types.Coin `protobuf:"bytes,3,opt,name=principal,proto3" json:"principal" yaml:"principal"` - CollateralType string `protobuf:"bytes,4,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` -} - -func (m *MsgCreateCdp) Reset() { *m = MsgCreateCdp{} } -func (m *MsgCreateCdp) String() string { return proto.CompactTextString(m) } -func (*MsgCreateCdp) ProtoMessage() {} -func (*MsgCreateCdp) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{0} -} -func (m *MsgCreateCdp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateCdp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateCdp.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCreateCdp) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateCdp.Merge(m, src) -} -func (m *MsgCreateCdp) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateCdp) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateCdp.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateCdp proto.InternalMessageInfo - -func (m *MsgCreateCdp) GetCollateral() types.Coin { - if m != nil { - return m.Collateral - } - return types.Coin{} -} - -func (m *MsgCreateCdp) GetPrincipal() types.Coin { - if m != nil { - return m.Principal - } - return types.Coin{} -} - -func (m *MsgCreateCdp) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type MsgCreateCdpResponse struct { -} - -func (m *MsgCreateCdpResponse) Reset() { *m = MsgCreateCdpResponse{} } -func (m *MsgCreateCdpResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateCdpResponse) ProtoMessage() {} -func (*MsgCreateCdpResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{1} -} -func (m *MsgCreateCdpResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateCdpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateCdpResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCreateCdpResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateCdpResponse.Merge(m, src) -} -func (m *MsgCreateCdpResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateCdpResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateCdpResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateCdpResponse proto.InternalMessageInfo - -type MsgDeposit struct { - Depositor github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=depositor,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"depositor" yaml:"depositor"` - Owner github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,2,opt,name=owner,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"owner" yaml:"owner"` - Collateral types.Coin `protobuf:"bytes,3,opt,name=collateral,proto3" json:"collateral" yaml:"collateral"` - CollateralType string `protobuf:"bytes,4,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` -} - -func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } -func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } -func (*MsgDeposit) ProtoMessage() {} -func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{2} -} -func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeposit.Merge(m, src) -} -func (m *MsgDeposit) XXX_Size() int { - return m.Size() -} -func (m *MsgDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo - -func (m *MsgDeposit) GetCollateral() types.Coin { - if m != nil { - return m.Collateral - } - return types.Coin{} -} - -func (m *MsgDeposit) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type MsgDepositResponse struct { -} - -func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } -func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDepositResponse) ProtoMessage() {} -func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{3} -} -func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDepositResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositResponse.Merge(m, src) -} -func (m *MsgDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo - -type MsgWithdraw struct { - Depositor github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=depositor,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"depositor" yaml:"depositor"` - Owner github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,2,opt,name=owner,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"owner" yaml:"owner"` - Collateral types.Coin `protobuf:"bytes,3,opt,name=collateral,proto3" json:"collateral" yaml:"collateral"` - CollateralType string `protobuf:"bytes,4,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` -} - -func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } -func (m *MsgWithdraw) String() string { return proto.CompactTextString(m) } -func (*MsgWithdraw) ProtoMessage() {} -func (*MsgWithdraw) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{4} -} -func (m *MsgWithdraw) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdraw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdraw.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdraw) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdraw.Merge(m, src) -} -func (m *MsgWithdraw) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdraw) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdraw.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdraw proto.InternalMessageInfo - -func (m *MsgWithdraw) GetCollateral() types.Coin { - if m != nil { - return m.Collateral - } - return types.Coin{} -} - -func (m *MsgWithdraw) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type MsgWithdrawResponse struct { -} - -func (m *MsgWithdrawResponse) Reset() { *m = MsgWithdrawResponse{} } -func (m *MsgWithdrawResponse) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawResponse) ProtoMessage() {} -func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{5} -} -func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdrawResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawResponse.Merge(m, src) -} -func (m *MsgWithdrawResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawResponse proto.InternalMessageInfo - -type MsgDrawDebt struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - CollateralType string `protobuf:"bytes,2,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - Principal types.Coin `protobuf:"bytes,3,opt,name=principal,proto3" json:"principal" yaml:"principal"` -} - -func (m *MsgDrawDebt) Reset() { *m = MsgDrawDebt{} } -func (m *MsgDrawDebt) String() string { return proto.CompactTextString(m) } -func (*MsgDrawDebt) ProtoMessage() {} -func (*MsgDrawDebt) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{6} -} -func (m *MsgDrawDebt) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDrawDebt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDrawDebt.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDrawDebt) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDrawDebt.Merge(m, src) -} -func (m *MsgDrawDebt) XXX_Size() int { - return m.Size() -} -func (m *MsgDrawDebt) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDrawDebt.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDrawDebt proto.InternalMessageInfo - -func (m *MsgDrawDebt) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -func (m *MsgDrawDebt) GetPrincipal() types.Coin { - if m != nil { - return m.Principal - } - return types.Coin{} -} - -type MsgDrawDebtResponse struct { -} - -func (m *MsgDrawDebtResponse) Reset() { *m = MsgDrawDebtResponse{} } -func (m *MsgDrawDebtResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDrawDebtResponse) ProtoMessage() {} -func (*MsgDrawDebtResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{7} -} -func (m *MsgDrawDebtResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDrawDebtResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDrawDebtResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDrawDebtResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDrawDebtResponse.Merge(m, src) -} -func (m *MsgDrawDebtResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDrawDebtResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDrawDebtResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDrawDebtResponse proto.InternalMessageInfo - -type MsgRepayDebt struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - CollateralType string `protobuf:"bytes,2,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - Payment types.Coin `protobuf:"bytes,3,opt,name=payment,proto3" json:"payment" yaml:"payment"` -} - -func (m *MsgRepayDebt) Reset() { *m = MsgRepayDebt{} } -func (m *MsgRepayDebt) String() string { return proto.CompactTextString(m) } -func (*MsgRepayDebt) ProtoMessage() {} -func (*MsgRepayDebt) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{8} -} -func (m *MsgRepayDebt) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRepayDebt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRepayDebt.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRepayDebt) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRepayDebt.Merge(m, src) -} -func (m *MsgRepayDebt) XXX_Size() int { - return m.Size() -} -func (m *MsgRepayDebt) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRepayDebt.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRepayDebt proto.InternalMessageInfo - -func (m *MsgRepayDebt) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -func (m *MsgRepayDebt) GetPayment() types.Coin { - if m != nil { - return m.Payment - } - return types.Coin{} -} - -type MsgRepayDebtResponse struct { -} - -func (m *MsgRepayDebtResponse) Reset() { *m = MsgRepayDebtResponse{} } -func (m *MsgRepayDebtResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRepayDebtResponse) ProtoMessage() {} -func (*MsgRepayDebtResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{9} -} -func (m *MsgRepayDebtResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRepayDebtResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRepayDebtResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRepayDebtResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRepayDebtResponse.Merge(m, src) -} -func (m *MsgRepayDebtResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRepayDebtResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRepayDebtResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRepayDebtResponse proto.InternalMessageInfo - -type MsgLiquidate struct { - Keeper github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=keeper,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"keeper" yaml:"keeper"` - Borrower github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,2,opt,name=borrower,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"borrower" yaml:"borrower"` - CollateralType string `protobuf:"bytes,3,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` -} - -func (m *MsgLiquidate) Reset() { *m = MsgLiquidate{} } -func (m *MsgLiquidate) String() string { return proto.CompactTextString(m) } -func (*MsgLiquidate) ProtoMessage() {} -func (*MsgLiquidate) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{10} -} -func (m *MsgLiquidate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgLiquidate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgLiquidate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgLiquidate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgLiquidate.Merge(m, src) -} -func (m *MsgLiquidate) XXX_Size() int { - return m.Size() -} -func (m *MsgLiquidate) XXX_DiscardUnknown() { - xxx_messageInfo_MsgLiquidate.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgLiquidate proto.InternalMessageInfo - -func (m *MsgLiquidate) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type MsgLiquidateResponse struct { -} - -func (m *MsgLiquidateResponse) Reset() { *m = MsgLiquidateResponse{} } -func (m *MsgLiquidateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgLiquidateResponse) ProtoMessage() {} -func (*MsgLiquidateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07a616735245490e, []int{11} -} -func (m *MsgLiquidateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgLiquidateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgLiquidateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgLiquidateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgLiquidateResponse.Merge(m, src) -} -func (m *MsgLiquidateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgLiquidateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgLiquidateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgLiquidateResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateCdp)(nil), "ununifi.cdp.MsgCreateCdp") - proto.RegisterType((*MsgCreateCdpResponse)(nil), "ununifi.cdp.MsgCreateCdpResponse") - proto.RegisterType((*MsgDeposit)(nil), "ununifi.cdp.MsgDeposit") - proto.RegisterType((*MsgDepositResponse)(nil), "ununifi.cdp.MsgDepositResponse") - proto.RegisterType((*MsgWithdraw)(nil), "ununifi.cdp.MsgWithdraw") - proto.RegisterType((*MsgWithdrawResponse)(nil), "ununifi.cdp.MsgWithdrawResponse") - proto.RegisterType((*MsgDrawDebt)(nil), "ununifi.cdp.MsgDrawDebt") - proto.RegisterType((*MsgDrawDebtResponse)(nil), "ununifi.cdp.MsgDrawDebtResponse") - proto.RegisterType((*MsgRepayDebt)(nil), "ununifi.cdp.MsgRepayDebt") - proto.RegisterType((*MsgRepayDebtResponse)(nil), "ununifi.cdp.MsgRepayDebtResponse") - proto.RegisterType((*MsgLiquidate)(nil), "ununifi.cdp.MsgLiquidate") - proto.RegisterType((*MsgLiquidateResponse)(nil), "ununifi.cdp.MsgLiquidateResponse") -} - -func init() { proto.RegisterFile("cdp/tx.proto", fileDescriptor_07a616735245490e) } - -var fileDescriptor_07a616735245490e = []byte{ - // 708 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x96, 0xcf, 0x6e, 0xd3, 0x30, - 0x18, 0xc0, 0xfb, 0x07, 0xb6, 0xd5, 0x1b, 0x1b, 0x84, 0x31, 0xba, 0x1e, 0x92, 0x11, 0x71, 0xd8, - 0x29, 0xd1, 0xc6, 0x8d, 0x03, 0xd2, 0xda, 0x69, 0xfc, 0x19, 0x3d, 0x10, 0x36, 0x21, 0x21, 0x21, - 0x70, 0x12, 0x2f, 0xb3, 0x68, 0x6d, 0x13, 0xbb, 0x74, 0xbd, 0x72, 0xe1, 0xca, 0x0b, 0xf0, 0x24, - 0xbc, 0xc0, 0x8e, 0x3b, 0x22, 0x0e, 0x15, 0xda, 0x9e, 0x80, 0x3e, 0x01, 0x4a, 0x9c, 0x38, 0x51, - 0xb3, 0x6a, 0xa2, 0x1a, 0x93, 0x90, 0xb8, 0xb5, 0xf9, 0xec, 0x9f, 0xed, 0xdf, 0x67, 0x7f, 0x36, - 0x58, 0xf0, 0x7c, 0x66, 0x8b, 0x23, 0x8b, 0x85, 0x54, 0x50, 0x6d, 0xbe, 0x47, 0x7a, 0x04, 0x1f, - 0x60, 0xcb, 0xf3, 0x59, 0x63, 0x39, 0xa0, 0x01, 0x8d, 0xbf, 0xdb, 0xd1, 0x2f, 0xd9, 0xa4, 0x61, - 0x04, 0x94, 0x06, 0x1d, 0x64, 0xc7, 0xff, 0xdc, 0xde, 0x81, 0x2d, 0x70, 0x17, 0x71, 0x01, 0xbb, - 0x2c, 0x69, 0xa0, 0x7b, 0x94, 0x77, 0x29, 0xb7, 0x5d, 0xc8, 0x91, 0xfd, 0x71, 0xc3, 0x45, 0x02, - 0x6e, 0xd8, 0x1e, 0xc5, 0x44, 0xc6, 0xcd, 0x61, 0x05, 0x2c, 0xb4, 0x79, 0xd0, 0x0a, 0x11, 0x14, - 0xa8, 0xe5, 0x33, 0xed, 0x1d, 0x98, 0xe1, 0x88, 0xf8, 0x28, 0xac, 0x97, 0xd7, 0xca, 0xeb, 0xb5, - 0xe6, 0x93, 0xe3, 0xa1, 0x51, 0xfa, 0x31, 0x34, 0xec, 0x00, 0x8b, 0xc3, 0x9e, 0x6b, 0x79, 0xb4, - 0x6b, 0xef, 0x93, 0x7d, 0x82, 0x77, 0xb0, 0xed, 0x1d, 0x42, 0x4c, 0x6c, 0x31, 0x60, 0x88, 0x5b, - 0x2f, 0x45, 0x88, 0x49, 0xb0, 0xe5, 0x79, 0x5b, 0xbe, 0x1f, 0x22, 0xce, 0x47, 0x43, 0xe3, 0xc6, - 0x00, 0x76, 0x3b, 0x0f, 0x4d, 0x89, 0x33, 0x9d, 0x84, 0xab, 0xed, 0x01, 0xe0, 0xd1, 0x4e, 0x07, - 0x0a, 0x14, 0xc2, 0x4e, 0xbd, 0xb2, 0x56, 0x5e, 0x9f, 0xdf, 0x5c, 0xb5, 0xe4, 0x3c, 0xad, 0x68, - 0x9e, 0x56, 0x32, 0x4f, 0xab, 0x45, 0x31, 0x69, 0xae, 0x46, 0x13, 0x18, 0x0d, 0x8d, 0x5b, 0x92, - 0x96, 0x75, 0x35, 0x9d, 0x1c, 0x47, 0x7b, 0x01, 0x6a, 0x2c, 0xc4, 0xc4, 0xc3, 0x0c, 0x76, 0xea, - 0xd5, 0x8b, 0xa0, 0xf5, 0x04, 0x7a, 0x53, 0x42, 0x55, 0x4f, 0xd3, 0xc9, 0x28, 0x5a, 0x0b, 0x2c, - 0x65, 0x03, 0xbc, 0x8d, 0x96, 0x59, 0xbf, 0x16, 0x3b, 0x69, 0x8c, 0x86, 0xc6, 0xca, 0xf8, 0x74, - 0xe2, 0x06, 0xa6, 0xb3, 0x98, 0x7d, 0xd9, 0x8b, 0x3e, 0xac, 0x80, 0xe5, 0xbc, 0x5f, 0x07, 0x71, - 0x46, 0x09, 0x47, 0xe6, 0xaf, 0x0a, 0x00, 0x6d, 0x1e, 0x6c, 0x23, 0x46, 0x39, 0x16, 0x1a, 0x06, - 0x35, 0x5f, 0xfe, 0xa4, 0xa9, 0xf9, 0xdd, 0xe9, 0xcd, 0x27, 0xcb, 0x52, 0x44, 0xd3, 0xc9, 0xe8, - 0xda, 0x1b, 0x70, 0x9d, 0xf6, 0x09, 0x0a, 0x63, 0xf5, 0xb5, 0xe6, 0xe3, 0xe9, 0x87, 0x59, 0x90, - 0xc3, 0xc4, 0x34, 0xd3, 0x91, 0xd4, 0xb1, 0xf4, 0x56, 0x2f, 0x29, 0xbd, 0x97, 0x92, 0x8b, 0x65, - 0xa0, 0x65, 0xca, 0x55, 0x26, 0x46, 0x15, 0x30, 0xdf, 0xe6, 0xc1, 0x2b, 0x2c, 0x0e, 0xfd, 0x10, - 0xf6, 0xff, 0xa7, 0xe2, 0x2a, 0x52, 0x71, 0x07, 0xdc, 0xce, 0x39, 0x57, 0xb9, 0xf8, 0x2c, 0x73, - 0xb1, 0x1d, 0xc2, 0xfe, 0x36, 0x72, 0xc5, 0x15, 0x54, 0xa3, 0x73, 0x56, 0x53, 0xf9, 0xd3, 0xd5, - 0xfc, 0x85, 0xe2, 0x93, 0x08, 0x4a, 0x45, 0x28, 0x41, 0x9f, 0x64, 0xbd, 0x76, 0x10, 0x83, 0x83, - 0x7f, 0xc9, 0xd0, 0x2e, 0x98, 0x65, 0x70, 0xd0, 0x45, 0x44, 0x5c, 0xec, 0x67, 0x25, 0xf1, 0xb3, - 0x98, 0xf8, 0x91, 0xfd, 0x4c, 0x27, 0x25, 0x24, 0x35, 0x55, 0x39, 0x50, 0x72, 0xbe, 0x4a, 0x39, - 0xcf, 0xf1, 0x87, 0x1e, 0xf6, 0xa1, 0x40, 0x91, 0x9c, 0xf7, 0x08, 0xb1, 0x4b, 0x94, 0x23, 0x71, - 0xa6, 0x93, 0x70, 0xb5, 0x03, 0x30, 0xe7, 0xd2, 0x30, 0xa4, 0x7d, 0x75, 0x88, 0x9f, 0x4d, 0x3f, - 0xc6, 0x92, 0x1c, 0x23, 0x05, 0x9a, 0x8e, 0x62, 0x9f, 0x97, 0x84, 0xea, 0x94, 0x77, 0x91, 0xd2, - 0x93, 0x7a, 0xdb, 0xfc, 0x56, 0x05, 0xd5, 0x36, 0x0f, 0xb4, 0xa7, 0xa0, 0x96, 0x3d, 0x04, 0x56, - 0xad, 0xdc, 0xf3, 0xc3, 0xca, 0xdf, 0x61, 0x8d, 0x7b, 0x13, 0x43, 0x29, 0x52, 0x6b, 0x81, 0xd9, - 0xf4, 0x6a, 0xbb, 0x3b, 0xde, 0x3a, 0x09, 0x34, 0x8c, 0x09, 0x01, 0x05, 0xd9, 0x01, 0x73, 0xaa, - 0x2a, 0xd7, 0xc7, 0x1b, 0xa7, 0x91, 0xc6, 0xda, 0xa4, 0x48, 0x9e, 0xa3, 0x2a, 0x4a, 0x81, 0x93, - 0x46, 0x8a, 0x9c, 0xf1, 0xc3, 0x17, 0xf9, 0xc9, 0x0e, 0x5e, 0xc1, 0x8f, 0x0a, 0x15, 0xfd, 0x14, - 0xb6, 0x6a, 0x84, 0xca, 0xb6, 0x69, 0x01, 0xa5, 0x42, 0x45, 0x54, 0x21, 0x7b, 0xcd, 0x47, 0xc7, - 0xa7, 0x7a, 0xf9, 0xe4, 0x54, 0x2f, 0xff, 0x3c, 0xd5, 0xcb, 0x5f, 0xce, 0xf4, 0xd2, 0xc9, 0x99, - 0x5e, 0xfa, 0x7e, 0xa6, 0x97, 0x5e, 0xdf, 0x9f, 0xb8, 0x05, 0x8f, 0xec, 0xf8, 0xa5, 0x19, 0x6d, - 0x44, 0x77, 0x26, 0x7e, 0x09, 0x3e, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xb0, 0xa9, 0x28, 0x93, - 0x7d, 0x0a, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - CreateCdp(ctx context.Context, in *MsgCreateCdp, opts ...grpc.CallOption) (*MsgCreateCdpResponse, error) - Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) - Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) - DrawDebt(ctx context.Context, in *MsgDrawDebt, opts ...grpc.CallOption) (*MsgDrawDebtResponse, error) - RepayDebt(ctx context.Context, in *MsgRepayDebt, opts ...grpc.CallOption) (*MsgRepayDebtResponse, error) - Liquidate(ctx context.Context, in *MsgLiquidate, opts ...grpc.CallOption) (*MsgLiquidateResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateCdp(ctx context.Context, in *MsgCreateCdp, opts ...grpc.CallOption) (*MsgCreateCdpResponse, error) { - out := new(MsgCreateCdpResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Msg/CreateCdp", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { - out := new(MsgDepositResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Msg/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) { - out := new(MsgWithdrawResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Msg/Withdraw", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) DrawDebt(ctx context.Context, in *MsgDrawDebt, opts ...grpc.CallOption) (*MsgDrawDebtResponse, error) { - out := new(MsgDrawDebtResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Msg/DrawDebt", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RepayDebt(ctx context.Context, in *MsgRepayDebt, opts ...grpc.CallOption) (*MsgRepayDebtResponse, error) { - out := new(MsgRepayDebtResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Msg/RepayDebt", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Liquidate(ctx context.Context, in *MsgLiquidate, opts ...grpc.CallOption) (*MsgLiquidateResponse, error) { - out := new(MsgLiquidateResponse) - err := c.cc.Invoke(ctx, "/ununifi.cdp.Msg/Liquidate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - CreateCdp(context.Context, *MsgCreateCdp) (*MsgCreateCdpResponse, error) - Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) - Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) - DrawDebt(context.Context, *MsgDrawDebt) (*MsgDrawDebtResponse, error) - RepayDebt(context.Context, *MsgRepayDebt) (*MsgRepayDebtResponse, error) - Liquidate(context.Context, *MsgLiquidate) (*MsgLiquidateResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateCdp(ctx context.Context, req *MsgCreateCdp) (*MsgCreateCdpResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateCdp not implemented") -} -func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") -} -func (*UnimplementedMsgServer) Withdraw(ctx context.Context, req *MsgWithdraw) (*MsgWithdrawResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") -} -func (*UnimplementedMsgServer) DrawDebt(ctx context.Context, req *MsgDrawDebt) (*MsgDrawDebtResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DrawDebt not implemented") -} -func (*UnimplementedMsgServer) RepayDebt(ctx context.Context, req *MsgRepayDebt) (*MsgRepayDebtResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RepayDebt not implemented") -} -func (*UnimplementedMsgServer) Liquidate(ctx context.Context, req *MsgLiquidate) (*MsgLiquidateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Liquidate not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateCdp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateCdp) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateCdp(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Msg/CreateCdp", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateCdp(ctx, req.(*MsgCreateCdp)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeposit) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Msg/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdraw) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Withdraw(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Msg/Withdraw", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Withdraw(ctx, req.(*MsgWithdraw)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_DrawDebt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDrawDebt) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DrawDebt(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Msg/DrawDebt", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DrawDebt(ctx, req.(*MsgDrawDebt)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RepayDebt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRepayDebt) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RepayDebt(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Msg/RepayDebt", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RepayDebt(ctx, req.(*MsgRepayDebt)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Liquidate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgLiquidate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Liquidate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.cdp.Msg/Liquidate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Liquidate(ctx, req.(*MsgLiquidate)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.cdp.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateCdp", - Handler: _Msg_CreateCdp_Handler, - }, - { - MethodName: "Deposit", - Handler: _Msg_Deposit_Handler, - }, - { - MethodName: "Withdraw", - Handler: _Msg_Withdraw_Handler, - }, - { - MethodName: "DrawDebt", - Handler: _Msg_DrawDebt_Handler, - }, - { - MethodName: "RepayDebt", - Handler: _Msg_RepayDebt_Handler, - }, - { - MethodName: "Liquidate", - Handler: _Msg_Liquidate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cdp/tx.proto", -} - -func (m *MsgCreateCdp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreateCdp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateCdp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintTx(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.Principal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgCreateCdpResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreateCdpResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateCdpResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDeposit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintTx(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Owner.Size() - i -= size - if _, err := m.Owner.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Depositor.Size() - i -= size - if _, err := m.Depositor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgDepositResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgWithdraw) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdraw) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdraw) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintTx(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Owner.Size() - i -= size - if _, err := m.Owner.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Depositor.Size() - i -= size - if _, err := m.Depositor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdrawResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDrawDebt) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDrawDebt) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDrawDebt) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Principal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintTx(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x12 - } - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgDrawDebtResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDrawDebtResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDrawDebtResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgRepayDebt) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRepayDebt) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRepayDebt) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Payment.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintTx(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x12 - } - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgRepayDebtResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRepayDebtResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRepayDebtResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgLiquidate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgLiquidate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgLiquidate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintTx(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x1a - } - { - size := m.Borrower.Size() - i -= size - if _, err := m.Borrower.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Keeper.Size() - i -= size - if _, err := m.Keeper.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgLiquidateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgLiquidateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgLiquidateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgCreateCdp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Collateral.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Principal.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgCreateCdpResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Depositor.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Owner.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Collateral.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgDepositResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgWithdraw) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Depositor.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Owner.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Collateral.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgWithdrawResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDrawDebt) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Principal.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgDrawDebtResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgRepayDebt) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Payment.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgRepayDebtResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgLiquidate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Keeper.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Borrower.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgLiquidateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgCreateCdp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateCdp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateCdp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Principal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateCdpResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateCdpResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateCdpResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDeposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Depositor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgWithdraw: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdraw: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Depositor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDrawDebt) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDrawDebt: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDrawDebt: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Principal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Principal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDrawDebtResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDrawDebtResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDrawDebtResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRepayDebt) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRepayDebt: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRepayDebt: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payment", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Payment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRepayDebtResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRepayDebtResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRepayDebtResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgLiquidate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgLiquidate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgLiquidate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keeper", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Keeper.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Borrower", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Borrower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgLiquidateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgLiquidateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgLiquidateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/cdp/types/types.go b/deprecated/x/cdp/types/types.go deleted file mode 100644 index 0802bc6d9..000000000 --- a/deprecated/x/cdp/types/types.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import "encoding/json" - -type DebtDenomMap map[string]string - -func NewDebtDenomMap(dps DebtParams) DebtDenomMap { - if len(dps) == 0 { - panic("is empty DebtParams") - } - new_map := make(DebtDenomMap) - for _, dp := range dps { - if dp.DebtDenom == "" { - panic("not exists DebtDenom") - } - new_map[dp.Denom] = dp.DebtDenom - } - return new_map -} - -func NewDebtDenomMapFromByte(dps_bytes []byte) DebtDenomMap { - if len(dps_bytes) == 0 { - panic("is empty DebtParams") - } - var debtDenomMap DebtDenomMap - err := json.Unmarshal(dps_bytes, &debtDenomMap) - if err != nil { - panic("is not DebtParams byte") - } - return debtDenomMap -} - -func (d DebtDenomMap) Byte() []byte { - bytes, err := json.Marshal(d) - if err != nil { - return []byte{} - } - return bytes -} diff --git a/deprecated/x/cdp/types/types_test.go b/deprecated/x/cdp/types/types_test.go deleted file mode 100644 index 2fdc9b4b5..000000000 --- a/deprecated/x/cdp/types/types_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" - - types "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -type TypeTestSuite struct { - suite.Suite -} - -func makeMockData() types.DebtParams { - return types.DebtParams{ - - types.DebtParam{ - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("jpu", sdk.ZeroInt()), - DebtDenom: "jpudebt", - }, - types.DebtParam{ - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("euu", sdk.ZeroInt()), - DebtDenom: "euudebt", - }, - } -} - -func (suite *TypeTestSuite) TestNewDebtDenomMap() { - debt_params := makeMockData() - debt_map := types.NewDebtDenomMap(debt_params) - except := make(types.DebtDenomMap) - except[debt_params[0].Denom] = debt_params[0].DebtDenom - except[debt_params[1].Denom] = debt_params[1].DebtDenom - - suite.Equal(except, debt_map) - suite.Panics(func() { - types.NewDebtDenomMap(types.DebtParams{}) - }) - suite.Panics(func() { - types.NewDebtDenomMap(types.DebtParams{ - types.DebtParam{ - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("jpu", sdk.ZeroInt()), - }, - types.DebtParam{ - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("euu", sdk.ZeroInt()), - DebtDenom: "euudebt", - }, - }) - }) - suite.Panics(func() { - types.NewDebtDenomMap(types.DebtParams{ - types.DebtParam{ - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("jpu", sdk.ZeroInt()), - DebtDenom: "debtjpu", - }, - types.DebtParam{ - Denom: "euu", - ReferenceAsset: "eur", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(1), - GlobalDebtLimit: sdk.NewCoin("euu", sdk.ZeroInt()), - }, - }) - }) -} - -func (suite *TypeTestSuite) TestNewDenomMapFromByte() { - mockStr := "{\"euu\":\"euudebt\",\"jpu\":\"jpudebt\"}" - debt_params := makeMockData() - debt_map := types.NewDebtDenomMapFromByte([]byte(mockStr)) - except := make(types.DebtDenomMap) - except[debt_params[0].Denom] = debt_params[0].DebtDenom - except[debt_params[1].Denom] = debt_params[1].DebtDenom - - suite.Equal(except, debt_map) - suite.Panics(func() { - types.NewDebtDenomMapFromByte([]byte{}) - }) - suite.Panics(func() { - types.NewDebtDenomMapFromByte([]byte("not json")) - }) -} - -func TestByte(t *testing.T) { - debt_params := makeMockData() - debt_map := types.NewDebtDenomMap(debt_params) - except_string := "{\"euu\":\"euudebt\",\"jpu\":\"jpudebt\"}" - assert.Equalf(t, []byte(except_string), debt_map.Byte(), "not match") -} - -func TestDrawTestSuite(t *testing.T) { - suite.Run(t, new(TypeTestSuite)) -} diff --git a/deprecated/x/cdp/types/utils.go b/deprecated/x/cdp/types/utils.go deleted file mode 100644 index f5cb0aaf2..000000000 --- a/deprecated/x/cdp/types/utils.go +++ /dev/null @@ -1,99 +0,0 @@ -package types - -import ( - "bytes" - "fmt" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// MaxSortableDec largest sortable sdk.Dec -var MaxSortableDec = sdk.OneDec().Quo(sdk.SmallestDec()) - -// ValidSortableDec sdk.Dec can't have precision of less than 10^-18 -func ValidSortableDec(dec sdk.Dec) bool { - return dec.Abs().LTE(MaxSortableDec) -} - -// SortableDecBytes returns a byte slice representation of a Dec that can be sorted. -// Left and right pads with 0s so there are 18 digits to left and right of the decimal point. -// For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec. -func SortableDecBytes(dec sdk.Dec) []byte { - if !ValidSortableDec(dec) { - panic("dec must be within bounds") - } - // Instead of adding an extra byte to all sortable decs in order to handle max sortable, we just - // makes its bytes be "max" which comes after all numbers in ASCIIbetical order - if dec.Equal(MaxSortableDec) { - return []byte("max") - } - // For the same reason, we make the bytes of minimum sortable dec be --, which comes before all numbers. - if dec.Equal(MaxSortableDec.Neg()) { - return []byte("--") - } - // We move the negative sign to the front of all the left padded 0s, to make negative numbers come before positive numbers - if dec.IsNegative() { - return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdk.Precision*2+1), dec.Abs().String()))...) - } - return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdk.Precision*2+1), dec.String())) -} - -// ParseDecBytes parses a []byte encoded using SortableDecBytes back to sdk.Dec -func ParseDecBytes(db []byte) (sdk.Dec, error) { - strFromDecBytes := strings.Trim(string(db[:]), "0") - if string(strFromDecBytes[0]) == "." { - strFromDecBytes = "0" + strFromDecBytes - } - if string(strFromDecBytes[len(strFromDecBytes)-1]) == "." { - strFromDecBytes = strFromDecBytes + "0" - } - if bytes.Equal(db, []byte("max")) { - return MaxSortableDec, nil - } - if bytes.Equal(db, []byte("--")) { - return MaxSortableDec.Neg(), nil - } - dec, err := sdk.NewDecFromStr(strFromDecBytes) - if err != nil { - return sdk.Dec{}, err - } - return dec, nil -} - -// RelativePow raises x to the power of n, where x (and the result, z) are scaled by factor b. -// For example, RelativePow(210, 2, 100) = 441 (2.1^2 = 4.41) -// Only defined for positive ints. -func RelativePow(x sdk.Int, n sdk.Int, b sdk.Int) (z sdk.Int) { - if x.IsZero() { - if n.IsZero() { - z = b // 0^0 = 1 - return - } - z = sdk.ZeroInt() // otherwise 0^a = 0 - return - } - - z = x - if n.Mod(sdk.NewInt(2)).Equal(sdk.ZeroInt()) { - z = b - } - - halfOfB := b.Quo(sdk.NewInt(2)) - n = n.Quo(sdk.NewInt(2)) - - for n.GT(sdk.ZeroInt()) { - xSquared := x.Mul(x) - xSquaredRounded := xSquared.Add(halfOfB) - - x = xSquaredRounded.Quo(b) - - if n.Mod(sdk.NewInt(2)).Equal(sdk.OneInt()) { - zx := z.Mul(x) - zxRounded := zx.Add(halfOfB) - z = zxRounded.Quo(b) - } - n = n.Quo(sdk.NewInt(2)) - } - return -} diff --git a/deprecated/x/cdp/types/utils_test.go b/deprecated/x/cdp/types/utils_test.go deleted file mode 100644 index 48a6947ed..000000000 --- a/deprecated/x/cdp/types/utils_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestSortableDecBytes(t *testing.T) { - tests := []struct { - d sdk.Dec - want []byte - }{ - {sdk.NewDec(0), []byte("000000000000000000.000000000000000000")}, - {sdk.NewDec(1), []byte("000000000000000001.000000000000000000")}, - {sdk.MustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, - {sdk.MustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, - {sdk.NewDec(10), []byte("000000000000000010.000000000000000000")}, - {sdk.NewDec(12340), []byte("000000000000012340.000000000000000000")}, - {sdk.NewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, - {sdk.NewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, - {sdk.NewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, - {sdk.NewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, - {sdk.NewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, - {sdk.NewDec(1000000000000000000), []byte("max")}, - {sdk.NewDec(-1000000000000000000), []byte("--")}, - } - for tcIndex, tc := range tests { - assert.Equal(t, tc.want, SortableDecBytes(tc.d), "bad String(), index: %v", tcIndex) - } - - assert.Panics(t, func() { SortableDecBytes(sdk.NewDec(1000000000000000001)) }) - assert.Panics(t, func() { SortableDecBytes(sdk.NewDec(-1000000000000000001)) }) -} - -func TestParseSortableDecBytes(t *testing.T) { - tests := []struct { - d sdk.Dec - want []byte - }{ - {sdk.NewDec(0), []byte("000000000000000000.000000000000000000")}, - {sdk.NewDec(1), []byte("000000000000000001.000000000000000000")}, - {sdk.MustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, - {sdk.MustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, - {sdk.NewDec(10), []byte("000000000000000010.000000000000000000")}, - {sdk.NewDec(12340), []byte("000000000000012340.000000000000000000")}, - {sdk.NewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, - {sdk.NewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, - {sdk.NewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, - {sdk.NewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, - {sdk.NewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, - {sdk.NewDec(1000000000000000000), []byte("max")}, - {sdk.NewDec(-1000000000000000000), []byte("--")}, - } - for tcIndex, tc := range tests { - b := SortableDecBytes(tc.d) - r, err := ParseDecBytes(b) - assert.NoError(t, err) - assert.Equal(t, tc.d, r, "bad Dec(), index: %v", tcIndex) - } -} - -func TestRelativePow(t *testing.T) { - tests := []struct { - args []sdk.Int - want sdk.Int - }{ - {[]sdk.Int{sdk.ZeroInt(), sdk.ZeroInt(), sdk.OneInt()}, sdk.OneInt()}, - {[]sdk.Int{sdk.ZeroInt(), sdk.ZeroInt(), sdk.NewInt(10)}, sdk.NewInt(10)}, - {[]sdk.Int{sdk.ZeroInt(), sdk.OneInt(), sdk.NewInt(10)}, sdk.ZeroInt()}, - {[]sdk.Int{sdk.NewInt(10), sdk.NewInt(2), sdk.OneInt()}, sdk.NewInt(100)}, - {[]sdk.Int{sdk.NewInt(210), sdk.NewInt(2), sdk.NewInt(100)}, sdk.NewInt(441)}, - {[]sdk.Int{sdk.NewInt(2100), sdk.NewInt(2), sdk.NewInt(1000)}, sdk.NewInt(4410)}, - {[]sdk.Int{sdk.NewInt(1000000001547125958), sdk.NewInt(600), sdk.NewInt(1000000000000000000)}, sdk.NewInt(1000000928276004850)}, - } - for i, tc := range tests { - res := RelativePow(tc.args[0], tc.args[1], tc.args[2]) - require.Equal(t, tc.want, res, "unexpected result for test case %d, input: %v, got: %v", i, tc.args, res) - } -} diff --git a/deprecated/x/decentralized-vault/spec/01_concepts.md b/deprecated/x/decentralized-vault/spec/01_concepts.md deleted file mode 100644 index fbd2282c5..000000000 --- a/deprecated/x/decentralized-vault/spec/01_concepts.md +++ /dev/null @@ -1,8 +0,0 @@ -# Concepts - -`decentralized-vault` module makes NFTs in non-cosmos networks available to NFTFI - -That's much like a bridge. - -architecture - diff --git a/deprecated/x/decentralized-vault/spec/02_state.md b/deprecated/x/decentralized-vault/spec/02_state.md deleted file mode 100644 index 11f70cd91..000000000 --- a/deprecated/x/decentralized-vault/spec/02_state.md +++ /dev/null @@ -1,10 +0,0 @@ -# State - -## `NftTransferRequest` - -```protobuf -message NftTransferRequest { - string nftid = 1; - string name = 2; -} -``` diff --git a/deprecated/x/decentralized-vault/spec/03_keepers.md b/deprecated/x/decentralized-vault/spec/03_keepers.md deleted file mode 100644 index d3a312c21..000000000 --- a/deprecated/x/decentralized-vault/spec/03_keepers.md +++ /dev/null @@ -1,11 +0,0 @@ -# Keepers - -## WrappedNftKeeper - -```go -type Keeper interface { - MintWrapedNft(ctx sdk.Context, account_id string, nftId string, name string) - BurnWrapedNft(ctx sdk.Context, nftId string) - DepositNft(ctx sdk.Context, nftId string) - WithdrawNft(ctx sdk.Context, account_id string, nftId string) -} diff --git a/deprecated/x/decentralized-vault/spec/04_messages.md b/deprecated/x/decentralized-vault/spec/04_messages.md deleted file mode 100644 index c819eb4d9..000000000 --- a/deprecated/x/decentralized-vault/spec/04_messages.md +++ /dev/null @@ -1,60 +0,0 @@ -# Messages - -## MsgNftLocked(execute only validators) - -Mint wrapped NFTs - -```protobuf -message MsgNftLocked { - string sender = 1; - string toAddress = 2; - string nftId = 3; - string nftName = 4; -} -``` - -## MsgNftUnLocked(execute only validators) - -Burn wrapped NFTs - -```protobuf -message MsgNftLocked { - string sender = 1; - string toAddress = 2; - string nftId = 3; -} -``` - -## MsgTransferRequst - -deposit wrapped NFTs - -```protobuf -message MsgNftLocked { - string sender = 1; - string ethAddress = 2; - string nftId = 3; -} -``` - -## MsgTransferred(execute only validators) - -Burn wrapped NFTs - -```protobuf -message MsgNftLocked { - string sender = 1; - string nftId = 2; -} -``` - -## MsgRejectTransfer(execute only validators) - -withdraw wrapped NFTs - -```protobuf -message MsgNftLocked { - string sender = 1; - string nftId = 2; -} -``` diff --git a/deprecated/x/incentive/abci.go b/deprecated/x/incentive/abci.go deleted file mode 100644 index 040243db1..000000000 --- a/deprecated/x/incentive/abci.go +++ /dev/null @@ -1,18 +0,0 @@ -package incentive - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/incentive/keeper" -) - -// BeginBlocker runs at the start of every block -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - params := k.GetParams(ctx) - for _, rp := range params.CdpMintingRewardPeriods { - err := k.AccumulateCdpMintingRewards(ctx, rp) - if err != nil { - panic(err) - } - } -} diff --git a/deprecated/x/incentive/client/cli/query.go b/deprecated/x/incentive/client/cli/query.go deleted file mode 100644 index 2d6acdec5..000000000 --- a/deprecated/x/incentive/client/cli/query.go +++ /dev/null @@ -1,32 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group incentive queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - cmd.AddCommand(CmdQueryParams()) - - return cmd -} diff --git a/deprecated/x/incentive/client/cli/query_params.go b/deprecated/x/incentive/client/cli/query_params.go deleted file mode 100644 index 0948395ad..000000000 --- a/deprecated/x/incentive/client/cli/query_params.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows a params", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/incentive/client/cli/tx.go b/deprecated/x/incentive/client/cli/tx.go deleted file mode 100644 index d825ef848..000000000 --- a/deprecated/x/incentive/client/cli/tx.go +++ /dev/null @@ -1,27 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - cmd.AddCommand(CmdClaimCdpMintingReward()) - - return cmd -} diff --git a/deprecated/x/incentive/client/cli/txClaim.go b/deprecated/x/incentive/client/cli/txClaim.go deleted file mode 100644 index 7c2f2f24c..000000000 --- a/deprecated/x/incentive/client/cli/txClaim.go +++ /dev/null @@ -1,38 +0,0 @@ -package cli - -import ( - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -func CmdClaimCdpMintingReward() *cobra.Command { - cmd := &cobra.Command{ - Use: "claim-cdp-minting-reward [multiplierName]", - Short: "Claims cdp minting reward", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - multiplierName := args[0] - - msg := types.NewMsgClaimCdpMintingReward(clientCtx.GetFromAddress(), multiplierName) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/incentive/client/rest/rest.go b/deprecated/x/incentive/client/rest/rest.go deleted file mode 100644 index 97fd6acab..000000000 --- a/deprecated/x/incentive/client/rest/rest.go +++ /dev/null @@ -1,25 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - // this line is used by starport scaffolding # 1 -) - -const ( - MethodGet = "GET" -) - -// RegisterRoutes registers incentive-related REST handlers to a router -func RegisterRoutes(clientCtx client.Context, r *mux.Router) { - // this line is used by starport scaffolding # 2 -} - -func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { - // this line is used by starport scaffolding # 3 -} - -func registerTxHandlers(clientCtx client.Context, r *mux.Router) { - // this line is used by starport scaffolding # 4 -} diff --git a/deprecated/x/incentive/genesis.go b/deprecated/x/incentive/genesis.go deleted file mode 100644 index 4d86e9f3b..000000000 --- a/deprecated/x/incentive/genesis.go +++ /dev/null @@ -1,86 +0,0 @@ -package incentive - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/incentive/keeper" - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -// InitGenesis initializes the store state from a genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKeeper, cdpKeeper types.CdpKeeper, gs types.GenesisState) { - - // check if the module account exists - moduleAcc := accountKeeper.GetModuleAccount(ctx, types.IncentiveMacc) - if moduleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", types.IncentiveMacc)) - } - - if err := gs.Validate(); err != nil { - panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) - } - - for _, rp := range gs.Params.CdpMintingRewardPeriods { - _, found := cdpKeeper.GetCollateral(ctx, rp.CollateralType) - if !found { - panic(fmt.Sprintf("cdp minting collateral type %s not found in cdp collateral types", rp.CollateralType)) - } - k.SetCdpMintingRewardFactor(ctx, rp.CollateralType, sdk.ZeroDec()) - } - - k.SetParams(ctx, gs.Params) - - for _, gat := range gs.CdpAccumulationTimes { - k.SetPreviousCdpMintingAccrualTime(ctx, gat.CollateralType, gat.PreviousAccumulationTime) - } - - for i, claim := range gs.CdpMintingClaims { - for j, ri := range claim.RewardIndexes { - if ri.RewardFactor != sdk.ZeroDec() { - gs.CdpMintingClaims[i].RewardIndexes[j].RewardFactor = sdk.ZeroDec() - } - } - k.SetCdpMintingClaim(ctx, claim) - } - - k.SetGenesisDenoms(ctx, gs.Denoms) -} - -// ExportGenesis export genesis state for incentive module -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { - params := k.GetParams(ctx) - - cdpClaims := k.GetAllCdpMintingClaims(ctx) - - synchronizedCdpClaims := types.CdpMintingClaims{} - - for _, jpuClaim := range cdpClaims { - claim, err := k.SynchronizeCdpMintingClaim(ctx, jpuClaim) - if err != nil { - panic(err) - } - for i := range claim.RewardIndexes { - claim.RewardIndexes[i].RewardFactor = sdk.ZeroDec() - } - synchronizedCdpClaims = append(synchronizedCdpClaims, claim) - } - - var cdpMintingGats types.GenesisAccumulationTimes - for _, rp := range params.CdpMintingRewardPeriods { - pat, found := k.GetPreviousCdpMintingAccrualTime(ctx, rp.CollateralType) - if !found { - panic(fmt.Sprintf("expected previous jpu minting reward accrual time to be set in state for %s", rp.CollateralType)) - } - gat := types.NewGenesisAccumulationTime(rp.CollateralType, pat) - cdpMintingGats = append(cdpMintingGats, gat) - } - - denoms, found := k.GetGenesisDenoms(ctx) - if !found { - denoms = types.DefaultGenesisDenoms() - } - - return types.NewGenesisState(params, cdpMintingGats, synchronizedCdpClaims, denoms) -} diff --git a/deprecated/x/incentive/handler.go b/deprecated/x/incentive/handler.go deleted file mode 100644 index d283d49ac..000000000 --- a/deprecated/x/incentive/handler.go +++ /dev/null @@ -1,38 +0,0 @@ -package incentive - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/incentive/keeper" - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgClaimCdpMintingReward: - return handleMsgClaimCdpMintingReward(ctx, k, msg) - // this line is used by starport scaffolding # 1 - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} - -func handleMsgClaimCdpMintingReward(ctx sdk.Context, k keeper.Keeper, msg *types.MsgClaimCdpMintingReward) (*sdk.Result, error) { - - err := k.ClaimCdpMintingReward(ctx, msg.Sender.AccAddress(), msg.MultiplierName) - if err != nil { - return nil, err - } - return &sdk.Result{ - Events: ctx.EventManager().ABCIEvents(), - }, nil -} diff --git a/deprecated/x/incentive/integration_test.go b/deprecated/x/incentive/integration_test.go deleted file mode 100644 index 04eeb7f3c..000000000 --- a/deprecated/x/incentive/integration_test.go +++ /dev/null @@ -1,223 +0,0 @@ -package incentive_test - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/app" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - incentivetypes "github.com/UnUniFi/chain/deprecated/x/incentive/types" - pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" -) - -// Avoid cluttering test cases with long function names -func i(in int64) sdk.Int { return sdk.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } - -func NewCDPGenStateMulti(tApp app.TestApp) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: "xrp", - Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(7000000000), - Prefix: 0x20, - SpotMarketId: "xrp:jpy", - LiquidationMarketId: "xrp:jpy", - ConversionFactor: i(6), - }, - { - Denom: "btc", - Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr - LiquidationPenalty: d("0.025"), - AuctionSize: i(10000000), - Prefix: 0x21, - SpotMarketId: "btc:jpy", - LiquidationMarketId: "btc:jpy", - ConversionFactor: i(8), - }, - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(50000000000), - Prefix: 0x22, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - ConversionFactor: i(8), - }, - { - Denom: "bjpy", - Type: "bjpy-a", - LiquidationRatio: d("1.01"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr - LiquidationPenalty: d("0.05"), - AuctionSize: i(10000000000), - Prefix: 0x23, - SpotMarketId: "bjpy:jpy", - LiquidationMarketId: "bjpy:jpy", - ConversionFactor: i(8), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bjpy-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bjpy-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} - -func NewPricefeedGenStateMulti(tApp app.TestApp) app.GenesisState { - pfGenesis := pricefeedtypes.GenesisState{ - Params: pricefeedtypes.Params{ - Markets: []pricefeedtypes.Market{ - {MarketId: "btc:jpy", BaseAsset: "btc", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "xrp:jpy", BaseAsset: "xrp", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "bnb:jpy", BaseAsset: "bnb", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "bjpy:jpy", BaseAsset: "bjpy", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - }, - }, - PostedPrices: []pricefeedtypes.PostedPrice{ - { - MarketId: "btc:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "xrp:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "bnb:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), - Expiry: time.Now().Add(1 * time.Hour), - }, - { - MarketId: "bjpy:jpy", - OracleAddress: ununifitypes.StringAccAddress{}, - Price: sdk.OneDec(), - Expiry: time.Now().Add(1 * time.Hour), - }, - }, - } - return app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pfGenesis)} -} - -func NewIncentiveGenState(tApp app.TestApp, previousAccumTime, endTime time.Time, rewardPeriods ...incentivetypes.RewardPeriod) app.GenesisState { - var accumulationTimes incentivetypes.GenesisAccumulationTimes - for _, rp := range rewardPeriods { - accumulationTimes = append( - accumulationTimes, - incentivetypes.NewGenesisAccumulationTime( - rp.CollateralType, - previousAccumTime, - ), - ) - } - genesis := incentivetypes.NewGenesisState( - incentivetypes.NewParams( - rewardPeriods, - incentivetypes.Multipliers{ - incentivetypes.NewMultiplier(incentivetypes.Small, 1, d("0.25")), - incentivetypes.NewMultiplier(incentivetypes.Large, 12, d("1.0")), - }, - endTime, - ), - incentivetypes.DefaultGenesisAccumulationTimes, - incentivetypes.DefaultCdpClaims, - incentivetypes.DefaultGenesisDenoms(), - ) - return app.GenesisState{incentivetypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&genesis)} -} - -func NewCDPGenStateHighInterest(tApp app.TestApp) app.GenesisState { - cdpGenesis := cdptypes.GenesisState{ - Params: cdptypes.Params{ - CollateralParams: cdptypes.CollateralParams{ - { - Denom: "bnb", - Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), - DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000051034942716"), // 500% APR - LiquidationPenalty: d("0.05"), - AuctionSize: i(50000000000), - Prefix: 0x22, - SpotMarketId: "bnb:jpy", - LiquidationMarketId: "bnb:jpy", - ConversionFactor: i(8), - }, - }, - DebtParams: cdptypes.DebtParams{ - { - Denom: "jpu", - ReferenceAsset: "jpy", - ConversionFactor: i(6), - DebtFloor: i(10000000), - GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), - DebtDenom: "debtjpu", - SurplusAuctionThreshold: sdk.NewInt(500000000000), - SurplusAuctionLot: sdk.NewInt(10000000000), - DebtAuctionThreshold: sdk.NewInt(100000000000), - DebtAuctionLot: sdk.NewInt(10000000000), - CircuitBreaker: false, - }, - }, - }, - StartingCdpId: cdptypes.DefaultCdpStartingID, - GovDenom: cdptypes.DefaultGovDenom, - Cdps: cdptypes.Cdps{}, - PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), - }, - TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), - }, - } - return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -} diff --git a/deprecated/x/incentive/keeper/grpc_query.go b/deprecated/x/incentive/keeper/grpc_query.go deleted file mode 100644 index 408b73a1d..000000000 --- a/deprecated/x/incentive/keeper/grpc_query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/deprecated/x/incentive/keeper/grpc_query_params.go b/deprecated/x/incentive/keeper/grpc_query_params.go deleted file mode 100644 index 6f48d9702..000000000 --- a/deprecated/x/incentive/keeper/grpc_query_params.go +++ /dev/null @@ -1,26 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var params types.Params - ctx := sdk.UnwrapSDKContext(c) - - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ParamsKey)) - k.cdc.MustUnmarshal(store.Get(types.KeyPrefix(types.ParamsKey)), ¶ms) - - return &types.QueryParamsResponse{Params: ¶ms}, nil -} diff --git a/deprecated/x/incentive/keeper/hooks.go b/deprecated/x/incentive/keeper/hooks.go deleted file mode 100644 index 2e5749bc6..000000000 --- a/deprecated/x/incentive/keeper/hooks.go +++ /dev/null @@ -1,91 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// Hooks wrapper struct for hooks -type Hooks struct { - k Keeper -} - -var _ cdptypes.CdpHooks = Hooks{} -var _ stakingtypes.StakingHooks = Hooks{} - -// Hooks create new incentive hooks -func (k Keeper) Hooks() Hooks { return Hooks{k} } - -// ------------------- Cdp Module Hooks ------------------- - -// AfterCdpCreated function that runs after a cdp is created -func (h Hooks) AfterCdpCreated(ctx sdk.Context, cdp cdptypes.Cdp) { - h.k.InitializeCdpMintingClaim(ctx, cdp) -} - -// BeforeCdpModified function that runs before a cdp is modified -// note that this is called immediately after interest is synchronized, and so could potentially -// be called AfterCdpInterestUpdated or something like that, if we we're to expand the scope of cdp hooks -func (h Hooks) BeforeCdpModified(ctx sdk.Context, cdp cdptypes.Cdp) { - h.k.SynchronizeCdpMintingReward(ctx, cdp) -} - -// ------------------- Staking Module Hooks ------------------- - -// BeforeDelegationCreated runs before a delegation is created -func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { - return nil -} - -// BeforeDelegationSharesModified runs before an existing delegation is modified -func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { - return nil -} - -// NOTE: following hooks are just implemented to ensure StakingHooks interface compliance - -// BeforeValidatorSlashed is called before a validator is slashed -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { - return nil -} - -// AfterValidatorBeginUnbonding is called after a validator begins unbonding -func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { - return nil -} - -// AfterValidatorBonded is called after a validator is bonded -func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { - return nil -} - -// AfterDelegationModified runs after a delegation is modified -func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { - return nil -} - -// BeforeDelegationRemoved runs directly before a delegation is deleted -func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { - return nil -} - -// AfterValidatorCreated runs after a validator is created -func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { - return nil -} - -// BeforeValidatorModified runs before a validator is modified -func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { - return nil -} - -// AfterValidatorRemoved runs after a validator is removed -func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { - return nil -} - -func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error { - return nil -} diff --git a/deprecated/x/incentive/keeper/integration_test.go b/deprecated/x/incentive/keeper/integration_test.go deleted file mode 100644 index cef8cae27..000000000 --- a/deprecated/x/incentive/keeper/integration_test.go +++ /dev/null @@ -1,371 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// ununifitypes "github.com/UnUniFi/chain/deprecated/types" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" -// ) - -// func NewCDPGenStateMulti(tApp app.TestApp) app.GenesisState { -// cdpGenesis := cdptypes.GenesisState{ -// Params: cdptypes.Params{ -// CollateralParams: cdptypes.CollateralParams{ -// { -// Denom: "xrp", -// Type: "xrp-a", -// LiquidationRatio: sdk.MustNewDecFromStr("2.0"), -// DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), -// StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr -// LiquidationPenalty: d("0.05"), -// AuctionSize: i(7000000000), -// Prefix: 0x20, -// SpotMarketId: "xrp:jpy", -// LiquidationMarketId: "xrp:jpy", -// ConversionFactor: i(6), -// }, -// { -// Denom: "btc", -// Type: "btc-a", -// LiquidationRatio: sdk.MustNewDecFromStr("1.5"), -// DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), -// StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr -// LiquidationPenalty: d("0.025"), -// AuctionSize: i(10000000), -// Prefix: 0x21, -// SpotMarketId: "btc:jpy", -// LiquidationMarketId: "btc:jpy", -// ConversionFactor: i(8), -// }, -// { -// Denom: "bnb", -// Type: "bnb-a", -// LiquidationRatio: sdk.MustNewDecFromStr("1.5"), -// DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), -// StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr -// LiquidationPenalty: d("0.05"), -// AuctionSize: i(50000000000), -// Prefix: 0x22, -// SpotMarketId: "bnb:jpy", -// LiquidationMarketId: "bnb:jpy", -// ConversionFactor: i(8), -// }, -// { -// Denom: "bjpy", -// Type: "bjpy-a", -// LiquidationRatio: d("1.01"), -// DebtLimit: sdk.NewInt64Coin("jpu", 500000000000), -// StabilityFee: sdk.OneDec(), // %0 apr -// LiquidationPenalty: d("0.05"), -// AuctionSize: i(10000000000), -// Prefix: 0x23, -// SpotMarketId: "bjpy:jpy", -// LiquidationMarketId: "bjpy:jpy", -// ConversionFactor: i(8), -// }, -// { -// Denom: "xrp", -// Type: "xrp-b", -// LiquidationRatio: sdk.MustNewDecFromStr("2.0"), -// DebtLimit: sdk.NewInt64Coin("euu", 500000000000), -// StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr -// LiquidationPenalty: d("0.05"), -// AuctionSize: i(7000000000), -// Prefix: 0x24, -// SpotMarketId: "xrp:eur", -// LiquidationMarketId: "xrp:eur", -// ConversionFactor: i(6), -// }, -// { -// Denom: "btc", -// Type: "btc-b", -// LiquidationRatio: sdk.MustNewDecFromStr("1.5"), -// DebtLimit: sdk.NewInt64Coin("euu", 500000000000), -// StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr -// LiquidationPenalty: d("0.025"), -// AuctionSize: i(10000000), -// Prefix: 0x25, -// SpotMarketId: "btc:eur", -// LiquidationMarketId: "btc:eur", -// ConversionFactor: i(8), -// }, -// { -// Denom: "bnb", -// Type: "bnb-b", -// LiquidationRatio: sdk.MustNewDecFromStr("1.5"), -// DebtLimit: sdk.NewInt64Coin("euu", 500000000000), -// StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr -// LiquidationPenalty: d("0.05"), -// AuctionSize: i(50000000000), -// Prefix: 0x26, -// SpotMarketId: "bnb:eur", -// LiquidationMarketId: "bnb:eur", -// ConversionFactor: i(8), -// }, -// { -// Denom: "bjpy", -// Type: "bjpy-b", -// LiquidationRatio: d("1.01"), -// DebtLimit: sdk.NewInt64Coin("euu", 500000000000), -// StabilityFee: sdk.OneDec(), // %0 apr -// LiquidationPenalty: d("0.05"), -// AuctionSize: i(10000000000), -// Prefix: 0x27, -// SpotMarketId: "bjpy:eur", -// LiquidationMarketId: "bjpy:eur", -// ConversionFactor: i(8), -// }, -// }, -// DebtParams: cdptypes.DebtParams{ -// { -// Denom: "jpu", -// ReferenceAsset: "jpy", -// ConversionFactor: i(6), -// DebtFloor: i(10000000), -// GlobalDebtLimit: sdk.NewInt64Coin("jpu", 2000000000000), -// DebtDenom: "debtjpu", -// SurplusAuctionThreshold: sdk.NewInt(500000000000), -// SurplusAuctionLot: sdk.NewInt(10000000000), -// DebtAuctionThreshold: sdk.NewInt(100000000000), -// DebtAuctionLot: sdk.NewInt(10000000000), -// CircuitBreaker: false, -// }, -// { -// Denom: "euu", -// ReferenceAsset: "eur", -// ConversionFactor: i(6), -// DebtFloor: i(10000000), -// GlobalDebtLimit: sdk.NewInt64Coin("euu", 2000000000000), -// DebtDenom: "debteuu", -// SurplusAuctionThreshold: sdk.NewInt(500000000000), -// SurplusAuctionLot: sdk.NewInt(10000000000), -// DebtAuctionThreshold: sdk.NewInt(100000000000), -// DebtAuctionLot: sdk.NewInt(10000000000), -// CircuitBreaker: false, -// }, -// }, -// }, -// StartingCdpId: cdptypes.DefaultCdpStartingID, -// GovDenom: cdptypes.DefaultGovDenom, -// Cdps: cdptypes.Cdps{}, -// PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ -// cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), -// cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), -// cdptypes.NewGenesisAccumulationTime("bjpy-a", time.Time{}, sdk.OneDec()), -// cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), - -// cdptypes.NewGenesisAccumulationTime("btc-b", time.Time{}, sdk.OneDec()), -// cdptypes.NewGenesisAccumulationTime("xrp-b", time.Time{}, sdk.OneDec()), -// cdptypes.NewGenesisAccumulationTime("bjpy-b", time.Time{}, sdk.OneDec()), -// cdptypes.NewGenesisAccumulationTime("bnb-b", time.Time{}, sdk.OneDec()), -// }, -// TotalPrincipals: cdptypes.GenesisTotalPrincipals{ -// cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), -// cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), -// cdptypes.NewGenesisTotalPrincipal("bjpy-a", sdk.ZeroInt()), -// cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), - -// cdptypes.NewGenesisTotalPrincipal("btc-b", sdk.ZeroInt()), -// cdptypes.NewGenesisTotalPrincipal("xrp-b", sdk.ZeroInt()), -// cdptypes.NewGenesisTotalPrincipal("bjpy-b", sdk.ZeroInt()), -// cdptypes.NewGenesisTotalPrincipal("bnb-b", sdk.ZeroInt()), -// }, -// } -// return app.GenesisState{cdptypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&cdpGenesis)} -// } - -// func NewPricefeedGenStateMulti(tApp app.TestApp) app.GenesisState { -// pfGenesis := pricefeedtypes.GenesisState{ -// Params: pricefeedtypes.Params{ -// Markets: []pricefeedtypes.Market{ -// {MarketId: "kava:jpy", BaseAsset: "kava", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "btc:jpy", BaseAsset: "btc", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "xrp:jpy", BaseAsset: "xrp", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "bnb:jpy", BaseAsset: "bnb", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "bjpy:jpy", BaseAsset: "bjpy", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "zzz:jpy", BaseAsset: "zzz", QuoteAsset: "jpy", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - -// {MarketId: "kava:eur", BaseAsset: "kava", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "btc:eur", BaseAsset: "btc", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "xrp:eur", BaseAsset: "xrp", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "bnb:eur", BaseAsset: "bnb", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "bjpy:eur", BaseAsset: "bjpy", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// {MarketId: "zzz:eur", BaseAsset: "zzz", QuoteAsset: "eur", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, -// }, -// }, -// PostedPrices: []pricefeedtypes.PostedPrice{ -// { -// MarketId: "kava:jpy", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("2.00"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "btc:jpy", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("8000.00"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "xrp:jpy", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("0.25"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "bnb:jpy", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("17.25"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "bjpy:jpy", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.OneDec(), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "zzz:jpy", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("2.00"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "kava:eur", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("2.00"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "btc:eur", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("8000.00"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "xrp:eur", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("0.25"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "bnb:eur", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("17.25"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "bjpy:eur", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.OneDec(), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// { -// MarketId: "zzz:eur", -// OracleAddress: ununifitypes.StringAccAddress{}, -// Price: sdk.MustNewDecFromStr("2.00"), -// Expiry: time.Now().Add(1 * time.Hour), -// }, -// }, -// } -// return app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pfGenesis)} -// } - -// /* Question: Not necessary for jpu because hard module does not exist? -// func NewHardGenStateMulti() app.GenesisState { -// loanToValue, _ := sdk.NewDecFromStr("0.6") -// borrowLimit := sdk.NewDec(1000000000000000) - -// hardGS := hard.NewGenesisState(hard.NewParams( -// hard.MoneyMarkets{ -// hard.NewMoneyMarket("jpu", hard.NewBorrowLimit(false, borrowLimit, loanToValue), "jpu:jpy", sdk.NewInt(1000000), hard.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), -// hard.NewMoneyMarket("uguu", hard.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:jpy", sdk.NewInt(1000000), hard.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), -// hard.NewMoneyMarket("bnb", hard.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:jpy", sdk.NewInt(1000000), hard.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), -// hard.NewMoneyMarket("btcb", hard.NewBorrowLimit(false, borrowLimit, loanToValue), "btc:jpy", sdk.NewInt(1000000), hard.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), -// hard.NewMoneyMarket("xrp", hard.NewBorrowLimit(false, borrowLimit, loanToValue), "xrp:jpy", sdk.NewInt(1000000), hard.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), -// hard.NewMoneyMarket("zzz", hard.NewBorrowLimit(false, borrowLimit, loanToValue), "zzz:jpy", sdk.NewInt(1000000), hard.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), -// }, -// sdk.NewDec(10), -// ), hard.DefaultAccumulationTimes, hard.DefaultDeposits, hard.DefaultBorrows, -// hard.DefaultTotalSupplied, hard.DefaultTotalBorrowed, hard.DefaultTotalReserves, -// ) - -// return app.GenesisState{hard.ModuleName: hard.ModuleCdc.MustMarshalJSON(hardGS)} -// } -// */ - -// func NewAuthGenState(tApp app.TestApp, addresses []sdk.AccAddress, coins sdk.Coins) app.GenesisState { -// coinsList := []sdk.Coins{} -// for range addresses { -// coinsList = append(coinsList, coins) -// } - -// // Load up our primary user address -// if len(addresses) >= 4 { -// coinsList[3] = sdk.NewCoins( -// sdk.NewCoin("bnb", sdk.NewInt(1000000000000000)), -// sdk.NewCoin("uguu", sdk.NewInt(1000000000000000)), -// sdk.NewCoin("btcb", sdk.NewInt(1000000000000000)), -// sdk.NewCoin("xrp", sdk.NewInt(1000000000000000)), -// sdk.NewCoin("zzz", sdk.NewInt(1000000000000000)), -// ) -// } - -// return app.NewAuthGenState(tApp, addresses, coinsList) -// } - -// func NewStakingGenesisState(tApp app.TestApp) app.GenesisState { -// genState := stakingtypes.DefaultGenesisState() -// genState.Params.BondDenom = "uguu" -// return app.GenesisState{ -// stakingtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(genState), -// } -// } - -// func (suite *KeeperTestSuite) SetupWithGenState() { -// _, allAddrs := app.GeneratePrivKeyAddressPairs(10) -// suite.addrs = allAddrs[:5] -// for _, a := range allAddrs[5:] { -// suite.validatorAddrs = append(suite.validatorAddrs, sdk.ValAddress(a)) -// } - -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - -// tApp.InitializeFromGenesisStates( -// NewAuthGenState(tApp, allAddrs, cs(c("uguu", 5_000_000))), -// NewStakingGenesisState(tApp), -// NewPricefeedGenStateMulti(tApp), -// NewCDPGenStateMulti(tApp), -// // NewHardGenStateMulti(), -// ) - -// /* Question: Not necessary for jpu because committee module does not exist? -// // Set up a god committee -// committeeModKeeper := tApp.GetCommitteeKeeper() -// godCommittee := committeetypes.Committee{ -// ID: 1, -// Description: "This committee is for testing.", -// Members: suite.addrs[:2], -// Permissions: []committeetypes.Permission{committeetypes.GodPermission{}}, -// VoteThreshold: d("0.667"), -// ProposalDuration: time.Hour * 24 * 7, -// } -// committeeModKeeper.SetCommittee(ctx, godCommittee) -// */ - -// suite.app = tApp -// suite.ctx = ctx -// suite.keeper = tApp.GetIncentiveKeeper() -// // suite.hardKeeper = tApp.GetHardKeeper() -// suite.stakingKeeper = tApp.GetStakingKeeper() -// // suite.committeeKeeper = committeeModKeeper -// } diff --git a/deprecated/x/incentive/keeper/keeper.go b/deprecated/x/incentive/keeper/keeper.go deleted file mode 100644 index e7ed50691..000000000 --- a/deprecated/x/incentive/keeper/keeper.go +++ /dev/null @@ -1,173 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -type ( - Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramSpace paramtypes.Subspace - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - cdpKeeper types.CdpKeeper - } -) - -func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, - paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - cdpKeeper types.CdpKeeper) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramSpace: paramSpace, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - cdpKeeper: cdpKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// GetCdpMintingClaim returns the claim in the store corresponding the the input address collateral type and id and a boolean for if the claim was found -func (k Keeper) GetCdpMintingClaim(ctx sdk.Context, addr sdk.AccAddress) (types.CdpMintingClaim, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey)) - bz := store.Get(addr) - if bz == nil { - return types.CdpMintingClaim{}, false - } - var c types.CdpMintingClaim - k.cdc.MustUnmarshal(bz, &c) - return c, true -} - -// SetCdpMintingClaim sets the claim in the store corresponding to the input address, collateral type, and id -func (k Keeper) SetCdpMintingClaim(ctx sdk.Context, c types.CdpMintingClaim) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey)) - bz := k.cdc.MustMarshal(&c) - store.Set(c.Owner, bz) - -} - -// DeleteCdpMintingClaim deletes the claim in the store corresponding to the input address, collateral type, and id -func (k Keeper) DeleteCdpMintingClaim(ctx sdk.Context, owner sdk.AccAddress) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey)) - store.Delete(owner) -} - -// IterateCdpMintingClaims iterates over all claim objects in the store and preforms a callback function -func (k Keeper) IterateCdpMintingClaims(ctx sdk.Context, cb func(c types.CdpMintingClaim) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingClaimKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var c types.CdpMintingClaim - k.cdc.MustUnmarshal(iterator.Value(), &c) - if cb(c) { - break - } - } -} - -// GetAllCdpMintingClaims returns all Claim objects in the store -func (k Keeper) GetAllCdpMintingClaims(ctx sdk.Context) types.CdpMintingClaims { - cs := types.CdpMintingClaims{} - k.IterateCdpMintingClaims(ctx, func(c types.CdpMintingClaim) (stop bool) { - cs = append(cs, c) - return false - }) - return cs -} - -// GetPreviousCdpMintingAccrualTime returns the last time a collateral type accrued Cdp minting rewards -func (k Keeper) GetPreviousCdpMintingAccrualTime(ctx sdk.Context, ctype string) (blockTime time.Time, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousCdpMintingRewardAccrualTimeKey)) - bz := store.Get([]byte(ctype)) - if bz == nil { - return time.Time{}, false - } - blockTime.UnmarshalBinary(bz) - - return blockTime, true -} - -// SetPreviousCdpMintingAccrualTime sets the last time a collateral type accrued Cdp minting rewards -func (k Keeper) SetPreviousCdpMintingAccrualTime(ctx sdk.Context, ctype string, blockTime time.Time) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousCdpMintingRewardAccrualTimeKey)) - bz, _ := blockTime.MarshalBinary() - store.Set([]byte(ctype), bz) -} - -// IterateCdpMintingAccrualTimes iterates over all previous Cdp minting accrual times and preforms a callback function -func (k Keeper) IterateCdpMintingAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PreviousCdpMintingRewardAccrualTimeKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var accrualTime time.Time - var collateralType string - collateralType = string(iterator.Value()) - accrualTime.UnmarshalBinary(iterator.Value()) - if cb(collateralType, accrualTime) { - break - } - } -} - -// GetCdpMintingRewardFactor returns the current reward factor for an individual collateral type -func (k Keeper) GetCdpMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdk.Dec, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingRewardFactorKey)) - bz := store.Get([]byte(ctype)) - if bz == nil { - return sdk.ZeroDec(), false - } - factor.Unmarshal(bz) - - return factor, true -} - -// SetCdpMintingRewardFactor sets the current reward factor for an individual collateral type -func (k Keeper) SetCdpMintingRewardFactor(ctx sdk.Context, ctype string, factor sdk.Dec) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CdpMintingRewardFactorKey)) - bz, _ := factor.Marshal() - store.Set([]byte(ctype), bz) -} - -func (k Keeper) GetGenesisDenoms(ctx sdk.Context) (_ *types.GenesisDenoms, found bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyPrefix(types.GenesisDenomsKey)) - if bz == nil { - return types.DefaultGenesisDenoms(), false - } - var denoms types.GenesisDenoms - denoms.Unmarshal(bz) - - return &denoms, true -} - -func (k Keeper) SetGenesisDenoms(ctx sdk.Context, denoms *types.GenesisDenoms) { - store := ctx.KVStore(k.storeKey) - bz, _ := denoms.Marshal() - store.Set(types.KeyPrefix(types.GenesisDenomsKey), bz) -} diff --git a/deprecated/x/incentive/keeper/keeper_test.go b/deprecated/x/incentive/keeper/keeper_test.go deleted file mode 100644 index f0ce7df3c..000000000 --- a/deprecated/x/incentive/keeper/keeper_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package keeper_test - -// import ( -// "testing" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// // authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" -// stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - -// // supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// // committeekeeper "github.com/UnUniFi/chain/x/committee/keeper" -// // hardkeeper "github.com/UnUniFi/chain/x/hard/keeper" - -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/deprecated/x/incentive/keeper" -// "github.com/UnUniFi/chain/deprecated/x/incentive/types" -// ) - -// // Test suite used for all keeper tests -// type KeeperTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// // hardKeeper hardkeeper.Keeper -// stakingKeeper *stakingkeeper.Keeper -// // committeeKeeper committeekeeper.Keeper -// app app.TestApp -// ctx sdk.Context -// addrs []sdk.AccAddress -// validatorAddrs []sdk.ValAddress -// } - -// // The default state used by each test -// func (suite *KeeperTestSuite) SetupTest() { -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - -// tApp.InitializeFromGenesisStates() - -// _, addrs := app.GeneratePrivKeyAddressPairs(5) -// keeper := tApp.GetIncentiveKeeper() -// suite.app = tApp -// suite.ctx = ctx -// suite.keeper = keeper -// suite.addrs = addrs -// } - -// func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { -// ak := suite.app.GetAccountKeeper() -// return ak.GetAccount(suite.ctx, addr) -// } - -// func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { -// sk := suite.app.GetAccountKeeper() -// return sk.GetModuleAccount(suite.ctx, name) -// } - -// func (suite *KeeperTestSuite) TestGetSetDeleteCdpMintingClaim() { -// c := types.NewCdpMintingClaim(suite.addrs[0], c("uguu", 1000000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdk.ZeroDec())}) -// _, found := suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().False(found) -// suite.Require().NotPanics(func() { -// suite.keeper.SetCdpMintingClaim(suite.ctx, c) -// }) -// testC, found := suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(c, testC) -// suite.Require().NotPanics(func() { -// suite.keeper.DeleteCdpMintingClaim(suite.ctx, suite.addrs[0]) -// }) -// _, found = suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().False(found) -// } - -// func (suite *KeeperTestSuite) TestIterateJPYXMintingClaims() { -// for i := 0; i < len(suite.addrs); i++ { -// c := types.NewCdpMintingClaim(suite.addrs[i], c("uguu", 100000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdk.ZeroDec())}) -// suite.Require().NotPanics(func() { -// suite.keeper.SetCdpMintingClaim(suite.ctx, c) -// }) -// } -// claims := types.CdpMintingClaims{} -// suite.keeper.IterateCdpMintingClaims(suite.ctx, func(c types.CdpMintingClaim) bool { -// claims = append(claims, c) -// return false -// }) -// suite.Require().Equal(len(suite.addrs), len(claims)) - -// claims = suite.keeper.GetAllCdpMintingClaims(suite.ctx) -// suite.Require().Equal(len(suite.addrs), len(claims)) -// } - -// func (suite *KeeperTestSuite) fundAccount(ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins) error { -// err := suite.app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, coins) -// if err != nil { -// return err -// } -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, coins) -// return err -// } - -// func (suite *KeeperTestSuite) createPeriodicVestingAccount(origVesting sdk.Coins, periods vestingtypes.Periods, startTime, endTime int64) (*vestingtypes.PeriodicVestingAccount, error) { -// _, addr := app.GeneratePrivKeyAddressPairs(1) -// bacc := authtypes.NewBaseAccountWithAddress(addr[0]) -// suite.fundAccount(suite.ctx, bacc.GetAddress(), origVesting) -// bva := vestingtypes.NewBaseVestingAccount(bacc, origVesting, endTime) -// err := bva.Validate() -// if err != nil { -// return &vestingtypes.PeriodicVestingAccount{}, err -// } -// pva := vestingtypes.NewPeriodicVestingAccountRaw(bva, startTime, periods) -// err = pva.Validate() -// if err != nil { -// return &vestingtypes.PeriodicVestingAccount{}, err -// } -// return pva, nil -// } - -// // Avoid cluttering test cases with long function names -// func i(in int64) sdk.Int { return sdk.NewInt(in) } -// func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } -// func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } -// func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } - -// func TestKeeperTestSuite(t *testing.T) { -// suite.Run(t, new(KeeperTestSuite)) -// } diff --git a/deprecated/x/incentive/keeper/params.go b/deprecated/x/incentive/keeper/params.go deleted file mode 100644 index 587fa9ba5..000000000 --- a/deprecated/x/incentive/keeper/params.go +++ /dev/null @@ -1,46 +0,0 @@ -package keeper - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return params -} - -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} - -// GetCdpMintingRewardPeriod returns the reward period with the specified collateral type if it's found in the params -func (k Keeper) GetCdpMintingRewardPeriod(ctx sdk.Context, collateralType string) (types.RewardPeriod, bool) { - params := k.GetParams(ctx) - for _, rp := range params.CdpMintingRewardPeriods { - if rp.CollateralType == collateralType { - return rp, true - } - } - return types.RewardPeriod{}, false -} - -// GetMultiplier returns the multiplier with the specified name if it's found in the params -func (k Keeper) GetMultiplier(ctx sdk.Context, name string) (types.Multiplier, bool) { - params := k.GetParams(ctx) - for _, m := range params.ClaimMultipliers { - if m.Name == name { - return m, true - } - } - return types.Multiplier{}, false -} - -// GetClaimEnd returns the claim end time for the params -func (k Keeper) GetClaimEnd(ctx sdk.Context) time.Time { - params := k.GetParams(ctx) - return params.ClaimEnd -} diff --git a/deprecated/x/incentive/keeper/payout.go b/deprecated/x/incentive/keeper/payout.go deleted file mode 100644 index 8284af4b5..000000000 --- a/deprecated/x/incentive/keeper/payout.go +++ /dev/null @@ -1,250 +0,0 @@ -package keeper - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -const ( - // BeginningOfMonth harvest rewards that are claimed after the 15th at 14:00UTC of the month always vest on the first of the month - BeginningOfMonth = 1 - // MidMonth harvest rewards that are claimed before the 15th at 14:00UTC of the month always vest on the 15 of the month - MidMonth = 15 - // PaymentHour harvest rewards always vest at 14:00UTC - PaymentHour = 14 -) - -// ClaimCdpMintingReward sends the reward amount to the input address and zero's out the claim in the store -func (k Keeper) ClaimCdpMintingReward(ctx sdk.Context, addr sdk.AccAddress, multiplierName string) error { - claim, found := k.GetCdpMintingClaim(ctx, addr) - if !found { - return sdkerrors.Wrapf(types.ErrClaimNotFound, "address: %s", addr) - } - - multiplier, found := k.GetMultiplier(ctx, multiplierName) - if !found { - return sdkerrors.Wrapf(types.ErrInvalidMultiplier, string(multiplierName)) - } - - claimEnd := k.GetClaimEnd(ctx) - - if ctx.BlockTime().After(claimEnd) { - return sdkerrors.Wrapf(types.ErrClaimExpired, "block time %s > claim end time %s", ctx.BlockTime(), claimEnd) - } - - claim, err := k.SynchronizeCdpMintingClaim(ctx, claim) - if err != nil { - return err - } - - rewardAmount := sdk.NewDecFromInt(claim.Reward.Amount).Mul(multiplier.Factor).RoundInt() - if rewardAmount.IsZero() { - return types.ErrZeroClaim - } - rewardCoin := sdk.NewCoin(claim.Reward.Denom, rewardAmount) - length, err := k.GetPeriodLength(ctx, multiplier) - if err != nil { - return err - } - - err = k.SendTimeLockedCoinsToAccount(ctx, types.IncentiveMacc, addr, sdk.NewCoins(rewardCoin), length) - if err != nil { - return err - } - - k.ZeroCdpMintingClaim(ctx, claim) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeClaim, - sdk.NewAttribute(types.AttributeKeyClaimedBy, claim.GetOwner().String()), - sdk.NewAttribute(types.AttributeKeyClaimAmount, claim.GetReward().String()), - sdk.NewAttribute(types.AttributeKeyClaimAmount, claim.GetType()), - ), - ) - return nil -} - -// SendTimeLockedCoinsToAccount sends time-locked coins from the input module account to the recipient. If the recipients account is not a vesting account and the input length is greater than zero, the recipient account is converted to a periodic vesting account and the coins are added to the vesting balance as a vesting period with the input length. -func (k Keeper) SendTimeLockedCoinsToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, length int64) error { - macc := k.accountKeeper.GetModuleAccount(ctx, senderModule) - - if !k.bankKeeper.GetAllBalances(ctx, macc.GetAddress()).IsAllGTE(amt) { - return sdkerrors.Wrapf(types.ErrInsufficientModAccountBalance, "%s", senderModule) - } - - // 0. Get the account from the account keeper and do a type switch, error if it's a validator vesting account or module account (can make this work for validator vesting later if necessary) - acc := k.accountKeeper.GetAccount(ctx, recipientAddr) - if acc == nil { - return sdkerrors.Wrapf(types.ErrAccountNotFound, recipientAddr.String()) - } - if length == 0 { - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt) - } - - switch acc.(type) { - case authtypes.ModuleAccountI: - return sdkerrors.Wrapf(types.ErrInvalidAccountType, "%T", acc) - case *vestingtypes.PeriodicVestingAccount: - return k.SendTimeLockedCoinsToPeriodicVestingAccount(ctx, senderModule, recipientAddr, amt, length) - case *authtypes.BaseAccount: - return k.SendTimeLockedCoinsToBaseAccount(ctx, senderModule, recipientAddr, amt, length) - default: - return sdkerrors.Wrapf(types.ErrInvalidAccountType, "%T", acc) - } -} - -// SendTimeLockedCoinsToPeriodicVestingAccount sends time-locked coins from the input module account to the recipient -func (k Keeper) SendTimeLockedCoinsToPeriodicVestingAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, length int64) error { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt) - if err != nil { - return err - } - k.addCoinsToVestingSchedule(ctx, recipientAddr, amt, length) - return nil -} - -// SendTimeLockedCoinsToBaseAccount sends time-locked coins from the input module account to the recipient, converting the recipient account to a vesting account -func (k Keeper) SendTimeLockedCoinsToBaseAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, length int64) error { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt) - if err != nil { - return err - } - acc := k.accountKeeper.GetAccount(ctx, recipientAddr) - // transition the account to a periodic vesting account: - bacc := authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence()) - newPeriods := vestingtypes.Periods{types.NewPeriod(amt, length)} - bva := vestingtypes.NewBaseVestingAccount(bacc, amt, ctx.BlockTime().Unix()+length) - - pva := vestingtypes.NewPeriodicVestingAccountRaw(bva, ctx.BlockTime().Unix(), newPeriods) - k.accountKeeper.SetAccount(ctx, pva) - return nil -} - -// GetPeriodLength returns the length of the period based on the input blocktime and multiplier -// note that pay dates are always the 1st or 15th of the month at 14:00UTC. -func (k Keeper) GetPeriodLength(ctx sdk.Context, multiplier types.Multiplier) (int64, error) { - - if multiplier.MonthsLockup == 0 { - return 0, nil - } - switch types.MultiplierName(multiplier.Name) { - case types.Small, types.Medium, types.Large: - currentDay := ctx.BlockTime().Day() - payDay := BeginningOfMonth - monthOffset := int64(1) - if currentDay < MidMonth || (currentDay == MidMonth && ctx.BlockTime().Hour() < PaymentHour) { - payDay = MidMonth - monthOffset = int64(0) - } - periodEndDate := time.Date(ctx.BlockTime().Year(), ctx.BlockTime().Month(), payDay, PaymentHour, 0, 0, 0, time.UTC).AddDate(0, int(multiplier.MonthsLockup+monthOffset), 0) - return periodEndDate.Unix() - ctx.BlockTime().Unix(), nil - default: - return 0, types.ErrInvalidMultiplier - } -} - -// addCoinsToVestingSchedule adds coins to the input account's vesting schedule where length is the amount of time (from the current block time), in seconds, that the coins will be vesting for -// the input address must be a periodic vesting account -func (k Keeper) addCoinsToVestingSchedule(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins, length int64) { - acc := k.accountKeeper.GetAccount(ctx, addr) - vacc := acc.(*vestingtypes.PeriodicVestingAccount) - // Add the new vesting coins to OriginalVesting - vacc.OriginalVesting = vacc.OriginalVesting.Add(amt...) - // update vesting periods - // EndTime = 100 - // BlockTime = 110 - // length == 6 - if vacc.EndTime < ctx.BlockTime().Unix() { - // edge case one - the vesting account's end time is in the past (ie, all previous vesting periods have completed) - // append a new period to the vesting account, update the end time, update the account in the store and return - newPeriodLength := (ctx.BlockTime().Unix() - vacc.EndTime) + length // 110 - 100 + 6 = 16 - newPeriod := types.NewPeriod(amt, newPeriodLength) - vacc.VestingPeriods = append(vacc.VestingPeriods, newPeriod) - vacc.EndTime = ctx.BlockTime().Unix() + length - k.accountKeeper.SetAccount(ctx, vacc) - return - } - // StartTime = 110 - // BlockTime = 100 - // length = 6 - if vacc.StartTime > ctx.BlockTime().Unix() { - // edge case two - the vesting account's start time is in the future (all periods have not started) - // update the start time to now and adjust the period lengths in place - a new period will be inserted in the next code block - updatedPeriods := vestingtypes.Periods{} - for i, period := range vacc.VestingPeriods { - updatedPeriod := period - if i == 0 { - updatedPeriod = types.NewPeriod(period.Amount, (vacc.StartTime-ctx.BlockTime().Unix())+period.Length) // 110 - 100 + 6 = 16 - } - updatedPeriods = append(updatedPeriods, updatedPeriod) - } - vacc.VestingPeriods = updatedPeriods - vacc.StartTime = ctx.BlockTime().Unix() - } - - // logic for inserting a new vesting period into the existing vesting schedule - remainingLength := vacc.EndTime - ctx.BlockTime().Unix() - elapsedTime := ctx.BlockTime().Unix() - vacc.StartTime - proposedEndTime := ctx.BlockTime().Unix() + length - if remainingLength < length { - // in the case that the proposed length is longer than the remaining length of all vesting periods, create a new period with length equal to the difference between the proposed length and the previous total length - newPeriodLength := length - remainingLength - newPeriod := types.NewPeriod(amt, newPeriodLength) - vacc.VestingPeriods = append(vacc.VestingPeriods, newPeriod) - // update the end time so that the sum of all period lengths equals endTime - startTime - vacc.EndTime = proposedEndTime - } else { - // In the case that the proposed length is less than or equal to the sum of all previous period lengths, insert the period and update other periods as necessary. - // EXAMPLE (l is length, a is amount) - // Original Periods: {[l: 1 a: 1], [l: 2, a: 1], [l:8, a:3], [l: 5, a: 3]} - // Period we want to insert [l: 5, a: x] - // Expected result: - // {[l: 1, a: 1], [l:2, a: 1], [l:2, a:x], [l:6, a:3], [l:5, a:3]} - - // StartTime = 100 - // Periods = [5,5,5,5] - // EndTime = 120 - // BlockTime = 101 - // length = 2 - - // for period in Periods: - // iteration 1: - // lengthCounter = 5 - // if 5 < 101 - 100 + 2 - no - // if 5 = 3 - no - // else - // newperiod = 2 - 0 - newPeriods := vestingtypes.Periods{} - lengthCounter := int64(0) - appendRemaining := false - for _, period := range vacc.VestingPeriods { - if appendRemaining { - newPeriods = append(newPeriods, period) - continue - } - lengthCounter += period.Length - if lengthCounter < elapsedTime+length { // 1 - newPeriods = append(newPeriods, period) - } else if lengthCounter == elapsedTime+length { - newPeriod := types.NewPeriod(period.Amount.Add(amt...), period.Length) - newPeriods = append(newPeriods, newPeriod) - appendRemaining = true - } else { - newPeriod := types.NewPeriod(amt, elapsedTime+length-types.GetTotalVestingPeriodLength(newPeriods)) - previousPeriod := types.NewPeriod(period.Amount, period.Length-newPeriod.Length) - newPeriods = append(newPeriods, newPeriod, previousPeriod) - appendRemaining = true - } - } - vacc.VestingPeriods = newPeriods - } - k.accountKeeper.SetAccount(ctx, vacc) - return -} diff --git a/deprecated/x/incentive/keeper/payout_test.go b/deprecated/x/incentive/keeper/payout_test.go deleted file mode 100644 index 93b3f36af..000000000 --- a/deprecated/x/incentive/keeper/payout_test.go +++ /dev/null @@ -1,644 +0,0 @@ -package keeper_test - -// import ( -// "errors" -// "strings" -// "time" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// sdk "github.com/cosmos/cosmos-sdk/types" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - -// "github.com/UnUniFi/chain/app" -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - -// "github.com/UnUniFi/chain/deprecated/x/incentive/types" -// ununifidisttypes "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -// ) - -// func (suite *KeeperTestSuite) TestPayoutCdpMintingClaim() { -// type args struct { -// ctype string -// rewardsPerSecond sdk.Coin -// initialTime time.Time -// initialCollateral sdk.Coin -// initialPrincipal sdk.Coin -// multipliers types.Multipliers -// multiplier types.MultiplierName -// timeElapsed int -// expectedBalance sdk.Coins -// expectedPeriods vestingtypes.Periods -// isPeriodicVestingAccount bool -// } -// type errArgs struct { -// expectPass bool -// contains string -// } -// type test struct { -// name string -// args args -// errArgs errArgs -// } -// testCases := []test{ -// { -// "valid 1 day", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialCollateral: c("bnb", 1000000000000), -// initialPrincipal: c("jpu", 10000000000), -// multipliers: types.Multipliers{types.NewMultiplier(types.MultiplierName("small"), 1, d("0.25")), types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0"))}, -// multiplier: types.MultiplierName("large"), -// timeElapsed: 86400, -// expectedBalance: cs(c("jpu", 10000000000), c("uguu", 10576385600)), -// expectedPeriods: vestingtypes.Periods{vestingtypes.Period{Length: 32918400, Amount: cs(c("uguu", 10571385600))}}, -// isPeriodicVestingAccount: true, -// }, -// errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// "invalid zero rewards", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 0), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialCollateral: c("bnb", 1000000000000), -// initialPrincipal: c("jpu", 10000000000), -// multipliers: types.Multipliers{types.NewMultiplier(types.MultiplierName("small"), 1, d("0.25")), types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0"))}, -// multiplier: types.MultiplierName("large"), -// timeElapsed: 86400, -// expectedBalance: cs(c("jpu", 10000000000)), -// expectedPeriods: vestingtypes.Periods{}, -// isPeriodicVestingAccount: false, -// }, -// errArgs{ -// expectPass: false, -// contains: "claim amount rounds to zero", -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // setup incentive state -// params := types.NewParams( -// types.RewardPeriods{types.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// tc.args.multipliers, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousCdpMintingAccrualTime(suite.ctx, tc.args.ctype, tc.args.initialTime) -// suite.keeper.SetCdpMintingRewardFactor(suite.ctx, tc.args.ctype, sdk.ZeroDec()) - -// // setup account state -// sk := suite.app.GetBankKeeper() -// err := sk.MintCoins(suite.ctx, cdptypes.ModuleName, sdk.NewCoins(tc.args.initialCollateral)) -// suite.Require().NoError(err) -// err = sk.SendCoinsFromModuleToAccount(suite.ctx, cdptypes.ModuleName, suite.addrs[0], sdk.NewCoins(tc.args.initialCollateral)) -// suite.Require().NoError(err) - -// // setup kavadist state -// err = sk.MintCoins(suite.ctx, ununifidisttypes.ModuleName, cs(c("uguu", 1000000000000))) -// suite.Require().NoError(err) - -// // setup cdp state -// cdpKeeper := suite.app.GetCDPKeeper() -// err = cdpKeeper.AddCdp(suite.ctx, suite.addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) -// suite.Require().NoError(err) - -// claim, found := suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) - -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) -// rewardPeriod, found := suite.keeper.GetCdpMintingRewardPeriod(suite.ctx, tc.args.ctype) -// suite.Require().True(found) -// err = suite.keeper.AccumulateCdpMintingRewards(suite.ctx, rewardPeriod) -// suite.Require().NoError(err) - -// err = suite.keeper.ClaimCdpMintingReward(suite.ctx, suite.addrs[0], string(tc.args.multiplier)) - -// if tc.errArgs.expectPass { -// suite.Require().NoError(err) -// ak := suite.app.GetAccountKeeper() -// acc := ak.GetAccount(suite.ctx, suite.addrs[0]) -// bk := suite.app.GetBankKeeper() -// suite.Require().Equal(tc.args.expectedBalance, bk.GetAllBalances(suite.ctx, acc.GetAddress())) - -// if tc.args.isPeriodicVestingAccount { -// vacc, ok := acc.(*vestingtypes.PeriodicVestingAccount) -// suite.Require().True(ok) -// suite.Require().Equal(tc.args.expectedPeriods, vestingtypes.Periods(vacc.VestingPeriods)) -// } - -// claim, found := suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(c("uguu", 0), claim.Reward) -// } else { -// suite.Require().Error(err) -// suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) -// } -// }) -// } -// } - -// func (suite *KeeperTestSuite) TestSendCoinsToPeriodicVestingAccount() { -// type accountArgs struct { -// periods vestingtypes.Periods -// origVestingCoins sdk.Coins -// startTime int64 -// endTime int64 -// } -// type args struct { -// accArgs accountArgs -// period vestingtypes.Period -// ctxTime time.Time -// mintModAccountCoins bool -// expectedPeriods vestingtypes.Periods -// expectedStartTime int64 -// expectedEndTime int64 -// } -// type errArgs struct { -// expectErr bool -// contains string -// } -// type testCase struct { -// name string -// args args -// errArgs errArgs -// } -// type testCases []testCase - -// tests := testCases{ -// { -// name: "insert period at beginning schedule", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 2, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(101, 0), -// mintModAccountCoins: true, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 3, Amount: cs(c("uguu", 6))}, -// vestingtypes.Period{Length: 2, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// expectedStartTime: 100, -// expectedEndTime: 120, -// }, -// errArgs: errArgs{ -// expectErr: false, -// contains: "", -// }, -// }, -// { -// name: "insert period at beginning with new start time", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 7, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(80, 0), -// mintModAccountCoins: true, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 7, Amount: cs(c("uguu", 6))}, -// vestingtypes.Period{Length: 18, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// expectedStartTime: 80, -// expectedEndTime: 120, -// }, -// errArgs: errArgs{ -// expectErr: false, -// contains: "", -// }, -// }, -// { -// name: "insert period in middle of schedule", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 7, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(101, 0), -// mintModAccountCoins: true, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 3, Amount: cs(c("uguu", 6))}, -// vestingtypes.Period{Length: 2, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// expectedStartTime: 100, -// expectedEndTime: 120, -// }, -// errArgs: errArgs{ -// expectErr: false, -// contains: "", -// }, -// }, -// { -// name: "append to end of schedule", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 7, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(125, 0), -// mintModAccountCoins: true, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 12, Amount: cs(c("uguu", 6))}}, -// expectedStartTime: 100, -// expectedEndTime: 132, -// }, -// errArgs: errArgs{ -// expectErr: false, -// contains: "", -// }, -// }, -// { -// name: "add coins to existing period", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(110, 0), -// mintModAccountCoins: true, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 11))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// expectedStartTime: 100, -// expectedEndTime: 120, -// }, -// errArgs: errArgs{ -// expectErr: false, -// contains: "", -// }, -// }, -// { -// name: "insufficient mod account balance", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 7, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(125, 0), -// mintModAccountCoins: false, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 12, Amount: cs(c("uguu", 6))}}, -// expectedStartTime: 100, -// expectedEndTime: 132, -// }, -// errArgs: errArgs{ -// expectErr: true, -// contains: "insufficient funds", -// }, -// }, -// { -// name: "add large period mid schedule", -// args: args{ -// accArgs: accountArgs{ -// periods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}}, -// origVestingCoins: cs(c("uguu", 20)), -// startTime: 100, -// endTime: 120, -// }, -// period: vestingtypes.Period{Length: 50, Amount: cs(c("uguu", 6))}, -// ctxTime: time.Unix(110, 0), -// mintModAccountCoins: true, -// expectedPeriods: vestingtypes.Periods{ -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 5, Amount: cs(c("uguu", 5))}, -// vestingtypes.Period{Length: 40, Amount: cs(c("uguu", 6))}}, -// expectedStartTime: 100, -// expectedEndTime: 160, -// }, -// errArgs: errArgs{ -// expectErr: false, -// contains: "", -// }, -// }, -// } -// for _, tc := range tests { -// suite.Run(tc.name, func() { -// // create the periodic vesting account -// pva, err := suite.createPeriodicVestingAccount(tc.args.accArgs.origVestingCoins, tc.args.accArgs.periods, tc.args.accArgs.startTime, tc.args.accArgs.endTime) -// suite.Require().NoError(err) - -// // setup store state with account and kavadist module account -// suite.ctx = suite.ctx.WithBlockTime(tc.args.ctxTime) -// ak := suite.app.GetAccountKeeper() -// ak.SetAccount(suite.ctx, pva) -// // mint module account coins if required -// if tc.args.mintModAccountCoins { -// sk := suite.app.GetBankKeeper() -// err = sk.MintCoins(suite.ctx, ununifidisttypes.ModuleName, tc.args.period.Amount) -// suite.Require().NoError(err) -// } - -// err = suite.keeper.SendTimeLockedCoinsToPeriodicVestingAccount(suite.ctx, ununifidisttypes.ModuleName, pva.GetAddress(), tc.args.period.Amount, tc.args.period.Length) -// if tc.errArgs.expectErr { -// suite.Require().Error(err) -// suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) -// } else { -// suite.Require().NoError(err) - -// acc := suite.getAccount(pva.GetAddress()) -// vacc, ok := acc.(*vestingtypes.PeriodicVestingAccount) -// suite.Require().True(ok) -// suite.Require().Equal(tc.args.expectedPeriods, vestingtypes.Periods(vacc.VestingPeriods)) -// suite.Require().Equal(tc.args.expectedStartTime, vacc.StartTime) -// suite.Require().Equal(tc.args.expectedEndTime, vacc.EndTime) -// } -// }) -// } -// } - -// func (suite *KeeperTestSuite) TestSendCoinsToBaseAccount() { -// suite.SetupWithAccountState() -// // send coins to base account -// err := suite.keeper.SendTimeLockedCoinsToAccount(suite.ctx, ununifidisttypes.ModuleName, suite.addrs[1], cs(c("uguu", 100)), 5) -// suite.Require().NoError(err) -// acc := suite.getAccount(suite.addrs[1]) -// vacc, ok := acc.(*vestingtypes.PeriodicVestingAccount) -// suite.True(ok) -// expectedPeriods := vestingtypes.Periods{ -// vestingtypes.Period{Length: int64(5), Amount: cs(c("uguu", 100))}, -// } -// bk := suite.app.GetBankKeeper() -// suite.Equal(expectedPeriods, vestingtypes.Periods(vacc.VestingPeriods)) -// suite.Equal(cs(c("uguu", 100)), vacc.OriginalVesting) -// suite.Equal(cs(c("uguu", 500)), bk.GetAllBalances(suite.ctx, vacc.GetAddress())) -// suite.Equal(int64(105), vacc.EndTime) -// suite.Equal(int64(100), vacc.StartTime) - -// } - -// func (suite *KeeperTestSuite) TestSendCoinsToInvalidAccount() { -// suite.SetupWithAccountState() -// err := suite.keeper.SendTimeLockedCoinsToAccount(suite.ctx, ununifidisttypes.ModuleName, suite.addrs[2], cs(c("uguu", 100)), 5) -// suite.Require().True(errors.Is(err, types.ErrInvalidAccountType)) -// macc := suite.getModuleAccount(cdptypes.ModuleName) -// err = suite.keeper.SendTimeLockedCoinsToAccount(suite.ctx, ununifidisttypes.ModuleName, macc.GetAddress(), cs(c("uguu", 100)), 5) -// suite.Require().True(errors.Is(err, types.ErrInvalidAccountType)) -// } - -// func (suite *KeeperTestSuite) SetupWithAccountState() { -// // creates a new app state with 4 funded addresses and 1 module account -// tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: time.Unix(100, 0)}) -// _, addrs := app.GeneratePrivKeyAddressPairs(4) -// authGS := app.NewAuthGenState( -// tApp, -// addrs, -// []sdk.Coins{ -// cs(c("uguu", 400)), -// cs(c("uguu", 400)), -// cs(c("uguu", 400)), -// cs(c("uguu", 400)), -// }) -// tApp.InitializeFromGenesisStates( -// authGS, -// ) -// ak := tApp.GetAccountKeeper() -// bk := tApp.GetBankKeeper() -// macc := ak.GetModuleAccount(ctx, ununifidisttypes.ModuleName) -// err := bk.MintCoins(ctx, macc.GetName(), cs(c("uguu", 600))) -// suite.Require().NoError(err) - -// // sets addrs[0] to be a periodic vesting account -// ak = tApp.GetAccountKeeper() -// acc := ak.GetAccount(ctx, addrs[0]) -// bacc := authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence()) -// periods := vestingtypes.Periods{ -// vestingtypes.Period{Length: int64(1), Amount: cs(c("uguu", 100))}, -// vestingtypes.Period{Length: int64(2), Amount: cs(c("uguu", 100))}, -// vestingtypes.Period{Length: int64(8), Amount: cs(c("uguu", 100))}, -// vestingtypes.Period{Length: int64(5), Amount: cs(c("uguu", 100))}, -// } -// bva := vestingtypes.NewBaseVestingAccount(bacc, cs(c("uguu", 400)), ctx.BlockTime().Unix()+16) -// // suite.Require().NoError(err2) -// pva := vestingtypes.NewPeriodicVestingAccountRaw(bva, ctx.BlockTime().Unix(), periods) -// ak.SetAccount(ctx, pva) - -// // sets addrs[2] to be a validator vesting account -// acc = ak.GetAccount(ctx, addrs[2]) -// bacc = authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence()) -// bva = vestingtypes.NewBaseVestingAccount(bacc, cs(c("uguu", 400)), ctx.BlockTime().Unix()+16) -// // suite.Require().NoError(err2) -// // vva := validatorvesting.NewValidatorVestingAccountRaw(bva, ctx.BlockTime().Unix(), periods, sdk.ConsAddress{}, nil, 90) -// // ak.SetAccount(ctx, vva) -// ak.SetAccount(ctx, bva) -// suite.app = tApp -// suite.keeper = tApp.GetIncentiveKeeper() -// suite.ctx = ctx -// suite.addrs = addrs -// } - -// func (suite *KeeperTestSuite) TestGetPeriodLength() { -// type args struct { -// blockTime time.Time -// multiplier types.Multiplier -// expectedLength int64 -// } -// type errArgs struct { -// expectPass bool -// contains string -// } -// type periodTest struct { -// name string -// args args -// errArgs errArgs -// } -// testCases := []periodTest{ -// { -// name: "first half of month", -// args: args{ -// blockTime: time.Date(2020, 11, 2, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 6, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2021, 5, 15, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 11, 2, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "first half of month long lockup", -// args: args{ -// blockTime: time.Date(2020, 11, 2, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 24, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2022, 11, 15, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 11, 2, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "second half of month", -// args: args{ -// blockTime: time.Date(2020, 12, 31, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 6, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2021, 7, 1, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 12, 31, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "second half of month long lockup", -// args: args{ -// blockTime: time.Date(2020, 12, 31, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Large, 24, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2023, 1, 1, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 12, 31, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "end of feb", -// args: args{ -// blockTime: time.Date(2021, 2, 28, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 6, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2021, 9, 1, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2021, 2, 28, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "leap year", -// args: args{ -// blockTime: time.Date(2020, 2, 29, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 6, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2020, 9, 1, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 2, 29, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "leap year long lockup", -// args: args{ -// blockTime: time.Date(2020, 2, 29, 15, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Large, 24, sdk.MustNewDecFromStr("1")), -// expectedLength: time.Date(2022, 3, 1, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 2, 29, 15, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "exactly half of month", -// args: args{ -// blockTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 6, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2021, 7, 1, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// { -// name: "just before half of month", -// args: args{ -// blockTime: time.Date(2020, 12, 15, 13, 59, 59, 0, time.UTC), -// multiplier: types.NewMultiplier(types.Medium, 6, sdk.MustNewDecFromStr("0.333333")), -// expectedLength: time.Date(2021, 6, 15, 14, 0, 0, 0, time.UTC).Unix() - time.Date(2020, 12, 15, 13, 59, 59, 0, time.UTC).Unix(), -// }, -// errArgs: errArgs{ -// expectPass: true, -// contains: "", -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// ctx := suite.ctx.WithBlockTime(tc.args.blockTime) -// length, err := suite.keeper.GetPeriodLength(ctx, tc.args.multiplier) -// if tc.errArgs.expectPass { -// suite.Require().NoError(err) -// suite.Require().Equal(tc.args.expectedLength, length) -// } else { -// suite.Require().Error(err) -// } -// }) -// } -// } diff --git a/deprecated/x/incentive/keeper/rewards.go b/deprecated/x/incentive/keeper/rewards.go deleted file mode 100644 index 7cc24c6b0..000000000 --- a/deprecated/x/incentive/keeper/rewards.go +++ /dev/null @@ -1,227 +0,0 @@ -package keeper - -import ( - "math" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -// AccumulateCdpMintingRewards updates the rewards accumulated for the input reward period -func (k Keeper) AccumulateCdpMintingRewards(ctx sdk.Context, rewardPeriod types.RewardPeriod) error { - previousAccrualTime, found := k.GetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType) - if !found { - k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime()) - return nil - } - timeElapsed := CalculateTimeElapsed(rewardPeriod.Start, rewardPeriod.End, ctx.BlockTime(), previousAccrualTime) - if timeElapsed.IsZero() { - return nil - } - if rewardPeriod.RewardsPerSecond.Amount.IsZero() { - k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime()) - return nil - } - - denoms, _ := k.GetGenesisDenoms(ctx) - - totalPrincipal := sdk.NewDecFromInt(k.cdpKeeper.GetTotalPrincipal(ctx, rewardPeriod.CollateralType, denoms.PrincipalDenom)) - if totalPrincipal.IsZero() { - k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime()) - return nil - } - newRewards := timeElapsed.Mul(rewardPeriod.RewardsPerSecond.Amount) - cdpFactor, found := k.cdpKeeper.GetInterestFactor(ctx, rewardPeriod.CollateralType) - if !found { - k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime()) - return nil - } - rewardFactor := sdk.NewDecFromInt(newRewards).Mul(cdpFactor).Quo(totalPrincipal) - - previousRewardFactor, found := k.GetCdpMintingRewardFactor(ctx, rewardPeriod.CollateralType) - if !found { - previousRewardFactor = sdk.ZeroDec() - } - newRewardFactor := previousRewardFactor.Add(rewardFactor) - k.SetCdpMintingRewardFactor(ctx, rewardPeriod.CollateralType, newRewardFactor) - k.SetPreviousCdpMintingAccrualTime(ctx, rewardPeriod.CollateralType, ctx.BlockTime()) - return nil -} - -// InitializeCdpMintingClaim creates or updates a claim such that no new rewards are accrued, but any existing rewards are not lost. -// this function should be called after a cdp is created. If a user previously had a cdp, then closed it, they shouldn't -// accrue rewards during the period the cdp was closed. By setting the reward factor to the current global reward factor, -// any unclaimed rewards are preserved, but no new rewards are added. -func (k Keeper) InitializeCdpMintingClaim(ctx sdk.Context, cdp cdptypes.Cdp) { - _, found := k.GetCdpMintingRewardPeriod(ctx, cdp.Type) - if !found { - // this collateral type is not incentivized, do nothing - return - } - rewardFactor, found := k.GetCdpMintingRewardFactor(ctx, cdp.Type) - if !found { - rewardFactor = sdk.ZeroDec() - } - claim, found := k.GetCdpMintingClaim(ctx, cdp.Owner.AccAddress()) - - denoms, _ := k.GetGenesisDenoms(ctx) - - if !found { // this is the owner's first jpu minting reward claim - claim = types.NewCdpMintingClaim(cdp.Owner.AccAddress(), sdk.NewCoin(denoms.CdpMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{types.NewRewardIndex(cdp.Type, rewardFactor)}) - k.SetCdpMintingClaim(ctx, claim) - return - } - // the owner has an existing jpu minting reward claim - index, hasRewardIndex := claim.HasRewardIndex(cdp.Type) - if !hasRewardIndex { // this is the owner's first jpu minting reward for this collateral type - claim.RewardIndexes = append(claim.RewardIndexes, types.NewRewardIndex(cdp.Type, rewardFactor)) - } else { // the owner has a previous jpu minting reward for this collateral type - claim.RewardIndexes[index] = types.NewRewardIndex(cdp.Type, rewardFactor) - } - k.SetCdpMintingClaim(ctx, claim) -} - -// SynchronizeCdpMintingReward updates the claim object by adding any accumulated rewards and updating the reward index value. -// this should be called before a cdp is modified, immediately after the 'SynchronizeInterest' method is called in the cdp module -func (k Keeper) SynchronizeCdpMintingReward(ctx sdk.Context, cdp cdptypes.Cdp) { - _, found := k.GetCdpMintingRewardPeriod(ctx, cdp.Type) - if !found { - // this collateral type is not incentivized, do nothing - return - } - - globalRewardFactor, found := k.GetCdpMintingRewardFactor(ctx, cdp.Type) - if !found { - globalRewardFactor = sdk.ZeroDec() - } - claim, found := k.GetCdpMintingClaim(ctx, cdp.Owner.AccAddress()) - - denoms, _ := k.GetGenesisDenoms(ctx) - - if !found { - claim = types.NewCdpMintingClaim(cdp.Owner.AccAddress(), sdk.NewCoin(denoms.CdpMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{types.NewRewardIndex(cdp.Type, globalRewardFactor)}) - k.SetCdpMintingClaim(ctx, claim) - return - } - - // the owner has an existing jpu minting reward claim - index, hasRewardIndex := claim.HasRewardIndex(cdp.Type) - if !hasRewardIndex { // this is the owner's first jpu minting reward for this collateral type - claim.RewardIndexes = append(claim.RewardIndexes, types.NewRewardIndex(cdp.Type, globalRewardFactor)) - k.SetCdpMintingClaim(ctx, claim) - return - } - userRewardFactor := claim.RewardIndexes[index].RewardFactor - rewardsAccumulatedFactor := globalRewardFactor.Sub(userRewardFactor) - if rewardsAccumulatedFactor.IsZero() { - return - } - claim.RewardIndexes[index].RewardFactor = globalRewardFactor - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount)).RoundInt() - if newRewardsAmount.IsZero() { - k.SetCdpMintingClaim(ctx, claim) - return - } - newRewardsCoin := sdk.NewCoin(denoms.CdpMintingRewardDenom, newRewardsAmount) - claim.Reward = claim.Reward.Add(newRewardsCoin) - k.SetCdpMintingClaim(ctx, claim) - return -} - -// ZeroCdpMintingClaim zeroes out the claim object's rewards and returns the updated claim object -func (k Keeper) ZeroCdpMintingClaim(ctx sdk.Context, claim types.CdpMintingClaim) types.CdpMintingClaim { - claim.Reward = sdk.NewCoin(claim.Reward.Denom, sdk.ZeroInt()) - k.SetCdpMintingClaim(ctx, claim) - return claim -} - -// SynchronizeCdpMintingClaim updates the claim object by adding any rewards that have accumulated. -// Returns the updated claim object -func (k Keeper) SynchronizeCdpMintingClaim(ctx sdk.Context, claim types.CdpMintingClaim) (types.CdpMintingClaim, error) { - for _, ri := range claim.RewardIndexes { - cdp, found := k.cdpKeeper.GetCdpByOwnerAndCollateralType(ctx, claim.Owner.AccAddress(), ri.CollateralType) - if !found { - // if the cdp for this collateral type has been closed, no updates are needed - continue - } - claim = k.synchronizeRewardAndReturnClaim(ctx, cdp) - } - return claim, nil -} - -// this function assumes a claim already exists, so don't call it if that's not the case -func (k Keeper) synchronizeRewardAndReturnClaim(ctx sdk.Context, cdp cdptypes.Cdp) types.CdpMintingClaim { - k.SynchronizeCdpMintingReward(ctx, cdp) - claim, _ := k.GetCdpMintingClaim(ctx, cdp.Owner.AccAddress()) - return claim -} - -// CalculateTimeElapsed calculates the number of reward-eligible seconds that have passed since the previous -// time rewards were accrued, taking into account the end time of the reward period -func CalculateTimeElapsed(start, end, blockTime time.Time, previousAccrualTime time.Time) sdk.Int { - if (end.Before(blockTime) && - (end.Before(previousAccrualTime) || end.Equal(previousAccrualTime))) || - (start.After(blockTime)) || - (start.Equal(blockTime)) { - return sdk.ZeroInt() - } - if start.After(previousAccrualTime) && start.Before(blockTime) { - previousAccrualTime = start - } - - if end.Before(blockTime) { - return sdk.MaxInt(sdk.ZeroInt(), sdk.NewInt(int64(math.RoundToEven( - end.Sub(previousAccrualTime).Seconds(), - )))) - } - return sdk.MaxInt(sdk.ZeroInt(), sdk.NewInt(int64(math.RoundToEven( - blockTime.Sub(previousAccrualTime).Seconds(), - )))) -} - -// SimulateCdpMintingSynchronization calculates a user's outstanding Cdp minting rewards by simulating reward synchronization -func (k Keeper) SimulateCdpMintingSynchronization(ctx sdk.Context, claim types.CdpMintingClaim) types.CdpMintingClaim { - for _, ri := range claim.RewardIndexes { - _, found := k.GetCdpMintingRewardPeriod(ctx, ri.CollateralType) - if !found { - continue - } - - globalRewardFactor, found := k.GetCdpMintingRewardFactor(ctx, ri.CollateralType) - if !found { - globalRewardFactor = sdk.ZeroDec() - } - - // the owner has an existing jpu minting reward claim - index, hasRewardIndex := claim.HasRewardIndex(ri.CollateralType) - if !hasRewardIndex { // this is the owner's first jpu minting reward for this collateral type - claim.RewardIndexes = append(claim.RewardIndexes, types.NewRewardIndex(ri.CollateralType, globalRewardFactor)) - } - userRewardFactor := claim.RewardIndexes[index].RewardFactor - rewardsAccumulatedFactor := globalRewardFactor.Sub(userRewardFactor) - if rewardsAccumulatedFactor.IsZero() { - continue - } - - claim.RewardIndexes[index].RewardFactor = globalRewardFactor - - cdp, found := k.cdpKeeper.GetCdpByOwnerAndCollateralType(ctx, claim.GetOwner(), ri.CollateralType) - if !found { - continue - } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount)).RoundInt() - if newRewardsAmount.IsZero() { - continue - } - - denoms, _ := k.GetGenesisDenoms(ctx) - - newRewardsCoin := sdk.NewCoin(denoms.CdpMintingRewardDenom, newRewardsAmount) - claim.Reward = claim.Reward.Add(newRewardsCoin) - } - - return claim -} diff --git a/deprecated/x/incentive/keeper/rewards_test.go b/deprecated/x/incentive/keeper/rewards_test.go deleted file mode 100644 index 177c6ef40..000000000 --- a/deprecated/x/incentive/keeper/rewards_test.go +++ /dev/null @@ -1,2812 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" -// sdk "github.com/cosmos/cosmos-sdk/types" -// stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - -// cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -// // "github.com/UnUniFi/chain/x/committee" -// // "github.com/UnUniFi/chain/x/hard" -// stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - -// incentivetypes "github.com/UnUniFi/chain/deprecated/x/incentive/types" -// ) - -// func (suite *KeeperTestSuite) TestAccumulateCdpMintingRewards() { -// type args struct { -// ctype string -// rewardsPerSecond sdk.Coin -// initialTime time.Time -// initialTotalPrincipal sdk.Coin -// timeElapsed int -// expectedRewardFactor sdk.Dec -// } -// type test struct { -// name string -// args args -// } -// testCases := []test{ -// { -// "7 seconds", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialTotalPrincipal: c("jpu", 1000000000000), -// timeElapsed: 7, -// expectedRewardFactor: d("0.000000856478000000"), -// }, -// }, -// { -// "1 day", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialTotalPrincipal: c("jpu", 1000000000000), -// timeElapsed: 86400, -// expectedRewardFactor: d("0.0105713856"), -// }, -// }, -// { -// "0 seconds", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialTotalPrincipal: c("jpu", 1000000000000), -// timeElapsed: 0, -// expectedRewardFactor: d("0.0"), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // setup cdp state -// cdpKeeper := suite.app.GetCDPKeeper() -// cdpKeeper.SetTotalPrincipal(suite.ctx, tc.args.ctype, cdptypes.DefaultStableDenom, tc.args.initialTotalPrincipal.Amount) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousCdpMintingAccrualTime(suite.ctx, tc.args.ctype, tc.args.initialTime) -// suite.keeper.SetCdpMintingRewardFactor(suite.ctx, tc.args.ctype, sdk.ZeroDec()) - -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) -// rewardPeriod, found := suite.keeper.GetCdpMintingRewardPeriod(suite.ctx, tc.args.ctype) -// suite.Require().True(found) -// err := suite.keeper.AccumulateCdpMintingRewards(suite.ctx, rewardPeriod) -// suite.Require().NoError(err) - -// rewardFactor, found := suite.keeper.GetCdpMintingRewardFactor(suite.ctx, tc.args.ctype) -// suite.Require().Equal(tc.args.expectedRewardFactor, rewardFactor) -// }) -// } -// } - -// func (suite *KeeperTestSuite) TestSynchronizeCdpMintingReward() { -// type args struct { -// ctype string -// rewardsPerSecond sdk.Coin -// initialTime time.Time -// initialCollateral sdk.Coin -// initialPrincipal sdk.Coin -// blockTimes []int -// expectedRewardFactor sdk.Dec -// expectedRewards sdk.Coin -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialCollateral: c("bnb", 1000000000000), -// initialPrincipal: c("jpu", 10000000000), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardFactor: d("0.001223540000000000"), -// expectedRewards: c("uguu", 12235400), -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: c("uguu", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialCollateral: c("bnb", 1000000000000), -// initialPrincipal: c("jpu", 10000000000), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardFactor: d("10.57138560000000000"), -// expectedRewards: c("uguu", 105713856000), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousCdpMintingAccrualTime(suite.ctx, tc.args.ctype, tc.args.initialTime) -// suite.keeper.SetCdpMintingRewardFactor(suite.ctx, tc.args.ctype, sdk.ZeroDec()) - -// // setup account state -// sk := suite.app.GetBankKeeper() -// sk.MintCoins(suite.ctx, cdptypes.ModuleName, sdk.NewCoins(tc.args.initialCollateral)) -// sk.SendCoinsFromModuleToAccount(suite.ctx, cdptypes.ModuleName, suite.addrs[0], sdk.NewCoins(tc.args.initialCollateral)) - -// // setup cdp state -// cdpKeeper := suite.app.GetCDPKeeper() -// err := cdpKeeper.AddCdp(suite.ctx, suite.addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) -// suite.Require().NoError(err) - -// claim, found := suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) - -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) -// rewardPeriod, found := suite.keeper.GetCdpMintingRewardPeriod(blockCtx, tc.args.ctype) -// suite.Require().True(found) -// err := suite.keeper.AccumulateCdpMintingRewards(blockCtx, rewardPeriod) -// suite.Require().NoError(err) -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) -// cdp, found := cdpKeeper.GetCdpByOwnerAndCollateralType(suite.ctx, suite.addrs[0], tc.args.ctype) -// suite.Require().True(found) -// suite.Require().NotPanics(func() { -// suite.keeper.SynchronizeCdpMintingReward(suite.ctx, cdp) -// }) - -// rewardFactor, found := suite.keeper.GetCdpMintingRewardFactor(suite.ctx, tc.args.ctype) -// suite.Require().Equal(tc.args.expectedRewardFactor, rewardFactor) - -// claim, found = suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(tc.args.expectedRewardFactor, claim.RewardIndexes[0].RewardFactor) -// suite.Require().Equal(tc.args.expectedRewards, claim.Reward) -// }) -// } -// } - -// /* -// func (suite *KeeperTestSuite) TestAccumulateHardBorrowRewards() { -// type args struct { -// borrow sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// timeElapsed int -// expectedRewardIndexes incentivetypes.RewardIndexes -// } -// type test struct { -// name string -// args args -// } -// testCases := []test{ -// { -// "single reward denom: 7 seconds", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 7, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.000000856478000001"))}, -// }, -// }, -// { -// "single reward denom: 1 day", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.010571385600010177"))}, -// }, -// }, -// { -// "single reward denom: 0 seconds", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 0, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.0"))}, -// }, -// }, -// { -// "multiple reward denoms: 7 seconds", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 7, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.000000856478000001")), -// incentivetypes.NewRewardIndex("uguu", d("0.000000856478000001")), -// }, -// }, -// }, -// { -// "multiple reward denoms: 1 day", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.010571385600010177")), -// incentivetypes.NewRewardIndex("uguu", d("0.010571385600010177")), -// }, -// }, -// }, -// { -// "multiple reward denoms: 0 seconds", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 0, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// incentivetypes.NewRewardIndex("uguu", d("0.0")), -// }, -// }, -// }, -// { -// "multiple reward denoms with different rewards per second: 1 day", -// args{ -// borrow: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 555555)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.010571385600010177")), -// incentivetypes.NewRewardIndex("uguu", d("0.047999952000046210")), -// }, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) - -// suite.keeper.SetPreviousHardBorrowRewardAccrualTime(suite.ctx, tc.args.borrow.Denom, tc.args.initialTime) -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// suite.keeper.SetHardBorrowRewardIndexes(suite.ctx, tc.args.borrow.Denom, rewardIndexes) - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetSupplyInterestFactor(suite.ctx, tc.args.borrow.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetBorrowInterestFactor(suite.ctx, tc.args.borrow.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.borrow.Denom, tc.args.initialTime) - -// // User deposits and borrows to increase total borrowed amount -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, sdk.NewCoins(sdk.NewCoin(tc.args.borrow.Denom, tc.args.borrow.Amount.Mul(sdk.NewInt(2))))) -// suite.Require().NoError(err) -// err = hardKeeper.Borrow(suite.ctx, userAddr, sdk.NewCoins(tc.args.borrow)) -// suite.Require().NoError(err) - -// // Set up chain context at future time -// runAtTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) -// runCtx := suite.ctx.WithBlockTime(runAtTime) - -// // Run Hard begin blocker in order to update the denom's index factor -// hard.BeginBlocker(runCtx, suite.hardKeeper) - -// // Accumulate hard borrow rewards for the deposit denom -// multiRewardPeriod, found := suite.keeper.GetHardBorrowRewardPeriods(runCtx, tc.args.borrow.Denom) -// suite.Require().True(found) -// err = suite.keeper.AccumulateHardBorrowRewards(runCtx, multiRewardPeriod) -// suite.Require().NoError(err) - -// // Check that each expected reward index matches the current stored reward index for the denom -// globalRewardIndexes, found := suite.keeper.GetHardBorrowRewardIndexes(runCtx, tc.args.borrow.Denom) -// suite.Require().True(found) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// globalRewardIndex, found := globalRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, globalRewardIndex) -// } -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestSynchronizeHardBorrowReward() { -// type args struct { -// incentiveBorrowRewardDenom string -// borrow sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// blockTimes []int -// expectedRewardIndexes incentivetypes.RewardIndexes -// expectedRewards sdk.Coins -// updateRewardsViaCommmittee bool -// updatedBaseDenom string -// updatedRewardsPerSecond sdk.Coins -// updatedExpectedRewardIndexes incentivetypes.RewardIndexes -// updatedExpectedRewards sdk.Coins -// updatedTimeDuration int -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.001223540000173228"))}, -// expectedRewards: cs(c("hard", 12235400)), -// updateRewardsViaCommmittee: false, -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("10.571385603126235340"))}, -// expectedRewards: cs(c("hard", 105713856031)), -// }, -// }, -// { -// "multiple reward denoms: 10 blocks", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.001223540000173228")), -// incentivetypes.NewRewardIndex("uguu", d("0.001223540000173228")), -// }, -// expectedRewards: cs(c("hard", 12235400), c("uguu", 12235400)), -// }, -// }, -// { -// "multiple reward denoms: 10 blocks - long block time", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("10.571385603126235340")), -// incentivetypes.NewRewardIndex("uguu", d("10.571385603126235340")), -// }, -// expectedRewards: cs(c("hard", 105713856031), c("uguu", 105713856031)), -// }, -// }, -// { -// "multiple reward denoms with different rewards per second: 10 blocks", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 555555)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.001223540000173228")), -// incentivetypes.NewRewardIndex("uguu", d("0.005555550000786558")), -// }, -// expectedRewards: cs(c("hard", 12235400), c("uguu", 55555500)), -// }, -// }, -// { -// "denom is in incentive's hard borrow reward params but it has no rewards; add reward", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "bnb", -// updatedRewardsPerSecond: cs(c("hard", 100000)), -// updatedExpectedRewards: cs(c("hard", 8640000000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864000000049803065")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom is in incentive's hard borrow reward params and has rewards; add new reward type", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("1.057138560060101160")), -// }, -// expectedRewards: cs(c("hard", 10571385601)), -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "bnb", -// updatedRewardsPerSecond: cs(c("hard", 122354), c("uguu", 100000)), -// updatedExpectedRewards: cs(c("hard", 21142771202), c("uguu", 8640000000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("2.114277120120202320")), -// incentivetypes.NewRewardIndex("uguu", d("0.864000000049120715")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom is in hard's money market params but not in incentive's hard supply reward params; add reward", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("zzz", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "zzz", -// updatedRewardsPerSecond: cs(c("hard", 100000)), -// updatedExpectedRewards: cs(c("hard", 8640000000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864000000049803065")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom incentive's hard borrow reward params but it has no rewards; add multiple reward types", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "bnb", -// updatedRewardsPerSecond: cs(c("hard", 100000), c("uguu", 100500), c("swap", 500)), -// updatedExpectedRewards: cs(c("hard", 8640000000), c("uguu", 8683200001), c("swap", 43200000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864000000049803065")), -// incentivetypes.NewRewardIndex("uguu", d("0.868320000050052081")), -// incentivetypes.NewRewardIndex("swap", d("0.004320000000249015")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom is in hard's money market params but not in incentive's hard supply reward params; add multiple reward types", -// args{ -// incentiveBorrowRewardDenom: "bnb", -// borrow: c("zzz", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "zzz", -// updatedRewardsPerSecond: cs(c("hard", 100000), c("uguu", 100500), c("swap", 500)), -// updatedExpectedRewards: cs(c("hard", 8640000000), c("uguu", 8683200001), c("swap", 43200000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864000000049803065")), -// incentivetypes.NewRewardIndex("uguu", d("0.868320000050052081")), -// incentivetypes.NewRewardIndex("swap", d("0.004320000000249015")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up incentive state -// incentiveParams := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.incentiveBorrowRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), c("hard", 1))}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.incentiveBorrowRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), sdk.Coins{})}, // Don't set any supply rewards for easier accounting -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.incentiveBorrowRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.incentiveBorrowRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), c("hard", 1))}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, incentiveParams) -// suite.keeper.SetPreviousHardBorrowRewardAccrualTime(suite.ctx, tc.args.incentiveBorrowRewardDenom, tc.args.initialTime) -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// if len(rewardIndexes) > 0 { -// suite.keeper.SetHardBorrowRewardIndexes(suite.ctx, tc.args.incentiveBorrowRewardDenom, rewardIndexes) -// } - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetSupplyInterestFactor(suite.ctx, tc.args.borrow.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetBorrowInterestFactor(suite.ctx, tc.args.borrow.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.borrow.Denom, tc.args.initialTime) - -// // User deposits and borrows to increase total borrowed amount -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, sdk.NewCoins(sdk.NewCoin(tc.args.borrow.Denom, tc.args.borrow.Amount.Mul(sdk.NewInt(2))))) -// suite.Require().NoError(err) -// err = hardKeeper.Borrow(suite.ctx, userAddr, sdk.NewCoins(tc.args.borrow)) -// suite.Require().NoError(err) - -// // Check that Hard hooks initialized a HardLiquidityProviderClaim -// claim, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(found) -// multiRewardIndex, _ := claim.BorrowRewardIndexes.GetRewardIndex(tc.args.borrow.Denom) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) -// } - -// // Run accumulator at several intervals -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) - -// // Run Hard begin blocker for each block ctx to update denom's interest factor -// hard.BeginBlocker(blockCtx, suite.hardKeeper) - -// // Accumulate hard borrow-side rewards -// multiRewardPeriod, found := suite.keeper.GetHardBorrowRewardPeriods(blockCtx, tc.args.borrow.Denom) -// if found { -// err := suite.keeper.AccumulateHardBorrowRewards(blockCtx, multiRewardPeriod) -// suite.Require().NoError(err) -// } -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// // After we've accumulated, run synchronize -// borrow, found := hardKeeper.GetBorrow(suite.ctx, userAddr) -// suite.Require().True(found) -// suite.Require().NotPanics(func() { -// suite.keeper.SynchronizeHardBorrowReward(suite.ctx, borrow) -// }) - -// // Check that the global reward index's reward factor and user's claim have been updated as expected -// claim, found = suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(found) -// globalRewardIndexes, foundGlobalRewardIndexes := suite.keeper.GetHardBorrowRewardIndexes(suite.ctx, tc.args.borrow.Denom) -// if len(tc.args.rewardsPerSecond) > 0 { -// suite.Require().True(foundGlobalRewardIndexes) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// // Check that global reward index has been updated as expected -// globalRewardIndex, found := globalRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, globalRewardIndex) - -// // Check that the user's claim's reward index matches the corresponding global reward index -// multiRewardIndex, found := claim.BorrowRewardIndexes.GetRewardIndex(tc.args.borrow.Denom) -// suite.Require().True(found) -// rewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.expectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// claim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// } - -// // Only test cases with reward param updates continue past this point -// if !tc.args.updateRewardsViaCommmittee { -// return -// } - -// // If are no initial rewards per second, add new rewards through a committee param change -// // 1. Construct incentive's new HardBorrowRewardPeriods param -// currIncentiveHardBorrowRewardPeriods := suite.keeper.GetParams(suite.ctx).HardBorrowRewardPeriods -// multiRewardPeriod, found := currIncentiveHardBorrowRewardPeriods.GetMultiRewardPeriod(tc.args.borrow.Denom) -// if found { -// // Borrow denom's reward period exists, but it doesn't have any rewards per second -// index, found := currIncentiveHardBorrowRewardPeriods.GetMultiRewardPeriodIndex(tc.args.borrow.Denom) -// suite.Require().True(found) -// multiRewardPeriod.RewardsPerSecond = tc.args.updatedRewardsPerSecond -// currIncentiveHardBorrowRewardPeriods[index] = multiRewardPeriod -// } else { -// // Borrow denom's reward period does not exist -// _, found := currIncentiveHardBorrowRewardPeriods.GetMultiRewardPeriodIndex(tc.args.borrow.Denom) -// suite.Require().False(found) -// newMultiRewardPeriod := incentivetypes.NewMultiRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.updatedRewardsPerSecond) -// currIncentiveHardBorrowRewardPeriods = append(currIncentiveHardBorrowRewardPeriods, newMultiRewardPeriod) -// } - -// // 2. Construct the parameter change proposal to update HardBorrowRewardPeriods param -// pubProposal := proposal.NewParameterChangeProposal( -// "Update hard borrow rewards", "Adds a new reward coin to the incentive module's hard borrow rewards.", -// []proposal.ParamChange{ -// { -// Subspace: incentivetypes.ModuleName, // target incentive module -// Key: string(hardtypes.KeyHardBorrowRewardPeriods), // target hard borrow rewards key -// Value: string(suite.app.AppCodec().MustMarshalJSON(currIncentiveHardBorrowRewardPeriods)), -// }, -// }, -// ) - -// // 3. Ensure proposal is properly formed -// err = suite.committeeKeeper.ValidatePubProposal(suite.ctx, pubProposal) -// suite.Require().NoError(err) - -// // 4. Committee creates proposal -// committeeMemberOne := suite.addrs[0] -// committeeMemberTwo := suite.addrs[1] -// proposalID, err := suite.committeeKeeper.SubmitProposal(suite.ctx, committeeMemberOne, 1, pubProposal) -// suite.Require().NoError(err) - -// // 5. Committee votes and passes proposal -// err = suite.committeeKeeper.AddVote(suite.ctx, proposalID, committeeMemberOne) -// err = suite.committeeKeeper.AddVote(suite.ctx, proposalID, committeeMemberTwo) - -// // 6. Check proposal passed -// proposalPasses, err := suite.committeeKeeper.GetProposalResult(suite.ctx, proposalID) -// suite.Require().NoError(err) -// suite.Require().True(proposalPasses) - -// // 7. Run committee module's begin blocker to enact proposal -// suite.NotPanics(func() { -// committee.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}, suite.committeeKeeper) -// }) - -// // We need to accumulate hard supply-side rewards again -// multiRewardPeriod, found = suite.keeper.GetHardBorrowRewardPeriods(suite.ctx, tc.args.borrow.Denom) -// suite.Require().True(found) - -// // But new borrow denoms don't have their PreviousHardBorrowRewardAccrualTime set yet, -// // so we need to call the accumulation method once to set the initial reward accrual time -// if tc.args.borrow.Denom != tc.args.incentiveBorrowRewardDenom { -// err = suite.keeper.AccumulateHardBorrowRewards(suite.ctx, multiRewardPeriod) -// suite.Require().NoError(err) -// } - -// // Now we can jump forward in time and accumulate rewards -// updatedBlockTime = previousBlockTime.Add(time.Duration(int(time.Second) * tc.args.updatedTimeDuration)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) -// err = suite.keeper.AccumulateHardBorrowRewards(suite.ctx, multiRewardPeriod) -// suite.Require().NoError(err) - -// // After we've accumulated, run synchronize -// borrow, found = hardKeeper.GetBorrow(suite.ctx, userAddr) -// suite.Require().True(found) -// suite.Require().NotPanics(func() { -// suite.keeper.SynchronizeHardBorrowReward(suite.ctx, borrow) -// }) - -// // Check that the global reward index's reward factor and user's claim have been updated as expected -// globalRewardIndexes, found = suite.keeper.GetHardBorrowRewardIndexes(suite.ctx, tc.args.borrow.Denom) -// suite.Require().True(found) -// claim, found = suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(found) - -// for _, expectedRewardIndex := range tc.args.updatedExpectedRewardIndexes { -// // Check that global reward index has been updated as expected -// globalRewardIndex, found := globalRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, globalRewardIndex) -// // Check that the user's claim's reward index matches the corresponding global reward index -// multiRewardIndex, found := claim.BorrowRewardIndexes.GetRewardIndex(tc.args.borrow.Denom) -// suite.Require().True(found) -// rewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.updatedExpectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// claim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestAccumulateHardDelegatorRewards() { -// type args struct { -// delegation sdk.Coin -// rewardsPerSecond sdk.Coin -// initialTime time.Time -// timeElapsed int -// expectedRewardFactor sdk.Dec -// } -// type test struct { -// name string -// args args -// } -// testCases := []test{ -// { -// "7 seconds", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: c("hard", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 7, -// expectedRewardFactor: d("0.428239000000000000"), -// }, -// }, -// { -// "1 day", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: c("hard", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardFactor: d("5285.692800000000000000"), -// }, -// }, -// { -// "0 seconds", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: c("hard", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 0, -// expectedRewardFactor: d("0.0"), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousHardDelegatorRewardAccrualTime(suite.ctx, tc.args.delegation.Denom, tc.args.initialTime) -// suite.keeper.SetHardDelegatorRewardFactor(suite.ctx, tc.args.delegation.Denom, sdk.ZeroDec()) - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.delegation.Denom, tc.args.initialTime) - -// err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], tc.args.delegation) -// suite.Require().NoError(err) -// suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[0], tc.args.delegation) -// suite.Require().NoError(err) - -// staking.EndBlocker(suite.ctx, suite.stakingKeeper) - -// // Set up chain context at future time -// runAtTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) -// runCtx := suite.ctx.WithBlockTime(runAtTime) - -// // Run Hard begin blocker in order to update the denom's index factor -// hard.BeginBlocker(runCtx, suite.hardKeeper) - -// rewardPeriod, found := suite.keeper.GetHardDelegatorRewardPeriod(runCtx, tc.args.delegation.Denom) -// suite.Require().True(found) -// err = suite.keeper.AccumulateHardDelegatorRewards(runCtx, rewardPeriod) -// suite.Require().NoError(err) - -// rewardFactor, found := suite.keeper.GetHardDelegatorRewardFactor(runCtx, tc.args.delegation.Denom) -// suite.Require().Equal(tc.args.expectedRewardFactor, rewardFactor) -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestInitializeHardSupplyRewards() { - -// type args struct { -// moneyMarketRewardDenoms map[string][]string -// deposit sdk.Coins -// initialTime time.Time -// expectedClaimSupplyRewardIndexes incentivetypes.MultiRewardIndexes -// } -// type test struct { -// name string -// args args -// } - -// standardMoneyMarketRewardDenoms := map[string][]string{ -// "bnb": {"hard"}, -// "btcb": {"hard", "uguu"}, -// "xrp": {}, -// } - -// testCases := []test{ -// { -// "single deposit denom, single reward denom", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("bnb", 1000000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimSupplyRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "bnb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// }, -// ), -// }, -// }, -// }, -// { -// "single deposit denom, multiple reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("btcb", 1000000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimSupplyRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "btcb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// incentivetypes.NewRewardIndex("uguu", d("0.0")), -// }, -// ), -// }, -// }, -// }, -// { -// "single deposit denom, no reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("xrp", 1000000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimSupplyRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "xrp", -// nil, -// ), -// }, -// }, -// }, -// { -// "multiple deposit denoms, multiple overlapping reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("bnb", 1000000000000), c("btcb", 1000000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimSupplyRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "bnb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// }, -// ), -// incentivetypes.NewMultiRewardIndex( -// "btcb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// incentivetypes.NewRewardIndex("uguu", d("0.0")), -// }, -// ), -// }, -// }, -// }, -// { -// "multiple deposit denoms, correct discrete reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("bnb", 1000000000000), c("xrp", 1000000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimSupplyRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "bnb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// }, -// ), -// incentivetypes.NewMultiRewardIndex( -// "xrp", -// nil, -// ), -// }, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// userAddr := suite.addrs[3] - -// // Prepare money market + reward params -// i := 0 -// var multiRewardPeriods incentivetypes.MultiRewardPeriods -// var rewardPeriods incentivetypes.RewardPeriods -// for moneyMarketDenom, rewardDenoms := range tc.args.moneyMarketRewardDenoms { -// // Set up multi reward periods for supply/borrow indexes with dynamic money market denoms/reward denoms -// var rewardsPerSecond sdk.Coins -// for _, rewardDenom := range rewardDenoms { -// rewardsPerSecond = append(rewardsPerSecond, sdk.NewCoin(rewardDenom, sdk.OneInt())) -// } -// multiRewardPeriod := incentivetypes.NewMultiRewardPeriod(true, moneyMarketDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), rewardsPerSecond) -// multiRewardPeriods = append(multiRewardPeriods, multiRewardPeriod) - -// // Set up generic reward periods for jpu minting/delegator indexes -// if i == 0 && len(rewardDenoms) > 0 { -// rewardPeriod := incentivetypes.NewRewardPeriod(true, moneyMarketDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), rewardsPerSecond[i]) -// rewardPeriods = append(rewardPeriods, rewardPeriod) -// i++ -// } -// } - -// // Initialize and set incentive params -// params := incentivetypes.NewParams( -// rewardPeriods, multiRewardPeriods, multiRewardPeriods, rewardPeriods, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) - -// // Set each money market's previous accrual time and supply reward indexes -// for moneyMarketDenom, rewardDenoms := range tc.args.moneyMarketRewardDenoms { -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardDenom := range rewardDenoms { -// rewardIndex := incentivetypes.NewRewardIndex(rewardDenom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// suite.keeper.SetPreviousHardSupplyRewardAccrualTime(suite.ctx, moneyMarketDenom, tc.args.initialTime) -// if len(rewardIndexes) > 0 { -// suite.keeper.SetHardSupplyRewardIndexes(suite.ctx, moneyMarketDenom, rewardIndexes) -// } -// } - -// // User deposits -// hardKeeper := suite.app.GetHardKeeper() -// err := hardKeeper.Deposit(suite.ctx, userAddr, tc.args.deposit) -// suite.Require().NoError(err) - -// claim, foundClaim := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(foundClaim) -// suite.Require().Equal(tc.args.expectedClaimSupplyRewardIndexes, claim.SupplyRewardIndexes) -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestAccumulateHardSupplyRewards() { -// type args struct { -// deposit sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// timeElapsed int -// expectedRewardIndexes incentivetypes.RewardIndexes -// } -// type test struct { -// name string -// args args -// } -// testCases := []test{ -// { -// "single reward denom: 7 seconds", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 7, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.000000856478000000"))}, -// }, -// }, -// { -// "single reward denom: 1 day", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.010571385600000000"))}, -// }, -// }, -// { -// "single reward denom: 0 seconds", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 0, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.0"))}, -// }, -// }, -// { -// "multiple reward denoms: 7 seconds", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 7, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.000000856478000000")), -// incentivetypes.NewRewardIndex("uguu", d("0.000000856478000000")), -// }, -// }, -// }, -// { -// "multiple reward denoms: 1 day", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.010571385600000000")), -// incentivetypes.NewRewardIndex("uguu", d("0.010571385600000000")), -// }, -// }, -// }, -// { -// "multiple reward denoms: 0 seconds", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 0, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// incentivetypes.NewRewardIndex("uguu", d("0.0")), -// }, -// }, -// }, -// { -// "multiple reward denoms with different rewards per second: 1 day", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 555555)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 86400, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.010571385600000000")), -// incentivetypes.NewRewardIndex("uguu", d("0.047999952000000000")), -// }, -// }, -// }, -// { -// "single reward denom, no rewards", -// args{ -// deposit: c("bnb", 1000000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// timeElapsed: 7, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), c("hard", 1))}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), c("hard", 1))}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousHardSupplyRewardAccrualTime(suite.ctx, tc.args.deposit.Denom, tc.args.initialTime) -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// if len(rewardIndexes) > 0 { -// suite.keeper.SetHardSupplyRewardIndexes(suite.ctx, tc.args.deposit.Denom, rewardIndexes) -// } - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetSupplyInterestFactor(suite.ctx, tc.args.deposit.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.deposit.Denom, tc.args.initialTime) - -// // User deposits to increase total supplied amount -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, sdk.NewCoins(tc.args.deposit)) -// suite.Require().NoError(err) - -// // Set up chain context at future time -// runAtTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) -// runCtx := suite.ctx.WithBlockTime(runAtTime) - -// // Run Hard begin blocker in order to update the denom's index factor -// hard.BeginBlocker(runCtx, suite.hardKeeper) - -// // Accumulate hard supply rewards for the deposit denom -// multiRewardPeriod, found := suite.keeper.GetHardSupplyRewardPeriods(runCtx, tc.args.deposit.Denom) -// suite.Require().True(found) -// err = suite.keeper.AccumulateHardSupplyRewards(runCtx, multiRewardPeriod) -// suite.Require().NoError(err) - -// // Check that each expected reward index matches the current stored reward index for the denom -// globalRewardIndexes, found := suite.keeper.GetHardSupplyRewardIndexes(runCtx, tc.args.deposit.Denom) -// if len(tc.args.rewardsPerSecond) > 0 { -// suite.Require().True(found) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// globalRewardIndex, found := globalRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, globalRewardIndex) -// } -// } else { -// suite.Require().False(found) -// } - -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestSynchronizeHardSupplyReward() { -// type args struct { -// incentiveSupplyRewardDenom string -// deposit sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// blockTimes []int -// expectedRewardIndexes incentivetypes.RewardIndexes -// expectedRewards sdk.Coins -// updateRewardsViaCommmittee bool -// updatedBaseDenom string -// updatedRewardsPerSecond sdk.Coins -// updatedExpectedRewardIndexes incentivetypes.RewardIndexes -// updatedExpectedRewards sdk.Coins -// updatedTimeDuration int -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "single reward denom: 10 blocks", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.001223540000000000"))}, -// expectedRewards: cs(c("hard", 12235400)), -// updateRewardsViaCommmittee: false, -// }, -// }, -// { -// "single reward denom: 10 blocks - long block time", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("10.571385600000000000"))}, -// expectedRewards: cs(c("hard", 105713856000)), -// updateRewardsViaCommmittee: false, -// }, -// }, -// { -// "multiple reward denoms: 10 blocks", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.001223540000000000")), -// incentivetypes.NewRewardIndex("uguu", d("0.001223540000000000")), -// }, -// expectedRewards: cs(c("hard", 12235400), c("uguu", 12235400)), -// updateRewardsViaCommmittee: false, -// }, -// }, -// { -// "multiple reward denoms: 10 blocks - long block time", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("10.571385600000000000")), -// incentivetypes.NewRewardIndex("uguu", d("10.571385600000000000")), -// }, -// expectedRewards: cs(c("hard", 105713856000), c("uguu", 105713856000)), -// updateRewardsViaCommmittee: false, -// }, -// }, -// { -// "multiple reward denoms with different rewards per second: 10 blocks", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 555555)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.001223540000000000")), -// incentivetypes.NewRewardIndex("uguu", d("0.005555550000000000")), -// }, -// expectedRewards: cs(c("hard", 12235400), c("uguu", 55555500)), -// updateRewardsViaCommmittee: false, -// }, -// }, -// { -// "denom is in incentive's hard supply reward params but it has no rewards; add reward", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "bnb", -// updatedRewardsPerSecond: cs(c("hard", 100000)), -// updatedExpectedRewards: cs(c("hard", 8640000000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom is in incentive's hard supply reward params and has rewards; add new reward type", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("1.057138560000000000")), -// }, -// expectedRewards: cs(c("hard", 10571385600)), -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "bnb", -// updatedRewardsPerSecond: cs(c("hard", 122354), c("uguu", 100000)), -// updatedExpectedRewards: cs(c("hard", 21142771200), c("uguu", 8640000000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("2.114277120000000000")), -// incentivetypes.NewRewardIndex("uguu", d("0.864000000000000000")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom is in hard's money market params but not in incentive's hard supply reward params; add reward", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("zzz", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "zzz", -// updatedRewardsPerSecond: cs(c("hard", 100000)), -// updatedExpectedRewards: cs(c("hard", 8640000000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom incentive's hard supply reward params but it has no rewards; add multiple reward types", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "bnb", -// updatedRewardsPerSecond: cs(c("hard", 100000), c("uguu", 100500), c("swap", 500)), -// updatedExpectedRewards: cs(c("hard", 8640000000), c("uguu", 8683200000), c("swap", 43200000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864")), -// incentivetypes.NewRewardIndex("uguu", d("0.86832")), -// incentivetypes.NewRewardIndex("swap", d("0.00432")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// { -// "denom is in hard's money market params but not in incentive's hard supply reward params; add multiple reward types", -// args{ -// incentiveSupplyRewardDenom: "bnb", -// deposit: c("zzz", 10000000000), -// rewardsPerSecond: sdk.Coins{}, -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{100}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{}, -// expectedRewards: sdk.Coins{}, -// updateRewardsViaCommmittee: true, -// updatedBaseDenom: "zzz", -// updatedRewardsPerSecond: cs(c("hard", 100000), c("uguu", 100500), c("swap", 500)), -// updatedExpectedRewards: cs(c("hard", 8640000000), c("uguu", 8683200000), c("swap", 43200000)), -// updatedExpectedRewardIndexes: incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.864")), -// incentivetypes.NewRewardIndex("uguu", d("0.86832")), -// incentivetypes.NewRewardIndex("swap", d("0.00432")), -// }, -// updatedTimeDuration: 86400, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up incentive state -// incentiveParams := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.incentiveSupplyRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), c("hard", 1))}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.incentiveSupplyRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.incentiveSupplyRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.incentiveSupplyRewardDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), c("hard", 1))}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, incentiveParams) -// suite.keeper.SetPreviousHardSupplyRewardAccrualTime(suite.ctx, tc.args.incentiveSupplyRewardDenom, tc.args.initialTime) -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// if len(rewardIndexes) > 0 { -// suite.keeper.SetHardSupplyRewardIndexes(suite.ctx, tc.args.incentiveSupplyRewardDenom, rewardIndexes) -// } - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetSupplyInterestFactor(suite.ctx, tc.args.incentiveSupplyRewardDenom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetBorrowInterestFactor(suite.ctx, tc.args.incentiveSupplyRewardDenom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.incentiveSupplyRewardDenom, tc.args.initialTime) - -// // User deposits and borrows to increase total borrowed amount -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, sdk.NewCoins(tc.args.deposit)) -// suite.Require().NoError(err) - -// // Check that Hard hooks initialized a HardLiquidityProviderClaim with 0 reward indexes -// claim, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(found) -// multiRewardIndex, _ := claim.SupplyRewardIndexes.GetRewardIndex(tc.args.deposit.Denom) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) -// } - -// // Run accumulator at several intervals -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) - -// // Run Hard begin blocker for each block ctx to update denom's interest factor -// hard.BeginBlocker(blockCtx, suite.hardKeeper) - -// // Accumulate hard supply-side rewards -// multiRewardPeriod, found := suite.keeper.GetHardSupplyRewardPeriods(blockCtx, tc.args.deposit.Denom) -// if found { -// err := suite.keeper.AccumulateHardSupplyRewards(blockCtx, multiRewardPeriod) -// suite.Require().NoError(err) -// } -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// // After we've accumulated, run synchronize -// deposit, found := hardKeeper.GetDeposit(suite.ctx, userAddr) -// suite.Require().True(found) -// suite.Require().NotPanics(func() { -// suite.keeper.SynchronizeHardSupplyReward(suite.ctx, deposit) -// }) - -// // Check that the global reward index's reward factor and user's claim have been updated as expected -// claim, found = suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(found) -// globalRewardIndexes, foundGlobalRewardIndexes := suite.keeper.GetHardSupplyRewardIndexes(suite.ctx, tc.args.deposit.Denom) -// if len(tc.args.rewardsPerSecond) > 0 { -// suite.Require().True(foundGlobalRewardIndexes) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// // Check that global reward index has been updated as expected -// globalRewardIndex, found := globalRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, globalRewardIndex) - -// // Check that the user's claim's reward index matches the corresponding global reward index -// multiRewardIndex, found := claim.SupplyRewardIndexes.GetRewardIndex(tc.args.deposit.Denom) -// suite.Require().True(found) -// rewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.expectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// claim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// } - -// // Only test cases with reward param updates continue past this point -// if !tc.args.updateRewardsViaCommmittee { -// return -// } - -// // If are no initial rewards per second, add new rewards through a committee param change -// // 1. Construct incentive's new HardSupplyRewardPeriods param -// currIncentiveHardSupplyRewardPeriods := suite.keeper.GetParams(suite.ctx).HardSupplyRewardPeriods -// multiRewardPeriod, found := currIncentiveHardSupplyRewardPeriods.GetMultiRewardPeriod(tc.args.deposit.Denom) -// if found { -// // Deposit denom's reward period exists, but it doesn't have any rewards per second -// index, found := currIncentiveHardSupplyRewardPeriods.GetMultiRewardPeriodIndex(tc.args.deposit.Denom) -// suite.Require().True(found) -// multiRewardPeriod.RewardsPerSecond = tc.args.updatedRewardsPerSecond -// currIncentiveHardSupplyRewardPeriods[index] = multiRewardPeriod -// } else { -// // Deposit denom's reward period does not exist -// _, found := currIncentiveHardSupplyRewardPeriods.GetMultiRewardPeriodIndex(tc.args.deposit.Denom) -// suite.Require().False(found) -// newMultiRewardPeriod := incentivetypes.NewMultiRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.updatedRewardsPerSecond) -// currIncentiveHardSupplyRewardPeriods = append(currIncentiveHardSupplyRewardPeriods, newMultiRewardPeriod) -// } - -// // 2. Construct the parameter change proposal to update HardSupplyRewardPeriods param -// pubProposal := proposal.NewParameterChangeProposal( -// "Update hard supply rewards", "Adds a new reward coin to the incentive module's hard supply rewards.", -// []proposal.ParamChange{ -// { -// Subspace: incentivetypes.ModuleName, // target incentive module -// Key: string(types.KeyHardSupplyRewardPeriods), // target hard supply rewards key -// Value: string(suite.app.AppCodec().MustMarshalJSON(currIncentiveHardSupplyRewardPeriods)), -// }, -// }, -// ) - -// // 3. Ensure proposal is properly formed -// err = suite.committeeKeeper.ValidatePubProposal(suite.ctx, pubProposal) -// suite.Require().NoError(err) - -// // 4. Committee creates proposal -// committeeMemberOne := suite.addrs[0] -// committeeMemberTwo := suite.addrs[1] -// proposalID, err := suite.committeeKeeper.SubmitProposal(suite.ctx, committeeMemberOne, 1, pubProposal) -// suite.Require().NoError(err) - -// // 5. Committee votes and passes proposal -// err = suite.committeeKeeper.AddVote(suite.ctx, proposalID, committeeMemberOne) -// err = suite.committeeKeeper.AddVote(suite.ctx, proposalID, committeeMemberTwo) - -// // 6. Check proposal passed -// proposalPasses, err := suite.committeeKeeper.GetProposalResult(suite.ctx, proposalID) -// suite.Require().NoError(err) -// suite.Require().True(proposalPasses) - -// // 7. Run committee module's begin blocker to enact proposal -// suite.NotPanics(func() { -// committee.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}, suite.committeeKeeper) -// }) - -// // We need to accumulate hard supply-side rewards again -// multiRewardPeriod, found = suite.keeper.GetHardSupplyRewardPeriods(suite.ctx, tc.args.deposit.Denom) -// suite.Require().True(found) - -// // But new deposit denoms don't have their PreviousHardSupplyRewardAccrualTime set yet, -// // so we need to call the accumulation method once to set the initial reward accrual time -// if tc.args.deposit.Denom != tc.args.incentiveSupplyRewardDenom { -// err = suite.keeper.AccumulateHardSupplyRewards(suite.ctx, multiRewardPeriod) -// suite.Require().NoError(err) -// } - -// // Now we can jump forward in time and accumulate rewards -// updatedBlockTime = previousBlockTime.Add(time.Duration(int(time.Second) * tc.args.updatedTimeDuration)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) -// err = suite.keeper.AccumulateHardSupplyRewards(suite.ctx, multiRewardPeriod) -// suite.Require().NoError(err) - -// // After we've accumulated, run synchronize -// deposit, found = hardKeeper.GetDeposit(suite.ctx, userAddr) -// suite.Require().True(found) -// suite.Require().NotPanics(func() { -// suite.keeper.SynchronizeHardSupplyReward(suite.ctx, deposit) -// }) - -// // Check that the global reward index's reward factor and user's claim have been updated as expected -// globalRewardIndexes, found = suite.keeper.GetHardSupplyRewardIndexes(suite.ctx, tc.args.deposit.Denom) -// suite.Require().True(found) -// claim, found = suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(found) -// for _, expectedRewardIndex := range tc.args.updatedExpectedRewardIndexes { -// // Check that global reward index has been updated as expected -// globalRewardIndex, found := globalRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, globalRewardIndex) - -// // Check that the user's claim's reward index matches the corresponding global reward index -// multiRewardIndex, found := claim.SupplyRewardIndexes.GetRewardIndex(tc.args.deposit.Denom) -// suite.Require().True(found) -// rewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.updatedExpectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// claim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestUpdateHardSupplyIndexDenoms() { -// type args struct { -// firstDeposit sdk.Coins -// secondDeposit sdk.Coins -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// expectedSupplyIndexDenoms []string -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "single reward denom: update adds one supply reward index", -// args{ -// firstDeposit: cs(c("bnb", 10000000000)), -// secondDeposit: cs(c("uguu", 10000000000)), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedSupplyIndexDenoms: []string{"bnb", "uguu"}, -// }, -// }, -// { -// "single reward denom: update adds multiple supply reward indexes", -// args{ -// firstDeposit: cs(c("bnb", 10000000000)), -// secondDeposit: cs(c("uguu", 10000000000), c("btcb", 10000000000), c("xrp", 10000000000)), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedSupplyIndexDenoms: []string{"bnb", "uguu", "btcb", "xrp"}, -// }, -// }, -// { -// "single reward denom: update doesn't add duplicate supply reward index for same denom", -// args{ -// firstDeposit: cs(c("bnb", 10000000000)), -// secondDeposit: cs(c("bnb", 5000000000)), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedSupplyIndexDenoms: []string{"bnb"}, -// }, -// }, -// { -// "multiple reward denoms: update adds one supply reward index", -// args{ -// firstDeposit: cs(c("bnb", 10000000000)), -// secondDeposit: cs(c("uguu", 10000000000)), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedSupplyIndexDenoms: []string{"bnb", "uguu"}, -// }, -// }, -// { -// "multiple reward denoms: update adds multiple supply reward indexes", -// args{ -// firstDeposit: cs(c("bnb", 10000000000)), -// secondDeposit: cs(c("uguu", 10000000000), c("btcb", 10000000000), c("xrp", 10000000000)), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedSupplyIndexDenoms: []string{"bnb", "uguu", "btcb", "xrp"}, -// }, -// }, -// { -// "multiple reward denoms: update doesn't add duplicate supply reward index for same denom", -// args{ -// firstDeposit: cs(c("bnb", 10000000000)), -// secondDeposit: cs(c("bnb", 5000000000)), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedSupplyIndexDenoms: []string{"bnb"}, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up generic reward periods -// var multiRewardPeriods incentivetypes.MultiRewardPeriods -// var rewardPeriods incentivetypes.RewardPeriods -// for i, denom := range tc.args.expectedSupplyIndexDenoms { -// // Create just one reward period for JPYX Minting / Hard Delegator reward periods (otherwise params will panic on duplicate) -// if i == 0 { -// rewardPeriod := incentivetypes.NewRewardPeriod(true, denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[i]) -// rewardPeriods = append(rewardPeriods, rewardPeriod) -// } -// multiRewardPeriod := incentivetypes.NewMultiRewardPeriod(true, denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond) -// multiRewardPeriods = append(multiRewardPeriods, multiRewardPeriod) -// } - -// // Setup incentive state -// params := incentivetypes.NewParams( -// rewardPeriods, multiRewardPeriods, multiRewardPeriods, rewardPeriods, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) - -// // Set each denom's previous accrual time and supply reward factor -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// for _, denom := range tc.args.expectedSupplyIndexDenoms { -// suite.keeper.SetPreviousHardSupplyRewardAccrualTime(suite.ctx, denom, tc.args.initialTime) -// suite.keeper.SetHardSupplyRewardIndexes(suite.ctx, denom, rewardIndexes) -// } - -// // User deposits (first time) -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, tc.args.firstDeposit) -// suite.Require().NoError(err) - -// // Confirm that a claim was created and populated with the correct supply indexes -// claimAfterFirstDeposit, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// for _, coin := range tc.args.firstDeposit { -// _, hasIndex := claimAfterFirstDeposit.HasSupplyRewardIndex(coin.Denom) -// suite.Require().True(hasIndex) -// } -// suite.Require().True(len(claimAfterFirstDeposit.SupplyRewardIndexes) == len(tc.args.firstDeposit)) - -// // User deposits (second time) -// err = hardKeeper.Deposit(suite.ctx, userAddr, tc.args.secondDeposit) -// suite.Require().NoError(err) - -// // Confirm that the claim contains all expected supply indexes -// claimAfterSecondDeposit, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// for _, denom := range tc.args.expectedSupplyIndexDenoms { -// _, hasIndex := claimAfterSecondDeposit.HasSupplyRewardIndex(denom) -// suite.Require().True(hasIndex) -// } -// suite.Require().True(len(claimAfterSecondDeposit.SupplyRewardIndexes) == len(tc.args.expectedSupplyIndexDenoms)) -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestInitializeHardBorrowRewards() { - -// type args struct { -// moneyMarketRewardDenoms map[string][]string -// deposit sdk.Coins -// borrow sdk.Coins -// initialTime time.Time -// expectedClaimBorrowRewardIndexes incentivetypes.MultiRewardIndexes -// } -// type test struct { -// name string -// args args -// } - -// standardMoneyMarketRewardDenoms := map[string][]string{ -// "bnb": {"hard"}, -// "btcb": {"hard", "uguu"}, -// "xrp": {}, -// } - -// testCases := []test{ -// { -// "single deposit denom, single reward denom", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("bnb", 1000000000000)), -// borrow: cs(c("bnb", 100000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimBorrowRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "bnb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// }, -// ), -// }, -// }, -// }, -// { -// "single deposit denom, multiple reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("btcb", 1000000000000)), -// borrow: cs(c("btcb", 100000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimBorrowRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "btcb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// incentivetypes.NewRewardIndex("uguu", d("0.0")), -// }, -// ), -// }, -// }, -// }, -// { -// "single deposit denom, no reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("xrp", 1000000000000)), -// borrow: cs(c("xrp", 100000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimBorrowRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "xrp", -// nil, -// ), -// }, -// }, -// }, -// { -// "multiple deposit denoms, multiple overlapping reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("bnb", 1000000000000), c("btcb", 1000000000000)), -// borrow: cs(c("bnb", 100000000000), c("btcb", 100000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimBorrowRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "bnb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// }, -// ), -// incentivetypes.NewMultiRewardIndex( -// "btcb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// incentivetypes.NewRewardIndex("uguu", d("0.0")), -// }, -// ), -// }, -// }, -// }, -// { -// "multiple deposit denoms, correct discrete reward denoms", -// args{ -// moneyMarketRewardDenoms: standardMoneyMarketRewardDenoms, -// deposit: cs(c("bnb", 1000000000000), c("xrp", 1000000000000)), -// borrow: cs(c("bnb", 100000000000), c("xrp", 100000000000)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedClaimBorrowRewardIndexes: incentivetypes.MultiRewardIndexes{ -// incentivetypes.NewMultiRewardIndex( -// "bnb", -// incentivetypes.RewardIndexes{ -// incentivetypes.NewRewardIndex("hard", d("0.0")), -// }, -// ), -// incentivetypes.NewMultiRewardIndex( -// "xrp", -// nil, -// ), -// }, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// userAddr := suite.addrs[3] - -// // Prepare money market + reward params -// i := 0 -// var multiRewardPeriods incentivetypes.MultiRewardPeriods -// var rewardPeriods incentivetypes.RewardPeriods -// for moneyMarketDenom, rewardDenoms := range tc.args.moneyMarketRewardDenoms { -// // Set up multi reward periods for supply/borrow indexes with dynamic money market denoms/reward denoms -// var rewardsPerSecond sdk.Coins -// for _, rewardDenom := range rewardDenoms { -// rewardsPerSecond = append(rewardsPerSecond, sdk.NewCoin(rewardDenom, sdk.OneInt())) -// } -// multiRewardPeriod := incentivetypes.NewMultiRewardPeriod(true, moneyMarketDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), rewardsPerSecond) -// multiRewardPeriods = append(multiRewardPeriods, multiRewardPeriod) - -// // Set up generic reward periods for jpu minting/delegator indexes -// if i == 0 && len(rewardDenoms) > 0 { -// rewardPeriod := incentivetypes.NewRewardPeriod(true, moneyMarketDenom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), rewardsPerSecond[i]) -// rewardPeriods = append(rewardPeriods, rewardPeriod) -// i++ -// } -// } - -// // Initialize and set incentive params -// params := incentivetypes.NewParams( -// rewardPeriods, multiRewardPeriods, multiRewardPeriods, rewardPeriods, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) - -// // Set each money market's previous accrual time and supply reward indexes -// for moneyMarketDenom, rewardDenoms := range tc.args.moneyMarketRewardDenoms { -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardDenom := range rewardDenoms { -// rewardIndex := incentivetypes.NewRewardIndex(rewardDenom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// suite.keeper.SetPreviousHardBorrowRewardAccrualTime(suite.ctx, moneyMarketDenom, tc.args.initialTime) -// if len(rewardIndexes) > 0 { -// suite.keeper.SetHardBorrowRewardIndexes(suite.ctx, moneyMarketDenom, rewardIndexes) -// } -// } - -// hardKeeper := suite.app.GetHardKeeper() -// // User deposits -// err := hardKeeper.Deposit(suite.ctx, userAddr, tc.args.deposit) -// suite.Require().NoError(err) -// // User borrows -// err = hardKeeper.Borrow(suite.ctx, userAddr, tc.args.borrow) -// suite.Require().NoError(err) - -// claim, foundClaim := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, userAddr) -// suite.Require().True(foundClaim) -// suite.Require().Equal(tc.args.expectedClaimBorrowRewardIndexes, claim.BorrowRewardIndexes) -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestUpdateHardBorrowIndexDenoms() { -// type args struct { -// initialDeposit sdk.Coins -// firstBorrow sdk.Coins -// secondBorrow sdk.Coins -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// expectedBorrowIndexDenoms []string -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "single reward denom: update adds one borrow reward index", -// args{ -// initialDeposit: cs(c("bnb", 10000000000)), -// firstBorrow: cs(c("bnb", 50000000)), -// secondBorrow: cs(c("uguu", 500000000)), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedBorrowIndexDenoms: []string{"bnb", "uguu"}, -// }, -// }, -// { -// "single reward denom: update adds multiple borrow supply reward indexes", -// args{ -// initialDeposit: cs(c("btcb", 10000000000)), -// firstBorrow: cs(c("btcb", 50000000)), -// secondBorrow: cs(c("uguu", 500000000), c("bnb", 50000000000), c("xrp", 50000000000)), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedBorrowIndexDenoms: []string{"btcb", "uguu", "bnb", "xrp"}, -// }, -// }, -// { -// "single reward denom: update doesn't add duplicate borrow reward index for same denom", -// args{ -// initialDeposit: cs(c("bnb", 100000000000)), -// firstBorrow: cs(c("bnb", 50000000)), -// secondBorrow: cs(c("bnb", 50000000000)), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedBorrowIndexDenoms: []string{"bnb"}, -// }, -// }, -// { -// "multiple reward denoms: update adds one borrow reward index", -// args{ -// initialDeposit: cs(c("bnb", 10000000000)), -// firstBorrow: cs(c("bnb", 50000000)), -// secondBorrow: cs(c("uguu", 500000000)), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedBorrowIndexDenoms: []string{"bnb", "uguu"}, -// }, -// }, -// { -// "multiple reward denoms: update adds multiple borrow supply reward indexes", -// args{ -// initialDeposit: cs(c("btcb", 10000000000)), -// firstBorrow: cs(c("btcb", 50000000)), -// secondBorrow: cs(c("uguu", 500000000), c("bnb", 50000000000), c("xrp", 50000000000)), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedBorrowIndexDenoms: []string{"btcb", "uguu", "bnb", "xrp"}, -// }, -// }, -// { -// "multiple reward denoms: update doesn't add duplicate borrow reward index for same denom", -// args{ -// initialDeposit: cs(c("bnb", 100000000000)), -// firstBorrow: cs(c("bnb", 50000000)), -// secondBorrow: cs(c("bnb", 50000000000)), -// rewardsPerSecond: cs(c("hard", 122354), c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// expectedBorrowIndexDenoms: []string{"bnb"}, -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account so it can service borrow requests -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := tc.args.firstBorrow.Add(tc.args.secondBorrow...) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up generic reward periods -// var multiRewardPeriods incentivetypes.MultiRewardPeriods -// var rewardPeriods incentivetypes.RewardPeriods -// for i, denom := range tc.args.expectedBorrowIndexDenoms { -// // Create just one reward period for JPYX Minting / Hard Delegator reward periods (otherwise params will panic on duplicate) -// if i == 0 { -// rewardPeriod := incentivetypes.NewRewardPeriod(true, denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[i]) -// rewardPeriods = append(rewardPeriods, rewardPeriod) -// } -// multiRewardPeriod := incentivetypes.NewMultiRewardPeriod(true, denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond) -// multiRewardPeriods = append(multiRewardPeriods, multiRewardPeriod) -// } - -// // Setup incentive state -// params := incentivetypes.NewParams( -// rewardPeriods, multiRewardPeriods, multiRewardPeriods, rewardPeriods, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) - -// // Set each expected borrow denom's previous accrual time and borrow reward factor -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// for _, denom := range tc.args.expectedBorrowIndexDenoms { -// suite.keeper.SetPreviousHardSupplyRewardAccrualTime(suite.ctx, denom, tc.args.initialTime) -// suite.keeper.SetHardBorrowRewardIndexes(suite.ctx, denom, rewardIndexes) -// } - -// // User deposits initial funds (so that user can borrow) -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, tc.args.initialDeposit) -// suite.Require().NoError(err) - -// // Confirm that claim exists but no borrow reward indexes have been added -// claimAfterDeposit, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// suite.Require().Equal(0, len(claimAfterDeposit.BorrowRewardIndexes)) - -// // User borrows (first time) -// err = hardKeeper.Borrow(suite.ctx, userAddr, tc.args.firstBorrow) -// suite.Require().NoError(err) - -// // Confirm that claim's borrow reward indexes have been updated -// claimAfterFirstBorrow, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// for _, coin := range tc.args.firstBorrow { -// _, hasIndex := claimAfterFirstBorrow.HasBorrowRewardIndex(coin.Denom) -// suite.Require().True(hasIndex) -// } -// suite.Require().True(len(claimAfterFirstBorrow.BorrowRewardIndexes) == len(tc.args.firstBorrow)) - -// // User borrows (second time) -// err = hardKeeper.Borrow(suite.ctx, userAddr, tc.args.secondBorrow) -// suite.Require().NoError(err) - -// // Confirm that claim's borrow reward indexes contain expected values -// claimAfterSecondBorrow, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// for _, coin := range tc.args.secondBorrow { -// _, hasIndex := claimAfterSecondBorrow.HasBorrowRewardIndex(coin.Denom) -// suite.Require().True(hasIndex) -// } -// suite.Require().True(len(claimAfterSecondBorrow.BorrowRewardIndexes) == len(tc.args.expectedBorrowIndexDenoms)) -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestSynchronizeHardDelegatorReward() { -// type args struct { -// delegation sdk.Coin -// rewardsPerSecond sdk.Coin -// initialTime time.Time -// blockTimes []int -// expectedRewardFactor sdk.Dec -// expectedRewards sdk.Coins -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: c("hard", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardFactor: d("6.117700000000000000"), -// expectedRewards: cs(c("hard", 6117700)), -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: c("hard", 122354), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardFactor: d("52856.928000000000000000"), -// expectedRewards: cs(c("hard", 52856928000)), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), cs(tc.args.rewardsPerSecond))}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousHardDelegatorRewardAccrualTime(suite.ctx, tc.args.delegation.Denom, tc.args.initialTime) -// suite.keeper.SetHardDelegatorRewardFactor(suite.ctx, tc.args.delegation.Denom, sdk.ZeroDec()) - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.delegation.Denom, tc.args.initialTime) - -// // Delegator delegates -// err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], tc.args.delegation) -// suite.Require().NoError(err) -// suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[0], tc.args.delegation) -// suite.Require().NoError(err) - -// staking.EndBlocker(suite.ctx, suite.stakingKeeper) - -// // Check that Staking hooks initialized a HardLiquidityProviderClaim -// claim, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), claim.DelegatorRewardIndexes[0].RewardFactor) - -// // Run accumulator at several intervals -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) - -// // Run Hard begin blocker for each block ctx to update denom's interest factor -// hard.BeginBlocker(blockCtx, suite.hardKeeper) - -// rewardPeriod, found := suite.keeper.GetHardDelegatorRewardPeriod(blockCtx, tc.args.delegation.Denom) -// suite.Require().True(found) - -// err := suite.keeper.AccumulateHardDelegatorRewards(blockCtx, rewardPeriod) -// suite.Require().NoError(err) -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// // After we've accumulated, run synchronize -// suite.Require().NotPanics(func() { -// suite.keeper.SynchronizeHardDelegatorRewards(suite.ctx, suite.addrs[0]) -// }) - -// // Check that reward factor and claim have been updated as expected -// rewardFactor, found := suite.keeper.GetHardDelegatorRewardFactor(suite.ctx, tc.args.delegation.Denom) -// suite.Require().Equal(tc.args.expectedRewardFactor, rewardFactor) - -// claim, found = suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(tc.args.expectedRewardFactor, claim.DelegatorRewardIndexes[0].RewardFactor) -// suite.Require().Equal(tc.args.expectedRewards, claim.Reward) -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestSimulateHardSupplyRewardSynchronization() { -// type args struct { -// deposit sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// blockTimes []int -// expectedRewardIndexes incentivetypes.RewardIndexes -// expectedRewards sdk.Coins -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.001223540000000000"))}, -// expectedRewards: cs(c("hard", 12235400)), -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// deposit: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("10.571385600000000000"))}, -// expectedRewards: cs(c("hard", 105713856000)), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // Set up incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.deposit.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousHardSupplyRewardAccrualTime(suite.ctx, tc.args.deposit.Denom, tc.args.initialTime) -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// suite.keeper.SetHardSupplyRewardIndexes(suite.ctx, tc.args.deposit.Denom, rewardIndexes) - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetSupplyInterestFactor(suite.ctx, tc.args.deposit.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.deposit.Denom, tc.args.initialTime) - -// // User deposits and borrows to increase total borrowed amount -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, sdk.NewCoins(tc.args.deposit)) -// suite.Require().NoError(err) - -// // Check that Hard hooks initialized a HardLiquidityProviderClaim -// claim, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// multiRewardIndex, _ := claim.SupplyRewardIndexes.GetRewardIndex(tc.args.deposit.Denom) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) -// } - -// // Run accumulator at several intervals -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) - -// // Run Hard begin blocker for each block ctx to update denom's interest factor -// hard.BeginBlocker(blockCtx, suite.hardKeeper) - -// // Accumulate hard supply-side rewards -// multiRewardPeriod, found := suite.keeper.GetHardSupplyRewardPeriods(blockCtx, tc.args.deposit.Denom) -// suite.Require().True(found) -// err := suite.keeper.AccumulateHardSupplyRewards(blockCtx, multiRewardPeriod) -// suite.Require().NoError(err) -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// // Confirm that the user's claim hasn't been synced -// claimPre, foundPre := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(foundPre) -// multiRewardIndexPre, _ := claimPre.SupplyRewardIndexes.GetRewardIndex(tc.args.deposit.Denom) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// currRewardIndex, found := multiRewardIndexPre.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) -// } - -// // Check that the synced claim held in memory has properly simulated syncing -// syncedClaim := suite.keeper.SimulateHardSynchronization(suite.ctx, claimPre) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// // Check that the user's claim's reward index matches the expected reward index -// multiRewardIndex, found := syncedClaim.SupplyRewardIndexes.GetRewardIndex(tc.args.deposit.Denom) -// suite.Require().True(found) -// rewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.expectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// syncedClaim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestSimulateHardBorrowRewardSynchronization() { -// type args struct { -// borrow sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// blockTimes []int -// expectedRewardIndexes incentivetypes.RewardIndexes -// expectedRewards sdk.Coins -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("0.001223540000173228"))}, -// expectedRewards: cs(c("hard", 12235400)), -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// borrow: c("bnb", 10000000000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("hard", d("10.571385603126235340"))}, -// expectedRewards: cs(c("hard", 105713856031)), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.borrow.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousHardBorrowRewardAccrualTime(suite.ctx, tc.args.borrow.Denom, tc.args.initialTime) -// var rewardIndexes incentivetypes.RewardIndexes -// for _, rewardCoin := range tc.args.rewardsPerSecond { -// rewardIndex := incentivetypes.NewRewardIndex(rewardCoin.Denom, sdk.ZeroDec()) -// rewardIndexes = append(rewardIndexes, rewardIndex) -// } -// suite.keeper.SetHardBorrowRewardIndexes(suite.ctx, tc.args.borrow.Denom, rewardIndexes) - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetSupplyInterestFactor(suite.ctx, tc.args.borrow.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetBorrowInterestFactor(suite.ctx, tc.args.borrow.Denom, sdk.MustNewDecFromStr("1.0")) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.borrow.Denom, tc.args.initialTime) - -// // User deposits and borrows to increase total borrowed amount -// hardKeeper := suite.app.GetHardKeeper() -// userAddr := suite.addrs[3] -// err := hardKeeper.Deposit(suite.ctx, userAddr, sdk.NewCoins(sdk.NewCoin(tc.args.borrow.Denom, tc.args.borrow.Amount.Mul(sdk.NewInt(2))))) -// suite.Require().NoError(err) -// err = hardKeeper.Borrow(suite.ctx, userAddr, sdk.NewCoins(tc.args.borrow)) -// suite.Require().NoError(err) - -// // Check that Hard hooks initialized a HardLiquidityProviderClaim -// claim, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(found) -// multiRewardIndex, _ := claim.BorrowRewardIndexes.GetRewardIndex(tc.args.borrow.Denom) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) -// } - -// // Run accumulator at several intervals -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) - -// // Run Hard begin blocker for each block ctx to update denom's interest factor -// hard.BeginBlocker(blockCtx, suite.hardKeeper) - -// // Accumulate hard borrow-side rewards -// multiRewardPeriod, found := suite.keeper.GetHardBorrowRewardPeriods(blockCtx, tc.args.borrow.Denom) -// suite.Require().True(found) -// err := suite.keeper.AccumulateHardBorrowRewards(blockCtx, multiRewardPeriod) -// suite.Require().NoError(err) -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// // Confirm that the user's claim hasn't been synced -// claimPre, foundPre := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[3]) -// suite.Require().True(foundPre) -// multiRewardIndexPre, _ := claimPre.BorrowRewardIndexes.GetRewardIndex(tc.args.borrow.Denom) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// currRewardIndex, found := multiRewardIndexPre.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) -// } - -// // Check that the synced claim held in memory has properly simulated syncing -// syncedClaim := suite.keeper.SimulateHardSynchronization(suite.ctx, claim) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// // Check that the user's claim's reward index matches the expected reward index -// multiRewardIndex, found := syncedClaim.BorrowRewardIndexes.GetRewardIndex(tc.args.borrow.Denom) -// suite.Require().True(found) -// rewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.expectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// syncedClaim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// }) -// } -// } -// */ - -// /* -// func (suite *KeeperTestSuite) TestSimulateHardDelegatorRewardSynchronization() { -// type args struct { -// delegation sdk.Coin -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// blockTimes []int -// expectedRewardIndexes incentivetypes.RewardIndexes -// expectedRewards sdk.Coins -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("uguu", d("6.117700000000000000"))}, // Here the reward index stores data differently than inside a MultiRewardIndex -// expectedRewards: cs(c("hard", 6117700)), -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// delegation: c("uguu", 1_000_000), -// rewardsPerSecond: cs(c("hard", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardIndexes: incentivetypes.RewardIndexes{incentivetypes.NewRewardIndex("uguu", d("52856.928000000000000000"))}, -// expectedRewards: cs(c("hard", 52856928000)), -// }, -// }, -// } - -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // Mint coins to hard module account -// supplyKeeper := suite.app.GetBankKeeper() -// hardMaccCoins := sdk.NewCoins(sdk.NewCoin("jpu", sdk.NewInt(200000000))) -// supplyKeeper.MintCoins(suite.ctx, hardtypes.ModuleAccountName, hardMaccCoins) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.MultiRewardPeriods{incentivetypes.NewMultiRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond)}, -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.delegation.Denom, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousHardDelegatorRewardAccrualTime(suite.ctx, tc.args.delegation.Denom, tc.args.initialTime) -// suite.keeper.SetHardDelegatorRewardFactor(suite.ctx, tc.args.delegation.Denom, sdk.ZeroDec()) - -// // Set up hard state (interest factor for the relevant denom) -// suite.hardKeeper.SetPreviousAccrualTime(suite.ctx, tc.args.delegation.Denom, tc.args.initialTime) - -// // Delegator delegates -// err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], tc.args.delegation) -// suite.Require().NoError(err) -// suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[0], tc.args.delegation) -// suite.Require().NoError(err) - -// staking.EndBlocker(suite.ctx, suite.stakingKeeper) - -// // Check that Staking hooks initialized a HardLiquidityProviderClaim -// claim, found := suite.keeper.GetHardLiquidityProviderClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), claim.DelegatorRewardIndexes[0].RewardFactor) - -// // Run accumulator at several intervals -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) - -// // Run Hard begin blocker for each block ctx to update denom's interest factor -// hard.BeginBlocker(blockCtx, suite.hardKeeper) - -// // Accumulate hard delegator rewards -// rewardPeriod, found := suite.keeper.GetHardDelegatorRewardPeriod(blockCtx, tc.args.delegation.Denom) -// suite.Require().True(found) -// err := suite.keeper.AccumulateHardDelegatorRewards(blockCtx, rewardPeriod) -// suite.Require().NoError(err) -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// // Check that the synced claim held in memory has properly simulated syncing -// syncedClaim := suite.keeper.SimulateHardSynchronization(suite.ctx, claim) -// for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { -// // Check that the user's claim's reward index matches the expected reward index -// rewardIndex, found := syncedClaim.DelegatorRewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) -// suite.Require().True(found) -// suite.Require().Equal(expectedRewardIndex, rewardIndex) - -// // Check that the user's claim holds the expected amount of reward coins -// suite.Require().Equal( -// tc.args.expectedRewards.AmountOf(expectedRewardIndex.CollateralType), -// syncedClaim.Reward.AmountOf(expectedRewardIndex.CollateralType), -// ) -// } -// }) -// } -// } -// */ - -// func (suite *KeeperTestSuite) TestSimulateCdpMintingRewardSynchronization() { -// type args struct { -// ctype string -// rewardsPerSecond sdk.Coins -// initialTime time.Time -// initialCollateral sdk.Coin -// initialPrincipal sdk.Coin -// blockTimes []int -// expectedRewardFactor sdk.Dec -// expectedRewards sdk.Coin -// } -// type test struct { -// name string -// args args -// } - -// testCases := []test{ -// { -// "10 blocks", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: cs(c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialCollateral: c("bnb", 1000000000000), -// initialPrincipal: c("jpu", 10000000000), -// blockTimes: []int{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, -// expectedRewardFactor: d("0.001223540000000000"), -// expectedRewards: c("uguu", 12235400), -// }, -// }, -// { -// "10 blocks - long block time", -// args{ -// ctype: "bnb-a", -// rewardsPerSecond: cs(c("uguu", 122354)), -// initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), -// initialCollateral: c("bnb", 1000000000000), -// initialPrincipal: c("jpu", 10000000000), -// blockTimes: []int{86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400, 86400}, -// expectedRewardFactor: d("10.57138560000000000"), -// expectedRewards: c("uguu", 105713856000), -// }, -// }, -// } -// for _, tc := range testCases { -// suite.Run(tc.name, func() { -// suite.SetupWithGenState() -// suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) - -// // setup incentive state -// params := incentivetypes.NewParams( -// incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod(true, tc.args.ctype, tc.args.initialTime, tc.args.initialTime.Add(time.Hour*24*365*4), tc.args.rewardsPerSecond[0])}, -// incentivetypes.Multipliers{incentivetypes.NewMultiplier(incentivetypes.MultiplierName("small"), 1, d("0.25")), incentivetypes.NewMultiplier(incentivetypes.MultiplierName("large"), 12, d("1.0"))}, -// tc.args.initialTime.Add(time.Hour*24*365*5), -// ) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetParams(suite.ctx, params) -// suite.keeper.SetPreviousCdpMintingAccrualTime(suite.ctx, tc.args.ctype, tc.args.initialTime) -// suite.keeper.SetCdpMintingRewardFactor(suite.ctx, tc.args.ctype, sdk.ZeroDec()) - -// // setup account state -// sk := suite.app.GetBankKeeper() -// sk.MintCoins(suite.ctx, cdptypes.ModuleName, sdk.NewCoins(tc.args.initialCollateral)) -// sk.SendCoinsFromModuleToAccount(suite.ctx, cdptypes.ModuleName, suite.addrs[0], sdk.NewCoins(tc.args.initialCollateral)) - -// // setup cdp state -// cdpKeeper := suite.app.GetCDPKeeper() -// err := cdpKeeper.AddCdp(suite.ctx, suite.addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) -// suite.Require().NoError(err) - -// claim, found := suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) - -// var timeElapsed int -// previousBlockTime := suite.ctx.BlockTime() -// for _, t := range tc.args.blockTimes { -// timeElapsed += t -// updatedBlockTime := previousBlockTime.Add(time.Duration(int(time.Second) * t)) -// previousBlockTime = updatedBlockTime -// blockCtx := suite.ctx.WithBlockTime(updatedBlockTime) -// rewardPeriod, found := suite.keeper.GetCdpMintingRewardPeriod(blockCtx, tc.args.ctype) -// suite.Require().True(found) -// err := suite.keeper.AccumulateCdpMintingRewards(blockCtx, rewardPeriod) -// suite.Require().NoError(err) -// } -// updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * timeElapsed)) -// suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) - -// claim, found = suite.keeper.GetCdpMintingClaim(suite.ctx, suite.addrs[0]) -// suite.Require().True(found) -// suite.Require().Equal(claim.RewardIndexes[0].RewardFactor, sdk.ZeroDec()) -// suite.Require().Equal(claim.Reward, sdk.NewCoin("uguu", sdk.ZeroInt())) - -// updatedClaim := suite.keeper.SimulateCdpMintingSynchronization(suite.ctx, claim) -// suite.Require().Equal(tc.args.expectedRewardFactor, updatedClaim.RewardIndexes[0].RewardFactor) -// suite.Require().Equal(tc.args.expectedRewards, updatedClaim.Reward) -// }) -// } -// } - -// func (suite *KeeperTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdk.Coin) error { -// msg, _ := stakingtypes.NewMsgCreateValidator( -// address, -// secp256k1.GenPrivKey().PubKey(), -// selfDelegation, -// stakingtypes.Description{}, -// stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), -// sdk.NewInt(1_000_000), -// ) -// msgServer := stakingkeeper.NewMsgServerImpl(suite.stakingKeeper) -// _, err := msgServer.CreateValidator(sdk.WrapSDKContext(ctx), msg) -// return err -// } - -// func (suite *KeeperTestSuite) deliverMsgDelegate(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coin) error { -// msg := stakingtypes.NewMsgDelegate( -// delegator, -// validator, -// amount, -// ) -// msgServer := stakingkeeper.NewMsgServerImpl(suite.stakingKeeper) -// _, err := msgServer.Delegate(sdk.WrapSDKContext(ctx), msg) -// return err -// } diff --git a/deprecated/x/incentive/module.go b/deprecated/x/incentive/module.go deleted file mode 100644 index d45c1fb25..000000000 --- a/deprecated/x/incentive/module.go +++ /dev/null @@ -1,171 +0,0 @@ -package incentive - -import ( - "encoding/json" - "fmt" - - "context" - - // this line is used by starport scaffolding # 1 - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/UnUniFi/chain/deprecated/x/incentive/client/cli" - "github.com/UnUniFi/chain/deprecated/x/incentive/client/rest" - "github.com/UnUniFi/chain/deprecated/x/incentive/keeper" - "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr) -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - cdpKeeper types.CdpKeeper -} - -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - cdpKeeper types.CdpKeeper) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, cdpKeeper: cdpKeeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, am.accountKeeper, am.cdpKeeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(&genState) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) -} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/deprecated/x/incentive/types/account.go b/deprecated/x/incentive/types/account.go deleted file mode 100644 index c45c6362b..000000000 --- a/deprecated/x/incentive/types/account.go +++ /dev/null @@ -1,14 +0,0 @@ -package types - -import ( - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" -) - -// GetTotalVestingPeriodLength returns the summed length of all vesting periods -func GetTotalVestingPeriodLength(periods vestingtypes.Periods) int64 { - length := int64(0) - for _, period := range periods { - length += period.Length - } - return length -} diff --git a/deprecated/x/incentive/types/account_test.go b/deprecated/x/incentive/types/account_test.go deleted file mode 100644 index 08f03569a..000000000 --- a/deprecated/x/incentive/types/account_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - - incentivetypes "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -type accountTest struct { - periods vestingtypes.Periods - expectedVal int64 -} - -type AccountTestSuite struct { - suite.Suite - - tests []accountTest -} - -func (suite *AccountTestSuite) SetupTest() { - tests := []accountTest{ - { - periods: vestingtypes.Periods{ - vestingtypes.Period{ - Length: int64(100), - Amount: sdk.Coins{}, - }, - vestingtypes.Period{ - Length: int64(200), - Amount: sdk.Coins{}, - }, - }, - expectedVal: int64(300), - }, - } - suite.tests = tests -} - -func (suite *AccountTestSuite) TestGetTotalPeriodLength() { - for _, t := range suite.tests { - length := incentivetypes.GetTotalVestingPeriodLength(t.periods) - suite.Equal(t.expectedVal, length) - } -} - -func TestAccountTestSuite(t *testing.T) { - suite.Run(t, new(AccountTestSuite)) -} diff --git a/deprecated/x/incentive/types/claims.go b/deprecated/x/incentive/types/claims.go deleted file mode 100644 index 52fe47cd6..000000000 --- a/deprecated/x/incentive/types/claims.go +++ /dev/null @@ -1,332 +0,0 @@ -package types - -import ( - "errors" - "fmt" - "strings" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - CdpMintingClaimType = "cdp_minting" -) - -// Claim is an interface for handling common claim actions -type Claim interface { - GetOwner() sdk.AccAddress - GetReward() sdk.Coin - GetType() string -} - -// Claims is a slice of Claim -type Claims []Claim - -// GetType returns the claim type, used to identify auctions in event attributes -func (c BaseClaim) GetType() string { return "base" } - -// Validate performs a basic check of a BaseClaim fields -func (c BaseClaim) Validate() error { - if c.Owner.AccAddress().Empty() { - return errors.New("claim owner cannot be empty") - } - if !c.Reward.IsValid() { - return fmt.Errorf("invalid reward amount: %s", c.Reward) - } - return nil -} - -// GetType returns the claim type, used to identify auctions in event attributes -func (c BaseMultiClaim) GetType() string { return "base" } - -// Validate performs a basic check of a BaseClaim fields -func (c BaseMultiClaim) Validate() error { - if c.Owner.AccAddress().Empty() { - return errors.New("claim owner cannot be empty") - } - if !sdk.Coins(c.Reward).IsValid() { - return fmt.Errorf("invalid reward amount: %s", c.Reward) - } - return nil -} - -// -------------- Custom Claim Types -------------- - -// NewCdpMintingClaim returns a new CdpMintingClaim -func NewCdpMintingClaim(owner sdk.AccAddress, reward sdk.Coin, rewardIndexes RewardIndexes) CdpMintingClaim { - return CdpMintingClaim{ - BaseClaim: &BaseClaim{ - Owner: owner.Bytes(), - Reward: reward, - }, - RewardIndexes: rewardIndexes, - } -} - -// GetType returns the claim's type -func (c CdpMintingClaim) GetType() string { return CdpMintingClaimType } - -// GetReward returns the claim's reward coin -func (c CdpMintingClaim) GetReward() sdk.Coin { return c.Reward } - -// GetOwner returns the claim's owner -func (c CdpMintingClaim) GetOwner() sdk.AccAddress { - return c.Owner.AccAddress() -} - -// Validate performs a basic check of a Claim fields -func (c CdpMintingClaim) Validate() error { - if err := RewardIndexes(c.RewardIndexes).Validate(); err != nil { - return err - } - - return c.BaseClaim.Validate() -} - -// HasRewardIndex check if a claim has a reward index for the input collateral type -func (c CdpMintingClaim) HasRewardIndex(collateralType string) (int64, bool) { - for index, ri := range c.RewardIndexes { - if ri.CollateralType == collateralType { - return int64(index), true - } - } - return 0, false -} - -// CdpMintingClaims slice of CdpMintingClaim -type CdpMintingClaims []CdpMintingClaim - -// Validate checks if all the claims are valid and there are no duplicated -// entries. -func (cs CdpMintingClaims) Validate() error { - for _, c := range cs { - if err := c.Validate(); err != nil { - return err - } - } - - return nil -} - -// ---------------------- Reward periods are used by the params ---------------------- - -// MultiRewardPeriod supports multiple reward types -type MultiRewardPeriod struct { - Active bool `json:"active" yaml:"active"` - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - Start time.Time `json:"start" yaml:"start"` - End time.Time `json:"end" yaml:"end"` - RewardsPerSecond sdk.Coins `json:"rewards_per_second" yaml:"rewards_per_second"` // per second reward payouts -} - -// String implements fmt.Stringer -func (mrp MultiRewardPeriod) String() string { - return fmt.Sprintf(`Reward Period: - Collateral Type: %s, - Start: %s, - End: %s, - Rewards Per Second: %s, - Active %t, - `, mrp.CollateralType, mrp.Start, mrp.End, mrp.RewardsPerSecond, mrp.Active) -} - -// NewMultiRewardPeriod returns a new MultiRewardPeriod -func NewMultiRewardPeriod(active bool, collateralType string, start time.Time, end time.Time, reward sdk.Coins) MultiRewardPeriod { - return MultiRewardPeriod{ - Active: active, - CollateralType: collateralType, - Start: start, - End: end, - RewardsPerSecond: reward, - } -} - -// Validate performs a basic check of a MultiRewardPeriod. -func (mrp MultiRewardPeriod) Validate() error { - if mrp.Start.IsZero() { - return errors.New("reward period start time cannot be 0") - } - if mrp.End.IsZero() { - return errors.New("reward period end time cannot be 0") - } - if mrp.Start.After(mrp.End) { - return fmt.Errorf("end period time %s cannot be before start time %s", mrp.End, mrp.Start) - } - if !mrp.RewardsPerSecond.IsValid() { - return fmt.Errorf("invalid reward amount: %s", mrp.RewardsPerSecond) - } - if strings.TrimSpace(mrp.CollateralType) == "" { - return fmt.Errorf("reward period collateral type cannot be blank: %s", mrp) - } - return nil -} - -// MultiRewardPeriods array of MultiRewardPeriod -type MultiRewardPeriods []MultiRewardPeriod - -// GetMultiRewardPeriod fetches a MultiRewardPeriod from an array of MultiRewardPeriods by its denom -func (mrps MultiRewardPeriods) GetMultiRewardPeriod(denom string) (MultiRewardPeriod, bool) { - for _, rp := range mrps { - if rp.CollateralType == denom { - return rp, true - } - } - return MultiRewardPeriod{}, false -} - -// GetMultiRewardPeriodIndex returns the index of a MultiRewardPeriod inside array MultiRewardPeriods -func (mrps MultiRewardPeriods) GetMultiRewardPeriodIndex(denom string) (int, bool) { - for i, rp := range mrps { - if rp.CollateralType == denom { - return i, true - } - } - return -1, false -} - -// Validate checks if all the RewardPeriods are valid and there are no duplicated -// entries. -func (mrps MultiRewardPeriods) Validate() error { - seenPeriods := make(map[string]bool) - for _, rp := range mrps { - if seenPeriods[rp.CollateralType] { - return fmt.Errorf("duplicated reward period with collateral type %s", rp.CollateralType) - } - - if err := rp.Validate(); err != nil { - return err - } - seenPeriods[rp.CollateralType] = true - } - - return nil -} - -// ---------------------- Reward indexes are used internally in the store ---------------------- - -// NewRewardIndex returns a new RewardIndex -func NewRewardIndex(collateralType string, factor sdk.Dec) RewardIndex { - return RewardIndex{ - CollateralType: collateralType, - RewardFactor: factor, - } -} - -// Validate validates reward index -func (ri RewardIndex) Validate() error { - if ri.RewardFactor.IsNegative() { - return fmt.Errorf("reward factor value should be positive, is %s for %s", ri.RewardFactor, ri.CollateralType) - } - if strings.TrimSpace(ri.CollateralType) == "" { - return fmt.Errorf("collateral type should not be empty") - } - return nil -} - -// RewardIndexes slice of RewardIndex -type RewardIndexes []RewardIndex - -// GetRewardIndex fetches a RewardIndex by its denom -func (ris RewardIndexes) GetRewardIndex(denom string) (RewardIndex, bool) { - for _, ri := range ris { - if ri.CollateralType == denom { - return ri, true - } - } - return RewardIndex{}, false -} - -// GetFactorIndex gets the index of a specific reward index inside the array by its index -func (ris RewardIndexes) GetFactorIndex(denom string) (int, bool) { - for i, ri := range ris { - if ri.CollateralType == denom { - return i, true - } - } - return -1, false -} - -// Validate validation for reward indexes -func (ris RewardIndexes) Validate() error { - for _, ri := range ris { - if err := ri.Validate(); err != nil { - return err - } - } - return nil -} - -// MultiRewardIndex stores reward accumulation information on multiple reward types -type MultiRewardIndex struct { - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - RewardIndexes RewardIndexes `json:"reward_indexes" yaml:"reward_indexes"` -} - -// NewMultiRewardIndex returns a new MultiRewardIndex -func NewMultiRewardIndex(collateralType string, indexes RewardIndexes) MultiRewardIndex { - return MultiRewardIndex{ - CollateralType: collateralType, - RewardIndexes: indexes, - } -} - -// GetFactorIndex gets the index of a specific reward index inside the array by its index -func (mri MultiRewardIndex) GetFactorIndex(denom string) (int, bool) { - for i, ri := range mri.RewardIndexes { - if ri.CollateralType == denom { - return i, true - } - } - return -1, false -} - -func (mri MultiRewardIndex) String() string { - return fmt.Sprintf(`Collateral Type: %s, Reward Indexes: %s`, mri.CollateralType, mri.RewardIndexes) -} - -// Validate validates multi-reward index -func (mri MultiRewardIndex) Validate() error { - for _, rf := range mri.RewardIndexes { - if rf.RewardFactor.IsNegative() { - return fmt.Errorf("reward index's factor value cannot be negative: %s", rf) - } - } - if strings.TrimSpace(mri.CollateralType) == "" { - return fmt.Errorf("collateral type should not be empty") - } - return nil -} - -// MultiRewardIndexes slice of MultiRewardIndex -type MultiRewardIndexes []MultiRewardIndex - -// GetRewardIndex fetches a RewardIndex from a MultiRewardIndex by its denom -func (mris MultiRewardIndexes) GetRewardIndex(denom string) (MultiRewardIndex, bool) { - for _, ri := range mris { - if ri.CollateralType == denom { - return ri, true - } - } - return MultiRewardIndex{}, false -} - -// GetRewardIndexIndex fetches a specific reward index inside the array by its denom -func (mris MultiRewardIndexes) GetRewardIndexIndex(denom string) (int, bool) { - for i, ri := range mris { - if ri.CollateralType == denom { - return i, true - } - } - return -1, false -} - -// Validate validation for reward indexes -func (mris MultiRewardIndexes) Validate() error { - for _, mri := range mris { - if err := mri.Validate(); err != nil { - return err - } - } - return nil -} diff --git a/deprecated/x/incentive/types/claims_test.go b/deprecated/x/incentive/types/claims_test.go deleted file mode 100644 index 25e318c66..000000000 --- a/deprecated/x/incentive/types/claims_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cometbft/cometbft/crypto" - - sdk "github.com/cosmos/cosmos-sdk/types" - - ununifitypes "github.com/UnUniFi/chain/deprecated/types" -) - -func TestClaimsValidate(t *testing.T) { - owner := sdk.AccAddress(crypto.AddressHash([]byte("KavaTestUser1"))) - - testCases := []struct { - msg string - claims CdpMintingClaims - expPass bool - }{ - { - "valid", - CdpMintingClaims{ - NewCdpMintingClaim(owner, sdk.NewCoin("bnb", sdk.OneInt()), RewardIndexes{NewRewardIndex("bnb-a", sdk.ZeroDec())}), - }, - true, - }, - { - "invalid owner", - CdpMintingClaims{ - CdpMintingClaim{ - BaseClaim: &BaseClaim{ - Owner: nil, - }, - }, - }, - false, - }, - { - "invalid reward", - CdpMintingClaims{ - { - BaseClaim: &BaseClaim{ - Owner: ununifitypes.StringAccAddress(owner), - Reward: sdk.Coin{Denom: "", Amount: sdk.ZeroInt()}, - }, - }, - }, - false, - }, - { - "invalid collateral type", - CdpMintingClaims{ - { - BaseClaim: &BaseClaim{ - Owner: ununifitypes.StringAccAddress(owner), - Reward: sdk.NewCoin("bnb", sdk.OneInt()), - }, - RewardIndexes: []RewardIndex{{"", sdk.ZeroDec()}}, - }, - }, - false, - }, - } - - for _, tc := range testCases { - err := tc.claims.Validate() - if tc.expPass { - require.NoError(t, err, tc.msg) - } else { - require.Error(t, err, tc.msg) - } - } -} diff --git a/deprecated/x/incentive/types/codec.go b/deprecated/x/incentive/types/codec.go deleted file mode 100644 index a1588f733..000000000 --- a/deprecated/x/incentive/types/codec.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" - // this line is used by starport scaffolding # 1 -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgClaimCdpMintingReward{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) diff --git a/deprecated/x/incentive/types/errors.go b/deprecated/x/incentive/types/errors.go deleted file mode 100644 index 9b2016576..000000000 --- a/deprecated/x/incentive/types/errors.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/incentive module sentinel errors -var ( - ErrClaimNotFound = sdkerrors.Register(ModuleName, 2, "no claimable rewards found for user") - ErrRewardPeriodNotFound = sdkerrors.Register(ModuleName, 3, "no reward period found for collateral type") - ErrInvalidAccountType = sdkerrors.Register(ModuleName, 4, "account type not supported") - ErrNoClaimsFound = sdkerrors.Register(ModuleName, 5, "no claimable rewards found") - ErrInsufficientModAccountBalance = sdkerrors.Register(ModuleName, 6, "module account has insufficient balance to pay claim") - ErrAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found") - ErrInvalidMultiplier = sdkerrors.Register(ModuleName, 8, "invalid rewards multiplier") - ErrZeroClaim = sdkerrors.Register(ModuleName, 9, "cannot claim - claim amount rounds to zero") - ErrClaimExpired = sdkerrors.Register(ModuleName, 10, "claim has expired") - ErrInvalidClaimType = sdkerrors.Register(ModuleName, 11, "invalid claim type") - ErrInvalidClaimOwner = sdkerrors.Register(ModuleName, 12, "invalid claim owner") -) diff --git a/deprecated/x/incentive/types/events.go b/deprecated/x/incentive/types/events.go deleted file mode 100644 index 5255d1c46..000000000 --- a/deprecated/x/incentive/types/events.go +++ /dev/null @@ -1,16 +0,0 @@ -package types - -// Events emitted by the incentive module -const ( - EventTypeClaim = "claim_reward" - EventTypeRewardPeriod = "new_reward_period" - EventTypeClaimPeriod = "new_claim_period" - EventTypeClaimPeriodExpiry = "claim_period_expiry" - - AttributeValueCategory = ModuleName - AttributeKeyClaimedBy = "claimed_by" - AttributeKeyClaimAmount = "claim_amount" - AttributeKeyClaimType = "claim_type" - AttributeKeyRewardPeriod = "reward_period" - AttributeKeyClaimPeriod = "claim_period" -) diff --git a/deprecated/x/incentive/types/expected_keepers.go b/deprecated/x/incentive/types/expected_keepers.go deleted file mode 100644 index 2fefd751d..000000000 --- a/deprecated/x/incentive/types/expected_keepers.go +++ /dev/null @@ -1,96 +0,0 @@ -package types - -import ( - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// AccountKeeper expected interface for the account keeper (noalias) -type AccountKeeper interface { - // Return a new account with the next account number and the specified address. Does not save the new account to the store. - NewAccountWithAddress(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Return a new account with the next account number. Does not save the new account to the store. - NewAccount(sdk.Context, authtypes.AccountI) authtypes.AccountI - - // Retrieve an account from the store. - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Set an account in the store. - SetAccount(sdk.Context, authtypes.AccountI) - - // Remove an account from the store. - RemoveAccount(sdk.Context, authtypes.AccountI) - - // Iterate over all accounts, calling the provided function. Stop iteraiton when it returns false. - IterateAccounts(sdk.Context, func(authtypes.AccountI) bool) - - // Fetch the public key of an account at a specified address - GetPubKey(sdk.Context, sdk.AccAddress) (cryptotypes.PubKey, error) - - // Fetch the sequence of an account at a specified address. - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) - - GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI -} - -type BankKeeper interface { - // View - ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error - HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool - - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetAccountsBalances(ctx sdk.Context) []banktypes.Balance - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(coin sdk.Coin) (stop bool)) - IterateAllBalances(ctx sdk.Context, cb func(address sdk.AccAddress, coin sdk.Coin) (stop bool)) - - // Send - InputOutputCoins(ctx sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - - GetParams(ctx sdk.Context) banktypes.Params - SetParams(ctx sdk.Context, params banktypes.Params) error - - BlockedAddr(addr sdk.AccAddress) bool - - // - InitGenesis(sdk.Context, *banktypes.GenesisState) - ExportGenesis(sdk.Context) *banktypes.GenesisState - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error) - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) - IterateAllDenomMetaData(ctx sdk.Context, cb func(banktypes.Metadata) bool) - - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - - DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error - UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error -} - -// CdpKeeper defines the expected interface for the pricefeed (noalias) -type CdpKeeper interface { - GetInterestFactor(ctx sdk.Context, collateralType string) (sdk.Dec, bool) - GetTotalPrincipal(ctx sdk.Context, collateralType string, principalDenom string) (total sdk.Int) - GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (cdptypes.Cdp, bool) - GetCollateral(ctx sdk.Context, collateralType string) (cdptypes.CollateralParam, bool) -} diff --git a/deprecated/x/incentive/types/genesis.go b/deprecated/x/incentive/types/genesis.go deleted file mode 100644 index dd4676d49..000000000 --- a/deprecated/x/incentive/types/genesis.go +++ /dev/null @@ -1,112 +0,0 @@ -package types - -import ( - "bytes" - "fmt" - "time" -) - -// this line is used by starport scaffolding # genesis/types/import - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - params := DefaultParams() - return &GenesisState{ - Params: params, - CdpAccumulationTimes: GenesisAccumulationTimes{}, - CdpMintingClaims: DefaultCdpClaims, - Denoms: DefaultGenesisDenoms(), - // this line is used by starport scaffolding # genesis/types/default - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - // return nil - if err := gs.Params.Validate(); err != nil { - return err - } - if err := GenesisAccumulationTimes(gs.CdpAccumulationTimes).Validate(); err != nil { - return err - } - if err := gs.Denoms.Validate(); err != nil { - return err - } - - return CdpMintingClaims(gs.CdpMintingClaims).Validate() -} - -// NewGenesisState returns a new genesis state -func NewGenesisState(params Params, jpuAccumTimes GenesisAccumulationTimes, c CdpMintingClaims, denoms *GenesisDenoms) GenesisState { - return GenesisState{ - Params: params, - CdpAccumulationTimes: jpuAccumTimes, - CdpMintingClaims: c, - Denoms: denoms, - } -} - -// Equal checks whether two gov GenesisState structs are equivalent -func (gs GenesisState) Equal(gs2 GenesisState) bool { - b1 := ModuleCdc.MustMarshal(&gs) - b2 := ModuleCdc.MustMarshal(&gs2) - return bytes.Equal(b1, b2) -} - -// IsEmpty returns true if a GenesisState is empty -func (gs GenesisState) IsEmpty() bool { - return gs.Equal(GenesisState{}) -} - -// NewGenesisAccumulationTime returns a new GenesisAccumulationTime -func NewGenesisAccumulationTime(ctype string, prevTime time.Time) GenesisAccumulationTime { - return GenesisAccumulationTime{ - CollateralType: ctype, - PreviousAccumulationTime: prevTime, - } -} - -// GenesisAccumulationTimes slice of GenesisAccumulationTime -type GenesisAccumulationTimes []GenesisAccumulationTime - -// Validate performs validation of GenesisAccumulationTimes -func (gats GenesisAccumulationTimes) Validate() error { - for _, gat := range gats { - if err := gat.Validate(); err != nil { - return err - } - } - return nil -} - -// Validate performs validation of GenesisAccumulationTime -func (gat GenesisAccumulationTime) Validate() error { - if len(gat.CollateralType) == 0 { - return fmt.Errorf("genesis accumulation time's collateral type must be defined") - } - return nil -} - -func DefaultGenesisDenoms() *GenesisDenoms { - return &GenesisDenoms{ - PrincipalDenom: DefaultPrincipalDenom, - CdpMintingRewardDenom: DefaultCDPMintingRewardDenom, - } -} - -func (denoms *GenesisDenoms) Validate() error { - if len(denoms.PrincipalDenom) == 0 { - return fmt.Errorf("GovDenom is nil or empty") - } - if len(denoms.CdpMintingRewardDenom) == 0 { - return fmt.Errorf("GovDenom is nil or empty") - } - - return nil -} diff --git a/deprecated/x/incentive/types/genesis.pb.go b/deprecated/x/incentive/types/genesis.pb.go deleted file mode 100644 index 09bac743d..000000000 --- a/deprecated/x/incentive/types/genesis.pb.go +++ /dev/null @@ -1,971 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: incentive/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the incentive module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - CdpAccumulationTimes []GenesisAccumulationTime `protobuf:"bytes,2,rep,name=cdp_accumulation_times,json=cdpAccumulationTimes,proto3" json:"cdp_accumulation_times" yaml:"cdp_accumulation_times"` - CdpMintingClaims []CdpMintingClaim `protobuf:"bytes,3,rep,name=cdp_minting_claims,json=cdpMintingClaims,proto3" json:"cdp_minting_claims" yaml:"cdp_minting_claims"` - Denoms *GenesisDenoms `protobuf:"bytes,4,opt,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_b5ea08f29a85d2f6, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetCdpAccumulationTimes() []GenesisAccumulationTime { - if m != nil { - return m.CdpAccumulationTimes - } - return nil -} - -func (m *GenesisState) GetCdpMintingClaims() []CdpMintingClaim { - if m != nil { - return m.CdpMintingClaims - } - return nil -} - -func (m *GenesisState) GetDenoms() *GenesisDenoms { - if m != nil { - return m.Denoms - } - return nil -} - -type GenesisAccumulationTime struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time" yaml:"previous_accumulation_time"` -} - -func (m *GenesisAccumulationTime) Reset() { *m = GenesisAccumulationTime{} } -func (m *GenesisAccumulationTime) String() string { return proto.CompactTextString(m) } -func (*GenesisAccumulationTime) ProtoMessage() {} -func (*GenesisAccumulationTime) Descriptor() ([]byte, []int) { - return fileDescriptor_b5ea08f29a85d2f6, []int{1} -} -func (m *GenesisAccumulationTime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisAccumulationTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisAccumulationTime.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisAccumulationTime) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisAccumulationTime.Merge(m, src) -} -func (m *GenesisAccumulationTime) XXX_Size() int { - return m.Size() -} -func (m *GenesisAccumulationTime) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisAccumulationTime.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisAccumulationTime proto.InternalMessageInfo - -func (m *GenesisAccumulationTime) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -func (m *GenesisAccumulationTime) GetPreviousAccumulationTime() time.Time { - if m != nil { - return m.PreviousAccumulationTime - } - return time.Time{} -} - -type GenesisDenoms struct { - PrincipalDenom string `protobuf:"bytes,1,opt,name=principal_denom,json=principalDenom,proto3" json:"principal_denom,omitempty" yaml:"principal_denom"` - CdpMintingRewardDenom string `protobuf:"bytes,2,opt,name=cdp_minting_reward_denom,json=cdpMintingRewardDenom,proto3" json:"cdp_minting_reward_denom,omitempty" yaml:"principal_denom"` -} - -func (m *GenesisDenoms) Reset() { *m = GenesisDenoms{} } -func (m *GenesisDenoms) String() string { return proto.CompactTextString(m) } -func (*GenesisDenoms) ProtoMessage() {} -func (*GenesisDenoms) Descriptor() ([]byte, []int) { - return fileDescriptor_b5ea08f29a85d2f6, []int{2} -} -func (m *GenesisDenoms) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisDenoms) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisDenoms.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisDenoms) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisDenoms.Merge(m, src) -} -func (m *GenesisDenoms) XXX_Size() int { - return m.Size() -} -func (m *GenesisDenoms) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisDenoms.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisDenoms proto.InternalMessageInfo - -func (m *GenesisDenoms) GetPrincipalDenom() string { - if m != nil { - return m.PrincipalDenom - } - return "" -} - -func (m *GenesisDenoms) GetCdpMintingRewardDenom() string { - if m != nil { - return m.CdpMintingRewardDenom - } - return "" -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.incentive.GenesisState") - proto.RegisterType((*GenesisAccumulationTime)(nil), "ununifi.incentive.GenesisAccumulationTime") - proto.RegisterType((*GenesisDenoms)(nil), "ununifi.incentive.GenesisDenoms") -} - -func init() { proto.RegisterFile("incentive/genesis.proto", fileDescriptor_b5ea08f29a85d2f6) } - -var fileDescriptor_b5ea08f29a85d2f6 = []byte{ - // 519 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcb, 0x6a, 0xdb, 0x40, - 0x14, 0xb5, 0xec, 0x62, 0xa8, 0xd2, 0xa4, 0x8d, 0xc8, 0x43, 0x36, 0x54, 0x76, 0x06, 0x0a, 0x21, - 0x50, 0x09, 0xd2, 0x5d, 0x77, 0x95, 0x43, 0x5b, 0x28, 0x85, 0xa2, 0x38, 0x9b, 0x6e, 0xcc, 0x78, - 0x34, 0x51, 0x06, 0x34, 0x0f, 0x34, 0xa3, 0xb4, 0xfe, 0x82, 0x6e, 0xf3, 0x11, 0xdd, 0xf4, 0x4f, - 0xb2, 0xcc, 0xb2, 0x2b, 0xb7, 0xd8, 0x9b, 0xae, 0xf3, 0x05, 0x45, 0xa3, 0xb1, 0x15, 0xbf, 0xc8, - 0x6e, 0x34, 0x73, 0xce, 0xb9, 0xe7, 0x9e, 0x7b, 0x65, 0x1f, 0x12, 0x86, 0x30, 0x53, 0xe4, 0x1a, - 0x07, 0x09, 0x66, 0x58, 0x12, 0xe9, 0x8b, 0x8c, 0x2b, 0xee, 0xec, 0xe6, 0x2c, 0x67, 0xe4, 0x92, - 0xf8, 0x73, 0x40, 0x7b, 0x2f, 0xe1, 0x09, 0xd7, 0xaf, 0x41, 0x71, 0x2a, 0x81, 0xed, 0x4e, 0xc2, - 0x79, 0x92, 0xe2, 0x40, 0x7f, 0x0d, 0xf3, 0xcb, 0x40, 0x11, 0x8a, 0xa5, 0x82, 0x54, 0x18, 0x40, - 0xab, 0x2a, 0x31, 0x3f, 0x95, 0x4f, 0xe0, 0x67, 0xc3, 0x7e, 0xf6, 0xa1, 0x2c, 0x7b, 0xae, 0xa0, - 0xc2, 0xce, 0x47, 0xbb, 0x29, 0x60, 0x06, 0xa9, 0x74, 0xad, 0xae, 0x75, 0xbc, 0x75, 0xda, 0xf2, - 0x57, 0x6c, 0xf8, 0x5f, 0x34, 0x20, 0xdc, 0xbf, 0x1d, 0x77, 0x6a, 0xf7, 0xe3, 0xce, 0xf6, 0x08, - 0xd2, 0xf4, 0x2d, 0x28, 0x69, 0x20, 0x32, 0x7c, 0xe7, 0x87, 0x65, 0x1f, 0xa0, 0x58, 0x0c, 0x20, - 0x42, 0x39, 0xcd, 0x53, 0xa8, 0x08, 0x67, 0x03, 0x6d, 0xcd, 0xad, 0x77, 0x1b, 0xc7, 0x5b, 0xa7, - 0x27, 0x6b, 0xa4, 0x8d, 0x97, 0x77, 0x0f, 0x38, 0x7d, 0x42, 0x71, 0xf8, 0xca, 0xd4, 0x7a, 0x59, - 0xd6, 0x5a, 0xaf, 0x0b, 0xa2, 0x3d, 0x14, 0x8b, 0x65, 0xae, 0x74, 0xa4, 0xed, 0x14, 0x04, 0x4a, - 0x98, 0x22, 0x2c, 0x19, 0xa0, 0x14, 0x12, 0x2a, 0xdd, 0x86, 0x36, 0x01, 0xd6, 0x98, 0xe8, 0xc5, - 0xe2, 0x73, 0x89, 0xed, 0x15, 0xd0, 0xf0, 0xc8, 0x14, 0x6f, 0x55, 0xc5, 0x17, 0xb5, 0x40, 0xf4, - 0x02, 0x2d, 0x72, 0xa4, 0xf3, 0xc9, 0x6e, 0xc6, 0x98, 0x71, 0x2a, 0xdd, 0x27, 0x3a, 0xc8, 0xee, - 0xe6, 0x6e, 0xcf, 0x34, 0x2e, 0xdc, 0xad, 0xb2, 0x2c, 0x99, 0x20, 0x32, 0x12, 0xe0, 0x9f, 0x65, - 0x1f, 0x6e, 0x88, 0xc6, 0xe9, 0xd9, 0xcf, 0x11, 0x4f, 0x53, 0xa8, 0x70, 0x06, 0xd3, 0x81, 0x1a, - 0x09, 0xac, 0x47, 0xf7, 0x34, 0x6c, 0xdf, 0x8f, 0x3b, 0x07, 0xc6, 0xf2, 0x22, 0x00, 0x44, 0x3b, - 0xd5, 0x4d, 0x7f, 0x24, 0x70, 0x31, 0xac, 0xb6, 0xc8, 0xf0, 0x35, 0xe1, 0xb9, 0x5c, 0x4d, 0xd6, - 0xad, 0xeb, 0x16, 0xda, 0x7e, 0xb9, 0x69, 0xfe, 0x6c, 0xd3, 0xfc, 0xfe, 0x6c, 0xd3, 0xc2, 0xd7, - 0x26, 0xa3, 0x23, 0xb3, 0x0c, 0x1b, 0xb5, 0xc0, 0xcd, 0x9f, 0x8e, 0x15, 0xb9, 0x33, 0xc0, 0x72, - 0x3b, 0xe0, 0x97, 0x65, 0x6f, 0x2f, 0xe4, 0x52, 0x34, 0x28, 0x32, 0xc2, 0x10, 0x11, 0x30, 0x1d, - 0xe8, 0x40, 0x56, 0x1b, 0x5c, 0x02, 0x80, 0x68, 0x67, 0x7e, 0xa3, 0x55, 0x9c, 0x73, 0xdb, 0x7d, - 0x38, 0xb7, 0x0c, 0x7f, 0x83, 0x59, 0x6c, 0xd4, 0xea, 0x8f, 0xaa, 0xed, 0x57, 0xe3, 0x8d, 0x34, - 0x53, 0x8b, 0x86, 0x67, 0xb7, 0x13, 0xcf, 0xba, 0x9b, 0x78, 0xd6, 0xdf, 0x89, 0x67, 0xdd, 0x4c, - 0xbd, 0xda, 0xdd, 0xd4, 0xab, 0xfd, 0x9e, 0x7a, 0xb5, 0xaf, 0x27, 0x09, 0x51, 0x57, 0xf9, 0xd0, - 0x47, 0x9c, 0x06, 0x17, 0xec, 0x82, 0x91, 0xf7, 0x24, 0x40, 0x57, 0x90, 0xb0, 0xe0, 0x7b, 0xf5, - 0x0f, 0x06, 0xc5, 0x2c, 0xe4, 0xb0, 0xa9, 0xe3, 0x7c, 0xf3, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x19, - 0x90, 0xfd, 0x63, 0x0a, 0x04, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Denoms != nil { - { - size, err := m.Denoms.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.CdpMintingClaims) > 0 { - for iNdEx := len(m.CdpMintingClaims) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CdpMintingClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.CdpAccumulationTimes) > 0 { - for iNdEx := len(m.CdpAccumulationTimes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CdpAccumulationTimes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GenesisAccumulationTime) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisAccumulationTime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisAccumulationTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.PreviousAccumulationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousAccumulationTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGenesis(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x12 - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GenesisDenoms) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisDenoms) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisDenoms) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CdpMintingRewardDenom) > 0 { - i -= len(m.CdpMintingRewardDenom) - copy(dAtA[i:], m.CdpMintingRewardDenom) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CdpMintingRewardDenom))) - i-- - dAtA[i] = 0x12 - } - if len(m.PrincipalDenom) > 0 { - i -= len(m.PrincipalDenom) - copy(dAtA[i:], m.PrincipalDenom) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.PrincipalDenom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.CdpAccumulationTimes) > 0 { - for _, e := range m.CdpAccumulationTimes { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.CdpMintingClaims) > 0 { - for _, e := range m.CdpMintingClaims { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.Denoms != nil { - l = m.Denoms.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func (m *GenesisAccumulationTime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousAccumulationTime) - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *GenesisDenoms) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PrincipalDenom) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.CdpMintingRewardDenom) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CdpAccumulationTimes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CdpAccumulationTimes = append(m.CdpAccumulationTimes, GenesisAccumulationTime{}) - if err := m.CdpAccumulationTimes[len(m.CdpAccumulationTimes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CdpMintingClaims", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CdpMintingClaims = append(m.CdpMintingClaims, CdpMintingClaim{}) - if err := m.CdpMintingClaims[len(m.CdpMintingClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Denoms == nil { - m.Denoms = &GenesisDenoms{} - } - if err := m.Denoms.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisAccumulationTime) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisAccumulationTime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisAccumulationTime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreviousAccumulationTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.PreviousAccumulationTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisDenoms) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisDenoms: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisDenoms: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrincipalDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrincipalDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CdpMintingRewardDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CdpMintingRewardDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/incentive/types/genesis_test.go b/deprecated/x/incentive/types/genesis_test.go deleted file mode 100644 index c8db33072..000000000 --- a/deprecated/x/incentive/types/genesis_test.go +++ /dev/null @@ -1,147 +0,0 @@ -package types - -import ( - "strings" - "testing" - "time" - - "github.com/cometbft/cometbft/crypto" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - ununifitypes "github.com/UnUniFi/chain/deprecated/types" -) - -func TestGenesisStateValidate(t *testing.T) { - type args struct { - params Params - genAccTimes GenesisAccumulationTimes - claims CdpMintingClaims - denoms *GenesisDenoms - } - - type errArgs struct { - expectPass bool - contains string - } - - testCases := []struct { - name string - args args - errArgs errArgs - }{ - { - name: "default", - args: args{ - params: DefaultParams(), - genAccTimes: DefaultGenesisAccumulationTimes, - claims: DefaultCdpClaims, - denoms: DefaultGenesisDenoms(), - }, - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - { - name: "valid", - args: args{ - params: NewParams( - RewardPeriods{ - NewRewardPeriod( - true, - "bnb-a", - time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), - time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.NewCoin("uguu", sdk.NewInt(25000)), - ), - }, - Multipliers{ - NewMultiplier(Small, 1, sdk.MustNewDecFromStr("0.33")), - }, - time.Date(2025, 10, 15, 14, 0, 0, 0, time.UTC), - ), - genAccTimes: GenesisAccumulationTimes{GenesisAccumulationTime{ - CollateralType: "bnb-a", - PreviousAccumulationTime: time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), - //RewardFactor: sdk.ZeroDec(), - }}, - claims: CdpMintingClaims{ - { - BaseClaim: &BaseClaim{ - Owner: ununifitypes.StringAccAddress(sdk.AccAddress(crypto.AddressHash([]byte("KavaTestUser1")))), - Reward: sdk.NewCoin("uguu", sdk.NewInt(100000000)), - }, - RewardIndexes: []RewardIndex{ - { - CollateralType: "bnb-a", - RewardFactor: sdk.ZeroDec(), - }, - }, - }, - }, - denoms: DefaultGenesisDenoms(), - }, - errArgs: errArgs{ - expectPass: true, - contains: "", - }, - }, - // { - // name: "invalid genesis accumulation time", - // args: args{ - // params: DefaultParams(), - // genAccTimes: GenesisAccumulationTimes{ - // { - // CollateralType: "btcb-a", - // RewardFactor: sdk.MustNewDecFromStr("-0.1"), - // }, - // }, - // claims: DefaultCdpClaims, - // }, - // errArgs: errArgs{ - // expectPass: false, - // contains: "reward factor should be ≥ 0.0", - // }, - // }, - { - name: "invalid claim", - args: args{ - params: DefaultParams(), - genAccTimes: DefaultGenesisAccumulationTimes, - claims: CdpMintingClaims{ - { - BaseClaim: &BaseClaim{ - Owner: ununifitypes.StringAccAddress(sdk.AccAddress{}), - Reward: sdk.NewCoin("uguu", sdk.NewInt(100000000)), - }, - RewardIndexes: []RewardIndex{ - { - CollateralType: "bnb-a", - RewardFactor: sdk.ZeroDec(), - }, - }, - }, - }, - denoms: DefaultGenesisDenoms(), - }, - errArgs: errArgs{ - expectPass: false, - contains: "claim owner cannot be empty", - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - gs := NewGenesisState(tc.args.params, tc.args.genAccTimes, tc.args.claims, tc.args.denoms) - err := gs.Validate() - if tc.errArgs.expectPass { - require.NoError(t, err, tc.name) - } else { - require.Error(t, err, tc.name) - require.True(t, strings.Contains(err.Error(), tc.errArgs.contains)) - } - }) - } -} diff --git a/deprecated/x/incentive/types/incentive.pb.go b/deprecated/x/incentive/types/incentive.pb.go deleted file mode 100644 index 4c77fcf20..000000000 --- a/deprecated/x/incentive/types/incentive.pb.go +++ /dev/null @@ -1,2005 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: incentive/incentive.proto - -package types - -import ( - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type BaseClaim struct { - Owner github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=owner,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"owner" yaml:"owner"` - Reward types.Coin `protobuf:"bytes,2,opt,name=reward,proto3" json:"reward" yaml:"reward"` -} - -func (m *BaseClaim) Reset() { *m = BaseClaim{} } -func (m *BaseClaim) String() string { return proto.CompactTextString(m) } -func (*BaseClaim) ProtoMessage() {} -func (*BaseClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{0} -} -func (m *BaseClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BaseClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BaseClaim.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BaseClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseClaim.Merge(m, src) -} -func (m *BaseClaim) XXX_Size() int { - return m.Size() -} -func (m *BaseClaim) XXX_DiscardUnknown() { - xxx_messageInfo_BaseClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseClaim proto.InternalMessageInfo - -func (m *BaseClaim) GetReward() types.Coin { - if m != nil { - return m.Reward - } - return types.Coin{} -} - -type BaseMultiClaim struct { - Owner github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=owner,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"owner" yaml:"owner"` - Reward []types.Coin `protobuf:"bytes,2,rep,name=reward,proto3" json:"reward" yaml:"rewards"` -} - -func (m *BaseMultiClaim) Reset() { *m = BaseMultiClaim{} } -func (m *BaseMultiClaim) String() string { return proto.CompactTextString(m) } -func (*BaseMultiClaim) ProtoMessage() {} -func (*BaseMultiClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{1} -} -func (m *BaseMultiClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BaseMultiClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BaseMultiClaim.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BaseMultiClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseMultiClaim.Merge(m, src) -} -func (m *BaseMultiClaim) XXX_Size() int { - return m.Size() -} -func (m *BaseMultiClaim) XXX_DiscardUnknown() { - xxx_messageInfo_BaseMultiClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseMultiClaim proto.InternalMessageInfo - -func (m *BaseMultiClaim) GetReward() []types.Coin { - if m != nil { - return m.Reward - } - return nil -} - -type CdpMintingClaim struct { - *BaseClaim `protobuf:"bytes,1,opt,name=base_claim,json=baseClaim,proto3,embedded=base_claim" json:"base_claim,omitempty" yaml:"base_claim"` - RewardIndexes []RewardIndex `protobuf:"bytes,2,rep,name=reward_indexes,json=rewardIndexes,proto3" json:"reward_indexes" yaml:"reward_indexes"` -} - -func (m *CdpMintingClaim) Reset() { *m = CdpMintingClaim{} } -func (m *CdpMintingClaim) String() string { return proto.CompactTextString(m) } -func (*CdpMintingClaim) ProtoMessage() {} -func (*CdpMintingClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{2} -} -func (m *CdpMintingClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CdpMintingClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CdpMintingClaim.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CdpMintingClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_CdpMintingClaim.Merge(m, src) -} -func (m *CdpMintingClaim) XXX_Size() int { - return m.Size() -} -func (m *CdpMintingClaim) XXX_DiscardUnknown() { - xxx_messageInfo_CdpMintingClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_CdpMintingClaim proto.InternalMessageInfo - -func (m *CdpMintingClaim) GetRewardIndexes() []RewardIndex { - if m != nil { - return m.RewardIndexes - } - return nil -} - -type RewardIndex struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - RewardFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=reward_factor,json=rewardFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_factor" yaml:"reward_factor"` -} - -func (m *RewardIndex) Reset() { *m = RewardIndex{} } -func (m *RewardIndex) String() string { return proto.CompactTextString(m) } -func (*RewardIndex) ProtoMessage() {} -func (*RewardIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{3} -} -func (m *RewardIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RewardIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RewardIndex.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RewardIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_RewardIndex.Merge(m, src) -} -func (m *RewardIndex) XXX_Size() int { - return m.Size() -} -func (m *RewardIndex) XXX_DiscardUnknown() { - xxx_messageInfo_RewardIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_RewardIndex proto.InternalMessageInfo - -func (m *RewardIndex) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -type Params struct { - CdpMintingRewardPeriods []RewardPeriod `protobuf:"bytes,1,rep,name=cdp_minting_reward_periods,json=cdpMintingRewardPeriods,proto3" json:"cdp_minting_reward_periods" yaml:"cdp_minting_reward_periods"` - ClaimMultipliers []Multiplier `protobuf:"bytes,2,rep,name=claim_multipliers,json=claimMultipliers,proto3" json:"claim_multipliers" yaml:"claim_multipliers"` - ClaimEnd time.Time `protobuf:"bytes,3,opt,name=claim_end,json=claimEnd,proto3,stdtime" json:"claim_end" yaml:"claim_end"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{4} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetCdpMintingRewardPeriods() []RewardPeriod { - if m != nil { - return m.CdpMintingRewardPeriods - } - return nil -} - -func (m *Params) GetClaimMultipliers() []Multiplier { - if m != nil { - return m.ClaimMultipliers - } - return nil -} - -func (m *Params) GetClaimEnd() time.Time { - if m != nil { - return m.ClaimEnd - } - return time.Time{} -} - -type RewardPeriod struct { - Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty" yaml:"active"` - CollateralType string `protobuf:"bytes,2,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty" yaml:"collateral_type"` - Start time.Time `protobuf:"bytes,3,opt,name=start,proto3,stdtime" json:"start" yaml:"start"` - End time.Time `protobuf:"bytes,4,opt,name=end,proto3,stdtime" json:"end" yaml:"end"` - RewardsPerSecond types.Coin `protobuf:"bytes,5,opt,name=rewards_per_second,json=rewardsPerSecond,proto3" json:"rewards_per_second" yaml:"rewards_per_second"` -} - -func (m *RewardPeriod) Reset() { *m = RewardPeriod{} } -func (m *RewardPeriod) String() string { return proto.CompactTextString(m) } -func (*RewardPeriod) ProtoMessage() {} -func (*RewardPeriod) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{5} -} -func (m *RewardPeriod) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RewardPeriod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RewardPeriod.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RewardPeriod) XXX_Merge(src proto.Message) { - xxx_messageInfo_RewardPeriod.Merge(m, src) -} -func (m *RewardPeriod) XXX_Size() int { - return m.Size() -} -func (m *RewardPeriod) XXX_DiscardUnknown() { - xxx_messageInfo_RewardPeriod.DiscardUnknown(m) -} - -var xxx_messageInfo_RewardPeriod proto.InternalMessageInfo - -func (m *RewardPeriod) GetActive() bool { - if m != nil { - return m.Active - } - return false -} - -func (m *RewardPeriod) GetCollateralType() string { - if m != nil { - return m.CollateralType - } - return "" -} - -func (m *RewardPeriod) GetStart() time.Time { - if m != nil { - return m.Start - } - return time.Time{} -} - -func (m *RewardPeriod) GetEnd() time.Time { - if m != nil { - return m.End - } - return time.Time{} -} - -func (m *RewardPeriod) GetRewardsPerSecond() types.Coin { - if m != nil { - return m.RewardsPerSecond - } - return types.Coin{} -} - -type Multiplier struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" yaml:"name"` - MonthsLockup int64 `protobuf:"varint,2,opt,name=months_lockup,json=monthsLockup,proto3" json:"months_lockup,omitempty" yaml:"months_lockup"` - Factor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=factor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"factor" yaml:"factor"` -} - -func (m *Multiplier) Reset() { *m = Multiplier{} } -func (m *Multiplier) String() string { return proto.CompactTextString(m) } -func (*Multiplier) ProtoMessage() {} -func (*Multiplier) Descriptor() ([]byte, []int) { - return fileDescriptor_4fbd49a6c550bd8c, []int{6} -} -func (m *Multiplier) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Multiplier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Multiplier.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Multiplier) XXX_Merge(src proto.Message) { - xxx_messageInfo_Multiplier.Merge(m, src) -} -func (m *Multiplier) XXX_Size() int { - return m.Size() -} -func (m *Multiplier) XXX_DiscardUnknown() { - xxx_messageInfo_Multiplier.DiscardUnknown(m) -} - -var xxx_messageInfo_Multiplier proto.InternalMessageInfo - -func (m *Multiplier) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Multiplier) GetMonthsLockup() int64 { - if m != nil { - return m.MonthsLockup - } - return 0 -} - -func init() { - proto.RegisterType((*BaseClaim)(nil), "ununifi.incentive.BaseClaim") - proto.RegisterType((*BaseMultiClaim)(nil), "ununifi.incentive.BaseMultiClaim") - proto.RegisterType((*CdpMintingClaim)(nil), "ununifi.incentive.CdpMintingClaim") - proto.RegisterType((*RewardIndex)(nil), "ununifi.incentive.RewardIndex") - proto.RegisterType((*Params)(nil), "ununifi.incentive.Params") - proto.RegisterType((*RewardPeriod)(nil), "ununifi.incentive.RewardPeriod") - proto.RegisterType((*Multiplier)(nil), "ununifi.incentive.Multiplier") -} - -func init() { proto.RegisterFile("incentive/incentive.proto", fileDescriptor_4fbd49a6c550bd8c) } - -var fileDescriptor_4fbd49a6c550bd8c = []byte{ - // 841 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0x93, 0x6d, 0xb4, 0x99, 0xa4, 0x69, 0x63, 0xed, 0x2e, 0x4e, 0xb4, 0x6b, 0x77, 0x07, - 0x09, 0xed, 0x22, 0x61, 0x6b, 0x97, 0x1b, 0x12, 0x42, 0xeb, 0x94, 0xc2, 0x22, 0x2a, 0x55, 0xde, - 0x2d, 0x48, 0x48, 0xc8, 0x9a, 0x8c, 0xa7, 0xe9, 0x50, 0x7b, 0xc6, 0xf2, 0x38, 0xbb, 0xed, 0x27, - 0xe0, 0xda, 0x0f, 0xc3, 0x89, 0x0b, 0xd7, 0x72, 0xa2, 0x37, 0x10, 0x07, 0x83, 0xda, 0x6f, 0x90, - 0x33, 0x07, 0xe4, 0x99, 0x49, 0xec, 0x96, 0x96, 0xd2, 0x0b, 0xa7, 0xf8, 0xbd, 0x79, 0xef, 0xf7, - 0x7e, 0xef, 0x6f, 0xc0, 0x90, 0x32, 0x4c, 0x58, 0x4e, 0xdf, 0x10, 0x6f, 0xf9, 0xe5, 0xa6, 0x19, - 0xcf, 0xb9, 0x39, 0x98, 0xb1, 0x19, 0xa3, 0x7b, 0xd4, 0x5d, 0x3e, 0x8c, 0xee, 0x4d, 0xf9, 0x94, - 0xcb, 0x57, 0xaf, 0xfc, 0x52, 0x86, 0x23, 0x67, 0xca, 0xf9, 0x34, 0x26, 0x9e, 0x94, 0x26, 0xb3, - 0x3d, 0x2f, 0xa7, 0x09, 0x11, 0x39, 0x4a, 0x52, 0x6d, 0x60, 0x63, 0x2e, 0x12, 0x2e, 0xbc, 0x09, - 0x12, 0xc4, 0x7b, 0xf3, 0x6c, 0x42, 0x72, 0xf4, 0xcc, 0xc3, 0x9c, 0x32, 0xf5, 0x0e, 0x7f, 0x30, - 0x40, 0xc7, 0x47, 0x82, 0x8c, 0x63, 0x44, 0x13, 0xf3, 0x5b, 0xb0, 0xc2, 0xdf, 0x32, 0x92, 0x59, - 0xc6, 0x86, 0xf1, 0xa4, 0xe3, 0x7f, 0x76, 0x52, 0x38, 0x8d, 0xdf, 0x0b, 0xc7, 0x9b, 0xd2, 0x7c, - 0x7f, 0x36, 0x71, 0x31, 0x4f, 0xbc, 0x5d, 0xb6, 0xcb, 0xe8, 0x16, 0xf5, 0xf0, 0x3e, 0xa2, 0xcc, - 0xcb, 0x8f, 0x52, 0x22, 0xdc, 0x57, 0x79, 0x46, 0xd9, 0xf4, 0x05, 0xc6, 0x2f, 0xa2, 0x28, 0x23, - 0x42, 0xcc, 0x0b, 0xa7, 0x77, 0x84, 0x92, 0xf8, 0x23, 0x28, 0xd1, 0x60, 0xa0, 0x50, 0xcd, 0xcf, - 0x41, 0x3b, 0x23, 0x6f, 0x51, 0x16, 0x59, 0xcd, 0x0d, 0xe3, 0x49, 0xf7, 0xf9, 0xd0, 0x55, 0xec, - 0xdc, 0x92, 0x9d, 0xab, 0xd9, 0xb9, 0x63, 0x4e, 0x99, 0x7f, 0xbf, 0x0c, 0x3d, 0x2f, 0x9c, 0x55, - 0x85, 0xa3, 0xdc, 0x60, 0xa0, 0xfd, 0xe1, 0x8f, 0x06, 0xe8, 0x97, 0xb4, 0xb7, 0x67, 0x71, 0x4e, - 0xff, 0x17, 0xee, 0x2f, 0x6b, 0xdc, 0x5b, 0xff, 0xce, 0xfd, 0x81, 0xe6, 0xde, 0xaf, 0x73, 0x17, - 0x15, 0xf9, 0x5f, 0x0c, 0xb0, 0x36, 0x8e, 0xd2, 0x6d, 0xca, 0x72, 0xca, 0xa6, 0x8a, 0xfd, 0x57, - 0x00, 0x94, 0x40, 0x21, 0x2e, 0x25, 0x99, 0x42, 0xf7, 0xf9, 0x43, 0xf7, 0x1f, 0x63, 0xe0, 0x2e, - 0x7b, 0xe5, 0x0f, 0x4f, 0x0b, 0xc7, 0x98, 0x17, 0xce, 0x40, 0x45, 0xa9, 0xbc, 0x61, 0xd0, 0x99, - 0x2c, 0x3b, 0x1a, 0x81, 0xbe, 0x8a, 0x1a, 0x52, 0x16, 0x91, 0x43, 0x22, 0x34, 0x7d, 0xfb, 0x0a, - 0xec, 0x40, 0x1a, 0xbe, 0x2c, 0xed, 0xfc, 0x47, 0x3a, 0x87, 0xfb, 0xf5, 0x1c, 0x16, 0x18, 0x30, - 0x58, 0xcd, 0x2a, 0x5b, 0x22, 0xe0, 0x4f, 0x06, 0xe8, 0xd6, 0xbc, 0xcd, 0x31, 0x58, 0xc3, 0x3c, - 0x8e, 0x51, 0x4e, 0x32, 0x14, 0x87, 0x65, 0xa1, 0x75, 0x57, 0x46, 0xf3, 0xc2, 0x79, 0xa0, 0x20, - 0x2f, 0x19, 0xc0, 0xa0, 0x5f, 0x69, 0x5e, 0x1f, 0xa5, 0xc4, 0x3c, 0x00, 0x3a, 0x4a, 0xb8, 0x87, - 0x70, 0xce, 0x33, 0x39, 0x34, 0x1d, 0x7f, 0x4b, 0x37, 0xf6, 0xbd, 0x5a, 0x63, 0xf5, 0x90, 0xab, - 0x9f, 0x0f, 0x44, 0x74, 0xa0, 0x9b, 0xbb, 0x49, 0xf0, 0xbc, 0x70, 0xee, 0x5d, 0xc8, 0x41, 0x81, - 0xc1, 0xa0, 0xa7, 0xe4, 0x2d, 0x25, 0xfe, 0xda, 0x04, 0xed, 0x1d, 0x94, 0xa1, 0x44, 0x98, 0xdf, - 0x1b, 0x60, 0x84, 0xa3, 0x34, 0x4c, 0x54, 0x7f, 0x42, 0xed, 0x97, 0x92, 0x8c, 0xf2, 0x48, 0x58, - 0x86, 0xac, 0x9f, 0x73, 0x6d, 0xfd, 0x76, 0xa4, 0x9d, 0xff, 0x54, 0x17, 0xf0, 0xb1, 0xce, 0xf6, - 0x5a, 0x40, 0x18, 0xbc, 0x83, 0x97, 0xc3, 0x50, 0x87, 0x10, 0x66, 0x0c, 0x06, 0xb2, 0xa3, 0x61, - 0x52, 0x8e, 0x79, 0x1a, 0x53, 0x92, 0x2d, 0xfa, 0xf7, 0xe8, 0x8a, 0xf8, 0xdb, 0x4b, 0x2b, 0x7f, - 0x43, 0x47, 0xb7, 0x74, 0xf4, 0xcb, 0x28, 0x30, 0x58, 0x97, 0xba, 0xca, 0x45, 0x98, 0xbb, 0xa0, - 0xa3, 0xec, 0x08, 0x8b, 0xac, 0x96, 0x9c, 0xc0, 0x91, 0xab, 0xee, 0x8b, 0xbb, 0xb8, 0x2f, 0xee, - 0xeb, 0xc5, 0x7d, 0xf1, 0x1f, 0xea, 0x10, 0xeb, 0xf5, 0x10, 0x84, 0x45, 0xf0, 0xf8, 0x0f, 0xc7, - 0x08, 0xee, 0x4a, 0xf9, 0x53, 0x16, 0xc1, 0xbf, 0x9a, 0xa0, 0x57, 0x4f, 0xcb, 0x7c, 0x0a, 0xda, - 0x08, 0x97, 0x84, 0xe5, 0x4c, 0xdc, 0xf5, 0x07, 0xd5, 0x9a, 0x2b, 0x3d, 0x0c, 0xb4, 0xc1, 0x55, - 0x73, 0xd4, 0xbc, 0xf5, 0x1c, 0x7d, 0x01, 0x56, 0x44, 0x8e, 0xb2, 0xfc, 0x3f, 0xe4, 0x64, 0xe9, - 0x9c, 0xf4, 0x05, 0x90, 0x6e, 0x2a, 0x1f, 0x05, 0x61, 0x6e, 0x82, 0x56, 0x59, 0x9d, 0x3b, 0x37, - 0x22, 0x2d, 0x6e, 0x00, 0x50, 0x48, 0xcb, 0xba, 0x94, 0xee, 0xe6, 0x77, 0xc0, 0xd4, 0x47, 0xa1, - 0x1c, 0x82, 0x50, 0x10, 0xcc, 0x59, 0x64, 0xad, 0xdc, 0x74, 0x13, 0x1f, 0x6b, 0xcc, 0xe1, 0x85, - 0xbb, 0x52, 0x83, 0x80, 0xc1, 0xba, 0x56, 0xee, 0x90, 0xec, 0x95, 0x52, 0xfd, 0x6c, 0x00, 0x50, - 0x75, 0xd9, 0x7c, 0x17, 0xdc, 0x61, 0x28, 0x59, 0xac, 0xe3, 0xda, 0xbc, 0x70, 0xba, 0x0a, 0xad, - 0xd4, 0xc2, 0x40, 0x3e, 0x9a, 0x1f, 0x83, 0xd5, 0x84, 0xb3, 0x7c, 0x5f, 0x84, 0x31, 0xc7, 0x07, - 0xb3, 0x54, 0x16, 0xbd, 0xe5, 0x5b, 0xd5, 0x2e, 0x5d, 0x78, 0x86, 0x41, 0x4f, 0xc9, 0x5f, 0x4a, - 0xd1, 0xfc, 0x1a, 0xb4, 0xf5, 0xc6, 0xb6, 0x64, 0x94, 0x4f, 0x6e, 0xbd, 0xb1, 0x7a, 0x1c, 0x16, - 0xab, 0xaa, 0xe1, 0xfc, 0xcd, 0x93, 0x33, 0xdb, 0x38, 0x3d, 0xb3, 0x8d, 0x3f, 0xcf, 0x6c, 0xe3, - 0xf8, 0xdc, 0x6e, 0x9c, 0x9e, 0xdb, 0x8d, 0xdf, 0xce, 0xed, 0xc6, 0x37, 0xef, 0x5f, 0x7b, 0xe5, - 0x0f, 0xab, 0x3f, 0x57, 0x15, 0x62, 0xd2, 0x96, 0xed, 0xfa, 0xf0, 0xef, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xca, 0x2f, 0xa5, 0x24, 0x80, 0x07, 0x00, 0x00, -} - -func (m *BaseClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BaseClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BaseClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Reward.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Owner.Size() - i -= size - if _, err := m.Owner.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *BaseMultiClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BaseMultiClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BaseMultiClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Reward) > 0 { - for iNdEx := len(m.Reward) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Reward[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size := m.Owner.Size() - i -= size - if _, err := m.Owner.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CdpMintingClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CdpMintingClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CdpMintingClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RewardIndexes) > 0 { - for iNdEx := len(m.RewardIndexes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RewardIndexes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.BaseClaim != nil { - { - size, err := m.BaseClaim.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RewardIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RewardIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RewardIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.RewardFactor.Size() - i -= size - if _, err := m.RewardFactor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintIncentive(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ClaimEnd, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ClaimEnd):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintIncentive(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x1a - if len(m.ClaimMultipliers) > 0 { - for iNdEx := len(m.ClaimMultipliers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ClaimMultipliers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.CdpMintingRewardPeriods) > 0 { - for iNdEx := len(m.CdpMintingRewardPeriods) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CdpMintingRewardPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *RewardPeriod) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RewardPeriod) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RewardPeriod) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.RewardsPerSecond.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.End, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.End):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintIncentive(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x22 - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Start):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintIncentive(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x1a - if len(m.CollateralType) > 0 { - i -= len(m.CollateralType) - copy(dAtA[i:], m.CollateralType) - i = encodeVarintIncentive(dAtA, i, uint64(len(m.CollateralType))) - i-- - dAtA[i] = 0x12 - } - if m.Active { - i-- - if m.Active { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Multiplier) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Multiplier) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Multiplier) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Factor.Size() - i -= size - if _, err := m.Factor.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintIncentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MonthsLockup != 0 { - i = encodeVarintIncentive(dAtA, i, uint64(m.MonthsLockup)) - i-- - dAtA[i] = 0x10 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintIncentive(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintIncentive(dAtA []byte, offset int, v uint64) int { - offset -= sovIncentive(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BaseClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Owner.Size() - n += 1 + l + sovIncentive(uint64(l)) - l = m.Reward.Size() - n += 1 + l + sovIncentive(uint64(l)) - return n -} - -func (m *BaseMultiClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Owner.Size() - n += 1 + l + sovIncentive(uint64(l)) - if len(m.Reward) > 0 { - for _, e := range m.Reward { - l = e.Size() - n += 1 + l + sovIncentive(uint64(l)) - } - } - return n -} - -func (m *CdpMintingClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BaseClaim != nil { - l = m.BaseClaim.Size() - n += 1 + l + sovIncentive(uint64(l)) - } - if len(m.RewardIndexes) > 0 { - for _, e := range m.RewardIndexes { - l = e.Size() - n += 1 + l + sovIncentive(uint64(l)) - } - } - return n -} - -func (m *RewardIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovIncentive(uint64(l)) - } - l = m.RewardFactor.Size() - n += 1 + l + sovIncentive(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CdpMintingRewardPeriods) > 0 { - for _, e := range m.CdpMintingRewardPeriods { - l = e.Size() - n += 1 + l + sovIncentive(uint64(l)) - } - } - if len(m.ClaimMultipliers) > 0 { - for _, e := range m.ClaimMultipliers { - l = e.Size() - n += 1 + l + sovIncentive(uint64(l)) - } - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ClaimEnd) - n += 1 + l + sovIncentive(uint64(l)) - return n -} - -func (m *RewardPeriod) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Active { - n += 2 - } - l = len(m.CollateralType) - if l > 0 { - n += 1 + l + sovIncentive(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Start) - n += 1 + l + sovIncentive(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.End) - n += 1 + l + sovIncentive(uint64(l)) - l = m.RewardsPerSecond.Size() - n += 1 + l + sovIncentive(uint64(l)) - return n -} - -func (m *Multiplier) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovIncentive(uint64(l)) - } - if m.MonthsLockup != 0 { - n += 1 + sovIncentive(uint64(m.MonthsLockup)) - } - l = m.Factor.Size() - n += 1 + l + sovIncentive(uint64(l)) - return n -} - -func sovIncentive(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozIncentive(x uint64) (n int) { - return sovIncentive(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BaseClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BaseClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BaseClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reward", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Reward.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BaseMultiClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BaseMultiClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BaseMultiClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reward", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reward = append(m.Reward, types.Coin{}) - if err := m.Reward[len(m.Reward)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CdpMintingClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CdpMintingClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CdpMintingClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseClaim", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BaseClaim == nil { - m.BaseClaim = &BaseClaim{} - } - if err := m.BaseClaim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardIndexes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RewardIndexes = append(m.RewardIndexes, RewardIndex{}) - if err := m.RewardIndexes[len(m.RewardIndexes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RewardIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RewardIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RewardIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RewardFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CdpMintingRewardPeriods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CdpMintingRewardPeriods = append(m.CdpMintingRewardPeriods, RewardPeriod{}) - if err := m.CdpMintingRewardPeriods[len(m.CdpMintingRewardPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimMultipliers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimMultipliers = append(m.ClaimMultipliers, Multiplier{}) - if err := m.ClaimMultipliers[len(m.ClaimMultipliers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimEnd", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ClaimEnd, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RewardPeriod) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RewardPeriod: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RewardPeriod: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Active = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollateralType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CollateralType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Start, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.End, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardsPerSecond", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RewardsPerSecond.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Multiplier) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Multiplier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Multiplier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MonthsLockup", wireType) - } - m.MonthsLockup = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MonthsLockup |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Factor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIncentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Factor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipIncentive(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIncentive - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIncentive - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIncentive - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthIncentive - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupIncentive - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthIncentive - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthIncentive = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIncentive = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupIncentive = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/incentive/types/keys.go b/deprecated/x/incentive/types/keys.go deleted file mode 100644 index 4c03c0786..000000000 --- a/deprecated/x/incentive/types/keys.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "incentive" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_capability" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} - -const ( - ParamsKey = "Params-value-" - CdpMintingClaimKey = "CdpMintingClaim" - CdpMintingRewardFactorKey = "CdpMintingRewardFactorKey" - PreviousCdpMintingRewardAccrualTimeKey = "PreviousCdpMintingRewardAccrualTime" - GenesisDenomsKey = "GenesisDenoms" -) diff --git a/deprecated/x/incentive/types/msg.go b/deprecated/x/incentive/types/msg.go deleted file mode 100644 index 45a5dcb93..000000000 --- a/deprecated/x/incentive/types/msg.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgClaimCdpMintingReward{} - -// NewMsgClaimCdpMintingReward returns a new MsgClaimCdpMintingReward. -func NewMsgClaimCdpMintingReward(sender sdk.AccAddress, multiplierName string) MsgClaimCdpMintingReward { - return MsgClaimCdpMintingReward{ - Sender: sender.Bytes(), - MultiplierName: multiplierName, - } -} - -// Route return the message type used for routing the message. -func (msg MsgClaimCdpMintingReward) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgClaimCdpMintingReward) Type() string { return "claim_cdp_minting_reward" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgClaimCdpMintingReward) ValidateBasic() error { - if msg.Sender.AccAddress().Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty") - } - return MultiplierName(strings.ToLower(msg.MultiplierName)).IsValid() -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgClaimCdpMintingReward) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgClaimCdpMintingReward) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} diff --git a/deprecated/x/incentive/types/msg_test.go b/deprecated/x/incentive/types/msg_test.go deleted file mode 100644 index 3531c1afb..000000000 --- a/deprecated/x/incentive/types/msg_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cometbft/cometbft/crypto" - - incentivetypes "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -type msgTest struct { - from sdk.AccAddress - multiplierName string - expectPass bool -} - -type MsgTestSuite struct { - suite.Suite - - tests []msgTest -} - -func (suite *MsgTestSuite) SetupTest() { - tests := []msgTest{ - { - from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), - multiplierName: "large", - expectPass: true, - }, - { - from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), - multiplierName: "medium", - expectPass: true, - }, - { - from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), - multiplierName: "small", - expectPass: true, - }, - { - from: sdk.AccAddress{}, - multiplierName: "medium", - expectPass: false, - }, - { - from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), - multiplierName: "huge", - expectPass: false, - }, - } - suite.tests = tests -} - -func (suite *MsgTestSuite) TestMsgValidation() { - for _, t := range suite.tests { - msg := incentivetypes.NewMsgClaimCdpMintingReward(t.from, t.multiplierName) - err := msg.ValidateBasic() - if t.expectPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - } -} - -func TestMsgTestSuite(t *testing.T) { - suite.Run(t, new(MsgTestSuite)) -} diff --git a/deprecated/x/incentive/types/params.go b/deprecated/x/incentive/types/params.go deleted file mode 100644 index a966b0079..000000000 --- a/deprecated/x/incentive/types/params.go +++ /dev/null @@ -1,238 +0,0 @@ -package types - -import ( - "errors" - "fmt" - "strings" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramstype "github.com/cosmos/cosmos-sdk/x/params/types" - - tmtime "github.com/cometbft/cometbft/types/time" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - ununifidistTypes "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -// Valid reward multipliers -const ( - Small MultiplierName = "small" - Medium MultiplierName = "medium" - Large MultiplierName = "large" -) - -// Parameter keys and default values -var ( - KeyCdpMintingRewardPeriods = []byte("CdpMintingRewardPeriods") - KeyClaimEnd = []byte("ClaimEnd") - KeyMultipliers = []byte("ClaimMultipliers") - DefaultActive = false - DefaultRewardPeriods = RewardPeriods{} - DefaultMultiRewardPeriods = MultiRewardPeriods{} - DefaultMultipliers = Multipliers{} - DefaultCdpClaims = CdpMintingClaims{} - DefaultGenesisAccumulationTimes = GenesisAccumulationTimes{} - DefaultClaimEnd = tmtime.Canonical(time.Unix(1, 0)) - DefaultPrincipalDenom = cdptypes.DefaultStableDenom - DefaultCDPMintingRewardDenom = cdptypes.DefaultGovDenom - IncentiveMacc = ununifidistTypes.ModuleName -) - -// NewParams returns a new params object -func NewParams(cdpMinting RewardPeriods, multipliers Multipliers, claimEnd time.Time) Params { - return Params{ - CdpMintingRewardPeriods: cdpMinting, - ClaimMultipliers: multipliers, - ClaimEnd: claimEnd, - } -} - -// DefaultParams returns default params for incentive module -func DefaultParams() Params { - return NewParams(DefaultRewardPeriods, DefaultMultipliers, DefaultClaimEnd) -} - -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstype.KeyTable { - return paramstype.NewKeyTable().RegisterParamSet(&Params{}) -} - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { - return paramstype.ParamSetPairs{ - paramstype.NewParamSetPair(KeyCdpMintingRewardPeriods, &p.CdpMintingRewardPeriods, validateRewardPeriodsParam), - paramstype.NewParamSetPair(KeyClaimEnd, &p.ClaimEnd, validateClaimEndParam), - paramstype.NewParamSetPair(KeyMultipliers, &p.ClaimMultipliers, validateMultipliersParam), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - - if err := validateMultipliersParam(p.ClaimMultipliers); err != nil { - return err - } - - if err := validateRewardPeriodsParam(p.CdpMintingRewardPeriods); err != nil { - return err - } - - return nil -} - -func validateRewardPeriodsParam(i interface{}) error { - rewards, ok := i.(RewardPeriods) - if !ok { - rewards, ok = i.([]RewardPeriod) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - } - - return rewards.Validate() -} - -func validateMultiRewardPeriodsParam(i interface{}) error { - rewards, ok := i.(MultiRewardPeriods) - if !ok { - rewards, ok = i.([]MultiRewardPeriod) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - } - - return rewards.Validate() -} - -func validateMultipliersParam(i interface{}) error { - multipliers, ok := i.(Multipliers) - if !ok { - multipliers, ok = i.([]Multiplier) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - } - return multipliers.Validate() -} - -func validateClaimEndParam(i interface{}) error { - endTime, ok := i.(time.Time) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - if endTime.Unix() <= 0 { - return fmt.Errorf("end time should not be zero") - } - return nil -} - -// NewRewardPeriod returns a new RewardPeriod -func NewRewardPeriod(active bool, collateralType string, start time.Time, end time.Time, reward sdk.Coin) RewardPeriod { - return RewardPeriod{ - Active: active, - CollateralType: collateralType, - Start: start, - End: end, - RewardsPerSecond: reward, - } -} - -// Validate performs a basic check of a RewardPeriod fields. -func (rp RewardPeriod) Validate() error { - if rp.Start.Unix() <= 0 { - return errors.New("reward period start time cannot be 0") - } - if rp.End.Unix() <= 0 { - return errors.New("reward period end time cannot be 0") - } - if rp.Start.After(rp.End) { - return fmt.Errorf("end period time %s cannot be before start time %s", rp.End, rp.Start) - } - if !rp.RewardsPerSecond.IsValid() { - return fmt.Errorf("invalid reward amount: %s", rp.RewardsPerSecond) - } - if strings.TrimSpace(rp.CollateralType) == "" { - return fmt.Errorf("reward period collateral type cannot be blank: %s", rp.String()) - } - return nil -} - -// RewardPeriods array of RewardPeriod -type RewardPeriods []RewardPeriod - -// Validate checks if all the RewardPeriods are valid and there are no duplicated -// entries. -func (rps RewardPeriods) Validate() error { - seenPeriods := make(map[string]bool) - for _, rp := range rps { - if seenPeriods[rp.CollateralType] { - return fmt.Errorf("duplicated reward period with collateral type %s", rp.CollateralType) - } - - if err := rp.Validate(); err != nil { - return err - } - seenPeriods[rp.CollateralType] = true - } - - return nil -} - -// NewMultiplier returns a new Multiplier -func NewMultiplier(name MultiplierName, lockup int64, factor sdk.Dec) Multiplier { - return Multiplier{ - Name: string(name), - MonthsLockup: lockup, - Factor: factor, - } -} - -// Validate multiplier param -func (m Multiplier) Validate() error { - if err := MultiplierName(m.Name).IsValid(); err != nil { - return err - } - if m.MonthsLockup < 0 { - return fmt.Errorf("expected non-negative lockup, got %d", m.MonthsLockup) - } - if m.Factor.IsNegative() { - return fmt.Errorf("expected non-negative factor, got %s", m.Factor.String()) - } - - return nil -} - -// Multipliers slice of Multiplier -type Multipliers []Multiplier - -// Validate validates each multiplier -func (ms Multipliers) Validate() error { - for _, m := range ms { - if err := m.Validate(); err != nil { - return err - } - } - return nil -} - -// String implements fmt.Stringer -func (ms Multipliers) String() string { - out := "Claim Multipliers\n" - for _, s := range ms { - out += fmt.Sprintf("%s\n", s.String()) - } - return out -} - -// MultiplierName name for valid multiplier -type MultiplierName string - -// IsValid checks if the input is one of the expected strings -func (mn MultiplierName) IsValid() error { - switch mn { - case Small, Medium, Large: - return nil - } - return fmt.Errorf("invalid multiplier name: %s", mn) -} diff --git a/deprecated/x/incentive/types/params_test.go b/deprecated/x/incentive/types/params_test.go deleted file mode 100644 index 3cf9cae12..000000000 --- a/deprecated/x/incentive/types/params_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package types_test - -import ( - "strings" - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/stretchr/testify/suite" - - incentivetypes "github.com/UnUniFi/chain/deprecated/x/incentive/types" -) - -type ParamTestSuite struct { - suite.Suite -} - -func (suite *ParamTestSuite) SetupTest() {} - -func (suite *ParamTestSuite) TestParamValidation() { - type args struct { - cdpMintingRewardPeriods incentivetypes.RewardPeriods - multipliers incentivetypes.Multipliers - end time.Time - } - - type errArgs struct { - expectPass bool - contains string - } - type test struct { - name string - args args - errArgs errArgs - } - - testCases := []test{ - { - "default", - args{ - cdpMintingRewardPeriods: incentivetypes.DefaultRewardPeriods, - multipliers: incentivetypes.DefaultMultipliers, - end: incentivetypes.DefaultClaimEnd, - }, - errArgs{ - expectPass: true, - contains: "", - }, - }, - { - "valid", - args{ - cdpMintingRewardPeriods: incentivetypes.RewardPeriods{incentivetypes.NewRewardPeriod( - true, "bnb-a", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.NewCoin(incentivetypes.DefaultCDPMintingRewardDenom, sdk.NewInt(122354)))}, - multipliers: incentivetypes.Multipliers{ - incentivetypes.NewMultiplier( - incentivetypes.Small, 1, sdk.MustNewDecFromStr("0.25"), - ), - incentivetypes.NewMultiplier( - incentivetypes.Large, 1, sdk.MustNewDecFromStr("1.0"), - ), - }, - end: time.Date(2025, 10, 15, 14, 0, 0, 0, time.UTC), - }, - errArgs{ - expectPass: true, - contains: "", - }, - }, - } - - for _, tc := range testCases { - suite.Run(tc.name, func() { - params := incentivetypes.NewParams(tc.args.cdpMintingRewardPeriods, tc.args.multipliers, tc.args.end) - err := params.Validate() - if tc.errArgs.expectPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) - } - }) - } -} - -func TestParamTestSuite(t *testing.T) { - suite.Run(t, new(ParamTestSuite)) -} diff --git a/deprecated/x/incentive/types/period.go b/deprecated/x/incentive/types/period.go deleted file mode 100644 index ddd571823..000000000 --- a/deprecated/x/incentive/types/period.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" -) - -// NewPeriod returns a new vesting period -func NewPeriod(amount sdk.Coins, length int64) vestingtypes.Period { - return vestingtypes.Period{Amount: amount, Length: length} -} diff --git a/deprecated/x/incentive/types/query.go b/deprecated/x/incentive/types/query.go deleted file mode 100644 index ab1254f4c..000000000 --- a/deprecated/x/incentive/types/query.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/deprecated/x/incentive/types/query.pb.go b/deprecated/x/incentive/types/query.pb.go deleted file mode 100644 index 2eef93e1f..000000000 --- a/deprecated/x/incentive/types/query.pb.go +++ /dev/null @@ -1,538 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: incentive/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_80763d3b6283e138, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_80763d3b6283e138, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.incentive.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.incentive.QueryParamsResponse") -} - -func init() { proto.RegisterFile("incentive/query.proto", fileDescriptor_80763d3b6283e138) } - -var fileDescriptor_80763d3b6283e138 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0xc1, 0x4a, 0xf4, 0x30, - 0x1c, 0xc4, 0x9b, 0x0f, 0xbe, 0x1e, 0xe2, 0xc9, 0xa8, 0x60, 0xab, 0x04, 0x2d, 0x28, 0xb2, 0x87, - 0x86, 0xae, 0x6f, 0x20, 0x22, 0x1e, 0x55, 0xd8, 0x8b, 0xb7, 0xb4, 0xc4, 0xee, 0x1f, 0xec, 0x3f, - 0xd9, 0x26, 0x5d, 0x5c, 0x8f, 0xfa, 0x02, 0x82, 0x2f, 0xe5, 0x71, 0xc1, 0x8b, 0x47, 0x69, 0x7d, - 0x10, 0xb1, 0x2d, 0xbb, 0xca, 0x0a, 0xde, 0xc2, 0xcc, 0x6f, 0x26, 0x93, 0xd0, 0x2d, 0xc0, 0x4c, - 0xa1, 0x83, 0xa9, 0x12, 0x93, 0x4a, 0x95, 0xb3, 0xd8, 0x94, 0xda, 0x69, 0xb6, 0x5e, 0x61, 0x85, - 0x70, 0x03, 0xf1, 0xc2, 0x0e, 0x77, 0x73, 0xad, 0xf3, 0x5b, 0x25, 0xa4, 0x01, 0x21, 0x11, 0xb5, - 0x93, 0x0e, 0x34, 0xda, 0x2e, 0x10, 0x0e, 0x32, 0x6d, 0x0b, 0x6d, 0x45, 0x2a, 0x6d, 0xdf, 0x24, - 0xa6, 0x49, 0xaa, 0x9c, 0x4c, 0x84, 0x91, 0x39, 0x60, 0x0b, 0xf7, 0x6c, 0xb0, 0xbc, 0x73, 0x71, - 0xea, 0xac, 0x68, 0x93, 0xb2, 0xcb, 0xaf, 0xf0, 0x85, 0x2c, 0x65, 0x61, 0xaf, 0xd4, 0xa4, 0x52, - 0xd6, 0x45, 0xe7, 0x74, 0xe3, 0x87, 0x6a, 0x8d, 0x46, 0xab, 0x58, 0x42, 0x7d, 0xd3, 0x2a, 0xdb, - 0x64, 0x8f, 0x1c, 0xad, 0x0d, 0x83, 0x78, 0x65, 0x75, 0xdc, 0x47, 0x7a, 0x70, 0xf8, 0x48, 0xe8, - 0xff, 0xb6, 0x8a, 0xdd, 0x53, 0xbf, 0xf3, 0xd8, 0xc1, 0x2f, 0xb1, 0xd5, 0x11, 0xe1, 0xe1, 0x5f, - 0x58, 0xb7, 0x2a, 0xda, 0x7f, 0x78, 0xfd, 0x78, 0xfe, 0xb7, 0xc3, 0x02, 0xd1, 0xf3, 0xcb, 0x47, - 0x8a, 0x6e, 0xc5, 0xc9, 0xe9, 0x4b, 0xcd, 0xc9, 0xbc, 0xe6, 0xe4, 0xbd, 0xe6, 0xe4, 0xa9, 0xe1, - 0xde, 0xbc, 0xe1, 0xde, 0x5b, 0xc3, 0xbd, 0xeb, 0x41, 0x0e, 0x6e, 0x5c, 0xa5, 0x71, 0xa6, 0x0b, - 0x31, 0xc2, 0x11, 0xc2, 0x19, 0x88, 0x6c, 0x2c, 0x01, 0xc5, 0xdd, 0xb7, 0x1a, 0x37, 0x33, 0xca, - 0xa6, 0x7e, 0xfb, 0x65, 0xc7, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x21, 0xcb, 0x95, 0xfd, 0xc3, - 0x01, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/ununifi.incentive.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.incentive.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.incentive.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "incentive/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/incentive/types/query.pb.gw.go b/deprecated/x/incentive/types/query.pb.gw.go deleted file mode 100644 index 3c355b2da..000000000 --- a/deprecated/x/incentive/types/query.pb.gw.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: incentive/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "incentive", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage -) diff --git a/deprecated/x/incentive/types/tx.pb.go b/deprecated/x/incentive/types/tx.pb.go deleted file mode 100644 index ff2b6b9cf..000000000 --- a/deprecated/x/incentive/types/tx.pb.go +++ /dev/null @@ -1,582 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: incentive/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgClaimCdpMintingReward struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - MultiplierName string `protobuf:"bytes,2,opt,name=multiplier_name,json=multiplierName,proto3" json:"multiplier_name,omitempty" yaml:"multiplier_name"` -} - -func (m *MsgClaimCdpMintingReward) Reset() { *m = MsgClaimCdpMintingReward{} } -func (m *MsgClaimCdpMintingReward) String() string { return proto.CompactTextString(m) } -func (*MsgClaimCdpMintingReward) ProtoMessage() {} -func (*MsgClaimCdpMintingReward) Descriptor() ([]byte, []int) { - return fileDescriptor_910d537256618935, []int{0} -} -func (m *MsgClaimCdpMintingReward) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClaimCdpMintingReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClaimCdpMintingReward.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgClaimCdpMintingReward) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaimCdpMintingReward.Merge(m, src) -} -func (m *MsgClaimCdpMintingReward) XXX_Size() int { - return m.Size() -} -func (m *MsgClaimCdpMintingReward) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaimCdpMintingReward.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClaimCdpMintingReward proto.InternalMessageInfo - -func (m *MsgClaimCdpMintingReward) GetMultiplierName() string { - if m != nil { - return m.MultiplierName - } - return "" -} - -type MsgClaimCdpMintingRewardResponse struct { -} - -func (m *MsgClaimCdpMintingRewardResponse) Reset() { *m = MsgClaimCdpMintingRewardResponse{} } -func (m *MsgClaimCdpMintingRewardResponse) String() string { return proto.CompactTextString(m) } -func (*MsgClaimCdpMintingRewardResponse) ProtoMessage() {} -func (*MsgClaimCdpMintingRewardResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_910d537256618935, []int{1} -} -func (m *MsgClaimCdpMintingRewardResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClaimCdpMintingRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClaimCdpMintingRewardResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgClaimCdpMintingRewardResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaimCdpMintingRewardResponse.Merge(m, src) -} -func (m *MsgClaimCdpMintingRewardResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgClaimCdpMintingRewardResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaimCdpMintingRewardResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClaimCdpMintingRewardResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgClaimCdpMintingReward)(nil), "ununifi.incentive.MsgClaimCdpMintingReward") - proto.RegisterType((*MsgClaimCdpMintingRewardResponse)(nil), "ununifi.incentive.MsgClaimCdpMintingRewardResponse") -} - -func init() { proto.RegisterFile("incentive/tx.proto", fileDescriptor_910d537256618935) } - -var fileDescriptor_910d537256618935 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x3f, 0x4f, 0xe3, 0x30, - 0x18, 0xc6, 0x93, 0x3b, 0xa9, 0xd2, 0x45, 0xba, 0x3b, 0x5d, 0x74, 0x77, 0xaa, 0x32, 0x24, 0x55, - 0x26, 0x04, 0x52, 0xac, 0xd2, 0x8d, 0xad, 0x2d, 0x42, 0x2c, 0x65, 0x08, 0xea, 0xc2, 0x02, 0x4e, - 0xf2, 0xd6, 0x7d, 0xa5, 0xd8, 0x8e, 0x62, 0xa7, 0xb4, 0x1b, 0x1f, 0x81, 0xaf, 0xc4, 0xd6, 0xb1, - 0x23, 0x62, 0x88, 0x50, 0xfb, 0x0d, 0xfa, 0x09, 0x50, 0x93, 0xf2, 0x47, 0x40, 0x07, 0x36, 0xfb, - 0x7d, 0x7e, 0x7e, 0xec, 0xf7, 0xf1, 0x6b, 0xd9, 0x28, 0x62, 0x10, 0x1a, 0x27, 0x40, 0xf4, 0x34, - 0xc8, 0x72, 0xa9, 0xa5, 0xfd, 0xa7, 0x10, 0x85, 0xc0, 0x11, 0x06, 0x2f, 0x9a, 0xf3, 0x97, 0x49, - 0x26, 0x2b, 0x95, 0x6c, 0x56, 0x35, 0xe8, 0x78, 0x4c, 0x4a, 0x96, 0x02, 0xa9, 0x76, 0x51, 0x31, - 0x22, 0x1a, 0x39, 0x28, 0x4d, 0x79, 0xb6, 0x05, 0xdc, 0x58, 0x2a, 0x2e, 0x15, 0x89, 0xa8, 0x02, - 0x32, 0x69, 0x47, 0xa0, 0x69, 0x9b, 0xc4, 0x12, 0x45, 0xad, 0xfb, 0x77, 0xa6, 0xd5, 0x1c, 0x28, - 0xd6, 0x4f, 0x29, 0xf2, 0x7e, 0x92, 0x0d, 0x50, 0x68, 0x14, 0x2c, 0x84, 0x6b, 0x9a, 0x27, 0xf6, - 0x95, 0xd5, 0x50, 0x20, 0x12, 0xc8, 0x9b, 0x66, 0xcb, 0xdc, 0xfb, 0xd1, 0x3b, 0x9d, 0x97, 0x9e, - 0xf1, 0x50, 0x7a, 0x84, 0xa1, 0x1e, 0x17, 0x51, 0x10, 0x4b, 0x4e, 0x86, 0x62, 0x28, 0xf0, 0x04, - 0x49, 0x3c, 0xa6, 0x28, 0x88, 0x9e, 0x65, 0xa0, 0x82, 0x73, 0x9d, 0xa3, 0x60, 0xdd, 0x38, 0xee, - 0x26, 0x49, 0x0e, 0x4a, 0xad, 0x4b, 0xef, 0xe7, 0x8c, 0xf2, 0xf4, 0xc8, 0xaf, 0xed, 0xfc, 0x70, - 0xeb, 0x6b, 0xf7, 0xad, 0xdf, 0xbc, 0x48, 0x35, 0x66, 0x29, 0x42, 0x7e, 0x29, 0x28, 0x87, 0xe6, - 0xb7, 0xea, 0x2a, 0x67, 0x5d, 0x7a, 0xff, 0xeb, 0x33, 0xef, 0x00, 0x3f, 0xfc, 0xf5, 0x5a, 0x39, - 0xdb, 0x14, 0x7c, 0xab, 0xb5, 0xab, 0x85, 0x10, 0x54, 0x26, 0x85, 0x82, 0xc3, 0x1b, 0xd3, 0xfa, - 0x3e, 0x50, 0xcc, 0x9e, 0x59, 0xff, 0x3e, 0xef, 0xf5, 0x20, 0xf8, 0x90, 0x79, 0xb0, 0xcb, 0xd5, - 0xe9, 0x7c, 0x01, 0x7e, 0x7e, 0x42, 0xef, 0x78, 0xbe, 0x74, 0xcd, 0xc5, 0xd2, 0x35, 0x1f, 0x97, - 0xae, 0x79, 0xbb, 0x72, 0x8d, 0xc5, 0xca, 0x35, 0xee, 0x57, 0xae, 0x71, 0xb1, 0xbf, 0x33, 0xcf, - 0x29, 0x79, 0x33, 0x1d, 0x9b, 0x6c, 0xa3, 0x46, 0xf5, 0x6f, 0x9d, 0xa7, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x66, 0x4a, 0x4c, 0x84, 0x37, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - ClaimCdpMintingReward(ctx context.Context, in *MsgClaimCdpMintingReward, opts ...grpc.CallOption) (*MsgClaimCdpMintingRewardResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) ClaimCdpMintingReward(ctx context.Context, in *MsgClaimCdpMintingReward, opts ...grpc.CallOption) (*MsgClaimCdpMintingRewardResponse, error) { - out := new(MsgClaimCdpMintingRewardResponse) - err := c.cc.Invoke(ctx, "/ununifi.incentive.Msg/ClaimCdpMintingReward", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - ClaimCdpMintingReward(context.Context, *MsgClaimCdpMintingReward) (*MsgClaimCdpMintingRewardResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) ClaimCdpMintingReward(ctx context.Context, req *MsgClaimCdpMintingReward) (*MsgClaimCdpMintingRewardResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimCdpMintingReward not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_ClaimCdpMintingReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgClaimCdpMintingReward) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ClaimCdpMintingReward(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.incentive.Msg/ClaimCdpMintingReward", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ClaimCdpMintingReward(ctx, req.(*MsgClaimCdpMintingReward)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.incentive.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ClaimCdpMintingReward", - Handler: _Msg_ClaimCdpMintingReward_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "incentive/tx.proto", -} - -func (m *MsgClaimCdpMintingReward) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgClaimCdpMintingReward) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClaimCdpMintingReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MultiplierName) > 0 { - i -= len(m.MultiplierName) - copy(dAtA[i:], m.MultiplierName) - i = encodeVarintTx(dAtA, i, uint64(len(m.MultiplierName))) - i-- - dAtA[i] = 0x12 - } - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgClaimCdpMintingRewardResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgClaimCdpMintingRewardResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClaimCdpMintingRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgClaimCdpMintingReward) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.MultiplierName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgClaimCdpMintingRewardResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgClaimCdpMintingReward) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgClaimCdpMintingReward: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaimCdpMintingReward: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MultiplierName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MultiplierName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgClaimCdpMintingRewardResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgClaimCdpMintingRewardResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaimCdpMintingRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/nft-marketmaker/spec/01_concepts.md b/deprecated/x/nft-marketmaker/spec/01_concepts.md deleted file mode 100644 index 0acfc8294..000000000 --- a/deprecated/x/nft-marketmaker/spec/01_concepts.md +++ /dev/null @@ -1,6 +0,0 @@ -# Concepts - -`nft-marketmaker` module will play a role as one of asset management target of `yield-aggregator`. - -`nft-marketmaker` module will offer bids in `nftmarket` module with lower price than the highest bid, to get income gains. -It can contribute to alleviate the problem of big `bid_active_rank`. diff --git a/deprecated/x/nft-marketmaker/spec/02_state.md b/deprecated/x/nft-marketmaker/spec/02_state.md deleted file mode 100644 index da704cc74..000000000 --- a/deprecated/x/nft-marketmaker/spec/02_state.md +++ /dev/null @@ -1 +0,0 @@ -# State diff --git a/deprecated/x/nft-marketmaker/spec/03_keeper.md b/deprecated/x/nft-marketmaker/spec/03_keeper.md deleted file mode 100644 index 018fcb680..000000000 --- a/deprecated/x/nft-marketmaker/spec/03_keeper.md +++ /dev/null @@ -1 +0,0 @@ -# Keeper diff --git a/deprecated/x/nft-marketmaker/spec/04_messages.md b/deprecated/x/nft-marketmaker/spec/04_messages.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/deprecated/x/nftmarketv1/abci.go b/deprecated/x/nftmarketv1/abci.go deleted file mode 100644 index d9e96fe10..000000000 --- a/deprecated/x/nftmarketv1/abci.go +++ /dev/null @@ -1,26 +0,0 @@ -package nftmarketv1 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/keeper" -) - -// EndBlocker updates the current pricefeed -func EndBlocker(ctx sdk.Context, k keeper.Keeper) { - - // process ending nft listings - k.ProcessEndingNftListings(ctx) - - // handle full payment period endings - k.HandleFullPaymentsPeriodEndings(ctx) - - // deliever successful bids - k.DelieverSuccessfulBids(ctx) - - // process matured nft bids cancel - err := k.HandleMaturedCancelledBids(ctx) - if err != nil { - panic(err) - } -} diff --git a/deprecated/x/nftmarketv1/client/cli/flags.go b/deprecated/x/nftmarketv1/client/cli/flags.go deleted file mode 100644 index a55e39522..000000000 --- a/deprecated/x/nftmarketv1/client/cli/flags.go +++ /dev/null @@ -1,9 +0,0 @@ -package cli - -const ( - FlagAutomaticPayment = "automatic-payment" - FlagBidActiveRank = "bid-active-rank" - FlagBidToken = "bid-token" - FlagMinBid = "min-bid" - FlagOwner = "owner" -) diff --git a/deprecated/x/nftmarketv1/client/cli/query.go b/deprecated/x/nftmarketv1/client/cli/query.go deleted file mode 100644 index 2b7646506..000000000 --- a/deprecated/x/nftmarketv1/client/cli/query.go +++ /dev/null @@ -1,331 +0,0 @@ -package cli - -import ( - "context" - "fmt" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - CmdQueryParams(), - CmdQueryNftListing(), - CmdQueryListedNfts(), - CmdQueryLoans(), - CmdQueryLoan(), - CmdQueryNftBids(), - CmdQueryBidderBids(), - CmdQueryCDPsList(), - CmdQueryRewards(), - CmdQueryListedClass(), - ) - - return cmd -} - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows params", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryNftListing() *cobra.Command { - cmd := &cobra.Command{ - Use: "nft_listing [class_id] [nft_id]", - Short: "shows nft listing", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryNftListingRequest{ - ClassId: args[0], - NftId: args[1], - } - - res, err := queryClient.NftListing(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryListedNfts() *cobra.Command { - cmd := &cobra.Command{ - Use: "listed_nfts", - Short: "shows listed nfts on the market", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - owner, err := cmd.Flags().GetString(FlagOwner) - if err != nil { - return err - } - - var params *types.QueryListedNftsRequest - if owner != "" { - params = &types.QueryListedNftsRequest{ - Owner: owner, - } - } else { - params = &types.QueryListedNftsRequest{} - } - - res, err := queryClient.ListedNfts(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - cmd.Flags().String(FlagOwner, "", "nft owner address") - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryLoans() *cobra.Command { - cmd := &cobra.Command{ - Use: "loans", - Short: "shows loans", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryLoansRequest{} - - res, err := queryClient.Loans(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryLoan() *cobra.Command { - cmd := &cobra.Command{ - Use: "loan [class-id] [nft-id]", - Short: "shows nft loan", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryLoanRequest{ - ClassId: args[0], - NftId: args[1], - } - - res, err := queryClient.Loan(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryNftBids() *cobra.Command { - cmd := &cobra.Command{ - Use: "nft_bids [class_id] [nft_id]", - Short: "shows nft bids", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryNftBidsRequest{ - ClassId: args[0], - NftId: args[1], - } - - res, err := queryClient.NftBids(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryBidderBids() *cobra.Command { - cmd := &cobra.Command{ - Use: "bidder_bids [bidder]", - Short: "shows bids by bidder", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryBidderBidsRequest{ - Bidder: args[0], - } - - res, err := queryClient.BidderBids(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryCDPsList() *cobra.Command { - cmd := &cobra.Command{ - Use: "cdp_list", - Short: "shows cdps", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryCDPsListRequest{} - - res, err := queryClient.CDPsList(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryRewards() *cobra.Command { - cmd := &cobra.Command{ - Use: "rewards [address]", - Short: "shows rewards of an address", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryRewardsRequest{} - - res, err := queryClient.Rewards(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryListedClass() *cobra.Command { - cmd := &cobra.Command{ - Use: "listed_class [class-id] [nft-limit]", - Short: "shows listed nft ids and uris in defined class-id", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - nftLimit, err := strconv.ParseInt(args[1], 10, 32) - if err != nil { - return err - } - req := types.QueryListedClassRequest{ - ClassId: args[0], - NftLimit: int32(nftLimit), - } - - res, err := queryClient.ListedClass(context.Background(), &req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/nftmarketv1/client/cli/tx.go b/deprecated/x/nftmarketv1/client/cli/tx.go deleted file mode 100644 index 8beaae30c..000000000 --- a/deprecated/x/nftmarketv1/client/cli/tx.go +++ /dev/null @@ -1,600 +0,0 @@ -package cli - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - CmdMintNft(), - CmdCreateListing(), - CmdCancelNftListing(), - CmdExpandListingPeriod(), - CmdSellingDecision(), - CmdCreatePlaceBid(), - CmdCancelBid(), - CmdPayFullBid(), - CmdEndListing(), - CmdBorrow(), - CmdRepay(), - CmdMintStableCoin(), - CmdBurnStableCoin(), - CmdLiquidate(), - ) - - return cmd -} - -func CmdMintNft() *cobra.Command { - cmd := &cobra.Command{ - Use: "mint [class-id] [nft-id] [uri] [uri-hash]", - Short: "Mint an nft", - Long: strings.TrimSpace( - fmt.Sprintf(`Mint an nft. -Example: -$ %s tx %s mint a10 a10 uri 888838 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgMintNft(clientCtx.GetFromAddress(), args[0], args[1], args[2], args[3]) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// todo: Implementation fields -// BidToken, MinBid, BidHook, ListingType -func CmdCreateListing() *cobra.Command { - cmd := &cobra.Command{ - Use: "listing [class-id] [nft-id]", - Short: "Creates a new listing", - Long: strings.TrimSpace( - fmt.Sprintf(`Create a new listing, depositing nft. -Example: -$ %s tx %s listing 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - bidActiveRank, err := cmd.Flags().GetUint64(FlagBidActiveRank) - if err != nil { - return err - } - - minBid, err := cmd.Flags().GetUint64(FlagMinBid) - if err != nil { - return err - } - - bidToken, err := cmd.Flags().GetString(FlagBidToken) - if err != nil { - return err - } - - msg := types.NewMsgListNft(clientCtx.GetFromAddress(), nftIde, bidToken, bidActiveRank, sdk.NewInt(int64(minBid))) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - cmd.Flags().Uint64(FlagBidActiveRank, 1, "bid active rank") - cmd.Flags().String(FlagBidToken, "uguu", "bid token") - cmd.Flags().Uint64(FlagMinBid, 1, "min bid amount") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdCreatePlaceBid() *cobra.Command { - cmd := &cobra.Command{ - Use: "placebid [class-id] [nft-id] [amount]", - Short: "Creates a new place bid", - Long: strings.TrimSpace( - fmt.Sprintf(`Creates a new place bid. -Example: -$ %s tx %s placebid 1 1 100uguu --automatic-payment --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - bidCoin, err := sdk.ParseCoinNormalized(args[2]) - if err != nil { - return err - } - automaticPayment, err := cmd.Flags().GetBool(FlagAutomaticPayment) - if err != nil { - return err - } - - msg := types.NewMsgPlaceBid(clientCtx.GetFromAddress(), nftIde, bidCoin, automaticPayment) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - cmd.Flags().BoolP(FlagAutomaticPayment, "p", false, "automation payment") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdEndListing() *cobra.Command { - cmd := &cobra.Command{ - Use: "endlisting [class-id] [nft-id]", - Short: "end listing", - Long: strings.TrimSpace( - fmt.Sprintf(`end listing. -Example: -$ %s tx %s endlisting 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgEndNftListing(clientCtx.GetFromAddress(), nftIde) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdSellingDecision() *cobra.Command { - cmd := &cobra.Command{ - Use: "selling_decision [class-id] [nft-id]", - Short: "broadcast selling decision message", - Long: strings.TrimSpace( - fmt.Sprintf(`broadcast selling decision message. -Example: -$ %s tx %s selling_decision 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgSellingDecision(clientCtx.GetFromAddress(), nftIde) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdBorrow() *cobra.Command { - cmd := &cobra.Command{ - Use: "borrow [class-id] [nft-id] [amount]", - Short: "borrow denom", - Long: strings.TrimSpace( - fmt.Sprintf(`borrow denom. -Example: -$ %s tx %s borrow 1 1 100uguu --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - borrowCoin, err := sdk.ParseCoinNormalized(args[2]) - if err != nil { - return err - } - - msg := types.NewMsgBorrow(clientCtx.GetFromAddress(), nftIde, borrowCoin) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdRepay() *cobra.Command { - cmd := &cobra.Command{ - Use: "repay [class-id] [nft-id] [amount]", - Short: "repay loan on nft", - Long: strings.TrimSpace( - fmt.Sprintf(`repay loan on nft. -Example: -$ %s tx %s repay 1 1 100uguu --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - borrowCoin, err := sdk.ParseCoinNormalized(args[2]) - if err != nil { - return err - } - - msg := types.NewMsgRepay(clientCtx.GetFromAddress(), nftIde, borrowCoin) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdMintStableCoin() *cobra.Command { - cmd := &cobra.Command{ - Use: "mint_stablecoin [class-id] [nft-id] [amount]", - Short: "mint stablecoin", - Long: strings.TrimSpace( - fmt.Sprintf(`mint stablecoin. -Example: -$ %s tx %s mint_stablecoin 1 1 100usd --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // classId := args[0] - // nftId := args[1] - // nftIde := types.NftIdentifier{ - // ClassId: classId, - // NftId: nftId, - // } - - // borrowCoin, err := sdk.ParseCoinNormalized(args[2]) - // if err != nil { - // return err - // } - - msg := types.NewMsgMintStableCoin(clientCtx.GetFromAddress()) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdBurnStableCoin() *cobra.Command { - cmd := &cobra.Command{ - Use: "burn_stablecoin [class-id] [nft-id] [amount]", - Short: "burn stablecoin", - Long: strings.TrimSpace( - fmt.Sprintf(`burn stablecoin. -Example: -$ %s tx %s burn_stablecoin 1 1 100usd --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // classId := args[0] - // nftId := args[1] - // nftIde := types.NftIdentifier{ - // ClassId: classId, - // NftId: nftId, - // } - - // borrowCoin, err := sdk.ParseCoinNormalized(args[2]) - // if err != nil { - // return err - // } - - msg := types.NewMsgBurnStableCoin(clientCtx.GetFromAddress()) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdLiquidate() *cobra.Command { - cmd := &cobra.Command{ - Use: "liquidate [class-id] [nft-id]", - Short: "liquidate", - Long: strings.TrimSpace( - fmt.Sprintf(`liquidate. -Example: -$ %s tx %s liquidate 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // classId := args[0] - // nftId := args[1] - // nftIde := types.NftIdentifier{ - // ClassId: classId, - // NftId: nftId, - // } - - // borrowCoin, err := sdk.ParseCoinNormalized(args[2]) - // if err != nil { - // return err - // } - - msg := types.NewMsgLiquidate(clientCtx.GetFromAddress()) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdCancelNftListing() *cobra.Command { - cmd := &cobra.Command{ - Use: "cancel_listing [class-id] [nft-id]", - Short: "Cancel nft listing", - Long: strings.TrimSpace( - fmt.Sprintf(`Cancel nft listing. -Example: -$ %s tx %s cancel_listing 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgCancelNftListing(clientCtx.GetFromAddress(), nftIde) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdExpandListingPeriod() *cobra.Command { - cmd := &cobra.Command{ - Use: "expand_nft_listing [class-id] [nft-id]", - Short: "Expand nft listing", - Long: strings.TrimSpace( - fmt.Sprintf(`Expand nft listing. -Example: -$ %s tx %s expand_nft_listing 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgExpandListingPeriod(clientCtx.GetFromAddress(), nftIde) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdCancelBid() *cobra.Command { - cmd := &cobra.Command{ - Use: "cancelbid [class-id] [nft-id]", - Short: "Cancel bid on nft", - Long: strings.TrimSpace( - fmt.Sprintf(`Cancel bid on nft. -Example: -$ %s tx %s cancelbid 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgCancelBid(clientCtx.GetFromAddress(), nftIde) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdPayFullBid() *cobra.Command { - cmd := &cobra.Command{ - Use: "pay_fullbid [class-id] [nft-id]", - Short: "Pay full bid on nft", - Long: strings.TrimSpace( - fmt.Sprintf(`Pay full bid on nft. -Example: -$ %s tx %s pay_fullbid 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgPayFullBid(clientCtx.GetFromAddress(), nftIde) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/nftmarketv1/genesis.go b/deprecated/x/nftmarketv1/genesis.go deleted file mode 100644 index 78d9b24c9..000000000 --- a/deprecated/x/nftmarketv1/genesis.go +++ /dev/null @@ -1,36 +0,0 @@ -package nftmarketv1 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/keeper" - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -// InitGenesis initializes the store state from a genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKeeper, gs types.GenesisState) { - k.SetParamSet(ctx, gs.Params) - for _, listing := range gs.Listings { - k.SaveNftListing(ctx, listing) - } - for _, bid := range gs.Bids { - k.SetBid(ctx, bid) - } - for _, bid := range gs.CancelledBids { - k.SetCancelledBid(ctx, bid) - } - for _, loan := range gs.Loans { - k.SetDebt(ctx, loan) - } -} - -// ExportGenesis export genesis state for nftmarket module -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { - return types.GenesisState{ - Params: k.GetParamSet(ctx), - Listings: k.GetAllNftListings(ctx), - Bids: k.GetAllBids(ctx), - CancelledBids: k.GetAllCancelledBids(ctx), - Loans: k.GetAllDebts(ctx), - } -} diff --git a/deprecated/x/nftmarketv1/handler.go b/deprecated/x/nftmarketv1/handler.go deleted file mode 100644 index 5b9609909..000000000 --- a/deprecated/x/nftmarketv1/handler.go +++ /dev/null @@ -1,66 +0,0 @@ -package nftmarketv1 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/keeper" - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -func NewHandler(k keeper.Keeper) sdk.Handler { - msgServer := keeper.NewMsgServerImpl(k) - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgMintNft: - res, err := msgServer.MintNft(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgListNft: - res, err := msgServer.ListNft(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgCancelNftListing: - res, err := msgServer.CancelNftListing(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgExpandListingPeriod: - res, err := msgServer.ExpandListingPeriod(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgPlaceBid: - res, err := msgServer.PlaceBid(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgCancelBid: - res, err := msgServer.CancelBid(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgSellingDecision: - res, err := msgServer.SellingDecision(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgEndNftListing: - res, err := msgServer.EndNftListing(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgPayFullBid: - res, err := msgServer.PayFullBid(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgBorrow: - res, err := msgServer.Borrow(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgRepay: - res, err := msgServer.Repay(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgMintStableCoin: - res, err := msgServer.MintStableCoin(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgBurnStableCoin: - res, err := msgServer.BurnStableCoin(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgLiquidate: - res, err := msgServer.Liquidate(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/deprecated/x/nftmarketv1/keeper/bid.go b/deprecated/x/nftmarketv1/keeper/bid.go deleted file mode 100644 index 71af4b41a..000000000 --- a/deprecated/x/nftmarketv1/keeper/bid.go +++ /dev/null @@ -1,400 +0,0 @@ -package keeper - -import ( - "sort" - "time" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -func (k Keeper) GetBid(ctx sdk.Context, nftIdBytes []byte, bidder sdk.AccAddress) (types.NftBid, error) { - bid := types.NftBid{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.NftBidKey(nftIdBytes, bidder)) - if bz == nil { - return bid, types.ErrBidDoesNotExists - } - - k.cdc.MustUnmarshal(bz, &bid) - return bid, nil -} - -func (k Keeper) GetAllBids(ctx sdk.Context) []types.NftBid { - store := ctx.KVStore(k.storeKey) - - bids := []types.NftBid{} - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftBid)) - defer it.Close() - - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - - bids = append(bids, bid) - } - return bids -} - -func (k Keeper) GetBidsByNft(ctx sdk.Context, nftIdBytes []byte) []types.NftBid { - store := ctx.KVStore(k.storeKey) - - bids := []types.NftBid{} - it := sdk.KVStorePrefixIterator(store, append([]byte(types.KeyPrefixNftBid), nftIdBytes...)) - defer it.Close() - - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - - bids = append(bids, bid) - } - - // sort bids by rank - sort.SliceStable(bids, func(i, j int) bool { - if bids[i].Amount.Amount.LT(bids[j].Amount.Amount) { - return true - } - if bids[i].Amount.Amount.GT(bids[j].Amount.Amount) { - return false - } - if bids[i].BidTime.After(bids[j].BidTime) { - return true - } - return false - }) - return bids -} - -func (k Keeper) GetBidsByBidder(ctx sdk.Context, bidder sdk.AccAddress) []types.NftBid { - store := ctx.KVStore(k.storeKey) - - bids := []types.NftBid{} - it := sdk.KVStorePrefixIterator(store, types.AddressBidKeyPrefix(bidder)) - defer it.Close() - - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - - bids = append(bids, bid) - } - return bids -} - -func (k Keeper) SetBid(ctx sdk.Context, bid types.NftBid) { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - panic(err) - } - if bid, err := k.GetBid(ctx, bid.IdBytes(), bidder); err == nil { - k.DeleteBid(ctx, bid) - } - - bz := k.cdc.MustMarshal(&bid) - store := ctx.KVStore(k.storeKey) - store.Set(types.NftBidKey(bid.IdBytes(), bidder), bz) - store.Set(types.AddressBidKey(bid.IdBytes(), bidder), bz) -} - -func (k Keeper) DeleteBid(ctx sdk.Context, bid types.NftBid) { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - panic(err) - } - store := ctx.KVStore(k.storeKey) - store.Delete(types.NftBidKey(bid.IdBytes(), bidder)) - store.Delete(types.AddressBidKey(bid.IdBytes(), bidder)) -} - -func getCancelledBidTimeKey(timestamp time.Time) []byte { - timeBz := sdk.FormatTimeBytes(timestamp) - timeBzL := len(timeBz) - prefixL := len(types.KeyPrefixNftBidCancelled) - - bz := make([]byte, prefixL+8+timeBzL) - - // copy the prefix - copy(bz[:prefixL], types.KeyPrefixNftBidCancelled) - - // copy the encoded time bytes length - copy(bz[prefixL:prefixL+8], sdk.Uint64ToBigEndian(uint64(timeBzL))) - - // copy the encoded time bytes - copy(bz[prefixL+8:prefixL+8+timeBzL], timeBz) - return bz -} - -func (k Keeper) SetCancelledBid(ctx sdk.Context, bid types.NftBid) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&bid) - store.Set(append(append(getCancelledBidTimeKey(bid.BidTime), bid.IdBytes()...), []byte(bid.Bidder)...), bz) -} - -func (k Keeper) GetAllCancelledBids(ctx sdk.Context) []types.NftBid { - store := ctx.KVStore(k.storeKey) - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftBidCancelled)) - defer it.Close() - - bids := []types.NftBid{} - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - bids = append(bids, bid) - } - return bids -} - -func (k Keeper) GetMaturedCancelledBids(ctx sdk.Context, endTime time.Time) []types.NftBid { - store := ctx.KVStore(k.storeKey) - timeKey := getCancelledBidTimeKey(endTime) - it := store.Iterator([]byte(types.KeyPrefixNftBidCancelled), storetypes.InclusiveEndBytes(timeKey)) - defer it.Close() - - bids := []types.NftBid{} - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - bids = append(bids, bid) - } - return bids -} - -func (k Keeper) TotalActiveRankDeposit(ctx sdk.Context, nftIdBytes []byte) sdk.Int { - listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) - if err != nil { - return sdk.ZeroInt() - } - - bids := k.GetBidsByNft(ctx, nftIdBytes) - totalActiveRankDeposit := sdk.ZeroInt() - - winnerCandidateStartIndex := len(bids) - int(listing.BidActiveRank) - if winnerCandidateStartIndex < 0 { - winnerCandidateStartIndex = 0 - } - for _, bid := range bids[winnerCandidateStartIndex:] { - totalActiveRankDeposit = totalActiveRankDeposit.Add(bid.PaidAmount) - } - return totalActiveRankDeposit -} - -func (k Keeper) DeleteCancelledBid(ctx sdk.Context, bid types.NftBid) { - store := ctx.KVStore(k.storeKey) - store.Delete(append(append(getCancelledBidTimeKey(bid.BidTime), bid.IdBytes()...), []byte(bid.Bidder)...)) -} - -func (k Keeper) PlaceBid(ctx sdk.Context, msg *types.MsgPlaceBid) error { - // Verify listing is in BIDDING state - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return err - } - - if listing.State != types.ListingState_LISTING && listing.State != types.ListingState_BIDDING { - return types.ErrNftListingNotInBidState - } - - if listing.BidToken != msg.Amount.Denom { - return types.ErrInvalidBidDenom - } - - if listing.MinBid.GT(msg.Amount.Amount) { - return types.ErrInvalidBidAmount - } - - bidder := msg.Sender.AccAddress() - increaseAmount := msg.Amount.Amount - paidAmount := sdk.ZeroInt() - - // if previous bid exists add more on top of existings - bid, err := k.GetBid(ctx, msg.NftId.IdBytes(), bidder) - if err == nil { - if bid.Amount.Amount.GTE(msg.Amount.Amount) { - return types.ErrInvalidBidAmount - } - paidAmount = bid.PaidAmount - increaseAmount = msg.Amount.Amount.Sub(bid.Amount.Amount) - } - - // Transfer required amount of token from bid account to module - initialDeposit := increaseAmount.Quo(sdk.NewInt(int64(listing.BidActiveRank))) - if initialDeposit.IsPositive() { - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.Coins{sdk.NewCoin(listing.BidToken, initialDeposit)}) - if err != nil { - return err - } - } - - // Add new bid on the listing - k.SetBid(ctx, types.NftBid{ - NftId: msg.NftId, - Bidder: msg.Sender.AccAddress().String(), - Amount: msg.Amount, - AutomaticPayment: msg.AutomaticPayment, - PaidAmount: paidAmount.Add(initialDeposit), - BidTime: ctx.BlockTime(), - }) - - // extend bid if there's bid within gap time - params := k.GetParamSet(ctx) - if listing.State == types.ListingState_LISTING { - listing.State = types.ListingState_BIDDING - } - gapTime := ctx.BlockTime().Add(time.Duration(params.NftListingGapTime) * time.Second) - if listing.EndAt.Before(gapTime) { - listing.EndAt = gapTime - } - k.SaveNftListing(ctx, listing) - - // Emit event for placing bid - ctx.EventManager().EmitTypedEvent(&types.EventPlaceBid{ - Bidder: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - Amount: msg.Amount.String(), - }) - - return nil -} - -func higherBids(bids []types.NftBid, amount sdk.Int) uint64 { - higherBids := uint64(0) - for _, bid := range bids { - if bid.Amount.Amount.GTE(amount) { - higherBids++ - } - } - return higherBids -} - -func (k Keeper) SafeCloseBid(ctx sdk.Context, bid types.NftBid) error { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - - // Delete bid - k.DeleteBid(ctx, bid) - - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(bid.Amount.Denom, bid.PaidAmount)}) -} - -func (k Keeper) CancelBid(ctx sdk.Context, msg *types.MsgCancelBid) error { - // Verify listing is in BIDDING state - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return err - } - - bidder := msg.Sender.AccAddress() - - // check if bid exists by bidder on nft - bid, err := k.GetBid(ctx, msg.NftId.IdBytes(), bidder) - if err != nil { - return types.ErrBidDoesNotExists - } - - // bids can only be cancelled X days after bidding - params := k.GetParamSet(ctx) - if bid.BidTime.Add(time.Duration(params.BidCancelRequiredSeconds) * time.Second).After(ctx.BlockTime()) { - return types.ErrBidCancelIsAllowedAfterSomeTime - } - - bids := k.GetBidsByNft(ctx, msg.NftId.IdBytes()) - if len(bids) == 1 { - return types.ErrCannotCancelListingSingleBid - } - - cancelFee := sdk.ZeroInt() - if higherBids(bids, bid.Amount.Amount) <= listing.BidActiveRank { - // Cancellation Fee Formula: MAX{canceling_bidder's_deposit - (total_deposit - borrowed_lister_amount), 0} - listingDebt := k.GetDebtByNft(ctx, msg.NftId.IdBytes()) - totalDeposit := sdk.ZeroInt() - for _, b := range bids { - totalDeposit = totalDeposit.Add(b.PaidAmount) - } - - loanAmount := sdk.ZeroInt() - if listingDebt.NftId.NftId != "" { - loanAmount = listingDebt.Loan.Amount - } - if bid.PaidAmount.Add(loanAmount).GT(totalDeposit) { - cancelFee = bid.PaidAmount.Add(loanAmount).Sub(totalDeposit) - } - } - - // Delete bid - k.DeleteBid(ctx, bid) - - // tokens will be reimbursed X days after the bid cancellation is approved - bid.BidTime = ctx.BlockTime().Add(time.Duration(params.BidTokenDisburseSecondsAfterCancel) * time.Second) - bid.PaidAmount = bid.PaidAmount.Sub(cancelFee) - k.SetCancelledBid(ctx, bid) - - // TODO: Liquidation may occur for sellers whose bids are cancelled. - - // Emit event for cancelling bid - ctx.EventManager().EmitTypedEvent(&types.EventCancelBid{ - Bidder: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) PayFullBid(ctx sdk.Context, msg *types.MsgPayFullBid) error { - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return err - } - - bidder := msg.Sender.AccAddress() - - // check if bid exists by bidder on nft - bid, err := k.GetBid(ctx, msg.NftId.IdBytes(), bidder) - if err != nil { - return types.ErrBidDoesNotExists - } - - // Transfer unpaid amount of token from bid account - unpaidAmount := bid.Amount.Amount.Sub(bid.PaidAmount) - if unpaidAmount.IsPositive() { - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.Coins{sdk.NewCoin(listing.BidToken, unpaidAmount)}) - if err != nil { - return err - } - - bid.PaidAmount = bid.Amount.Amount - k.SetBid(ctx, bid) - } - // Emit event for paying full bid - ctx.EventManager().EmitTypedEvent(&types.EventPayFullBid{ - Bidder: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) HandleMaturedCancelledBids(ctx sdk.Context) error { - bids := k.GetMaturedCancelledBids(ctx, ctx.BlockTime()) - for _, bid := range bids { - // transfer amount of token except fee to bid account - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(bid.Amount.Denom, bid.PaidAmount)}) - if err != nil { - return err - } - k.DeleteCancelledBid(ctx, bid) - } - - return nil -} diff --git a/deprecated/x/nftmarketv1/keeper/bid_test.go b/deprecated/x/nftmarketv1/keeper/bid_test.go deleted file mode 100644 index d3986e37c..000000000 --- a/deprecated/x/nftmarketv1/keeper/bid_test.go +++ /dev/null @@ -1,944 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" -// nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - -// ununifitypes "github.com/UnUniFi/chain/deprecated/types" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -// ) - -// // test basic functions of bids on nft bids -// func (suite *KeeperTestSuite) TestNftBidBasics() { -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// bids := []types.NftBid{ -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner2.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "2", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// } - -// for _, bid := range bids { -// suite.app.NftmarketKeeper.SetBid(suite.ctx, bid) -// } - -// for _, bid := range bids { -// bidder, err := sdk.AccAddressFromBech32(bid.Bidder) -// suite.Require().NoError(err) -// gotBid, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, bid.NftId.IdBytes(), bidder) -// suite.Require().NoError(err) -// suite.Require().Equal(bid, gotBid) -// } - -// // check all bids -// allBids := suite.app.NftmarketKeeper.GetAllBids(suite.ctx) -// suite.Require().Len(allBids, len(bids)) - -// // check bids by bidder -// bidsByOwner := suite.app.NftmarketKeeper.GetBidsByBidder(suite.ctx, owner) -// suite.Require().Len(bidsByOwner, 2) - -// // check bids by nft -// nftBids := suite.app.NftmarketKeeper.GetBidsByNft(suite.ctx, (types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }).IdBytes()) -// suite.Require().Len(nftBids, 2) - -// // delete all the bids -// for _, bid := range bids { -// suite.app.NftmarketKeeper.DeleteBid(suite.ctx, bid) -// } - -// // check all bids -// allBids = suite.app.NftmarketKeeper.GetAllBids(suite.ctx) -// suite.Require().Len(allBids, 0) - -// // check bids by bidder -// bidsByOwner = suite.app.NftmarketKeeper.GetBidsByBidder(suite.ctx, owner) -// suite.Require().Len(bidsByOwner, 0) - -// // check bids by nft -// nftBids = suite.app.NftmarketKeeper.GetBidsByNft(suite.ctx, (types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }).IdBytes()) -// suite.Require().Len(nftBids, 0) -// } - -// func (suite *KeeperTestSuite) TestCancelledBid() { -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// cancelledBids := []types.NftBid{ -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner2.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "2", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now.Add(time.Second), -// }, -// } - -// for _, bid := range cancelledBids { -// suite.app.NftmarketKeeper.SetCancelledBid(suite.ctx, bid) -// } - -// // check all cancelled bids -// allCancelledBids := suite.app.NftmarketKeeper.GetAllCancelledBids(suite.ctx) -// suite.Require().Len(allCancelledBids, len(cancelledBids)) - -// // check matured cancelled bids -// maturedCancelledBids := suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now.Add(time.Second)) -// suite.Require().Len(maturedCancelledBids, 2) - -// // check normal bids -// allBids := suite.app.NftmarketKeeper.GetAllBids(suite.ctx) -// suite.Require().Len(allBids, 0) - -// // delete all cancelled bids -// for _, bid := range cancelledBids { -// suite.app.NftmarketKeeper.DeleteCancelledBid(suite.ctx, bid) -// } - -// // check all cancelled bids -// allCancelledBids = suite.app.NftmarketKeeper.GetAllCancelledBids(suite.ctx) -// suite.Require().Len(allCancelledBids, 0) - -// // check matured cancelled bids -// maturedCancelledBids = suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now) -// suite.Require().Len(maturedCancelledBids, 0) -// } - -// func (suite *KeeperTestSuite) TestSafeCloseBid() { -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// bids := []types.NftBid{ -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// } - -// for _, bid := range bids { -// suite.app.NftmarketKeeper.SetBid(suite.ctx, bid) -// } - -// // try safe close of bids when module account does not have enough balance -// for _, bid := range bids { -// cacheCtx, _ := suite.ctx.CacheContext() -// err := suite.app.NftmarketKeeper.SafeCloseBid(cacheCtx, bid) -// suite.Require().Error(err) -// } - -// // allocate tokens to the module -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) - -// // try safe close of bids when module account has enough balance -// for _, bid := range bids { -// cacheCtx, _ := suite.ctx.CacheContext() -// err := suite.app.NftmarketKeeper.SafeCloseBid(cacheCtx, bid) -// suite.Require().NoError(err) - -// // check tokens are received -// balance := suite.app.BankKeeper.GetBalance(cacheCtx, owner, "uguu") -// suite.Require().True(balance.IsPositive()) -// } -// } - -// func (suite *KeeperTestSuite) TestTotalActiveRankDeposit() { -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// owner3 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// classId := "1" -// nftId := "1" -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: classId, -// Name: classId, -// Symbol: classId, -// Description: classId, -// Uri: classId, -// }) -// err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: classId, -// Id: nftId, -// Uri: nftId, -// UriHash: nftId, -// }, owner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} -// err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(owner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) - -// now := time.Now().UTC() -// bids := []types.NftBid{ -// { -// NftId: nftIdentifier, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: nftIdentifier, -// Bidder: owner2.String(), -// Amount: sdk.NewInt64Coin("uguu", 2000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1500000), -// BidTime: now, -// }, -// { -// NftId: nftIdentifier, -// Bidder: owner3.String(), -// Amount: sdk.NewInt64Coin("uguu", 3000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(2000000), -// BidTime: now, -// }, -// } - -// for _, bid := range bids { -// suite.app.NftmarketKeeper.SetBid(suite.ctx, bid) -// } - -// // check total active rank deposit -// activeRankDeposit := suite.app.NftmarketKeeper.TotalActiveRankDeposit(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Equal(activeRankDeposit, sdk.NewInt(3500000)) -// } - -// func (suite *KeeperTestSuite) TestPlaceBid() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// bidder sdk.AccAddress -// prevBids int -// originAmount sdk.Coin -// amount sdk.Coin -// listBefore bool -// endedListing bool -// expectPass bool -// }{ -// { -// testCase: "bid on not listed nft", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 10000000), -// listBefore: false, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "already ended listing", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 10000000), -// listBefore: true, -// endedListing: true, -// expectPass: false, -// }, -// { -// testCase: "invalid denom bid", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("xxxx", 10000000), -// listBefore: true, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "lower than min bid", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 1), -// listBefore: true, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "successful bid increase case when original bid exists", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 1000000), -// amount: sdk.NewInt64Coin("uguu", 2000000), -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// { -// testCase: "successful bid when only lower bids exists", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 2, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 20000000), -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// { -// testCase: "successful bid when no bids exists case", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 20000000), -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.NewInt(10), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// for i := 0; i < tc.prevBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.originAmount.IsPositive() { -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.originAmount}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.bidder, sdk.Coins{tc.originAmount}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: tc.originAmount, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.endedListing { -// err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } - -// // mint coins to the bidder -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.amount}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.bidder, sdk.Coins{tc.amount}) -// suite.NoError(err) - -// oldBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") -// err = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(tc.bidder), -// NftId: nftIdentifier, -// Amount: tc.amount, -// AutomaticPayment: false, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // check bidder balance reduction -// bidderNewBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") -// suite.Require().True(bidderNewBalance.Amount.LT(oldBidderBalance.Amount)) - -// // check bid paid amount -// suite.Require().Equal(bidderNewBalance.Amount.Add(tc.amount.Amount.Sub(tc.originAmount.Amount).Quo(sdk.NewInt(2))), oldBidderBalance.Amount) - -// // check if nft listing status is BIDDING -// listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_BIDDING) - -// // check listing update when it is within gas time -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) -// suite.Require().True(listing.EndAt.After(suite.ctx.BlockTime().Add(time.Duration(params.NftListingGapTime) * time.Second))) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// func (suite *KeeperTestSuite) TestCancelBid() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// bidder sdk.AccAddress -// prevBids int -// bidAmount sdk.Coin -// listBefore bool -// cancelAfter time.Duration -// loanAmount sdk.Coin -// expectPass bool -// expectCancelFee bool -// }{ -// { -// testCase: "bid on not listed nft", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// bidAmount: sdk.NewInt64Coin("uguu", 0), -// listBefore: false, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// expectPass: false, -// expectCancelFee: false, -// }, -// { -// testCase: "did not bid previously", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 1, -// bidAmount: sdk.NewInt64Coin("uguu", 0), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// expectPass: false, -// expectCancelFee: false, -// }, -// { -// testCase: "cancelling just after bid", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 1, -// bidAmount: sdk.NewInt64Coin("uguu", 10000000), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// cancelAfter: 0, -// expectPass: false, -// expectCancelFee: false, -// }, -// { -// testCase: "cancel single bid case", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 0, -// bidAmount: sdk.NewInt64Coin("uguu", 10000000), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// expectPass: false, -// expectCancelFee: false, -// }, -// { -// testCase: "successful bid cancel on active rank with loan with cancel fee", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 2, -// bidAmount: sdk.NewInt64Coin("uguu", 100000000), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 10000000), -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// expectPass: true, -// expectCancelFee: true, -// }, -// { -// testCase: "successful bid cancel on active rank without loan without cancel fee", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 2, -// bidAmount: sdk.NewInt64Coin("uguu", 100000000), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// expectPass: true, -// expectCancelFee: false, -// }, -// { -// testCase: "successful bid cancel on not active rank", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// prevBids: 2, -// bidAmount: sdk.NewInt64Coin("uguu", 1000), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// expectPass: true, -// expectCancelFee: false, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.NewInt(10), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// for i := 0; i < tc.prevBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.bidAmount.IsPositive() { -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.bidAmount}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.bidder, sdk.Coins{tc.bidAmount}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: tc.bidAmount, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// originBid, _ := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), tc.bidder) - -// if tc.loanAmount.IsPositive() { -// suite.app.NftmarketKeeper.SetDebt(suite.ctx, types.Loan{ -// NftId: nftIdentifier, -// Loan: tc.loanAmount, -// }) -// } -// suite.ctx = suite.ctx.WithBlockTime(now.Add(tc.cancelAfter)) -// err = suite.app.NftmarketKeeper.CancelBid(suite.ctx, &types.MsgCancelBid{ -// Sender: ununifitypes.StringAccAddress(tc.bidder), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // bid removal check -// _, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), tc.bidder) -// suite.Require().Error(err) - -// // cancelled bid creation check -// cancelledBids := suite.app.NftmarketKeeper.GetAllCancelledBids(suite.ctx) -// suite.Require().Len(cancelledBids, 1) - -// // cancelled bid delievery time check -// suite.Require().Equal(cancelledBids[0].BidTime, suite.ctx.BlockTime().Add(time.Duration(params.BidTokenDisburseSecondsAfterCancel)*time.Second)) - -// // cancel fee check if in active rank -// if tc.expectCancelFee { -// suite.Require().True(cancelledBids[0].PaidAmount.LT(originBid.PaidAmount)) -// } else { -// suite.Require().True(cancelledBids[0].PaidAmount.Equal(originBid.PaidAmount)) -// } -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// func (suite *KeeperTestSuite) TestPayFullBid() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// bidder sdk.AccAddress -// bidAmount sdk.Coin -// listBefore bool -// loanAmount sdk.Coin -// expectPass bool -// expectCancelFee bool -// }{ -// { -// testCase: "bid on not listed nft", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// bidder: bidder, -// bidAmount: sdk.NewInt64Coin("uguu", 0), -// listBefore: false, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// expectPass: false, -// expectCancelFee: false, -// }, -// { -// testCase: "did not bid previously", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// bidder: bidder, -// bidAmount: sdk.NewInt64Coin("uguu", 0), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 0), -// expectPass: false, -// expectCancelFee: false, -// }, -// { -// testCase: "successful full pay", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// bidder: bidder, -// bidAmount: sdk.NewInt64Coin("uguu", 100000000), -// listBefore: true, -// loanAmount: sdk.NewInt64Coin("uguu", 10000000), -// expectPass: true, -// expectCancelFee: true, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.NewInt(10), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// if tc.bidAmount.IsPositive() { -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.bidAmount}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.bidder, sdk.Coins{tc.bidAmount}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: tc.bidAmount, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// oldBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") - -// err = suite.app.NftmarketKeeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ -// Sender: ununifitypes.StringAccAddress(tc.bidder), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // check balance changes after execution -// newBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") -// suite.Require().True(newBidderBalance.Amount.LT(oldBidderBalance.Amount)) - -// // check paid amount changes after execution -// bid, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), tc.bidder) -// suite.Require().NoError(err) -// suite.Require().Equal(bid.Amount.Amount, bid.PaidAmount) - -// // re-execute full pay -// err = suite.app.NftmarketKeeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ -// Sender: ununifitypes.StringAccAddress(tc.bidder), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) - -// // check balance after reexecution -// new2BidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") -// suite.Require().True(newBidderBalance.Amount.Equal(new2BidderBalance.Amount)) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// func (suite *KeeperTestSuite) TestHandleMaturedCancelledBids() { -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// cancelledBids := []types.NftBid{ -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Bidder: owner2.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "2", -// }, -// Bidder: owner.String(), -// Amount: sdk.NewInt64Coin("uguu", 1000000), -// AutomaticPayment: true, -// PaidAmount: sdk.NewInt(1000000), -// BidTime: now.Add(time.Second), -// }, -// } - -// for _, bid := range cancelledBids { -// suite.app.NftmarketKeeper.SetCancelledBid(suite.ctx, bid) -// } - -// // check matured cancelled bids -// maturedCancelledBids := suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now.Add(time.Second)) -// suite.Require().Len(maturedCancelledBids, 2) - -// // allocate tokens to the module -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) - -// // execute matured cancelled bids -// err = suite.app.NftmarketKeeper.HandleMaturedCancelledBids(suite.ctx) -// suite.Require().NoError(err) - -// // check matured cancelled bids after handle -// maturedCancelledBids = suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now.Add(time.Second)) -// suite.Require().Len(maturedCancelledBids, 0) -// } diff --git a/deprecated/x/nftmarketv1/keeper/grpc_query.go b/deprecated/x/nftmarketv1/keeper/grpc_query.go deleted file mode 100644 index 6c9918167..000000000 --- a/deprecated/x/nftmarketv1/keeper/grpc_query.go +++ /dev/null @@ -1,300 +0,0 @@ -package keeper - -import ( - "context" - "sort" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryParamsResponse{ - Params: k.GetParamSet(ctx), - }, nil -} - -func (k Keeper) NftListing(c context.Context, req *types.QueryNftListingRequest) (*types.QueryNftListingResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - listing, err := k.GetNftListingByIdBytes(ctx, types.NftBytes(req.ClassId, req.NftId)) - if err != nil { - return nil, err - } - - return &types.QueryNftListingResponse{ - Listing: listing, - }, nil -} - -func (k Keeper) ListedNfts(c context.Context, req *types.QueryListedNftsRequest) (*types.QueryListedNftsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - if req.Owner != "" { - acc, err := sdk.AccAddressFromBech32(req.Owner) - if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid request. address wrong") - } - return k.ListedNftsByOwner(ctx, acc) - } else { - listings := k.GetAllNftListings(ctx) - return &types.QueryListedNftsResponse{ - Listings: listings, - }, nil - } - -} - -func (k Keeper) ListedNftsByOwner(c context.Context, address sdk.AccAddress) (*types.QueryListedNftsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - listings := k.GetListingsByOwner(ctx, address) - return &types.QueryListedNftsResponse{ - Listings: listings, - }, nil -} - -// todo add pagenation -func (k Keeper) ListedClasses(c context.Context, req *types.QueryListedClassesRequest) (*types.QueryListedClassesResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - classes, err := k.GetListedClasses(ctx) - if err != nil { - return nil, err - } - - var limit int - if int(req.NftLimit) > 0 { - limit = int(req.NftLimit) - } else { - limit = 1 - } - var listedClasses []*types.QueryListedClassResponse - for _, v := range classes { - listedClass, err := k.GetListedClass(ctx, v.ClassId, limit) - if err != nil { - return nil, status.Error(codes.NotFound, "not found nft") - } - listedClasses = append(listedClasses, listedClass) - } - - return &types.QueryListedClassesResponse{ - Classes: listedClasses, - }, nil -} - -func (k Keeper) ListedClass(c context.Context, req *types.QueryListedClassRequest) (*types.QueryListedClassResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - - var limit int - if int(req.NftLimit) > 0 { - limit = int(req.NftLimit) - } else { - limit = 1 - } - listedClass, err := k.GetListedClass(ctx, req.ClassId, limit) - if err != nil { - return nil, err - } - - return listedClass, nil -} - -func (k Keeper) GetListedClass(ctx sdk.Context, classId string, limit int) (*types.QueryListedClassResponse, error) { - class, err := k.GetListedClassByClassIdBytes(ctx, types.ClassIdKey(classId)) - if err != nil { - return nil, err - } - classInfo, hasClass := k.nftKeeper.GetClass(ctx, class.ClassId) - if !hasClass { - return nil, status.Error(codes.NotFound, "not found class") - } - - var nfts []types.ListedNft - var pnfts []*types.ListedNft - for i, v := range class.NftIds { - if limit <= i { - break - } - nftInfo, hasNft := k.nftKeeper.GetNFT(ctx, class.ClassId, v) - if !hasNft { - return nil, status.Error(codes.NotFound, "not found nft") - } - nfts = append(nfts, types.ListedNft{Id: nftInfo.Id, Uri: nftInfo.Uri, UriHash: nftInfo.UriHash}) - } - - for i, _ := range nfts { - pnfts = append(pnfts, &nfts[i]) - } - - return &types.QueryListedClassResponse{ - ClassId: class.ClassId, - Name: classInfo.Name, - Description: classInfo.Description, - Symbol: classInfo.Symbol, - Uri: classInfo.Uri, - Urihash: classInfo.UriHash, - NftCount: uint64(len(class.NftIds)), - Nfts: pnfts, - }, nil -} - -func (k Keeper) Loans(c context.Context, req *types.QueryLoansRequest) (*types.QueryLoansResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryLoansResponse{ - Loans: k.GetAllDebts(ctx), - }, nil -} - -func (k Keeper) Loan(c context.Context, req *types.QueryLoanRequest) (*types.QueryLoanResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - nftId := types.NftIdentifier{ - ClassId: req.ClassId, - NftId: req.NftId, - } - ctx := sdk.UnwrapSDKContext(c) - nft, err := k.GetNftListingByIdBytes(ctx, nftId.IdBytes()) - if err != nil { - return &types.QueryLoanResponse{ - Loan: types.Loan{}, - BorrowingLimit: sdk.ZeroInt(), - }, nil - } - bids := k.GetBidsByNft(ctx, nftId.IdBytes()) - // Change the order of bids to descending order - sort.SliceStable(bids, func(i, j int) bool { - if bids[i].Amount.Amount.LT(bids[j].Amount.Amount) { - return false - } - if bids[i].Amount.Amount.GT(bids[j].Amount.Amount) { - return true - } - if bids[i].BidTime.After(bids[j].BidTime) { - return true - } - return false - }) - max := sdk.ZeroInt() - for i, v := range bids { - if i+1 > int(nft.BidActiveRank) { - break - } - max = max.Add(v.PaidAmount) - } - - return &types.QueryLoanResponse{ - Loan: k.GetDebtByNft(ctx, nftId.IdBytes()), - BorrowingLimit: max, - }, nil -} - -func (k Keeper) CDPsList(c context.Context, req *types.QueryCDPsListRequest) (*types.QueryCDPsListResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - _ = ctx - return &types.QueryCDPsListResponse{}, nil -} - -func (k Keeper) NftBids(c context.Context, req *types.QueryNftBidsRequest) (*types.QueryNftBidsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - bids := k.GetBidsByNft(ctx, types.NftBytes(req.ClassId, req.NftId)) - return &types.QueryNftBidsResponse{ - Bids: bids, - }, nil -} - -func (k Keeper) BidderBids(c context.Context, req *types.QueryBidderBidsRequest) (*types.QueryBidderBidsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - bids := k.GetBidsByBidder(ctx, sdk.AccAddress(sdk.MustAccAddressFromBech32(req.Bidder))) - return &types.QueryBidderBidsResponse{ - Bids: bids, - }, nil -} - -func (k Keeper) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - _ = ctx - return &types.QueryRewardsResponse{}, nil -} - -func (k Keeper) PaymentStatus(c context.Context, req *types.QueryPaymentStatusRequest) (*types.QueryPaymentStatusResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - nft := types.NftIdentifier{ - ClassId: req.ClassId, - NftId: req.NftId, - } - listing, err := k.GetNftListingByIdBytes(ctx, nft.IdBytes()) - if err != nil { - return &types.QueryPaymentStatusResponse{}, err - } - bids := k.GetBidsByNft(ctx, nft.IdBytes()) - if len(bids) == 0 { - return nil, status.Error(codes.InvalidArgument, "not existing bidder") - } - - var bidderBid types.NftBid - for _, v := range bids { - if v.Bidder == req.Bidder { - bidderBid = v - } - } - if (bidderBid == types.NftBid{}) { - return nil, status.Error(codes.InvalidArgument, "does not match bidder") - } - - allPaid := listing.State >= types.ListingState_END_LISTING && bidderBid.Amount.Amount.Equal(bidderBid.PaidAmount) - return &types.QueryPaymentStatusResponse{ - PaymentStatus: types.PaymentStatus{ - NftId: listing.NftId, - State: listing.State, - Bidder: bidderBid.Bidder, - Amount: bidderBid.Amount, - AutomaticPayment: bidderBid.AutomaticPayment, - PaidAmount: bidderBid.PaidAmount, - BidTime: bidderBid.BidTime, - AllPaid: allPaid, - }, - }, nil -} diff --git a/deprecated/x/nftmarketv1/keeper/grpc_query_test.go b/deprecated/x/nftmarketv1/keeper/grpc_query_test.go deleted file mode 100644 index 0279e45fd..000000000 --- a/deprecated/x/nftmarketv1/keeper/grpc_query_test.go +++ /dev/null @@ -1,444 +0,0 @@ -package keeper_test - -// import ( -// gocontext "context" -// "fmt" -// "testing" -// "time" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/stretchr/testify/require" -// "github.com/stretchr/testify/suite" - -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -// ) - -// func TestGRPCQuery(t *testing.T) { -// suite.Run(t, new(KeeperTestSuite)) -// } - -// func (s *KeeperTestSuite) TestListedNfts() { -// var req *types.QueryListedNftsRequest -// testCases := []struct { -// msg string -// malleate func(index int, require *require.Assertions) -// expError string -// listingNft []types.NftListing -// postTest func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) -// }{ -// { -// "success empty", -// func(index int, require *require.Assertions) { -// req = &types.QueryListedNftsRequest{} -// }, -// "", -// []types.NftListing(nil), -// func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) { -// require.Equal(res.Listings, expListingNft, "the error occurred on:%d", index) -// }, -// }, -// { -// "fail invalid Owner addr", -// func(index int, require *require.Assertions) { -// req = &types.QueryListedNftsRequest{ -// Owner: "owner", -// } -// }, -// "invalid request. address wrong", -// []types.NftListing{}, -// func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) { -// }, -// }, -// { -// "Success owner1", -// func(index int, require *require.Assertions) { -// s.TestListNft() -// req = &types.QueryListedNftsRequest{ -// Owner: s.addrs[0].String(), -// } -// }, -// "", -// []types.NftListing{ -// { -// NftId: types.NftIdentifier{ClassId: "class2", NftId: "nft2"}, -// Owner: s.addrs[0].String(), -// ListingType: 0, -// State: 0, -// BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 0x1, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0x0, -// }, -// { -// NftId: types.NftIdentifier{ClassId: "class5", NftId: "nft5"}, -// Owner: s.addrs[0].String(), -// ListingType: 0, State: 0, BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 1, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ClassId: "class6", NftId: "nft6"}, -// Owner: s.addrs[0].String(), -// ListingType: 0, State: 0, BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 100, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0, -// }, -// }, -// func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) { -// require.Equal(res.Listings, expListingNft, "the error occurred on:%d", index) -// }, -// }, -// { -// "Success owner2", -// func(index int, require *require.Assertions) { -// req = &types.QueryListedNftsRequest{ -// Owner: s.addrs[1].String(), -// } -// }, -// "", -// []types.NftListing{ -// { -// NftId: types.NftIdentifier{ClassId: "class7", NftId: "nft7"}, -// Owner: s.addrs[1].String(), -// ListingType: 0, State: 0, BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 1, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0, -// }, -// }, -// func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) { -// require.Equal(res.Listings, expListingNft, "the error occurred on:%d", index) -// }, -// }, -// { -// "Success all req", -// func(index int, require *require.Assertions) { -// req = &types.QueryListedNftsRequest{} -// }, -// "", -// []types.NftListing{ -// { -// NftId: types.NftIdentifier{ClassId: "class2", NftId: "nft2"}, -// Owner: s.addrs[0].String(), -// ListingType: 0, -// State: 0, -// BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 0x1, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0x0, -// }, -// { -// NftId: types.NftIdentifier{ClassId: "class5", NftId: "nft5"}, -// Owner: s.addrs[0].String(), -// ListingType: 0, State: 0, BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 1, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ClassId: "class6", NftId: "nft6"}, -// Owner: s.addrs[0].String(), -// ListingType: 0, State: 0, BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 100, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ClassId: "class7", NftId: "nft7"}, -// Owner: s.addrs[1].String(), -// ListingType: 0, State: 0, BidToken: "uguu", -// MinBid: sdk.NewInt(0), -// BidActiveRank: 1, -// StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// EndAt: time.Date(1, time.January, 1, 0, 1, 0, 0, time.UTC), -// FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), -// AutoRelistedCount: 0, -// }, -// }, -// func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) { -// require.Equal(res.Listings, expListingNft, "the error occurred on:%d", index) -// }, -// }, -// { -// "success empty owner", -// func(index int, require *require.Assertions) { -// req = &types.QueryListedNftsRequest{ -// Owner: s.addrs[2].String(), -// } -// }, -// "", -// []types.NftListing(nil), -// func(index int, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListing) { -// require.Equal(res.Listings, expListingNft, "the error occurred on:%d", index) -// }, -// }, -// } -// for index, tc := range testCases { -// s.Run(fmt.Sprintf("Case %s", tc.msg), func() { -// require := s.Require() -// tc.malleate(index, require) -// result, err := s.queryClient.ListedNfts(gocontext.Background(), req) -// if tc.expError == "" { -// require.NoError(err) -// } else { -// require.Error(err) -// require.Contains(err.Error(), tc.expError) -// } -// tc.postTest(index, require, result, tc.listingNft) -// }) -// } -// } - -// func (s *KeeperTestSuite) TestLoan() { -// testCases := []struct { -// msg string -// malleate func(index int, require *require.Assertions) -// req *types.QueryLoanRequest -// expError string -// expResult types.QueryLoanResponse -// }{ -// { -// "success empty", -// func(index int, require *require.Assertions) { -// }, -// &types.QueryLoanRequest{}, -// "", -// types.QueryLoanResponse{ -// Loan: types.Loan{ -// NftId: types.NftIdentifier{}, -// Loan: sdk.Coin{ -// Amount: sdk.NewInt(0), -// }, -// }, -// BorrowingLimit: sdk.ZeroInt(), -// }, -// }, -// { -// "fail invalid class id", -// func(index int, require *require.Assertions) { -// }, -// &types.QueryLoanRequest{ -// ClassId: "ddfdifd", -// NftId: "a10", -// }, -// "", -// types.QueryLoanResponse{ -// Loan: types.Loan{ -// NftId: types.NftIdentifier{}, -// Loan: sdk.Coin{ -// Amount: sdk.NewInt(0), -// }, -// }, -// BorrowingLimit: sdk.ZeroInt(), -// }, -// }, -// { -// "Success", -// func(index int, require *require.Assertions) { -// s.TestBorrow() -// }, -// &types.QueryLoanRequest{ -// ClassId: "class5", -// NftId: "nft5", -// }, -// "", -// types.QueryLoanResponse{ -// Loan: types.Loan{ -// NftId: types.NftIdentifier{ -// ClassId: "class5", -// NftId: "nft5", -// }, -// Loan: sdk.Coin{ -// Denom: "uguu", -// Amount: sdk.NewInt(2000000), -// }, -// }, -// BorrowingLimit: sdk.NewInt(3500000), -// }, -// }, -// } -// for index, tc := range testCases { -// s.Run(fmt.Sprintf("Case %s", tc.msg), func() { -// require := s.Require() -// tc.malleate(index, require) -// result, err := s.queryClient.Loan(gocontext.Background(), tc.req) -// if tc.expError == "" { -// require.NoError(err) -// require.Equal(result, &tc.expResult, "the error occurred on:%d", index) -// } else { -// require.Error(err) -// require.Contains(err.Error(), tc.expError) -// } -// }) -// } -// } - -// func (s *KeeperTestSuite) TestClasses() { -// testCases := []struct { -// msg string -// malleate func(index int, require *require.Assertions) -// req *types.QueryListedClassesRequest -// expError string -// expResult types.QueryListedClassesResponse -// }{ -// { -// "success empty", -// func(index int, require *require.Assertions) { -// }, -// &types.QueryListedClassesRequest{}, -// "", -// types.QueryListedClassesResponse{ -// Classes: []*types.QueryListedClassResponse(nil), -// }, -// }, -// { -// "Success list nft", -// func(index int, require *require.Assertions) { -// s.TestListNft() -// }, -// &types.QueryListedClassesRequest{}, -// "", -// types.QueryListedClassesResponse{ -// Classes: []*types.QueryListedClassResponse{ -// { -// ClassId: "class2", -// Name: "class2", -// Description: "class2", -// Symbol: "class2", -// Uri: "class2", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft2", -// Uri: "nft2", -// UriHash: "nft2", -// }, -// }, -// NftCount: 1, -// }, -// { -// ClassId: "class5", -// Name: "class5", -// Description: "class5", -// Symbol: "class5", -// Uri: "class5", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft5", -// Uri: "nft5", -// UriHash: "nft5", -// }, -// }, -// NftCount: 1, -// }, -// { -// ClassId: "class6", -// Name: "class6", -// Description: "class6", -// Symbol: "class6", -// Uri: "class6", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft6", -// Uri: "nft6", -// UriHash: "nft6", -// }, -// }, -// NftCount: 1, -// }, -// { -// ClassId: "class7", -// Name: "class7", -// Description: "class7", -// Symbol: "class7", -// Uri: "class7", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft7", -// Uri: "nft7", -// UriHash: "nft7", -// }, -// }, -// NftCount: 1, -// }, -// }, -// }, -// }, -// { -// "Success plaace bid", -// func(index int, require *require.Assertions) { -// s.TestPlaceBid() -// }, -// &types.QueryListedClassesRequest{}, -// "", -// types.QueryListedClassesResponse{ -// Classes: []*types.QueryListedClassResponse{ -// { -// ClassId: "class5", -// Name: "class5", -// Description: "class5", -// Symbol: "class5", -// Uri: "class5", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft5", -// Uri: "nft5", -// UriHash: "nft5", -// }, -// }, -// NftCount: 1, -// }, -// }, -// }, -// }, -// } -// for index, tc := range testCases { -// s.Run(fmt.Sprintf("Case %s", tc.msg), func() { -// require := s.Require() -// tc.malleate(index, require) -// result, err := s.queryClient.ListedClasses(gocontext.Background(), tc.req) -// if tc.expError == "" { -// require.NoError(err) -// require.Equal(result, &tc.expResult, "the error occurred on:%d", index) -// } else { -// require.Error(err) -// require.Contains(err.Error(), tc.expError) -// } -// }) -// } -// } diff --git a/deprecated/x/nftmarketv1/keeper/hooks.go b/deprecated/x/nftmarketv1/keeper/hooks.go deleted file mode 100644 index 17e8ae8b9..000000000 --- a/deprecated/x/nftmarketv1/keeper/hooks.go +++ /dev/null @@ -1,27 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -var _ types.NftmarketHooks = Keeper{} - -func (k Keeper) AfterNftListed(ctx sdk.Context, nftIdentifier types.NftIdentifier, txMemo string) { - if k.hooks != nil { - k.hooks.AfterNftListed(ctx, nftIdentifier, txMemo) - } -} - -func (k Keeper) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier types.NftIdentifier, fee sdk.Coin) { - if k.hooks != nil { - k.hooks.AfterNftPaymentWithCommission(ctx, nftIdentifier, fee) - } -} - -func (k Keeper) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier types.NftIdentifier) { - if k.hooks != nil { - k.hooks.AfterNftUnlistedWithoutPayment(ctx, nftIdentifier) - } -} diff --git a/deprecated/x/nftmarketv1/keeper/hooks_test.go b/deprecated/x/nftmarketv1/keeper/hooks_test.go deleted file mode 100644 index 433ce937b..000000000 --- a/deprecated/x/nftmarketv1/keeper/hooks_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -var statusAfterNftListed bool -var statusAfterNftPaymentWithCommission bool -var statusAfterNftUnlistedWithoutPayment bool - -type dummyNftmarketHook struct{} - -func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftIdentifier, txMemo string) { - statusAfterNftListed = true -} - -func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, nftId types.NftIdentifier, fee sdk.Coin) { - statusAfterNftPaymentWithCommission = true -} - -func (hook *dummyNftmarketHook) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftId types.NftIdentifier) { - statusAfterNftUnlistedWithoutPayment = true -} diff --git a/deprecated/x/nftmarketv1/keeper/keeper.go b/deprecated/x/nftmarketv1/keeper/keeper.go deleted file mode 100644 index c385a7ac9..000000000 --- a/deprecated/x/nftmarketv1/keeper/keeper.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -type Keeper struct { - cdc codec.Codec - txCfg client.TxConfig - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramSpace paramtypes.Subspace - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - nftKeeper types.NftKeeper - hooks types.NftmarketHooks -} - -func NewKeeper(cdc codec.Codec, txCfg client.TxConfig, storeKey, - memKey storetypes.StoreKey, paramSpace paramtypes.Subspace, - accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, - nftKeeper types.NftKeeper) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - txCfg: txCfg, - storeKey: storeKey, - memKey: memKey, - paramSpace: paramSpace, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - nftKeeper: nftKeeper, - hooks: nil, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// SetHooks sets the nftmarket keeper hooks -func (k *Keeper) SetHooks(hooks types.NftmarketHooks) *Keeper { - if k.hooks != nil { - panic("cannot set validator hooks twice") - } - k.hooks = hooks - return k -} diff --git a/deprecated/x/nftmarketv1/keeper/keeper_test.go b/deprecated/x/nftmarketv1/keeper/keeper_test.go deleted file mode 100644 index 0007e2dbd..000000000 --- a/deprecated/x/nftmarketv1/keeper/keeper_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package keeper_test - -// import ( -// "testing" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/stretchr/testify/suite" - -// "github.com/cosmos/cosmos-sdk/baseapp" -// distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - -// authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" -// banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" -// "github.com/cosmos/cosmos-sdk/x/nft" -// nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" - -// simapp "github.com/UnUniFi/chain/app" -// appparams "github.com/UnUniFi/chain/app/params" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/keeper" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -// ) - -// var ( -// maccPerms = map[string][]string{ -// authtypes.FeeCollectorName: nil, -// distrtypes.ModuleName: nil, -// minttypes.ModuleName: {authtypes.Minter}, -// nft.ModuleName: nil, -// types.ModuleName: nil, -// // types.NftTradingFee: nil, -// } -// ) - -// type KeeperTestSuite struct { -// suite.Suite - -// ctx sdk.Context -// app *simapp.App -// addrs []sdk.AccAddress -// queryClient types.QueryClient -// keeper keeper.Keeper -// nftKeeper nftkeeper.Keeper -// } - -// func (suite *KeeperTestSuite) SetupTest() { -// isCheckTx := false - -// app := simapp.Setup(suite.T(), isCheckTx) - -// suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) -// suite.addrs = simapp.AddTestAddrsIncremental(app, suite.ctx, 3, sdk.NewInt(30000000)) -// suite.app = app -// queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry()) -// types.RegisterQueryServer(queryHelper, app.NftmarketKeeper) -// suite.queryClient = types.NewQueryClient(queryHelper) - -// encodingConfig := appparams.MakeEncodingConfig() -// appCodec := encodingConfig.Marshaler - -// txCfg := encodingConfig.TxConfig -// accountKeeper := authkeeper.NewAccountKeeper( -// appCodec, app.GetKey(authtypes.StoreKey), app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, -// ) -// bankKeeper := bankkeeper.NewBaseKeeper( -// appCodec, -// app.GetKey(banktypes.StoreKey), -// app.AccountKeeper, -// app.GetSubspace(banktypes.ModuleName), -// app.BlockedAddrs(), -// ) -// nftKeeper := nftkeeper.NewKeeper(app.GetKey(nft.StoreKey), appCodec, accountKeeper, bankKeeper) -// keeper := keeper.NewKeeper(appCodec, txCfg, app.GetKey(types.StoreKey), app.GetKey(types.MemStoreKey), suite.app.GetSubspace(types.ModuleName), accountKeeper, bankKeeper, nftKeeper) -// hooks := dummyNftmarketHook{} -// keeper.SetHooks(&hooks) -// suite.nftKeeper = nftKeeper -// suite.keeper = keeper -// } -// func TestKeeperSuite(t *testing.T) { -// suite.Run(t, new(KeeperTestSuite)) -// } diff --git a/deprecated/x/nftmarketv1/keeper/loan.go b/deprecated/x/nftmarketv1/keeper/loan.go deleted file mode 100644 index 20cf5de3e..000000000 --- a/deprecated/x/nftmarketv1/keeper/loan.go +++ /dev/null @@ -1,182 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -func (k Keeper) GetDebtByNft(ctx sdk.Context, nftIdBytes []byte) types.Loan { - loan := types.Loan{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.NftLoanKey(nftIdBytes)) - if bz == nil { - return loan - } - - k.cdc.MustUnmarshal(bz, &loan) - return loan -} - -func (k Keeper) GetAllDebts(ctx sdk.Context) []types.Loan { - store := ctx.KVStore(k.storeKey) - - loans := []types.Loan{} - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftLoan)) - defer it.Close() - - for ; it.Valid(); it.Next() { - loan := types.Loan{} - k.cdc.MustUnmarshal(it.Value(), &loan) - - loans = append(loans, loan) - } - return loans -} - -func (k Keeper) SetDebt(ctx sdk.Context, loan types.Loan) { - bz := k.cdc.MustMarshal(&loan) - store := ctx.KVStore(k.storeKey) - store.Set(types.NftLoanKey(loan.NftId.IdBytes()), bz) -} - -func (k Keeper) DeleteDebt(ctx sdk.Context, nftBytes []byte) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.NftLoanKey(nftBytes)) -} - -// remove debt (loan) from KVStore by using DeleteDebt method with the feature -// to judge if it exists before calling it -func (k Keeper) RemoveDebt(ctx sdk.Context, nftBytes []byte) { - loan := k.GetDebtByNft(ctx, nftBytes) - if !loan.Loan.Amount.IsNil() { - k.DeleteDebt(ctx, nftBytes) - } -} - -func (k Keeper) IncreaseDebt(ctx sdk.Context, nftId types.NftIdentifier, amount sdk.Coin) { - currDebt := k.GetDebtByNft(ctx, nftId.IdBytes()) - if sdk.Coin.IsNil(currDebt.Loan) { - currDebt.NftId = nftId - currDebt.Loan = amount - } else { - currDebt.Loan = currDebt.Loan.Add(amount) - } - k.SetDebt(ctx, currDebt) -} - -func (k Keeper) DecreaseDebt(ctx sdk.Context, nftId types.NftIdentifier, amount sdk.Coin) { - currDebt := k.GetDebtByNft(ctx, nftId.IdBytes()) - currDebt.Loan = currDebt.Loan.Sub(amount) - k.SetDebt(ctx, currDebt) -} - -func (k Keeper) Borrow(ctx sdk.Context, msg *types.MsgBorrow) error { - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return err - } - - // check listing token == msg.Amount.Denom - if listing.BidToken != msg.Amount.Denom { - return types.ErrInvalidBorrowDenom - } - - if listing.Owner != msg.Sender.AccAddress().String() { - return types.ErrNotNftListingOwner - } - - // calculate maximum borrow amount for the listing - maxDebt := k.TotalActiveRankDeposit(ctx, msg.NftId.IdBytes()) - - currDebt := k.GetDebtByNft(ctx, msg.NftId.IdBytes()) - if !sdk.Coin.IsNil(currDebt.Loan) && msg.Amount.Add(currDebt.Loan).Amount.GT(maxDebt) { - return types.ErrDebtExceedsMaxDebt - } - - k.IncreaseDebt(ctx, msg.NftId, msg.Amount) - - sender := msg.Sender.AccAddress() - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, sdk.Coins{msg.Amount}) - if err != nil { - return err - } - - // Emit event for paying full bid - ctx.EventManager().EmitTypedEvent(&types.EventBorrow{ - Borrower: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - Amount: msg.Amount.String(), - }) - - return nil -} - -func (k Keeper) Repay(ctx sdk.Context, msg *types.MsgRepay) error { - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return err - } - - if listing.Owner != msg.Sender.AccAddress().String() { - return types.ErrNotNftListingOwner - } - - // check listing token == msg.Amount.Denom - if listing.BidToken != msg.Amount.Denom { - return types.ErrInvalidRepayDenom - } - - currDebt := k.GetDebtByNft(ctx, msg.NftId.IdBytes()) - - // return err if borrowing didn't happen once before - if currDebt.Loan.IsNil() { - return types.ErrNotBorrowed - } - - if msg.Amount.Amount.GT(currDebt.Loan.Amount) { - return types.ErrRepayAmountExceedsLoanAmount - } - - k.DecreaseDebt(ctx, msg.NftId, msg.Amount) - - sender := msg.Sender.AccAddress() - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.Coins{msg.Amount}) - if err != nil { - return err - } - - // Emit event for paying full bid - ctx.EventManager().EmitTypedEvent(&types.EventRepay{ - Repayer: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - Amount: msg.Amount.String(), - }) - - return nil -} - -func (k Keeper) Liquidate(ctx sdk.Context, msg *types.MsgLiquidate) error { - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return err - } - - if listing.State != types.ListingState_LIQUIDATION { - return types.ErrNftListingNotInLiquidation - } - - // TODO: handle nft sending - // TODO: handle token flow - - // Emit event for liquidation - ctx.EventManager().EmitTypedEvent(&types.EventLiquidate{ - Liquidator: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} diff --git a/deprecated/x/nftmarketv1/keeper/loan_test.go b/deprecated/x/nftmarketv1/keeper/loan_test.go deleted file mode 100644 index 3d1ab05f7..000000000 --- a/deprecated/x/nftmarketv1/keeper/loan_test.go +++ /dev/null @@ -1,589 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" -// nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - -// ununifitypes "github.com/UnUniFi/chain/deprecated/types" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -// ) - -// func (suite *KeeperTestSuite) TestDebtBasics() { -// debts := []types.Loan{ -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Loan: sdk.NewInt64Coin("uguu", 1000000), -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "2", -// }, -// Loan: sdk.NewInt64Coin("uguu", 1000000), -// }, -// } - -// for _, debt := range debts { -// suite.app.NftmarketKeeper.SetDebt(suite.ctx, debt) -// } - -// for _, debt := range debts { -// loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, debt.NftId.IdBytes()) -// suite.Require().Equal(loan, debt) -// } - -// // check all debts -// allDebts := suite.app.NftmarketKeeper.GetAllDebts(suite.ctx) -// suite.Require().Len(allDebts, len(debts)) - -// // delete all the debts -// for _, debt := range debts { -// suite.app.NftmarketKeeper.DeleteDebt(suite.ctx, debt.NftId.IdBytes()) -// } - -// // check all debts -// allDebts = suite.app.NftmarketKeeper.GetAllDebts(suite.ctx) -// suite.Require().Len(allDebts, 0) -// } - -// func (suite *KeeperTestSuite) TestIncreaseDecreaseDebt() { -// nftIdentifier := types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// } - -// loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Equal(loan.Loan, sdk.Coin{}) - -// suite.app.NftmarketKeeper.IncreaseDebt(suite.ctx, nftIdentifier, sdk.NewInt64Coin("uguu", 1000000)) -// loan = suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Equal(loan.Loan, sdk.NewInt64Coin("uguu", 1000000)) - -// suite.app.NftmarketKeeper.DecreaseDebt(suite.ctx, nftIdentifier, sdk.NewInt64Coin("uguu", 500000)) -// loan = suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Equal(loan.Loan, sdk.NewInt64Coin("uguu", 500000)) - -// suite.app.NftmarketKeeper.DecreaseDebt(suite.ctx, nftIdentifier, sdk.NewInt64Coin("uguu", 500000)) -// loan = suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Equal(loan.Loan, sdk.NewInt64Coin("uguu", 0)) -// } - -// func (suite *KeeperTestSuite) TestBorrow() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// borrower sdk.AccAddress -// prevBids int -// originAmount sdk.Coin -// amount sdk.Coin -// listBefore bool -// expectPass bool -// }{ -// { -// testCase: "borrow on not listed nft", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 0, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 10000000), -// listBefore: false, -// expectPass: false, -// }, -// { -// testCase: "borrow request by non owner", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// borrower: acc2, -// prevBids: 2, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 1), -// listBefore: true, -// expectPass: false, -// }, -// { -// testCase: "invalid borrow denom", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 2, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("xxxx", 10000000), -// listBefore: true, -// expectPass: false, -// }, -// { -// testCase: "more than max debt", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 1, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 1000000000), -// listBefore: true, -// expectPass: false, -// }, -// { -// testCase: "successful 1st time borrow", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 2, -// originAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 1000000), -// listBefore: true, -// expectPass: true, -// }, -// { -// testCase: "successful 2nd time borrow", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 4, -// originAmount: sdk.NewInt64Coin("uguu", 1000000), -// amount: sdk.NewInt64Coin("uguu", 1000000), -// listBefore: true, -// expectPass: true, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.NewInt(10), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// for i := 0; i < tc.prevBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.originAmount.IsPositive() { -// err := suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ -// Sender: ununifitypes.StringAccAddress(tc.borrower), -// NftId: nftIdentifier, -// Amount: tc.originAmount, -// }) -// suite.Require().NoError(err) -// } - -// oldBorrowerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") -// err = suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ -// Sender: ununifitypes.StringAccAddress(tc.borrower), -// NftId: nftIdentifier, -// Amount: tc.amount, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // check borrow balance increase -// borrowerNewBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") -// suite.Require().True(borrowerNewBalance.Amount.GT(oldBorrowerBalance.Amount)) - -// // check debt increase -// loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().True(loan.Loan.Amount.IsPositive()) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// func (suite *KeeperTestSuite) TestRepay() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// borrower sdk.AccAddress -// prevBids int -// borrowAmount sdk.Coin -// amount sdk.Coin -// listBefore bool -// expectPass bool -// }{ -// { -// testCase: "repay on not listed nft", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 0, -// borrowAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 10000000), -// listBefore: false, -// expectPass: false, -// }, -// { -// testCase: "repay request by non owner", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// borrower: acc2, -// prevBids: 2, -// borrowAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("uguu", 1), -// listBefore: true, -// expectPass: false, -// }, -// { -// testCase: "invalid repay denom", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 2, -// borrowAmount: sdk.NewInt64Coin("uguu", 0), -// amount: sdk.NewInt64Coin("xxxx", 10000000), -// listBefore: true, -// expectPass: false, -// }, -// { -// testCase: "repay more than debt", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 1, -// borrowAmount: sdk.NewInt64Coin("uguu", 100), -// amount: sdk.NewInt64Coin("uguu", 10000), -// listBefore: true, -// expectPass: false, -// }, -// { -// testCase: "successful full repay", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 2, -// borrowAmount: sdk.NewInt64Coin("uguu", 1000000), -// amount: sdk.NewInt64Coin("uguu", 1000000), -// listBefore: true, -// expectPass: true, -// }, -// { -// testCase: "successful partial repay", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// borrower: acc1, -// prevBids: 2, -// borrowAmount: sdk.NewInt64Coin("uguu", 1000000), -// amount: sdk.NewInt64Coin("uguu", 100000), -// listBefore: true, -// expectPass: true, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.NewInt(10), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// for i := 0; i < tc.prevBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.borrowAmount.IsPositive() { -// err := suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ -// Sender: ununifitypes.StringAccAddress(tc.borrower), -// NftId: nftIdentifier, -// Amount: tc.borrowAmount, -// }) -// suite.Require().NoError(err) -// } - -// oldRepayerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") -// err = suite.app.NftmarketKeeper.Repay(suite.ctx, &types.MsgRepay{ -// Sender: ununifitypes.StringAccAddress(tc.borrower), -// NftId: nftIdentifier, -// Amount: tc.amount, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// repayerNewBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") -// suite.Require().True(repayerNewBalance.Amount.LT(oldRepayerBalance.Amount)) - -// // check debt decrease -// loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().True(loan.Loan.Amount.Equal(tc.borrowAmount.Amount.Sub(tc.amount.Amount))) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// // TestLoanManagement is a test to see if the management of loan data is properly working. -// // Specifically, this tests loan situation in HandleFullPaymentPeriodEnding method. -// func (suite *KeeperTestSuite) TestLoanManagement() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) -// bidAmount := sdk.NewCoin("uguu", sdk.NewInt(100)) -// nftOwner := acc1 -// nftIdentifier := types.NftIdentifier{ClassId: "class1", NftId: "nft1"} - -// tests := []struct { -// testCase string -// listingState types.ListingState -// fullPay bool -// multiBid bool -// overBorrow bool -// }{ -// { -// testCase: "unit borrow in selling decision listing when highest bid is paid", -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: true, -// multiBid: false, -// }, // add successful listing state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status -// { -// testCase: "unit borrow in selling decision listing when highest bid is not paid and no more bids", -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: false, -// multiBid: false, -// }, // status => ListingState_LISTING -// // -// { -// testCase: "multi borrow in selling decision listing when highest bid is not paid, and more bids", -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: false, -// multiBid: true, -// overBorrow: true, -// }, // status => ListingState_BIDDING -// // loan data is removed since only one bid exists. -// { -// testCase: "multi borrow in selling decision listing when highest bid is not paid, and more bids", -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: false, -// multiBid: true, -// overBorrow: false, -// }, // status => ListingState_BIDDING -// // loan data is removed since only one bid exists. -// { -// testCase: "borrow in ended listing, when fully paid bid exists", -// listingState: types.ListingState_END_LISTING, -// fullPay: true, -// multiBid: false, -// }, // add successful bid state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status, close all the other bids -// // and loan data is just removed. -// { -// testCase: "borrow in ended listing, when fully paid bid does not exist", -// listingState: types.ListingState_END_LISTING, -// fullPay: false, -// multiBid: false, -// }, // all the bids closed, pay depositCollected, nft listing delete, transfer nft to fully paid bidder -// // and loan data is just removed. -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) -// _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{bidAmount}) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: nftIdentifier.ClassId, -// Name: nftIdentifier.ClassId, -// Symbol: nftIdentifier.ClassId, -// }) -// _ = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: nftIdentifier.ClassId, -// Id: nftIdentifier.NftId, -// }, nftOwner) - -// _ = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 10, -// }) -// listing, _ := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - -// if !tc.multiBid { -// suite.PlaceAndBorrow(bidAmount, nftIdentifier, nftOwner, tc.fullPay, 10) -// } else if tc.overBorrow { -// for i := 0; i < 2; i++ { -// suite.PlaceAndBorrow(bidAmount, nftIdentifier, nftOwner, tc.fullPay, 10) -// } -// } else { -// suite.PlaceAndBorrow(bidAmount, nftIdentifier, nftOwner, tc.fullPay, 10) -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) -// _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - -// _ = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: bidAmount, -// AutomaticPayment: true, -// }) -// } - -// listing.State = tc.listingState -// suite.app.NftmarketKeeper.SetNftListing(suite.ctx, listing) - -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) -// suite.app.NftmarketKeeper.HandleFullPaymentsPeriodEndings(suite.ctx) -// loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - -// switch tc.listingState { -// case types.ListingState_SELLING_DECISION: -// if tc.fullPay { -// // afte the fullpay, every loan must be removed -// suite.Require().Empty(loan.Loan) -// } else { -// if tc.multiBid && tc.overBorrow { -// suite.Require().Equal(bidAmount.Amount.QuoRaw(10), loan.Loan.Amount) -// } else { -// suite.Require().Empty(loan.Loan) -// } -// } -// case types.ListingState_END_LISTING: -// // under END_LISTING condition, loan must be removed after HandleFullPaymentsPeriodEndings -// suite.Require().Empty(loan.Loan) -// } -// } -// } - -// // this method is for TestLoanManagement -// func (suite *KeeperTestSuite) PlaceAndBorrow(coin sdk.Coin, nftId types.NftIdentifier, nftOwner sdk.AccAddress, fullPay bool, bidActiveRank uint64) { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftId, -// Amount: coin, -// AutomaticPayment: true, -// }) -// suite.Require().NoError(err) -// err = suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftId, -// Amount: sdk.NewCoin("uguu", coin.Amount.Quo(sdk.NewInt(int64(bidActiveRank)))), -// }) -// suite.Require().NoError(err) - -// if fullPay { -// err := suite.app.NftmarketKeeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftId, -// }) -// suite.Require().NoError(err) -// } -// } - -// func (suite *KeeperTestSuite) Liquidate() { -// // TODO: implement it once logic is implemented! -// } diff --git a/deprecated/x/nftmarketv1/keeper/mint.go b/deprecated/x/nftmarketv1/keeper/mint.go deleted file mode 100644 index bfd2aabaf..000000000 --- a/deprecated/x/nftmarketv1/keeper/mint.go +++ /dev/null @@ -1,39 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -func (k Keeper) MintNft(ctx sdk.Context, msg *types.MsgMintNft) error { - classId := msg.ClassId - nftId := msg.NftId - _, exists := k.nftKeeper.GetNFT(ctx, classId, nftId) - if exists { - return nft.ErrNFTExists - } - - _, hasId := k.nftKeeper.GetClass(ctx, classId) - if !hasId { - class := nft.Class{ - Id: classId, - Name: classId, - Symbol: classId, - Description: classId, - Uri: classId, - UriHash: classId, - } - k.nftKeeper.SaveClass(ctx, class) - } - - expNFT := nft.NFT{ - ClassId: classId, - Id: nftId, - Uri: msg.NftUri, - UriHash: msg.NftUriHash, - } - err := k.nftKeeper.Mint(ctx, expNFT, msg.Sender.AccAddress()) - return err -} diff --git a/deprecated/x/nftmarketv1/keeper/msg_server.go b/deprecated/x/nftmarketv1/keeper/msg_server.go deleted file mode 100644 index 9355e7a4d..000000000 --- a/deprecated/x/nftmarketv1/keeper/msg_server.go +++ /dev/null @@ -1,145 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -type msgServer struct { - keeper Keeper -} - -// NewMsgServerImpl returns an implementation of the bank MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{ - keeper: keeper, - } -} - -var _ types.MsgServer = msgServer{} - -func (k msgServer) MintNft(c context.Context, msg *types.MsgMintNft) (*types.MsgMintNftResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - err := k.keeper.MintNft(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgMintNftResponse{}, nil -} - -func (k msgServer) ListNft(c context.Context, msg *types.MsgListNft) (*types.MsgListNftResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - err := k.keeper.ListNft(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgListNftResponse{}, nil -} - -func (k msgServer) CancelNftListing(c context.Context, msg *types.MsgCancelNftListing) (*types.MsgCancelNftListingResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.CancelNftListing(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgCancelNftListingResponse{}, nil -} - -func (k msgServer) ExpandListingPeriod(c context.Context, msg *types.MsgExpandListingPeriod) (*types.MsgExpandListingPeriodResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.ExpandListingPeriod(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgExpandListingPeriodResponse{}, nil -} - -func (k msgServer) PlaceBid(c context.Context, msg *types.MsgPlaceBid) (*types.MsgPlaceBidResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.PlaceBid(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgPlaceBidResponse{}, nil -} - -func (k msgServer) CancelBid(c context.Context, msg *types.MsgCancelBid) (*types.MsgCancelBidResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.CancelBid(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgCancelBidResponse{}, nil -} - -func (k msgServer) SellingDecision(c context.Context, msg *types.MsgSellingDecision) (*types.MsgSellingDecisionResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.SellingDecision(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgSellingDecisionResponse{}, nil -} - -func (k msgServer) EndNftListing(c context.Context, msg *types.MsgEndNftListing) (*types.MsgEndNftListingResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.EndNftListing(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgEndNftListingResponse{}, nil -} - -func (k msgServer) PayFullBid(c context.Context, msg *types.MsgPayFullBid) (*types.MsgPayFullBidResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.PayFullBid(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgPayFullBidResponse{}, nil -} - -func (k msgServer) Borrow(c context.Context, msg *types.MsgBorrow) (*types.MsgBorrowResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.Borrow(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgBorrowResponse{}, nil -} - -func (k msgServer) Repay(c context.Context, msg *types.MsgRepay) (*types.MsgRepayResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.Repay(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgRepayResponse{}, nil -} - -func (k msgServer) MintStableCoin(c context.Context, msg *types.MsgMintStableCoin) (*types.MsgMintStableCoinResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - _ = ctx - return &types.MsgMintStableCoinResponse{}, nil -} - -func (k msgServer) BurnStableCoin(c context.Context, msg *types.MsgBurnStableCoin) (*types.MsgBurnStableCoinResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - _ = ctx - return &types.MsgBurnStableCoinResponse{}, nil -} - -func (k msgServer) Liquidate(c context.Context, msg *types.MsgLiquidate) (*types.MsgLiquidateResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.Liquidate(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgLiquidateResponse{}, nil -} diff --git a/deprecated/x/nftmarketv1/keeper/msg_server_test.go b/deprecated/x/nftmarketv1/keeper/msg_server_test.go deleted file mode 100644 index 942926490..000000000 --- a/deprecated/x/nftmarketv1/keeper/msg_server_test.go +++ /dev/null @@ -1 +0,0 @@ -package keeper_test diff --git a/deprecated/x/nftmarketv1/keeper/nft_listed_class.go b/deprecated/x/nftmarketv1/keeper/nft_listed_class.go deleted file mode 100644 index c5de647ad..000000000 --- a/deprecated/x/nftmarketv1/keeper/nft_listed_class.go +++ /dev/null @@ -1,106 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" - "github.com/UnUniFi/chain/x/nftfactory/keeper" -) - -func (k Keeper) UpdateListedClass(ctx sdk.Context, listing types.NftListing) { - // if listing doesn't exist, delete it from listed calss - if _, err := k.GetNftListingByIdBytes(ctx, listing.IdBytes()); err != nil { - k.DeleteListingFromListedClass(ctx, listing) - return - } - - switch listing.State { - case types.ListingState_LISTING: - k.SetListingInListedClass(ctx, listing) - case types.ListingState_BIDDING: - k.SetListingInListedClass(ctx, listing) - case types.ListingState_END_LISTING: - k.DeleteListingFromListedClass(ctx, listing) - case types.ListingState_SUCCESSFUL_BID: - k.DeleteListingFromListedClass(ctx, listing) - case types.ListingState_SELLING_DECISION: - k.DeleteListingFromListedClass(ctx, listing) - case types.ListingState_LIQUIDATION: - k.DeleteListingFromListedClass(ctx, listing) - } -} - -func (k Keeper) SetListingInListedClass(ctx sdk.Context, listing types.NftListing) { - store := ctx.KVStore(k.storeKey) - bzIdlist := store.Get(types.ClassKey(listing.ClassIdBytes())) - if bzIdlist == nil { - bz := k.cdc.MustMarshal( - &types.ListedClass{ - ClassId: listing.NftId.ClassId, - NftIds: []string{listing.NftId.NftId}, - }, - ) - store.Set(types.ClassKey(listing.ClassIdBytes()), bz) - } else { - class := types.ListedClass{} - k.cdc.MustUnmarshal(bzIdlist, &class) - - // return if the nft_id already exists - index := keeper.SliceIndex(class.NftIds, listing.NftId.NftId) - if index != -1 { - return - } - class.NftIds = append(class.NftIds, listing.NftId.NftId) - bz := k.cdc.MustMarshal(&class) - store.Set(types.ClassKey(listing.ClassIdBytes()), bz) - } -} - -func (k Keeper) DeleteListingFromListedClass(ctx sdk.Context, listing types.NftListing) { - store := ctx.KVStore(k.storeKey) - bzIdlist := store.Get(types.ClassKey(listing.ClassIdBytes())) - - class := types.ListedClass{} - k.cdc.MustUnmarshal(bzIdlist, &class) - - removeIndex := keeper.SliceIndex(class.NftIds, listing.NftId.NftId) - if removeIndex == -1 { - return - } - class.NftIds = keeper.RemoveIndex(class.NftIds, removeIndex) - // if class doens't have any listed nft, just delete class id key from kvstore - if len(class.NftIds) == 0 { - store.Delete(types.ClassKey(listing.ClassIdBytes())) - return - } - - bz := k.cdc.MustMarshal(&class) - store.Set(types.ClassKey(listing.ClassIdBytes()), bz) -} - -func (k Keeper) GetListedClassByClassIdBytes(ctx sdk.Context, classIdByte []byte) (types.ListedClass, error) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(classIdByte) - if bz == nil { - return types.ListedClass{}, types.ErrNftListingDoesNotExist - } - class := types.ListedClass{} - k.cdc.MustUnmarshal(bz, &class) - return class, nil -} - -func (k Keeper) GetListedClasses(ctx sdk.Context) ([]types.ListedClass, error) { - store := ctx.KVStore(k.storeKey) - classes := []types.ListedClass{} - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixClass)) - defer it.Close() - - for ; it.Valid(); it.Next() { - var class types.ListedClass - k.cdc.MustUnmarshal(it.Value(), &class) - - classes = append(classes, class) - } - - return classes, nil -} diff --git a/deprecated/x/nftmarketv1/keeper/nft_listing.go b/deprecated/x/nftmarketv1/keeper/nft_listing.go deleted file mode 100644 index 07c6e7de0..000000000 --- a/deprecated/x/nftmarketv1/keeper/nft_listing.go +++ /dev/null @@ -1,831 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/nft" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - - ecoincentivetypes "github.com/UnUniFi/chain/x/ecosystemincentive/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -func (k Keeper) GetNftListingByIdBytes(ctx sdk.Context, nftIdBytes []byte) (types.NftListing, error) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.NftListingKey(nftIdBytes)) - if bz == nil { - return types.NftListing{}, types.ErrNftListingDoesNotExist - } - listing := types.NftListing{} - k.cdc.MustUnmarshal(bz, &listing) - return listing, nil -} - -func (k Keeper) GetListingsByOwner(ctx sdk.Context, owner sdk.AccAddress) []types.NftListing { - store := ctx.KVStore(k.storeKey) - - listings := []types.NftListing{} - it := sdk.KVStorePrefixIterator(store, types.NftAddressNftListingPrefixKey(owner)) - defer it.Close() - - for ; it.Valid(); it.Next() { - nftIdBytes := it.Value() - listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) - if err != nil { - panic(err) - } - - listings = append(listings, listing) - } - return listings -} - -func getTimeKey(prefix string, timestamp time.Time) []byte { - timeBz := sdk.FormatTimeBytes(timestamp) - timeBzL := len(timeBz) - prefixL := len(prefix) - - bz := make([]byte, prefixL+8+timeBzL) - - // copy the prefix - copy(bz[:prefixL], prefix) - - // copy the encoded time bytes length - copy(bz[prefixL:prefixL+8], sdk.Uint64ToBigEndian(uint64(timeBzL))) - - // copy the encoded time bytes - copy(bz[prefixL+8:prefixL+8+timeBzL], timeBz) - return bz -} - -// call this method when you want to call SetNftListing -func (k Keeper) SaveNftListing(ctx sdk.Context, listing types.NftListing) { - k.SetNftListing(ctx, listing) - k.UpdateListedClass(ctx, listing) -} - -func (k Keeper) SetNftListing(ctx sdk.Context, listing types.NftListing) { - if oldListing, err := k.GetNftListingByIdBytes(ctx, listing.IdBytes()); err == nil { - k.DeleteNftListings(ctx, oldListing) - } - - nftIdBytes := listing.IdBytes() - bz := k.cdc.MustMarshal(&listing) - store := ctx.KVStore(k.storeKey) - store.Set(types.NftListingKey(nftIdBytes), bz) - - owner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - panic(err) - } - store.Set(types.NftAddressNftListingKey(owner, nftIdBytes), nftIdBytes) - - if listing.IsActive() { - store.Set(append(getTimeKey(types.KeyPrefixEndTimeNftListing, listing.EndAt), nftIdBytes...), nftIdBytes) - } else if listing.IsFullPayment() { - store.Set(append(getTimeKey(types.KeyPrefixFullPaymentPeriodListing, listing.FullPaymentEndAt), nftIdBytes...), nftIdBytes) - } else if listing.IsSuccessfulBid() { - store.Set(append(getTimeKey(types.KeyPrefixSuccessfulBidListing, listing.SuccessfulBidEndAt), nftIdBytes...), nftIdBytes) - } -} - -// call this method when you want to call DeleteNftListing -func (k Keeper) DeleteNftListings(ctx sdk.Context, listing types.NftListing) { - k.DeleteNftListing(ctx, listing) - k.UpdateListedClass(ctx, listing) -} - -func (k Keeper) DeleteNftListing(ctx sdk.Context, listing types.NftListing) { - nftIdBytes := listing.IdBytes() - store := ctx.KVStore(k.storeKey) - store.Delete(types.NftListingKey(nftIdBytes)) - - owner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - panic(err) - } - store.Delete(types.NftAddressNftListingKey(owner, nftIdBytes)) - - if listing.IsActive() { - store.Delete(append(getTimeKey(types.KeyPrefixEndTimeNftListing, listing.EndAt), nftIdBytes...)) - } else if listing.IsFullPayment() { - store.Delete(append(getTimeKey(types.KeyPrefixFullPaymentPeriodListing, listing.FullPaymentEndAt), nftIdBytes...)) - } else if listing.IsSuccessfulBid() { - store.Delete(append(getTimeKey(types.KeyPrefixSuccessfulBidListing, listing.SuccessfulBidEndAt), nftIdBytes...)) - } -} - -func (k Keeper) GetActiveNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftListing { - store := ctx.KVStore(k.storeKey) - timeKey := getTimeKey(types.KeyPrefixEndTimeNftListing, endTime) - it := store.Iterator([]byte(types.KeyPrefixEndTimeNftListing), storetypes.InclusiveEndBytes(timeKey)) - defer it.Close() - - listings := []types.NftListing{} - for ; it.Valid(); it.Next() { - nftIdBytes := it.Value() - listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) - if err != nil { - panic(err) - } - - listings = append(listings, listing) - } - return listings -} - -func (k Keeper) GetFullPaymentNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftListing { - store := ctx.KVStore(k.storeKey) - timeKey := getTimeKey(types.KeyPrefixFullPaymentPeriodListing, endTime) - it := store.Iterator([]byte(types.KeyPrefixFullPaymentPeriodListing), storetypes.InclusiveEndBytes(timeKey)) - defer it.Close() - - listings := []types.NftListing{} - for ; it.Valid(); it.Next() { - nftIdBytes := it.Value() - listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) - if err != nil { - panic(err) - } - - listings = append(listings, listing) - } - return listings -} - -func (k Keeper) GetSuccessfulBidNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftListing { - store := ctx.KVStore(k.storeKey) - timeKey := getTimeKey(types.KeyPrefixSuccessfulBidListing, endTime) - it := store.Iterator([]byte(types.KeyPrefixSuccessfulBidListing), storetypes.InclusiveEndBytes(timeKey)) - defer it.Close() - - listings := []types.NftListing{} - for ; it.Valid(); it.Next() { - nftIdBytes := it.Value() - listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) - if err != nil { - panic(err) - } - - listings = append(listings, listing) - } - return listings -} - -func (k Keeper) GetAllNftListings(ctx sdk.Context) []types.NftListing { - store := ctx.KVStore(k.storeKey) - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftListing)) - defer it.Close() - - allListings := []types.NftListing{} - for ; it.Valid(); it.Next() { - var listing types.NftListing - k.cdc.MustUnmarshal(it.Value(), &listing) - - allListings = append(allListings, listing) - } - - return allListings -} - -func (k Keeper) ListNft(ctx sdk.Context, msg *types.MsgListNft) error { - // check listing already exists - _, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err == nil { - return types.ErrNftListingAlreadyExists - } - - // todo:delete - k.TestMint(ctx, msg.Sender.AccAddress(), msg.NftId.ClassId, msg.NftId.NftId) - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of nft - owner := k.nftKeeper.GetOwner(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if owner.String() != msg.Sender.AccAddress().String() { - return types.ErrNotNftOwner - } - - params := k.GetParamSet(ctx) - // todo: delete - params.BidTokens = append(params.BidTokens, "uguu") - for !Contains(params.BidTokens, msg.BidToken) { - return types.ErrNotSupportedBidToken - } - - // Send ownership to market module - moduleAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) - err = k.nftKeeper.Transfer(ctx, msg.NftId.ClassId, msg.NftId.NftId, moduleAddr) - if err != nil { - return err - } - - // create listing - bidActiveRank := msg.BidActiveRank - if bidActiveRank == 0 { - bidActiveRank = params.DefaultBidActiveRank - } - listing := types.NftListing{ - NftId: msg.NftId, - Owner: owner.String(), - ListingType: msg.ListingType, - State: types.ListingState_LISTING, - BidToken: msg.BidToken, - MinBid: msg.MinBid, - BidActiveRank: bidActiveRank, - StartedAt: ctx.BlockTime(), - EndAt: ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingPeriodInitial)), - } - k.SaveNftListing(ctx, listing) - - // get the memo data from Tx contains MsgListNft - k.AfterNftListed(ctx, msg.NftId, GetMemo(ctx.TxBytes(), k.txCfg)) - - // Emit event for nft listing - ctx.EventManager().EmitTypedEvent(&types.EventListNft{ - Owner: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing) error { - // check listing already exists - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return types.ErrNftListingDoesNotExist - } - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of listing - if listing.Owner != msg.Sender.AccAddress().String() { - return types.ErrNotNftListingOwner - } - - // The listing of items can only be cancelled after N seconds have elapsed from the time it was placed on the marketplace - params := k.GetParamSet(ctx) - if listing.StartedAt.Add(time.Duration(params.NftListingCancelRequiredSeconds) * time.Second).After(ctx.BlockTime()) { - return types.ErrNotTimeForCancel - } - - // check nft is bidding status - if !listing.IsActive() { - return types.ErrStatusCannotCancelListing - } - - bids := k.GetBidsByNft(ctx, msg.NftId.IdBytes()) - - winnerCandidateStartIndex := len(bids) - int(listing.BidActiveRank) - if winnerCandidateStartIndex < 0 { - winnerCandidateStartIndex = 0 - } - // distribute cancellation fee to winner bidders - for _, bid := range bids[winnerCandidateStartIndex:] { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - cancelFee := bid.Amount.Amount.Mul(sdk.NewInt(int64(params.NftListingCancelFeePercentage))).Quo(sdk.NewInt(100)) - if cancelFee.IsPositive() { - err = k.bankKeeper.SendCoins(ctx, msg.Sender.AccAddress(), bidder, sdk.Coins{sdk.NewCoin(listing.BidToken, cancelFee)}) - if err != nil { - return err - } - } - } - - // delete all bids and return funds back - for _, bid := range bids { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{bid.Amount}) - if err != nil { - return err - } - k.DeleteBid(ctx, bid) - } - - // Send ownership to original owner - err = k.nftKeeper.Transfer(ctx, msg.NftId.ClassId, msg.NftId.NftId, msg.Sender.AccAddress()) - if err != nil { - return err - } - - // delete listing - k.DeleteNftListings(ctx, listing) - - // Call AfterNftUnlistedWithoutPayment to delete NFT ID from the ecosystem-incentive KVStore - // since it's unlisted. - k.AfterNftUnlistedWithoutPayment(ctx, listing.NftId) - - // Emit event for nft listing cancel - ctx.EventManager().EmitTypedEvent(&types.EventCancelListNfting{ - Owner: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) ExpandListingPeriod(ctx sdk.Context, msg *types.MsgExpandListingPeriod) error { - // check listing already exists - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return types.ErrNftListingDoesNotExist - } - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of listing - if listing.Owner != msg.Sender.AccAddress().String() { - return types.ErrNotNftListingOwner - } - - // check nft is bidding status - if !listing.IsActive() { - return types.ErrListingIsNotInStatusToBid - } - - // pay nft listing extend fee - params := k.GetParamSet(ctx) - feeAmount := params.NftListingPeriodExtendFeePerHour.Amount.Mul(sdk.NewInt(int64(params.NftListingExtendSeconds))).Quo(sdk.NewInt(3600)) - - // distribute nft listing extend fee to winner bidders - bids := k.GetBidsByNft(ctx, msg.NftId.IdBytes()) - totalBidAmount := sdk.ZeroInt() - - winnerCandidateStartIndex := len(bids) - int(listing.BidActiveRank) - if winnerCandidateStartIndex < 0 { - winnerCandidateStartIndex = 0 - } - - for _, bid := range bids[winnerCandidateStartIndex:] { - totalBidAmount = totalBidAmount.Add(bid.Amount.Amount) - } - - if totalBidAmount.IsPositive() { - for _, bid := range bids[winnerCandidateStartIndex:] { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - bidderCommission := bid.Amount.Amount.Mul(feeAmount).Quo(totalBidAmount) - if bidderCommission.IsPositive() { - commmission := sdk.NewCoin(params.NftListingPeriodExtendFeePerHour.Denom, bidderCommission) - err = k.bankKeeper.SendCoins(ctx, msg.Sender.AccAddress(), bidder, sdk.Coins{commmission}) - if err != nil { - return err - } - } - } - } - - // update listing end time - listing.EndAt = listing.EndAt.Add(time.Second * time.Duration(params.NftListingExtendSeconds)) - k.SaveNftListing(ctx, listing) - - // Emit event for nft listing cancel - ctx.EventManager().EmitTypedEvent(&types.EventExpandListingPeriod{ - Owner: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) SellingDecision(ctx sdk.Context, msg *types.MsgSellingDecision) error { - // check listing already exists - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return types.ErrNftListingDoesNotExist - } - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of listing - if listing.Owner != msg.Sender.AccAddress().String() { - return types.ErrNotNftListingOwner - } - - // check if listing is already ended or on selling decision status - if listing.State != types.ListingState_BIDDING { - return types.ErrListingNeedsToBeBiddingStatus - } - - params := k.GetParamSet(ctx) - listing.FullPaymentEndAt = ctx.BlockTime().Add(time.Duration(params.NftListingFullPaymentPeriod) * time.Second) - listing.State = types.ListingState_SELLING_DECISION - k.SaveNftListing(ctx, listing) - - // automatic payment if enabled - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if len(bids) > 0 { - winnerIndex := len(bids) - 1 - bid := bids[winnerIndex] - if bid.AutomaticPayment { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - fmt.Println(err) - return err - } - - cacheCtx, write := ctx.CacheContext() - err = k.PayFullBid(cacheCtx, &types.MsgPayFullBid{ - Sender: bidder.Bytes(), - NftId: listing.NftId, - }) - if err == nil { - write() - } else { - fmt.Println(err) - } - } - } - - // Emit event for nft listing end - ctx.EventManager().EmitTypedEvent(&types.EventSellingDecision{ - Owner: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) EndNftListing(ctx sdk.Context, msg *types.MsgEndNftListing) error { - // check listing already exists - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return types.ErrNftListingDoesNotExist - } - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of listing - if listing.Owner != msg.Sender.AccAddress().String() { - return types.ErrNotNftListingOwner - } - - // check if listing is already ended - if listing.State == types.ListingState_END_LISTING || listing.State == types.ListingState_SELLING_DECISION { - return types.ErrListingAlreadyEnded - } - - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if len(bids) == 0 { - err = k.nftKeeper.Transfer(ctx, listing.NftId.ClassId, listing.NftId.NftId, msg.Sender.AccAddress()) - if err != nil { - panic(err) - } - k.DeleteNftListings(ctx, listing) - } else { - params := k.GetParamSet(ctx) - listing.FullPaymentEndAt = ctx.BlockTime().Add(time.Duration(params.NftListingFullPaymentPeriod) * time.Second) - listing.State = types.ListingState_END_LISTING - k.SaveNftListing(ctx, listing) - - // automatic payment after listing ends - winnerCandidateStartIndex := len(bids) - int(listing.BidActiveRank) - if winnerCandidateStartIndex < 0 { - winnerCandidateStartIndex = 0 - } - for _, bid := range bids[winnerCandidateStartIndex:] { - if bid.AutomaticPayment { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - fmt.Println(err) - continue - } - - cacheCtx, write := ctx.CacheContext() - err = k.PayFullBid(cacheCtx, &types.MsgPayFullBid{ - Sender: bidder.Bytes(), - NftId: listing.NftId, - }) - if err == nil { - write() - } else { - fmt.Println(err) - continue - } - } - } - - // automatically cancel bids for not active rank - for _, bid := range bids[:winnerCandidateStartIndex] { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - fmt.Println(err) - continue - } - // Delete bid - k.DeleteBid(ctx, bid) - cacheCtx, write := ctx.CacheContext() - err = k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(bid.Amount.Denom, bid.PaidAmount)}) - if err != nil { - return err - } - if err == nil { - write() - } else { - fmt.Println(err) - continue - } - } - } - - // Emit event for nft listing end - ctx.EventManager().EmitTypedEvent(&types.EventEndListNfting{ - Owner: msg.Sender.AccAddress().String(), - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - // Call AfterNftUnlistedWithoutPayment to delete NFT ID from the ecosystem-incentive KVStore - // since it's unlisted. - if _, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()); err != nil { - k.AfterNftUnlistedWithoutPayment(ctx, listing.NftId) - } - - return nil -} - -func (k Keeper) ProcessEndingNftListings(ctx sdk.Context) { - params := k.GetParamSet(ctx) - listings := k.GetActiveNftListingsEndingAt(ctx, ctx.BlockTime()) - for _, listing := range listings { - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if listing.AutoRelistedCount < params.AutoRelistingCountIfNoBid && len(bids) == 0 { - listing.EndAt = listing.EndAt.Add(time.Duration(params.NftListingExtendSeconds) * time.Second) - listing.AutoRelistedCount++ - k.SaveNftListing(ctx, listing) - } else { - listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - fmt.Println(err) - continue - } - err = k.EndNftListing(ctx, &types.MsgEndNftListing{ - Sender: listingOwner.Bytes(), - NftId: listing.NftId, - }) - if err != nil { - fmt.Println(err) - continue - } - } - } -} - -func (k Keeper) HandleFullPaymentsPeriodEndings(ctx sdk.Context) { - params := k.GetParamSet(ctx) - // get listings ended earlier - listings := k.GetFullPaymentNftListingsEndingAt(ctx, ctx.BlockTime()) - - // handle not fully paid bids - for _, listing := range listings { - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if listing.State == types.ListingState_SELLING_DECISION { - i := len(bids) - 1 - bid := bids[i] - - // if winner bidder did not pay full bid, nft is listed again after deleting winner bidder - if bid.PaidAmount.LT(bid.Amount.Amount) { - k.DeleteBid(ctx, bid) - if len(bids) == 1 { - listing.State = types.ListingState_LISTING - } else { - listing.State = types.ListingState_BIDDING - } - listing.EndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingExtendSeconds)) - - // Reset the loan data for a lister - // If the bid.PaidAmount is more than loan.Coin.Amount, then just delete the loan data for lister. - // Otherwise, subtract bid.PaidAmount from loaning amount - loan := k.GetDebtByNft(ctx, listing.IdBytes()) - if !loan.Loan.Amount.IsNil() { - if loan.Loan.Amount.LTE(bid.PaidAmount) { - k.DeleteDebt(ctx, listing.IdBytes()) - } else { - renewedLoanAmount := loan.Loan.Amount.Sub(bid.PaidAmount) - loan.Loan.Amount = renewedLoanAmount - k.SetDebt(ctx, loan) - } - } - } else { - // schedule NFT / token send after X days - listing.SuccessfulBidEndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingNftDeliveryPeriod)) - listing.State = types.ListingState_SUCCESSFUL_BID - // delete the loan data for the nftId which is deleted from the market - k.RemoveDebt(ctx, listing.IdBytes()) - } - k.SaveNftListing(ctx, listing) - } else if listing.State == types.ListingState_END_LISTING { - index := len(bids) - 1 - for ; index >= 0; index-- { - bid := bids[index] - if bid.PaidAmount.Equal(bid.Amount.Amount) { - break - } - } - - if index >= 0 { // if winner bidder exists who paid full amount - // schedule NFT / token send after X days - listing.SuccessfulBidEndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingNftDeliveryPeriod)) - listing.State = types.ListingState_SUCCESSFUL_BID - k.SaveNftListing(ctx, listing) - - for i, bid := range bids { - if index != i { - cacheCtx, write := ctx.CacheContext() - err := k.SafeCloseBid(cacheCtx, bid) - if err == nil { - write() - } else { - fmt.Println(err) - } - } - } - // TODO: shouldn't we handle winning bidder candidates above successful bidder that didn't pay full amount? - } else { // if all winning bidder candidates do not pay - // the amount of the collected deposit plus NFT to be listed will be given to the lister - listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - continue - } - - depositCollected := sdk.ZeroInt() - for _, bid := range bids { - depositCollected = depositCollected.Add(bid.PaidAmount) - k.DeleteBid(ctx, bid) - } - - // pay fee - loan := k.GetDebtByNft(ctx, listing.IdBytes()) - k.ProcessPaymentWithCommissionFee(ctx, listingOwner, listing.BidToken, depositCollected, loan.Loan.Amount, listing.NftId) - - // transfer nft to listing owner - cacheCtx, write := ctx.CacheContext() - err = k.nftKeeper.Transfer(cacheCtx, listing.NftId.ClassId, listing.NftId.NftId, listingOwner) - if err != nil { - fmt.Println(err) - } else { - write() - } - - // remove listing - k.DeleteNftListings(ctx, listing) - } - // delete the loan data for the nftId which is deleted from the market anyway - k.RemoveDebt(ctx, listing.IdBytes()) - } - } -} - -func (k Keeper) DelieverSuccessfulBids(ctx sdk.Context) { - params := k.GetParamSet(ctx) - // get listings ended earlier - listings := k.GetSuccessfulBidNftListingsEndingAt(ctx, ctx.BlockTime()) - - _, _ = params, listings - for _, listing := range listings { - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if len(bids) != 1 { - continue - } - bid := bids[0] - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - continue - } - - listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - continue - } - - cacheCtx, write := ctx.CacheContext() - err = k.nftKeeper.Transfer(cacheCtx, listing.NftId.ClassId, listing.NftId.NftId, bidder) - if err != nil { - fmt.Println(err) - continue - } else { - write() - } - - loan := k.GetDebtByNft(ctx, listing.IdBytes()) - k.ProcessPaymentWithCommissionFee(ctx, listingOwner, bid.Amount.Denom, bid.PaidAmount, loan.Loan.Amount, listing.NftId) - - k.DeleteBid(ctx, bid) - k.DeleteNftListings(ctx, listing) - } -} - -func (k Keeper) ProcessPaymentWithCommissionFee(ctx sdk.Context, listingOwner sdk.AccAddress, denom string, amount sdk.Int, loanAmount sdk.Int, nftId types.NftIdentifier) { - params := k.GetParamSet(ctx) - commissionFee := params.NftListingCommissionFee - cacheCtx, write := ctx.CacheContext() - // pay commission fees for nft listing - fee := amount.Mul(sdk.NewInt(int64(commissionFee))).Quo(sdk.NewInt(100)) - if fee.IsPositive() { - feeCoins := sdk.Coins{sdk.NewCoin(denom, fee)} - err := k.bankKeeper.SendCoinsFromModuleToModule(cacheCtx, types.ModuleName, ecoincentivetypes.ModuleName, feeCoins) - if err != nil { - fmt.Println(err) - return - } else { - write() - } - } - - if loanAmount.IsNil() { - loanAmount = sdk.ZeroInt() - } - listerPayment := amount.Sub(fee) - listerPayment = listerPayment.Sub(loanAmount) - if !listerPayment.IsZero() { - err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, listingOwner, sdk.Coins{sdk.NewCoin(denom, listerPayment)}) - if err != nil { - fmt.Println(err) - return - } else { - write() - } - } - - // Call AfterNftPaymentWithCommission hook method to inform the payment is successfuly - // executed. - k.AfterNftPaymentWithCommission(ctx, nftId, sdk.NewCoin(denom, fee)) -} - -// todo: delete -func (k Keeper) TestMint(ctx sdk.Context, addr sdk.AccAddress, classId, nftId string) { - _, exists := k.nftKeeper.GetNFT(ctx, classId, nftId) - if exists { - return - } - const ( - testClassName = "Crypto Kitty" - testClassSymbol = "kitty" - testClassDescription = "Crypto Kitty" - testClassURI = "class uri" - testClassURIHash = "ae702cefd6b6a65fe2f991ad6d9969ed" - testURI = "kitty uri" - testURIHash = "229bfd3c1b431c14a526497873897108" - ) - - _, hasId := k.nftKeeper.GetClass(ctx, classId) - if !hasId { - class := nft.Class{ - Id: classId, - Name: testClassName, - Symbol: testClassSymbol, - Description: testClassDescription, - Uri: testClassURI, - UriHash: testClassURIHash, - } - k.nftKeeper.SaveClass(ctx, class) - fmt.Println("save class") - } - - expNFT := nft.NFT{ - ClassId: classId, - Id: nftId, - Uri: testURI, - } - err := k.nftKeeper.Mint(ctx, expNFT, addr) - if err != nil { - fmt.Println("err occur") - } -} diff --git a/deprecated/x/nftmarketv1/keeper/nft_listing_test.go b/deprecated/x/nftmarketv1/keeper/nft_listing_test.go deleted file mode 100644 index 77628025b..000000000 --- a/deprecated/x/nftmarketv1/keeper/nft_listing_test.go +++ /dev/null @@ -1,1947 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" -// nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - -// ununifitypes "github.com/UnUniFi/chain/deprecated/types" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -// ecoincentivetypes "github.com/UnUniFi/chain/x/ecosystemincentive/types" -// ) - -// // test basic functions of nft listing -// func (suite *KeeperTestSuite) TestNftListingBasics() { -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// future := now.Add(time.Second) -// listings := []types.NftListing{ -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "1", -// }, -// Owner: owner.String(), -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// State: types.ListingState_LISTING, -// BidToken: "uguu", -// MinBid: sdk.OneInt(), -// BidActiveRank: 1, -// StartedAt: now, -// EndAt: now, -// FullPaymentEndAt: time.Time{}, -// SuccessfulBidEndAt: time.Time{}, -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "2", -// }, -// Owner: owner.String(), -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// State: types.ListingState_BIDDING, -// BidToken: "uguu", -// MinBid: sdk.OneInt(), -// BidActiveRank: 1, -// StartedAt: now, -// EndAt: now, -// FullPaymentEndAt: time.Time{}, -// SuccessfulBidEndAt: time.Time{}, -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "3", -// }, -// Owner: owner.String(), -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// State: types.ListingState_END_LISTING, -// BidToken: "uguu", -// MinBid: sdk.OneInt(), -// BidActiveRank: 1, -// StartedAt: now, -// EndAt: now, -// FullPaymentEndAt: now, -// SuccessfulBidEndAt: time.Time{}, -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "1", -// NftId: "4", -// }, -// Owner: owner.String(), -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// State: types.ListingState_SELLING_DECISION, -// BidToken: "uguu", -// MinBid: sdk.OneInt(), -// BidActiveRank: 1, -// StartedAt: time.Time{}, -// EndAt: now, -// FullPaymentEndAt: now, -// SuccessfulBidEndAt: time.Time{}, -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "2", -// NftId: "1", -// }, -// Owner: owner2.String(), -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// State: types.ListingState_SUCCESSFUL_BID, -// BidToken: "uguu", -// MinBid: sdk.OneInt(), -// BidActiveRank: 1, -// StartedAt: time.Time{}, -// EndAt: now, -// FullPaymentEndAt: now, -// SuccessfulBidEndAt: now, -// AutoRelistedCount: 0, -// }, -// { -// NftId: types.NftIdentifier{ -// ClassId: "2", -// NftId: "2", -// }, -// Owner: owner2.String(), -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// State: types.ListingState_LIQUIDATION, -// BidToken: "uguu", -// MinBid: sdk.OneInt(), -// BidActiveRank: 1, -// StartedAt: time.Time{}, -// EndAt: now, -// FullPaymentEndAt: now, -// SuccessfulBidEndAt: now, -// AutoRelistedCount: 0, -// }, -// } - -// for _, listing := range listings { -// suite.app.NftmarketKeeper.SetNftListing(suite.ctx, listing) -// } - -// for _, listing := range listings { -// gotListing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, listing.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing, gotListing) -// } - -// // check all listings -// allListings := suite.app.NftmarketKeeper.GetAllNftListings(suite.ctx) -// suite.Require().Len(allListings, len(listings)) - -// // check listing by owner -// listingsByOwner := suite.app.NftmarketKeeper.GetListingsByOwner(suite.ctx, owner) -// suite.Require().Len(listingsByOwner, 4) - -// // check active listings (bidding or listing status ending now) -// activeNftListings := suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, now) -// suite.Require().Len(activeNftListings, 0) -// // check active listings (bidding or listing status ending future time) -// activeNftListings = suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, future) -// suite.Require().Len(activeNftListings, 2) - -// // full payment listings (sell decision or end listing status ending now) -// fullPaymentNftListingsEnding := suite.app.NftmarketKeeper.GetFullPaymentNftListingsEndingAt(suite.ctx, now) -// suite.Require().Len(fullPaymentNftListingsEnding, 0) -// // full payment listings (sell decision or end listing status ending future) -// fullPaymentNftListingsEnding = suite.app.NftmarketKeeper.GetFullPaymentNftListingsEndingAt(suite.ctx, future) -// suite.Require().Len(fullPaymentNftListingsEnding, 2) - -// // successful listing endings (ending now) -// successfulNftListingsEnding := suite.app.NftmarketKeeper.GetSuccessfulBidNftListingsEndingAt(suite.ctx, now) -// suite.Require().Len(successfulNftListingsEnding, 0) -// // successful listing endings (ending future) -// successfulNftListingsEnding = suite.app.NftmarketKeeper.GetSuccessfulBidNftListingsEndingAt(suite.ctx, future) -// suite.Require().Len(successfulNftListingsEnding, 1) - -// // delete all the listings -// for _, listing := range listings { -// suite.app.NftmarketKeeper.DeleteNftListing(suite.ctx, listing) -// } - -// // check queries after deleting all -// allListings = suite.app.NftmarketKeeper.GetAllNftListings(suite.ctx) -// suite.Require().Len(allListings, 0) - -// // listings by owner -// listingsByOwner = suite.app.NftmarketKeeper.GetListingsByOwner(suite.ctx, owner) -// suite.Require().Len(listingsByOwner, 0) - -// // queries for active listings -// activeNftListings = suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, future) -// suite.Require().Len(activeNftListings, 0) -// // queries for full payment queue -// fullPaymentNftListingsEnding = suite.app.NftmarketKeeper.GetFullPaymentNftListingsEndingAt(suite.ctx, future) -// suite.Require().Len(fullPaymentNftListingsEnding, 0) -// // queries for successful ending queue -// successfulNftListingsEnding = suite.app.NftmarketKeeper.GetSuccessfulBidNftListingsEndingAt(suite.ctx, future) -// suite.Require().Len(successfulNftListingsEnding, 0) -// } - -// func (suite *KeeperTestSuite) TestListNft() { -// acc1 := suite.addrs[0] -// acc2 := suite.addrs[1] -// keeper := suite.keeper -// nftKeeper := suite.nftKeeper - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// lister sdk.AccAddress -// bidToken string -// activeRank uint64 -// mintBefore bool -// listBefore bool -// expectPass bool -// statusListedHook bool -// }{ -// { -// testCase: "not existing nft", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// lister: acc1, -// bidToken: "uguu", -// activeRank: 1, -// mintBefore: false, -// listBefore: false, -// expectPass: false, -// statusListedHook: false, -// }, -// { -// testCase: "already listed", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// lister: acc1, -// bidToken: "uguu", -// activeRank: 1, -// mintBefore: true, -// listBefore: true, -// expectPass: false, -// statusListedHook: true, -// }, -// { -// testCase: "not owned nft", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// lister: acc2, -// bidToken: "uguu", -// activeRank: 1, -// mintBefore: true, -// listBefore: false, -// expectPass: false, -// statusListedHook: false, -// }, -// { -// testCase: "unsupported bid token", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// lister: acc1, -// bidToken: "xxxx", -// activeRank: 1, -// mintBefore: true, -// listBefore: false, -// expectPass: false, -// statusListedHook: false, -// }, -// { -// testCase: "successful listing with default active rank", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// lister: acc1, -// bidToken: "uguu", -// activeRank: 0, -// mintBefore: true, -// listBefore: false, -// expectPass: true, -// statusListedHook: true, -// }, -// { -// testCase: "successful listing with non-default active rank", -// classId: "class6", -// nftId: "nft6", -// nftOwner: acc1, -// lister: acc1, -// bidToken: "uguu", -// activeRank: 100, -// mintBefore: true, -// listBefore: false, -// expectPass: true, -// statusListedHook: true, -// }, -// { -// testCase: "successful anther owner", -// classId: "class7", -// nftId: "nft7", -// nftOwner: acc2, -// lister: acc2, -// bidToken: "uguu", -// activeRank: 0, -// mintBefore: true, -// listBefore: false, -// expectPass: true, -// statusListedHook: true, -// }, -// } - -// for _, tc := range tests { -// statusAfterNftListed = false -// if tc.mintBefore { -// nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := nftKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) -// } -// if tc.listBefore { -// err := keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.lister), -// NftId: types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId}, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: tc.bidToken, -// MinBid: sdk.ZeroInt(), -// BidActiveRank: tc.activeRank, -// }) -// suite.Require().NoError(err) -// } -// err := keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.lister), -// NftId: types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId}, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: tc.bidToken, -// MinBid: sdk.ZeroInt(), -// BidActiveRank: tc.activeRank, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// params := keeper.GetParamSet(suite.ctx) -// // get listing -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, (types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId}).IdBytes()) -// suite.Require().NoError(err) - -// // check ownership is transferred -// moduleAddr := suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) -// nftOwner := nftKeeper.GetOwner(suite.ctx, tc.classId, tc.nftId) -// suite.Require().Equal(nftOwner.String(), moduleAddr.String()) - -// // check bid active rank is set to default if zero -// if tc.activeRank == 0 { -// suite.Require().Equal(params.DefaultBidActiveRank, listing.BidActiveRank) -// } - -// // check startedAt is set as current time -// suite.Require().Equal(suite.ctx.BlockTime(), listing.StartedAt) - -// // check endAt is set from initial listing duration -// suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingPeriodInitial)), listing.EndAt) -// } else { -// suite.Require().Error(err) -// } - -// suite.Require().Equal(tc.statusListedHook, statusAfterNftListed) -// } -// } - -// func (suite *KeeperTestSuite) TestCancelNftListing() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// keeper := suite.keeper -// nftKeeper := suite.nftKeeper - -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// canceller sdk.AccAddress -// cancelAfter time.Duration -// numBids int -// listBefore bool -// endedListing bool -// expectPass bool -// statusUnlistedHook bool -// }{ -// { -// testCase: "not existing listing", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// canceller: acc1, -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// numBids: 0, -// listBefore: false, -// endedListing: false, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "not owned nft listing", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// canceller: acc2, -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// numBids: 0, -// listBefore: true, -// endedListing: false, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "cancel time not pass", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// canceller: acc1, -// cancelAfter: 0, -// numBids: 0, -// listBefore: true, -// endedListing: false, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "already ended listing", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// canceller: acc1, -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// numBids: 0, -// listBefore: true, -// endedListing: true, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "successful cancel without cancel fee", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// canceller: acc1, -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// numBids: 0, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// statusUnlistedHook: true, -// }, -// { -// testCase: "successful cancel with cancel fee", -// classId: "class6", -// nftId: "nft6", -// nftOwner: acc1, -// canceller: acc1, -// cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), -// numBids: 0, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// statusUnlistedHook: true, -// }, -// } - -// for _, tc := range tests { -// statusAfterNftUnlistedWithoutPayment = false - -// nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err := nftKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := keeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.endedListing { -// err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } - -// oldCancellerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.canceller, "uguu") -// suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(tc.cancelAfter)) -// err = keeper.CancelNftListing(suite.ctx, &types.MsgCancelNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.canceller), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // check all bids are closed and returned -// nftBids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Len(nftBids, 0) - -// // check cancel fee is reduced from listing owner -// if tc.numBids > 0 { -// cancellerNewBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.canceller, "uguu") -// suite.Require().True(cancellerNewBalance.Amount.LT(oldCancellerBalance.Amount)) -// } - -// // check nft ownership is returned back to owner -// owner := nftKeeper.GetOwner(suite.ctx, tc.classId, tc.nftId) -// suite.Require().Equal(owner, tc.nftOwner) - -// // check nft listing is deleted -// _, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) -// } else { -// suite.Require().Error(err) -// } - -// suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) -// } -// } - -// func (suite *KeeperTestSuite) TestExpandListingPeriod() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// executor sdk.AccAddress -// numBids int -// listBefore bool -// endedListing bool -// expectPass bool -// }{ -// { -// testCase: "not existing listing", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// executor: acc1, -// numBids: 0, -// listBefore: false, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "not owned nft listing", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// executor: acc2, -// numBids: 0, -// listBefore: true, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "already ended nft listing", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// executor: acc2, -// numBids: 1, -// listBefore: true, -// endedListing: true, -// expectPass: false, -// }, -// { -// testCase: "successful nft listing period extend", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// executor: acc1, -// numBids: 1, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// } - -// for _, tc := range tests { - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) -// suite.NoError(err) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// lastBidder := sdk.AccAddress{} -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// lastBidder = bidder - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.endedListing { -// err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } - -// oldListing, _ := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - -// oldExecutorBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.executor, "uguu") -// oldLastBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, lastBidder, "uguu") -// err = suite.app.NftmarketKeeper.ExpandListingPeriod(suite.ctx, &types.MsgExpandListingPeriod{ -// Sender: ununifitypes.StringAccAddress(tc.executor), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // check fee is paid -// newExecutorBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.executor, "uguu") -// suite.Require().True(newExecutorBalance.Amount.LT(oldExecutorBalance.Amount)) - -// // check winner bidders get extend fee -// newLastBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, lastBidder, "uguu") -// suite.Require().True(newLastBidderBalance.Amount.GT(oldLastBidderBalance.Amount)) - -// // check listing endAt is extended -// listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().True(oldListing.EndAt.Before(listing.EndAt)) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// func (suite *KeeperTestSuite) TestSellingDecision() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// executor sdk.AccAddress -// numBids int -// enoughAutoPay bool -// autoPayment bool -// listBefore bool -// endedListing bool -// expectPass bool -// }{ -// { -// testCase: "not existing listing", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// executor: acc1, -// numBids: 0, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: false, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "not owned nft listing", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// executor: acc2, -// numBids: 0, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "already ended nft listing", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// executor: acc2, -// numBids: 1, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: true, -// expectPass: false, -// }, -// { -// testCase: "successful nft selling decision with automatic payment", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// executor: acc1, -// numBids: 1, -// enoughAutoPay: true, -// autoPayment: true, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// { -// testCase: "successful nft selling decision with automatic payment enabled with not enough balance", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// executor: acc1, -// numBids: 1, -// enoughAutoPay: false, -// autoPayment: true, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// { -// testCase: "successful nft selling decision without automatic payment", -// classId: "class6", -// nftId: "nft6", -// nftOwner: acc1, -// executor: acc1, -// numBids: 1, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) -// suite.NoError(err) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// lastBidder := sdk.AccAddress{} -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// lastBidder = bidder - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// mintCoin := coin -// if !tc.enoughAutoPay { -// mintCoin = sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) -// } -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{mintCoin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{mintCoin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: tc.autoPayment, -// }) -// suite.Require().NoError(err) -// } - -// if tc.endedListing { -// err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } - -// err = suite.app.NftmarketKeeper.SellingDecision(suite.ctx, &types.MsgSellingDecision{ -// Sender: ununifitypes.StringAccAddress(tc.executor), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) -// if tc.autoPayment { -// bid, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), lastBidder) -// suite.Require().NoError(err) -// if tc.enoughAutoPay { -// // check automatic payment execution when user has enough balance -// suite.Require().Equal(bid.PaidAmount, bid.Amount.Amount) -// } else { -// // check automatic payment when the user does not have enough balance -// suite.Require().NotEqual(bid.PaidAmount, bid.Amount.Amount) -// } -// } - -// // check full payment end time update -// listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_SELLING_DECISION) -// suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingFullPaymentPeriod)), listing.FullPaymentEndAt) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -// func (suite *KeeperTestSuite) TestEndNftListing() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// executor sdk.AccAddress -// numBids int -// enoughAutoPay bool -// autoPayment bool -// listBefore bool -// endedListing bool -// expectPass bool -// statusUnlistedHook bool -// }{ -// { -// testCase: "not existing listing", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// executor: acc1, -// numBids: 0, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: false, -// endedListing: false, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "not owned nft listing", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// executor: acc2, -// numBids: 0, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: false, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "already ended nft listing", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// executor: acc2, -// numBids: 1, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: true, -// expectPass: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "successful nft listing ending when no bid", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// executor: acc1, -// numBids: 0, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// statusUnlistedHook: true, -// }, -// { -// testCase: "successful nft listing ending with automatic payment enabled with not enough balance", -// classId: "class5", -// nftId: "nft5", -// nftOwner: acc1, -// executor: acc1, -// numBids: 1, -// enoughAutoPay: false, -// autoPayment: true, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// statusUnlistedHook: false, -// }, -// { -// testCase: "successful nft listing ending without automatic payment", -// classId: "class6", -// nftId: "nft6", -// nftOwner: acc1, -// executor: acc1, -// numBids: 4, -// enoughAutoPay: true, -// autoPayment: false, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// statusUnlistedHook: false, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() -// keeper := suite.keeper -// nftKeeper := suite.nftKeeper -// statusAfterNftUnlistedWithoutPayment = false - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) -// suite.NoError(err) - -// nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err = nftKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// } - -// lastBidder := sdk.AccAddress{} -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// lastBidder = bidder - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// mintCoin := coin -// if !tc.enoughAutoPay { -// mintCoin = sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) -// } -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{mintCoin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{mintCoin}) -// suite.NoError(err) - -// err := keeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: tc.autoPayment, -// }) -// suite.Require().NoError(err) -// } - -// if tc.endedListing { -// err := keeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } - -// err = keeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.executor), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) -// if tc.autoPayment { -// bid, err := keeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), lastBidder) -// suite.Require().NoError(err) -// if tc.enoughAutoPay { -// // check automatic payment execution when user has enough balance -// suite.Require().Equal(bid.PaidAmount, bid.Amount.Amount) -// } else { -// // check automatic payment when the user does not have enough balance -// suite.Require().NotEqual(bid.PaidAmount, bid.Amount.Amount) -// } -// } - -// if tc.numBids == 0 { -// // successful end when there's no bid - delete listing directly and transfer nft back to owner -// _, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) -// } else { -// // check full payment end time update -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_END_LISTING) -// suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingFullPaymentPeriod)), listing.FullPaymentEndAt) - -// // check non-active bids are cancelled automatically -// bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().True(len(bids) <= int(listing.BidActiveRank)) -// } - -// } else { -// suite.Require().Error(err) -// } -// suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) -// } -// } - -// func (suite *KeeperTestSuite) TestProcessEndingNftListings() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// numBids int -// relistedCount uint64 -// expectedToEnd bool -// expectedToBeRemoved bool -// statusUnlistedHook bool -// }{ -// { -// testCase: "no bid nft listing extend when relisted count not reached the limit", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// numBids: 0, -// relistedCount: 0, -// expectedToEnd: false, -// expectedToBeRemoved: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "no bid nft listing end when relisted count reached", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// numBids: 0, -// relistedCount: params.AutoRelistingCountIfNoBid, -// expectedToEnd: true, -// expectedToBeRemoved: true, -// statusUnlistedHook: true, -// }, -// { -// testCase: "bids existing nft listing end when relisted count not reached", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// numBids: 1, -// relistedCount: 0, -// expectedToEnd: true, -// expectedToBeRemoved: false, -// statusUnlistedHook: false, -// }, -// { -// testCase: "bids existing nft listing end when relisted count reached", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// numBids: 1, -// relistedCount: params.AutoRelistingCountIfNoBid, -// expectedToEnd: true, -// expectedToBeRemoved: false, -// statusUnlistedHook: false, -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() -// keeper := suite.keeper -// nftKeeper := suite.nftKeeper -// statusAfterNftUnlistedWithoutPayment = false - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.nftOwner, sdk.Coins{coin}) -// suite.NoError(err) - -// nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err = nftKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// err = keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// listing.AutoRelistedCount = tc.relistedCount -// keeper.SetNftListing(suite.ctx, listing) - -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := keeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: true, -// }) -// suite.Require().NoError(err) -// } - -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) -// keeper.ProcessEndingNftListings(suite.ctx) - -// if tc.expectedToBeRemoved { -// _, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) -// } else { -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) - -// if tc.expectedToEnd { -// suite.Require().Equal(listing.State, types.ListingState_END_LISTING) -// } else { -// suite.Require().NotEqual(listing.State, types.ListingState_END_LISTING) -// } -// } -// suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) -// } -// } - -// func (suite *KeeperTestSuite) TestActiveNftListingsEndingAtQueueRemovalOnNftListingEnd() { -// suite.SetupTest() - -// classId := "class1" -// nftId := "nf1" -// nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// now := time.Now().UTC() - -// suite.ctx = suite.ctx.WithBlockTime(now) -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{coin}) -// suite.NoError(err) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: classId, -// Name: classId, -// Symbol: classId, -// Description: classId, -// Uri: classId, -// }) -// err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: classId, -// Id: nftId, -// Uri: nftId, -// UriHash: nftId, -// }, nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} -// err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) - -// listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().True(listing.IsActive()) - -// // check number before end listing -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) -// activeNftListings := suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, now.Add(time.Second*time.Duration(params.NftListingPeriodInitial+1))) -// suite.Require().Len(activeNftListings, 1) - -// err = suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) - -// // check number after end listing -// activeNftListings = suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, now.Add(time.Second*time.Duration(params.NftListingPeriodInitial+1))) -// suite.Require().Len(activeNftListings, 0) -// } - -// func (suite *KeeperTestSuite) TestHandleFullPaymentPeriodEndings() { - -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// numBids int -// listingState types.ListingState -// fullPay bool -// statusUnlistedHook bool -// }{ -// { -// testCase: "selling decision listing when highest bid is paid", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// numBids: 2, -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: true, -// statusUnlistedHook: false, -// }, // add successful listing state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status -// { -// testCase: "selling decision listing when highest bid is not paid and no more bids", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// numBids: 1, -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: false, -// statusUnlistedHook: false, -// }, // status => ListingState_LISTING -// { -// testCase: "selling decision listing when highest bid is not paid, and more bids", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// numBids: 2, -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: false, -// statusUnlistedHook: false, -// }, // status => ListingState_BIDDING -// { -// testCase: "ended listing, when fully paid bid exists", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// numBids: 2, -// listingState: types.ListingState_END_LISTING, -// fullPay: true, -// statusUnlistedHook: false, -// }, // add successful bid state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status, close all the other bids -// { -// testCase: "ended listing, when fully paid bid does not exist", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// numBids: 2, -// listingState: types.ListingState_END_LISTING, -// fullPay: true, -// statusUnlistedHook: false, -// }, // all the bids closed, pay depositCollected, nft listing delete, transfer nft to fully paid bidder -// } - -// for _, tc := range tests { -// suite.SetupTest() -// keeper := suite.keeper -// nftKeeper := suite.nftKeeper -// statusAfterNftUnlistedWithoutPayment = false - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.nftOwner, sdk.Coins{coin}) -// suite.NoError(err) - -// nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err = nftKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// err = keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) - -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := keeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: true, -// }) -// suite.Require().NoError(err) - -// if tc.fullPay { -// err := keeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } -// } - -// listing.State = tc.listingState -// keeper.SetNftListing(suite.ctx, listing) - -// oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.nftOwner, "uguu") -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) -// keeper.HandleFullPaymentsPeriodEndings(suite.ctx) - -// switch tc.listingState { -// case types.ListingState_SELLING_DECISION: -// if tc.fullPay { -// // add successful listing state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status -// listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) -// suite.Require().Equal(listing.SuccessfulBidEndAt, suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingNftDeliveryPeriod))) -// } else if tc.numBids > 1 { -// // status => ListingState_BIDDING -// listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_BIDDING) -// } else { -// // status => ListingState_LISTING -// listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_LISTING) -// } -// case types.ListingState_END_LISTING: -// if tc.fullPay { -// // add successful bid state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status, close all the other bids -// listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) -// suite.Require().Equal(listing.SuccessfulBidEndAt, suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingNftDeliveryPeriod))) -// } else { -// // all the bids closed, pay depositCollected, nft listing delete, transfer nft to fully paid bidder -// _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) - -// bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Len(bids, 0) - -// newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.nftOwner, "uguu") -// suite.Require().True(newOwnerBalance.Amount.GT(oldNftOwnerBalance.Amount)) - -// nft, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(nft.Owner, tc.nftOwner) -// } -// } -// suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) -// } -// } - -// func (suite *KeeperTestSuite) TestDelieverSuccessfulBids() { -// suite.SetupTest() -// keeper := suite.keeper - -// classId := "class1" -// nftId := "nf1" -// nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// now := time.Now().UTC() - -// suite.ctx = suite.ctx.WithBlockTime(now) -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{coin}) -// suite.NoError(err) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: classId, -// Name: classId, -// Symbol: classId, -// Description: classId, -// Uri: classId, -// }) -// err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: classId, -// Id: nftId, -// Uri: nftId, -// UriHash: nftId, -// }, nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} -// err = keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) - -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err = keeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: true, -// }) -// suite.Require().NoError(err) -// err = keeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) - -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// listing.SuccessfulBidEndAt = now -// listing.State = types.ListingState_SUCCESSFUL_BID -// keeper.SetNftListing(suite.ctx, listing) - -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) -// oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") - -// keeper.DelieverSuccessfulBids(suite.ctx) - -// // check nft transfer -// newNftOwner := suite.app.NFTKeeper.GetOwner(suite.ctx, classId, nftId) -// suite.Require().NoError(err) -// suite.Require().Equal(newNftOwner.String(), bidder.String()) - -// // check fee paid -// newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") -// suite.Require().True(newOwnerBalance.Amount.GT(oldNftOwnerBalance.Amount)) - -// // check bid deleted -// bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Len(bids, 0) - -// // check nft listing deleted -// _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) - -// // check if AfterNftPaymentWithCommission is called -// suite.Require().True(statusAfterNftPaymentWithCommission) -// } - -// func (suite *KeeperTestSuite) TestProcessPaymentWithCommissionFee() { -// tests := []struct { -// testCase string -// loanAmount sdk.Int -// }{ -// { -// testCase: "zero loan", -// loanAmount: sdk.ZeroInt(), -// }, -// { -// testCase: "positive loan", -// loanAmount: sdk.NewInt(10), -// }, -// } - -// for _, tc := range tests { -// suite.SetupTest() -// keeper := suite.keeper -// statusAfterNftPaymentWithCommission = false - -// amount := sdk.NewInt(1000000) -// owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{sdk.NewCoin("uguu", amount)}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{sdk.NewCoin("uguu", amount)}) -// suite.NoError(err) - -// var nftId types.NftIdentifier -// keeper.ProcessPaymentWithCommissionFee(suite.ctx, owner, "uguu", amount, tc.loanAmount, nftId) - -// params := keeper.GetParamSet(suite.ctx) -// fee := amount.Mul(sdk.NewInt(int64(params.NftListingCommissionFee))).Quo(sdk.NewInt(100)) -// listingPayment := amount.Sub(fee).Sub(tc.loanAmount) - -// // check fee paid to NftTradingFee -// tradingFeeModuleAcc := suite.app.AccountKeeper.GetModuleAddress(ecoincentivetypes.ModuleName) -// tradingFeeBal := suite.app.BankKeeper.GetBalance(suite.ctx, tradingFeeModuleAcc, "uguu") -// suite.Require().Equal(tradingFeeBal, sdk.NewCoin("uguu", fee)) - -// // check fee to lister -// ownerBal := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "uguu") -// suite.Require().Equal(ownerBal, sdk.NewCoin("uguu", listingPayment)) - -// // check if AfterNftPaymentWithCommission is called -// suite.Require().True(statusAfterNftPaymentWithCommission) -// } -// } - -// func (suite *KeeperTestSuite) TestDelieverSuccessfulBidForPositiveLoan() { -// suite.SetupTest() -// keeper := suite.keeper - -// classId := "class1" -// nftId := "nf1" -// nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// now := time.Now().UTC() - -// suite.ctx = suite.ctx.WithBlockTime(now) -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{coin}) -// suite.NoError(err) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: classId, -// Name: classId, -// Symbol: classId, -// Description: classId, -// Uri: classId, -// }) -// err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: classId, -// Id: nftId, -// Uri: nftId, -// UriHash: nftId, -// }, nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} -// err = keeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// suite.Require().NoError(err) - -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // init tokens to addr -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err = keeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: true, -// }) -// suite.Require().NoError(err) -// err = keeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) - -// listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// listing.SuccessfulBidEndAt = now -// listing.State = types.ListingState_SUCCESSFUL_BID -// keeper.SetNftListing(suite.ctx, listing) - -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) - -// loanAmount := sdk.NewInt64Coin("uguu", 10) -// params := keeper.GetParamSet(suite.ctx) -// commissionFee := params.NftListingCommissionFee -// feeAmount := coin.Amount.Mul(sdk.NewInt(int64(commissionFee))).Quo(sdk.NewInt(100)) -// err = keeper.Borrow(suite.ctx, &types.MsgBorrow{ -// Sender: nftOwner.Bytes(), -// NftId: nftIdentifier, -// Amount: loanAmount, -// }) -// suite.Require().NoError(err) - -// oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") -// suite.NotPanics(func() { -// keeper.DelieverSuccessfulBids(suite.ctx) -// }) - -// // check nft transfer -// newNftOwner := suite.app.NFTKeeper.GetOwner(suite.ctx, classId, nftId) -// suite.Require().NoError(err) -// suite.Require().Equal(newNftOwner.String(), bidder.String()) - -// // check fee paid -// newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") -// suite.Require().True(newOwnerBalance.Amount.Equal(oldNftOwnerBalance.Amount.Add(coin.Amount).Sub(feeAmount).Sub(loanAmount.Amount))) - -// // check bid deleted -// bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Len(bids, 0) - -// // check nft listing deleted -// _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) - -// suite.Require().True(statusAfterNftPaymentWithCommission) -// } - -// // TestReListingDataManagement is a test to check if the all data related listing like bid and loan -// // works as intended when the list is re-listed by system or even by user's hand -// func (suite *KeeperTestSuite) TestReListingDataManagement() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) -// nftIdentifier := types.NftIdentifier{ClassId: "class1", NftId: "nft1"} -// nftOwner := acc1 - -// tests := []struct { -// testCase string -// numBids int -// listingState types.ListingState -// fullPay bool -// borrow bool -// }{ -// { -// testCase: "selling decision listing when highest bid is paid and no more bids", -// numBids: 1, -// listingState: types.ListingState_SELLING_DECISION, -// fullPay: true, -// borrow: true, -// }, // status => ListingState_LISTING -// { -// testCase: "selling decision listing when highest bid is not paid and no more bids", -// numBids: 1, -// listingState: types.ListingState_SELLING_DECISION, -// borrow: true, -// }, // status => ListingState_LISTING -// { -// testCase: "selling decision listing when highest bid is not paid, and more bids", -// numBids: 2, -// listingState: types.ListingState_SELLING_DECISION, -// borrow: true, -// }, // status => ListingState_BIDDING -// { -// testCase: "end listing when no bids is not paid", -// numBids: 1, -// listingState: types.ListingState_END_LISTING, -// borrow: true, -// }, // status => delist -// { -// testCase: "end listing when no bids is not paid", -// numBids: 1, -// listingState: types.ListingState_END_LISTING, -// fullPay: true, -// borrow: true, -// }, // status => delist -// } - -// for _, tc := range tests { -// suite.SetupTest() - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{coin}) - -// _ = suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: nftIdentifier.ClassId, -// Name: nftIdentifier.ClassId, -// Symbol: nftIdentifier.ClassId, -// }) -// _ = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: nftIdentifier.ClassId, -// Id: nftIdentifier.NftId, -// }, nftOwner) - -// _ = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinBid: sdk.ZeroInt(), -// BidActiveRank: 2, -// }) -// listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) - -// for i := 0; i < tc.numBids; i++ { -// if tc.borrow { -// suite.PlaceAndBorrow(coin, nftIdentifier, nftOwner, tc.fullPay, 2) -// } else { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) - -// _ = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// Amount: coin, -// AutomaticPayment: false, -// }) -// } -// } - -// listing.State = tc.listingState -// suite.app.NftmarketKeeper.SetNftListing(suite.ctx, listing) - -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) -// suite.app.NftmarketKeeper.HandleFullPaymentsPeriodEndings(suite.ctx) -// bids := suite.app.NftmarketKeeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) -// loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - -// // check bids and loan data specifically -// switch tc.listingState { -// case types.ListingState_SELLING_DECISION: -// if tc.numBids > 1 { -// // status => ListingState_BIDDING -// listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_BIDDING) -// suite.Require().NotEmpty(bids) -// suite.Require().NotEmpty(loan) -// } else if tc.fullPay { -// // status => ListingState_SUCCESSFUL_BID -// // this simulates the state of re-lisitng from the situation the list is successfully sent to -// // a buyer and buyer lists it -// listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) -// suite.Require().Len(bids, 1) -// suite.Require().Empty(loan) -// } else { -// // status => ListingState_LISTING -// listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_LISTING) -// suite.Require().Empty(bids) -// suite.Require().Empty(loan) -// } -// case types.ListingState_END_LISTING: -// if tc.fullPay { -// // pay depositCollected, nft listing delete, transfer nft to fully paid bidder -// // this simulates the state of re-listing from the situation the list was handed to buyer -// // and that buyer lists -// listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) -// suite.Require().Len(bids, 1) -// suite.Require().Empty(loan) -// } else { -// // all the bids closed, pay depositCollected, nft listing delete -// // this simulates the state of re-listing from the situation the list was handed to buyer -// _, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().Error(err) -// suite.Require().Empty(bids) -// suite.Require().Empty(loan) -// } -// } -// } -// } diff --git a/deprecated/x/nftmarketv1/keeper/params.go b/deprecated/x/nftmarketv1/keeper/params.go deleted file mode 100644 index 70fea131c..000000000 --- a/deprecated/x/nftmarketv1/keeper/params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -) - -// GetParamSet returns token params from the global param store -func (k Keeper) GetParamSet(ctx sdk.Context) types.Params { - var p types.Params - k.paramSpace.GetParamSet(ctx, &p) - return p -} - -// SetParamSet sets token params to the global param store -func (k Keeper) SetParamSet(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} diff --git a/deprecated/x/nftmarketv1/keeper/querier.go b/deprecated/x/nftmarketv1/keeper/querier.go deleted file mode 100644 index 2bb7c0d51..000000000 --- a/deprecated/x/nftmarketv1/keeper/querier.go +++ /dev/null @@ -1,28 +0,0 @@ -package keeper - -// import ( -// "github.com/cosmos/cosmos-sdk/codec" -// sdk "github.com/cosmos/cosmos-sdk/types" -// sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" - -// abci "github.com/cometbft/cometbft/abci/types" -// ) - -// func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { -// return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { -// var ( -// res []byte -// err error -// ) - -// switch path[0] { -// // this line is used by starport scaffolding # 1 -// default: -// err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown %s query endpoint: %s", types.ModuleName, path[0]) -// } - -// return res, err -// } -// } diff --git a/deprecated/x/nftmarketv1/keeper/utils.go b/deprecated/x/nftmarketv1/keeper/utils.go deleted file mode 100644 index ccdd264c9..000000000 --- a/deprecated/x/nftmarketv1/keeper/utils.go +++ /dev/null @@ -1,37 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" -) - -func Contains(a []string, x string) bool { - for _, n := range a { - if x == n { - return true - } - } - return false -} - -func GetMemo(txBytes []byte, txCfg client.TxConfig) string { - /// NOTE: this way requires txConfig by importing it into keeper struct - txData, err := txCfg.TxDecoder()(txBytes) - if err != nil { - fmt.Printf("err: %v\n", err) - - txData, err = txCfg.TxJSONDecoder()(txBytes) - if err != nil { - fmt.Printf("err: %v\n", err) - } - } - - txBldr, err := txCfg.WrapTxBuilder(txData) - if err != nil { - return "" - } - memo := txBldr.GetTx().GetMemo() - - return memo -} diff --git a/deprecated/x/nftmarketv1/module.go b/deprecated/x/nftmarketv1/module.go deleted file mode 100644 index 60cb12bf2..000000000 --- a/deprecated/x/nftmarketv1/module.go +++ /dev/null @@ -1,174 +0,0 @@ -package nftmarketv1 - -// import ( -// "context" -// "encoding/json" -// "fmt" - -// "github.com/gorilla/mux" -// "github.com/grpc-ecosystem/grpc-gateway/runtime" -// "github.com/spf13/cobra" - -// abci "github.com/cometbft/cometbft/abci/types" - -// "github.com/cosmos/cosmos-sdk/client" -// "github.com/cosmos/cosmos-sdk/codec" -// cdctypes "github.com/cosmos/cosmos-sdk/codec/types" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/types/module" - -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/client/cli" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/keeper" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" -// ) - -// var ( -// _ module.AppModule = AppModule{} -// _ module.AppModuleBasic = AppModuleBasic{} -// ) - -// // ---------------------------------------------------------------------------- -// // AppModuleBasic -// // ---------------------------------------------------------------------------- - -// // AppModuleBasic implements the AppModuleBasic interface for the capability module. -// type AppModuleBasic struct { -// cdc codec.Codec -// } - -// func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { -// return AppModuleBasic{cdc: cdc} -// } - -// // Name returns the capability module's name. -// func (AppModuleBasic) Name() string { -// return types.ModuleName -// } - -// func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { -// types.RegisterCodec(cdc) -// } - -// func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { -// types.RegisterCodec(cdc) -// } - -// // RegisterInterfaces registers the module's interface types -// func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { -// types.RegisterInterfaces(reg) -// } - -// // DefaultGenesis returns the capability module's default genesis state. -// func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { -// return cdc.MustMarshalJSON(types.DefaultGenesis()) -// } - -// // ValidateGenesis performs genesis state validation for the capability module. -// func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { -// var genState types.GenesisState -// if err := cdc.UnmarshalJSON(bz, &genState); err != nil { -// return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) -// } -// return genState.Validate() -// } - -// // RegisterRESTRoutes registers the capability module's REST service handlers. -// func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -// } - -// // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -// func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { -// types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -// } - -// // GetTxCmd returns the capability module's root tx command. -// func (a AppModuleBasic) GetTxCmd() *cobra.Command { -// return cli.GetTxCmd() -// } - -// // GetQueryCmd returns the capability module's root query command. -// func (AppModuleBasic) GetQueryCmd() *cobra.Command { -// return cli.GetQueryCmd(types.StoreKey) -// } - -// // ---------------------------------------------------------------------------- -// // AppModule -// // ---------------------------------------------------------------------------- - -// // AppModule implements the AppModule interface for the capability module. -// type AppModule struct { -// AppModuleBasic - -// keeper keeper.Keeper -// accountKeeper types.AccountKeeper -// bankKeeper types.BankKeeper -// } - -// func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, -// bankKeeper types.BankKeeper) AppModule { -// return AppModule{ -// AppModuleBasic: NewAppModuleBasic(cdc), -// keeper: keeper, -// accountKeeper: accountKeeper, -// bankKeeper: bankKeeper, -// } -// } - -// // Name returns the capability module's name. -// func (am AppModule) Name() string { -// return am.AppModuleBasic.Name() -// } - -// // Route returns the capability module's message routing key. -// func (am AppModule) Route() sdk.Route { -// return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -// } - -// // QuerierRoute returns the capability module's query routing key. -// func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// // LegacyQuerierHandler returns the capability module's Querier. -// func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { -// return keeper.NewQuerier(am.keeper, legacyQuerierCdc) -// } - -// // RegisterServices registers a GRPC query service to respond to the -// // module-specific GRPC queries. -// func (am AppModule) RegisterServices(cfg module.Configurator) { -// types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -// } - -// // RegisterInvariants registers the capability module's invariants. -// func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// // InitGenesis performs the capability module's genesis initialization It returns -// // no validator updates. -// func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { -// var genState types.GenesisState -// // Initialize global index to index in genesis state -// cdc.MustUnmarshalJSON(gs, &genState) - -// InitGenesis(ctx, am.keeper, am.accountKeeper, genState) - -// return []abci.ValidatorUpdate{} -// } - -// // ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -// func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { -// genState := ExportGenesis(ctx, am.keeper) -// return cdc.MustMarshalJSON(&genState) -// } - -// // ConsensusVersion implements AppModule/ConsensusVersion. -// func (AppModule) ConsensusVersion() uint64 { return 2 } - -// // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -// func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { -// } - -// // EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// // returns no validator updates. -// func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { -// EndBlocker(ctx, am.keeper) -// return []abci.ValidatorUpdate{} -// } diff --git a/deprecated/x/nftmarketv1/spec/01_concepts.md b/deprecated/x/nftmarketv1/spec/01_concepts.md deleted file mode 100644 index ffd6b4a55..000000000 --- a/deprecated/x/nftmarketv1/spec/01_concepts.md +++ /dev/null @@ -1,166 +0,0 @@ -# Concepts - -stablecoins can be minted with NFT as collateral - -# requirement - -## basic - -## auction system - -1. 出品者はbid_active_rankを決めることができる -1. bid_active_rankは入札デポジット額、入札キャンセル額、担保額、落札者決定ロジックに影響する - see 10_Generalized_auction_deposit.md -1. オークションには、通常オークションとlate shipping nftオークションがある -1. 通常オークションはプロトコル上でNFTの受け渡しが行われるオークション -1. late shipping nftオークションはプロトコル以外で受け渡すものがあるオークション - -### listing - -1. 所有しているNFTを出品することができる -1. 出品時にbid_active_rankを1...100までの数値を決めることができる(default:10, default is global_option) -1. 入札に使うトークンは出品者がBDに基づいて決定する(global_option) -1. 出品するNFTはロックされる -1. 誰も入札がいない場合は、x回まで自動的で再出品される(global_option) -1. 認証済みのNFTを表示できる -1. 出品時に、最低入札額を決めることができる(min is global_option) -1. 出品時に、最低落札額を決めることができる(min is global_option) -1. 出品時に、通常オークションとlate shipping nftオークションのどちらかを選ぶことできる -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### listing cancel - -1. 誰にも入札されていない場合に、出品者は出品キャンセルすることができる -1. 入札されている場合は、出品者は出品キャンセル手数料を支払うことで出品キャンセルすることができる -1. 出品キャンセル手数料は入札デポジット額のX%(global_option) -1. 出品キャンセル手数料は、落札候補者にデポジット額割合に応じて分配される -1. 出品キャンセルは出品後N秒経過後にしか行えない(global_option) -1. 出品キャンセルするとNFTはロック解除され出品者に返却される -1. ロックされた入札デポジットは全て払い戻される -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### expand auction period - -1. 出品者はBDトークンを支払い、オークションの期間を延長することができる(global_option) -1. 出品延長手数料は、落札候補者へデポジット額割合に応じて分配される -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### bid - -1. 出品されているNFTを入札することができる -1. 入札するトークンはBD基準を満たしていないといけない -1. 最低入札額を上回っていないと入札できない -1. トークンp円分で入札するとd円分がデポジットされる(計算式 $d=\frac{1}{bid_active_rank}\times p$) -1. 入札が行われる時に、出品残り時間N時間の場合、自動的にn'分出品時間が伸びる(global_option) -1. 最低落札価格を下回る入札は受け付けない -1. 最低落札価格以下の入札は、オークションに記録され、通常の入札情報として扱われる -1. 入札者は入札時に自動支払い機能を有効にすることができる -1. 入札者とtxのSignが一致していること、それ以外の場合は、受け付けずログを残すこと - -### bid cancel - -1. 入札をキャンセルすることができる -1. 自分自身しか入札していない場合は、キャンセルすることができない -1. キャンセルする入札者の入札順位がbid_active_rank以下の場合は無料で入札キャンセルできる -1. キャンセルする入札者の入札順位がbid_active_rank以上の場合はキャンセル料計算に基づいたキャンセル料を支払うことで入札キャンセルできる -1. キャンセル料計算式: ```MAX{キャンセルしたい入札者のデポジット額 - (総デポジット額 - 出品者が借りている額), 0}``` -1. 入札のキャンセルは入札後X日後にしか行えない(global_option) -1. 入札キャンセル成立後、X日後にトークンの払い出される (global_option) -1. 入札をキャンセルされた出品者は清算が起こる可能性がある -1. 入札者かつtxと入札キャンセル者のSignが一致していること、それ以外の場合は、受け付けずログを残すこと - -### SellingDecision - -1. 出品者は入札がある時に落札者を決定することができる -1. 落札者はN時間以内に入札金額 - デポジット金額を支払う必要がある(global_option) -1. 落札者が期限内に支払わない場合、デポジット金額が徴収される -1. 落札者が期限内に支払わない場合、オークションの期間がX日延長されオークションが再開される(global_option) -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### end auction - -1. オークションは時間経過で終了する -1. オークションが終了すると、bid_active_rank位以下のデポジットは返還される -1. オークションが終了すると、bid_active_rank位以上は落札候補者として扱われる -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### pay auction fee - -1. 落札候補者はN時間までにデポジット額を引いた入札額を支払う必要がある (global_option) -1. 自動支払いが有効な場合は、残高があれば自動的に支払うことができる -1. N時間経過後、protocolは最上位入札から順番に落札候補者が入札額を支払ったか確認する -1. 確認時に支払っていない落札候補者のデポジット額は徴収される -1. 落札候補者の支払いが確認できたら、それを落札者とする -1. 落札者よりも下の落札候補者のデポジット額は返還する -1. 出品者に支払われる落札価格は、徴収デポジット額 + (入札額 - デポジット額)となる -1. 落札候補者が全員支払わなかった場合は、徴収デポジット額+NFTを出品者に渡す -1. オークションが成立すると、出品者にトークン、落札者にNFTが引き渡される -1. NFTの引き渡しは落札後X日経過後 (global_option) -1. Tokenの引き渡しは落札後X日経過後 (global_option) -1. オークションが成立した場合、 価格情報を記録しqueryで引き出せること -1. 価格情報はNFT,出品者,落札者,落札日時,落札タイプ,入札件数,落札金額を累積で記録すること - -### late shipping nft - -1. late shipping nftオークションは落札者が支払い後、出品者がプロトコル以外の場所で受け渡しを行う -1. 落札者が出品者から受け取り後オークションが終了となる -1. オークション終了後に出品者にTokenが支払われる -1. Tokenの引き渡しは落札後X日経過後 (global_option) - -### boost staking reward - -1. BDが直接借用資産型の場合に、入札すると(入札者がステーキングしているGUU x 2 or N)を限度額にステーキングGUUが増える (global_option) -1. ステーキングGUUが増える期間はオークションが終了するか、入札キャンセルを行うまで - -### borrow - -1. 直接借用資産型オークションの場合、出品者は入札されたbid_active_rank位以上の総デポジットを限度額とし、protocolから直接借りることができる -1. 出品者は借りたトークンをprotocolへ戻すことができる -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### CDP - -1. 合成資産造成型オークションの場合、出品者は入札されたbid_active_rank位以上の総デポジットを担保とし、それでステーブルトークンを発行できる -1. 出品者は発行したステーブルトークンをprotocolへ戻すことができる -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### liquidation - -1. 入札トークン価値が下がり、発行したステーブルトークンの総額が入札額の50%を上回った場合、清算するかステーブルトークンを戻して50%以下にしなければ、NFTが入札者に強制的に支払われることになる -1. 清算が発生している時に、N時間までにステーブルトークンを戻すか、落札を決めないと罰則が発生する (global_option) -1. 罰則は、出品者に対して、トークンが支払われず、それ以外は落札と同じ流れとなる -1. 罰則時に落札候補者全員が支払わない場合にNFTと徴収デポジットはモジュールが持つ -1. 出品者のSign以外の場合は、受け付けずログを残すこと - -### BD(Bid Denom) - -1. BDはオークションに使用されるトークン基準 -1. BDは2種類あり、オークションタイプや出品者がstableトークンを発行することにより変更になる。 -1. 直接借用資産型オークションの場合、BDは、出品者が指定した単一のトークンになる。 (global_option) -1. 合成資産造成型オークションの場合、BDは、UnUniFiがサポートする任意のトークンを使用できる (global_option) - -## expanded - -### incentive system - -1. 買い戻し発生時に、NFT作者、外部フロントエンドエンジニア、ecosystemプールにそれぞれN%のインセンティブが発生する (global_option) -1. 落札時に、NFT作者、外部フロントエンドエンジニア、ecosystemプールにそれぞれN%のインセンティブが発生する (global_option) - -### vault system - -1. 出品したNFTはVaultに格納される -1. 入札に使用したトークンはVaultに格納される -1. NFTを担保にCDPする場合は、vaultを経由して行う -1. 落札時のNFT払い出しは、vaultを経由して行う -1. 落札時のトークン払い出しは、vaultを経由して行う -1. vaultはセキュリティインシデントが起きた時にXによって閉めることができる (global_option) - -### saving system - -1. voteによって奪われたトークンを取り戻すことができる -1. voteによって奪われたNFTを取り戻すことができる -1. Xの権利でIBCチャンネルを閉じることができる (global_option) -1. Xの権利で特定の入札トークンの利用取り消すことができる (global_option) -1. Xの権利でオークション機能を停止することができる (global_option) - -※global_option is defined by genesisjson diff --git a/deprecated/x/nftmarketv1/spec/01_concepts_en.md b/deprecated/x/nftmarketv1/spec/01_concepts_en.md deleted file mode 100644 index 7d0dd0d81..000000000 --- a/deprecated/x/nftmarketv1/spec/01_concepts_en.md +++ /dev/null @@ -1,175 +0,0 @@ -# Concepts - -stablecoins can be minted with NFT as collateral - -# requirement - -## basic - -## listing system - -1. listers decide “bid_active_rank” -1. bid_active_rank affects bid deposit amount, bid cancellation amount, collateral amount, and bidder determination logic - see 10_Generalized_listing_deposit.md -1. There are two types of listing - normal listing - late shipping nft listing. -1. normal listing is an listing where NFTs are passed and received over the protocol -1. late shipping nft listing are listing with delivery outside of protocol - -### listing - -1. You can list the NFTs you own on the marketplace. -1. The lister can decide the bid_active_rank from a number between 1 to 100 at the time of listing. (default:x, default is global_option) -1. the token used for bidding is determined by the lister based on BD.(global_option) -1. the NFT to be listed on the marketplace is locked -1. if no bids are received, the item will automatically be re-listed up to x times (global_option) -1. Lister can display authenticated NFTs -1. Lister can decide a minimum bid at the time of listing (global_option) -1. Lister can choose between normal listing and late shipping nft listing at the time of listing -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### listing cancel - -1. if no one has bid on the item, the lister can cancel the listing -1. if a bid has been placed, the lister may cancel the listing by paying a cancellation fee -1. cancellation fee is X% of the bid deposit(global_option) -1. Commission paid by the lister will be divided wining bidder candidate in proportion to their percentage of the deposit amount -1. The listing of items can only be cancelled after N seconds have elapsed from the time it was placed on the marketplace (global_option) -1. the NFT to be listed will be unlocked and returned to the lister when the listing is cancelled -1. bid deposits will be refunded -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### expand listing period - -1. the lister can pay BD tokens to extend the period of the listing (global_option) -1. Commission paid by the lister will be divided wining bidder candidate in proportion to their percentage of the deposit amount -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### bid - -1. you can bid on the NFTs on the marketplace -1. tokens to be bid on must meet BD criteria -1. you cannot bid unless you exceed the minimum bid -1. bidding with "p" amount of tokens will deposit "d" amount(Calculation Formula: $d=\frac{1}{bid_active_rank}\times p$) -1. if the bidder has N hours remaining in the listing when the bidding takes place, the listing time will automatically be extended by n' minutes. (global_option) -1. bids below the minimum bid price will not be accepted -1. Bids below the minimum bid price are recorded in the listing and treated as normal bidding information -1. bidders can activate the automatic payment feature at the time of bidding -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### bid cancel - -1. you can cancel your bid -1. if you are the only bidder yourself, you cannot cancel -1. Bidder can cancel bids free of charge if the bidder's bid rank is below the bid_active_rank. -1. if the bid rank is bid_active_rank or higher, the bid can be cancelled by paying a cancellation fee. -1. Cancellation Fee Formula: `MAX{canceling_bidder's_deposit - (total_deposit - borrowed_lister_amount), 0}` -1. bids can only be cancelled X days after bidding (global_option) -1. tokens will be reimbursed X days after the bid cancellation is approved (global_option) -1. Liquidation may occur for sellers whose bids are cancelled. -1. the bidder and the bid canceller's Sign must match, otherwise the bid will not be accepted and a log will be kept. - -### SellingDecision - -1. the lister can decide the successful bidder when there are bids -1. the winning bidder must pay the bid amount - deposit amount within N hours (global_option) -1. if the successful bidder fails to pay on time, the amount of the successful bidder's deposit will be collected -1. if the winning bidder does not pay by the due date, the listing period will be extended for X days and the listing will be restarted (global_option) -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### end listing - -1. the listing will end after a certain amount of time -1. deposits below the bid_active_rank will be returned at the end of the listing -1. at the end of the listing, the bidder with the bid_active_rank position or higher will be considered as a wining bidder candidate -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### pay listing fee - -1. the wining bidder candidates must pay the bid amount minus the deposit amount by N time (global_option) -1. if automatic payment is enabled, the candidate winning bidder's balance will be paid automatically -1. after N hours, the protocol checks whether the wining bidder candidates have paid their bids, starting with the highest bidder -1. the deposit amount of the wining bidder candidates who has not paid at the time of confirmation will be collected -1. upon confirmation of payment by the wining bidder candidates, it shall be the successful bidder -1. the deposit amount of the wining bidder candidates below the successful bidder will be returned -1. the winning bid price paid to the lister will be the amount of the `(deposit_collected + (bidder price - bidder deposit)) * (1.00 - fee_rate)` Note: fee_rate variable name could be changed -1. if all wining bidder candidates do not pay, the amount of the collected deposit plus NFT to be listed will be given to the lister -1. When an listing is successful, tokens are handed over to the lister and NFTs are handed over to the successful bidder. -1. delivery of the NFT will be made X days after the successful bid (global_option) -1. the Token will be delivered X days after the successful bid. (global_option) -1. When an listing is successful, the price information must be recorded and pulled up in query -1. the price information shall be recorded as NFT, lister, successful bidder, successful bid price, successful bid date and time, successful bid type, and the number of bids cumulatively. - -### late shipping nft - -1. late shipping nft listting are delivered by the lister outside of protocol after payment by the winning bidder -1. the listing will end after the winning bidder receives the item from the lister -1. Token will be paid to the lister after the listing ends. -1. the Token will be delivered X days after the successful bid. (global_option) - -### boost staking reward - -1. if the BD is a Direct Borrowed Asset type, When a bid is placed, the bidder's staking GUUs are increased up to the limit of (GUUs staked by bidder x 2 or N)(global_option) -1. staking GUUs will increase for a period of time until the listing ends or you cancel your bid - -### borrow - -1. in the case of a direct borrow asset type listing, the lister can borrow the Total deposit amount above bid_active_rank rank from the protocol -1. the lister can return the borrowed tokens to the protocol -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### CDP - -1. in the case of a synthetic asset creation type listings, the lister can issue stablecoins with the total deposit of bid_active_rank rank or higher as collateral -1. the lister can return the issued stave tokens to the protocol -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### liquidation - -1. if the amount of stabled tokens issued exceeds 50% of the bid amount due to a decline in the bid token value, you must liquidate or return the stabled tokens to less than 50% of the bid amount. -1. When liquidation is occurring, if you don't return the stave token by N hours or decide to win the bid, you will be penalized. (global_option) -1. the penalty is that no tokens will be paid to the lister. Other than that, the process will be the same as a successful bid. -1. the NFT and the collection deposit will be held by the module if all wining bidder candidates not pay at the time of penalty -1. tx will not be accepted except for the Lister's Sign. And keep a log. - -### BD(Bidding Token) - -1. BD is the token standard used for listings -1. There are two types of BDs, and they change depending on the listing type and whether the lister issues stablecoins. -1. for direct borrowing asset type listings, BD is only for tokens specified by the lister (global_option) -1. for synthetic asset creation type listings, BD can use any token supported by UnUniFi (global_option) - -### Trading Fee - -1. There's fee for the trading NFT except for trasaction fee -1. Specifically, that's extracted when user actually pay listing fee to buy NFT -1. The fee rate is defined as global_option between 0-100% -1. The protocol earned fee goes to the other module account (specific module has not decieded yet) -1. The fee is contained in bidding price - -## expanded - -### incentive system - -1. when a lister repurchases an NFT, the NFT author, the external front-end engineer, and the ecosystem pool will each receive an N% incentive (global_option) -1. upon winning the NFT bid, the NFT author, the external front-end engineer, and the ecosystem pool will each receive an N% incentive (global_option) - -### vault system - -1. the NFTs you submitted are stored in Vault -1. tokens used for bidding are stored in Vault -1. When you create CDP using NFT as collateral, do so via vault -1. NFT disbursement at the time of bidding is done via vault -1. Token disbursement at the time of bidding is done via vault -1. vault can be closed by X in the event of a security incident (global_option) - -### saving system - -1. vote allows you to regain tokens stolen from an attacker -1. vote allows you to regain NFTs stolen from an attacker -1. x can close the IBC channel (global_option) -1. X may cancel the use of a particular bid token (global_option) -1. X can stop the listing function (global_option) - -※global_option is defined by genesisjson diff --git a/deprecated/x/nftmarketv1/spec/01_state.md b/deprecated/x/nftmarketv1/spec/01_state.md deleted file mode 100644 index 0095fbbbe..000000000 --- a/deprecated/x/nftmarketv1/spec/01_state.md +++ /dev/null @@ -1,109 +0,0 @@ - - -# State - -## NftListing - -`NftListing` is created when a nft is listed for sell by owner. - -```protobuf -enum ListingType { - DIRECT_ASSET_BORROW = 0; - SYNTHETIC_ASSET_CREATION = 1; -} -enum ListingState { - SELLING = 0; - BIDDING = 1; - LIQUIDATION = 2; - END_LISTING = 3; - SUCCESSFUL_BID = 4; -} - -message NftIdentifier { - string class_id = 1; - string nft_id = 2; -} - -message NftListing { - NftIdentifier nft_id = 1 [ (gogoproto.nullable) = false ]; - ListingType listing_type = 2; - ListingState state = 3; - string bid_token = 4; - string min_bid = 5 [ - (gogoproto.moretags) = "yaml:\"min_bid\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - uint64 bid_active_rank = 6; -} -``` - -- NftListing: `"nft_listing" | format(nft) -> NftListing` -- NftListing by address: `"address_nft_listing" | format(address) | format(nft) -> format(nft)` - -## Bid - -`Bid` is created when a bidder bid on a nft listing. - -```protobuf -message NftBid { - NftIdentifier nft_id = 1 [ (gogoproto.nullable) = false ]; - string bidder = 2; - cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; -} -``` - -- Bid: `"nft_bid" | format(nft) | format(bidder) -> Bid` -- Bid by address: `"address_bid" | format(bidder) | format(nft) -> Bid` - -## Loan - -`Loan` is created when a nft lister make a loan from the protocol for using a listed nft as collateral. - -```protobuf -message Loan { - NftIdentifier nft_id = 1 [ (gogoproto.nullable) = false ]; - repeated cosmos.base.v1beta1.Coin loan = 2 [ (gogoproto.nullable) = false ]; -} -``` - -- Loan: `"nft_loan" | format(nft) -> Loan` -- Loan by address: `"nft_loan" | format(address) | format(nft) -> Loan` - -## Rewards - -`Rewards` stores how many tokens are eligible for an address to claim. - -- Rewards: `"rewards" | format(address) -> Coins` - -## Params - -`Params` describes global parameters that are maintained by governance. - -```protobuf -message Params { - string min_staking_for_listing = 1 [ - (gogoproto.moretags) = "yaml:\"min_staking_for_listing\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - repeated string bid_tokens = 2; - uint64 auto_relisting_count_if_no_bid = 3; - uint64 nft_listing_delay_seconds = 4; - uint64 nft_listing_period_initial = 5; - uint64 nft_listing_cancel_required_seconds = 6; - uint64 nft_listing_buy_back_extra_percentage = 7; - uint64 nft_listing_gap_time = 8; - uint64 bid_cancel_required_seconds = 9; - uint64 bid_token_disburse_seconds_after_cancel = 10; - uint64 nft_listing_full_payment_period = 11; - uint64 nft_listing_nft_delivery_period = 12; - uint64 nft_creator_share_percentage = 13; - string market_administrator = 14; - cosmos.base.v1beta1.Coin nft_listing_commission_fee = 15 [ (gogoproto.nullable) = false ]; - uint64 nft_listing_extend_seconds = 16; - cosmos.base.v1beta1.Coin nft_listing_period_extend_fee_per_hour = 17 [ (gogoproto.nullable) = false ]; -} -``` diff --git a/deprecated/x/nftmarketv1/spec/02_messages.md b/deprecated/x/nftmarketv1/spec/02_messages.md deleted file mode 100644 index 096e24c79..000000000 --- a/deprecated/x/nftmarketv1/spec/02_messages.md +++ /dev/null @@ -1,186 +0,0 @@ - - -# Messages - -In this section we describe the processing of the nftmarket messages. - -## MsgListNft - -```protobuf -message MsgListNft { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - ListingType listing_type = 3; - string bid_token = 4; - string min_bid = 5 [ - (gogoproto.moretags) = "yaml:\"min_bid\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - uint64 bid_active_rank = 6; -} -``` - -## MsgCancelNftListing - -```protobuf -message MsgCancelNftListing { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgNftBuyBack - -```protobuf -message MsgNftBuyBack { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgExpandListingPeriod - -```protobuf -message MsgExpandListingPeriod { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgPlaceBid - -```protobuf -message MsgPlaceBid { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgCancelBid - -```protobuf -message MsgCancelBid { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgEndNftListing - -```protobuf -message MsgEndNftListing { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} - -``` - -## MsgPayFullBid - -```protobuf -message MsgPayFullBid { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgBorrow - -```protobuf -message MsgBorrow { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgRepay - -```protobuf -message MsgRepay { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; - repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ]; -} -``` - -## MsgMintStableCoin - -```protobuf -message MsgMintStableCoin { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -``` - -## MsgBurnStableCoin - -```protobuf -message MsgBurnStableCoin { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -``` - -## MsgLiquidate - -```protobuf -message MsgLiquidate { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - NftIdentifier nft_id = 2 [ (gogoproto.nullable) = false ]; -} -``` diff --git a/deprecated/x/nftmarketv1/spec/02_state.md b/deprecated/x/nftmarketv1/spec/02_state.md deleted file mode 100644 index f6f13d67f..000000000 --- a/deprecated/x/nftmarketv1/spec/02_state.md +++ /dev/null @@ -1,8 +0,0 @@ -# state - -The `x/nftmarket` module keeps state of n primary objects: - -1. listing state. -1. bid balances. -1. NFT Ownership. -1. CDP balance using NFT. diff --git a/deprecated/x/nftmarketv1/spec/03_events.md b/deprecated/x/nftmarketv1/spec/03_events.md deleted file mode 100644 index c99e982e6..000000000 --- a/deprecated/x/nftmarketv1/spec/03_events.md +++ /dev/null @@ -1,82 +0,0 @@ - - -# Events - -The `nftmarket` module emits the following events: - -## MsgListNft - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgCancelNftListing - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgNftBuyBack - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgExpandListingPeriod - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgPlaceBid - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgCancelBid - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgEndNftListing - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgPayFullBid - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgBorrow - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgRepay - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgMintStableCoin - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgBurnStableCoin - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## MsgLiquidate - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## BeginBlocker - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | - -## EndBlocker - -| Type | Attribute Key | Attribute Value | -| ---- | ------------- | --------------- | diff --git a/deprecated/x/nftmarketv1/spec/03_listing_state.md b/deprecated/x/nftmarketv1/spec/03_listing_state.md deleted file mode 100644 index a4ceccd98..000000000 --- a/deprecated/x/nftmarketv1/spec/03_listing_state.md +++ /dev/null @@ -1,241 +0,0 @@ -# state - -The `x/nftmarket` module keeps state of n primary objects: - -## basic lithing abstract flow - -```mermaid -flowchart TD - listing --> bidding - bidding --> pay_fee - pay_fee --> swap_token_and_nft - swap_token_and_nft --> end_liting -``` - -## late shipping lithing abstract flow - -```mermaid -flowchart TD - listing --> bidding - bidding --> pay_fee - pay_fee --> lister_send_things_to_win_bidder - lister_send_things_to_win_bidder --> win_bidder_receive_things - win_bidder_receive_things --> swap_token_and_nft - swap_token_and_nft --> end_listing - -``` - -# basic listing - -## listing state - -|No |state |Description. | -|---|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------| -|1 |unsold_state |NFT not listed for listing | -|2 |listing_state |It's the state of listing. | -|3 |bidding_state |It's state that there are bids in the listing | -|4 |SellingDecision_state|It's state that the lister has decided to sell | -|5 |liquidation_state |The value of the Denom used for bidding has dropped. Therefore, the collateral rate for the stabled coins issued by lister has exceeded the threshold| -|6 |end_listing_state |It's just the state of the listing period has ended. | -|7 |successful_bid_state |The lister has ended and the candidate bidder has paid for the item. The successful bidder and lister can exchange NFTs and tokens. | - -### msg list - -| ID | Name | -| --- | -------------------- | -| 1 | sell Msg | -| 2 | cancel sell Msg | -| 3 | ------------ | -| 4 | SellingDecision Msg | -| 5 | end listing Msg | -| 6 | bid Msg | -| 7 | mint stable coin Msg | -| 8 | burn stable coin Msg | -| 9 | bid cancellation Msg | -| 10 | extend Msg | -| 11 | pay listing fee Msg | - -### listing flow - -```mermaid -flowchart TD - unsold_state -->|1.sell_msg| listing_state -  bidding_state -->|time out|Extend_listing_period{Extend listing period?} -  bidding_state -->|Exceeds available \n loan amount|liquidation{liquidation?} - bidding_state --->|collateral falls below \n the loan value|?{?} -  Extend_listing_period-->|Yes_10.extend_msg|bidding_state -  listing_state -->|6.bid_Msg| over_minimum_bid{over minimum bid?} - over_minimum_bid -->|Yes| bidding_state - over_minimum_bid -->|No_reject_6.bit_msg| listing_state - bidding_state -->|6.bit_Msg| bidding_state - bidding_state -->|7.Mint_Msg| bidding_state - bidding_state -->|8.Burn_Msg| bidding_state -  bidding_state -->|4.SellingDecisions_Msg| SellingDecisions_state - SellingDecisions_state --> check_pay_fee{pay_fee?} - check_pay_fee --yes--> successful_bid_state - check_pay_fee --no--> Deposit_collection_process_top_bidder - Deposit_collection_process_top_bidder --> bidding_state -  bidding_state -->|2.cancel_sell_msg| unsold_state - listing_state -->|2.cancel_sell_msg| unsold_state -  Extend_listing_period-->|No_or_NonAction| end_listing_state -  liquidation -->|Yes_5.end_listing_Msg| end_listing_state -  liquidation -->|No_8.BurnMsg| bidding_state -  liquidation -->|NonAction| penalty_process -  penalty_process -->|5.end_listing_Msg| end_listing_state -  end_listing_state --> pay_check{pay fee?} -  pay_check -->|yes| successful_bid_state -  pay_check -->|no| Deposit_collection_process -  Deposit_collection_process --> check_wining_bidder_candidates{any_wining_bidder_candidates?} -  check_wining_bidder_candidates -->|yes| pay_check -  check_wining_bidder_candidates -->|no| pay_collected_deposit_process -  pay_collected_deposit_process --> unsold_state -``` - -### listing Token and NFT flow - -#### case. start listing - -```mermaid -flowchart TD -subgraph start sell nft - lister1[[lister]] - listing_state[[listing_state]] - lister1--NFT--> listing_state -end -subgraph start listing - bidder1[[bidder]] - bidding_state1[[bidding_state]] - bidder1 --BD--> bidding_state1 -end -``` - -#### case. bidding - -```mermaid -flowchart TD -subgraph bidding_buy_back - bidder_buy_back[[bidder]] - lister_buy_back[[lister]] - NFT_author_buy_back[[NFT author]] - UI_author_buy_back[[UI author]] - - lister_buy_back --BD--> buy_back_process - buy_back_process --BD--> bidder_buy_back - buy_back_process --BD--> NFT_author_buy_back - buy_back_process --BD--> UI_author_buy_back - buy_back_process --NFT--> lister_buy_back -end - -subgraph bidding_expand_period - top_bidder_expand_period[[top_bidder]] - second_bidder_expand_period[[second_bidder]] - lister_expand_period[[lister]] - - lister_expand_period--BD--> expand_period_process - expand_period_process--BD--> top_bidder_expand_period - expand_period_process--BD--> second_bidder_expand_period -end -``` - -```mermaid -flowchart TD -subgraph bidding_mint_stable_token - lister[[lister]] - - bidding_state --BD--> cdp_process - cdp_process--stable_token--> lister -end - -subgraph bidding_prevent_liquidation - lister2[[lister]] - - lister2 --stable_token--> liquidation_process - liquidation_process--BD--> change_state_to_bidding_state -end -``` - -```mermaid -flowchart TD -subgraph bidding_accept_liquidation - lister3[[lister]] - - lister3 --> accept_liquidation_process - accept_liquidation_process--Locked_BD--> end_listing_process -end - -subgraph bidding_ignore_liquidation - bidder_state--BD--> force_liquidation_process - force_liquidation_process --BD--> NFT_author - force_liquidation_process --BD--> UI_author - force_liquidation_process --BD--> system - force_liquidation_process --NFT--> bidder -end -``` - -### bidding cancel - -Bid cancellations will have a delay before the tokens are returned -The time to return tokens for canceled bids can be determined at the time of the listing - -```mermaid -flowchart TD -subgraph bidding_cancel_bid - cancel_bidder[[cancel_bidder]] - check_mint{lister mint stable coins?} - check_limit{all bid deposit - cancel bid deposit < borrowed token amount?} - - check_mint.-NO.-> bidding_state - check_limit--No--> bidding_state - bidding_state--BD--> delay_time_process - check_mint--Yes--> check_limit - check_limit--Yes--> cancel_process - cancel_process --BD--> bidding_state - delay_time_process .-BD.-> cancel_bidder - delay_time_process --decrease_BD_or_empty--> cancel_bidder - -end -``` - -### end listing - -```mermaid -flowchart TD - -subgraph disigion - SellingDecision_state --> check_pay_only_top_bidder{payed?} - check_pay_only_top_bidder --yes--> successful_bid_state1 - check_pay_only_top_bidder --no--> collected_deposit_only_top_bidder - collected_deposit_only_top_bidder --deposit_BD--> bidding_state -end - -subgraph end listing - lister2[[lister]] - successful_bid_state1[successful_bid_state1] - end_listing_state --> check_pay{payed?} - check_pay --yes--> successful_bid_state1 - check_pay --no--> collected_deposit - collected_deposit --> check_wining_bidder{any_wining_bidder?} - check_wining_bidder --yes--> check_pay - check_wining_bidder --no--> return_process - return_process --NFT_and_BD--> lister2 - return_process --> unsold_state -end - -subgraph successful bid - bidder3[[bidder]] - lister3[[lister]] - NFT_author[[NFT author]] - UI_author[[UI author]] - end_listing_state3[end_listing_state] - end_listing_state3 --BD--> successful_bid_state - end_listing_state3 --NFT--> successful_bid_state - successful_bid_state --BD_and_Locked_BD--> lister3 - successful_bid_state --BD--> UI_author - successful_bid_state --BD--> NFT_author - successful_bid_state --NFT--> bidder3 -end -``` - -# late shipping nft listing - -TODO: Describe the detailed flow diff --git a/deprecated/x/nftmarketv1/spec/04.tokens.md b/deprecated/x/nftmarketv1/spec/04.tokens.md deleted file mode 100644 index 7be82c2ef..000000000 --- a/deprecated/x/nftmarketv1/spec/04.tokens.md +++ /dev/null @@ -1,34 +0,0 @@ -# tokens - -## How to determine BD(Bidding Token) - -- BD can be any token if the lister designated the "minting synthetic assets" type listing -- BD can be only the token designated by the lister if the lister designated the "directly borrowing assets" type listing - -```mermaid -flowchart TD - check_mint{lister want mint stable token?} - check_token{lister want Specific Token?} - - check_mint--NO--> check_token - check_token--Yes--> Single_token - check_token--No--> All_support_token - check_mint--Yes--> All_support_token -``` - -## bidding reward - -## UnUniFi Synthetic assets - -```mermaid -flowchart TD - subgraph case GUU withdraw - APP2 --2_ n GUU withdraw--> User2 - User2 --1_ n bGUU deposit--> APP2 - end - - subgraph case bGUU mint - APP1 --2_ n bGUU Mint--> User1 - User1 --1_ n GUU deposit--> APP1 - end -``` diff --git a/deprecated/x/nftmarketv1/spec/04_params.md b/deprecated/x/nftmarketv1/spec/04_params.md deleted file mode 100644 index ea5d0463d..000000000 --- a/deprecated/x/nftmarketv1/spec/04_params.md +++ /dev/null @@ -1,10 +0,0 @@ - - -# Parameters - -The `nftmarket` module contains the following parameters: - -| Key | Type | Example | -| --- | ---- | ------- | diff --git a/deprecated/x/nftmarketv1/spec/05.UX.md b/deprecated/x/nftmarketv1/spec/05.UX.md deleted file mode 100644 index 802eedcc7..000000000 --- a/deprecated/x/nftmarketv1/spec/05.UX.md +++ /dev/null @@ -1,129 +0,0 @@ -# UX - -## EN - -### lister - -1. Users can understand that they can listing NFTs -2. Users can listing NFTs. -3. Users can understand that the NFT was put up for listing. -4. Users can understand that they can cancel listings -5. User can cancel listings -6. Users can understand that listing has been cancled -7. Users can understand that the listing has ended with no bids over time. -8. Users can see how many NFTs are up for listing. -9. Users can understand when the listing will end. -10. Users can see how much they are bidding for a particular NFT and when the listing will close -11. Users understand that when there is a bid on a particular NFT, it can be sold. -12. Users can sell when there is a bid on a particular NFT. -13. Users can understand that a sale has been made when there is a bid on a particular NFT. -14. Users can understand that certain NFT listings were automatically sold over time. -15. Users understand that if no bids are received, they will be automatically extended at no charge. -16. Users understand that they can use GUUs to extend the time period of the listing if there are bids. -17. Users can use GUUs to extend the time period of the listing if there are bids. -18. Users could use GUUs to extend the listing period. -19. xxx -20. xxx -21. xxx -22. xx -23. xx -24. xx -25. xx -26. xx -27. xx -28. Users understand that they can issue stablecoins with NFT as collateral when there is a bid -29. Users can issue stablecoins with NFT as collateral when there is a bid -30. The user can understand that a STABLE token could be issued with the NFT as collateral. -31. xx -32. xx -33. xx -34. Users can understand that they can buy back NFTs even if there is a bid -35. Users can buy back NFTs even if there is a bid -36. Users can understand that the NFT was bought back - -### bidder - -1. Users can understand that the NFT was put up for listing -2. Users can search for NFTs in the listing by genre. -3. Users can search for NFTs in the listing by name. -4. Users can search for NFTs in the listing by series. -5. Users can search for NFTs in the listing by author. -6. Users can see how much a particular NFT has sold for at listing in the past. -7. xx -8. xx -9. xx -10. xx -11. xx -12. xx -13. Users can understand that they did not exceed the minimum level amount after bidding -14. Users can understand how many NFTs are under bidding -15. Users can understand that they could have won the NFT bid. -16. Users can understand that other users have bid above their bids -17. The user can understand that the listing period has been extended by the lister during the bidding process. -18. Users can understand how much GUU commission they received when the listing period was extended - -## JP - -### 出品者 - -1. ユーザーは NFT を出品できることがわかる -2. ユーザーは NFT を出品できる -3. ユーザーは NFT を出品できたことがわかる -4. ユーザーは出品をキャンセルできることがわかる -5. ユーザーは出品をキャンセルできる -6. ユーザーは出品をキャンセルできたことがわかる -1. ユーザーは入札がある時に有料で出品をキャンセルできることがわかる -1. ユーザーは入札がある時に有料で出品をキャンセルできる -1. ユーザーは入札がある時に有料で出品をキャンセルできたことがわかる -7. ユーザーは時間経過で入札が無く出品が終了したことがわかる -8. ユーザーは出品している NFT の数がわかる -9. ユーザーはいつ出品が終わるかわかる -10. ユーザーは特定の NFT にいくらで入札され、いつ出品が終了することがわかる -11. ユーザーは特定の NFT に入札がある時に、落札確定できることがわかる -12. ユーザーは特定の NFT に入札がある時に、落札確定できる -13. ユーザーは特定の NFT に入札がある時に、落札確定できたことがわかる -14. ユーザーは特定の NFT が時間経過で落札されたことがわかる -15. ユーザーは入札がない場合は無料で自動で延長されることがわかる -16. ユーザーは入札がある場合は GUU 使い出品期間を延長できることがわかる -17. ユーザーは出品期間を延長できる -18. ユーザーは出品期間を延長できたことがわかる -19. ユーザーは担保割れが起こると清算するか stable token を返済するかをしないと罰則が発生することがわかる -20. ユーザーは担保割れを起こす比率がわかること -21. ユーザーは担保割れが起こっていて、清算できることがわかること -22. ユーザーは清算できたことがわかること -23. ユーザーは担保割れが起こっていて、stable token を返済して入札状態にすることができることがわかること -24. ユーザーは stable token を補充できたことがわかること -25. ユーザーは stable token を補充され入札状態に戻ったことがわかること -26. ユーザーは担保割れが起こっていて、罰則までの時間がどれぐらいあるのかわかること -27. ユーザーは罰則が発生したことがわかること -28. ユーザーは入札があるときに NFT を担保に stable token を発行できることがわかること -29. ユーザーは入札があるときに NFT を担保に stable token を発行できること -30. ユーザーは入札があるときに NFT を担保に stable token を発行できたことがわかること -31. ユーザーは入札があり、stable_token を発行している時に、stable token を返済できることがわかること -32. ユーザーは入札があり、stable_token を発行している時に、stable token を返済できること -33. ユーザーは入札があり、stable_token を発行している時に、stable token を返済できたことがわかること -34. ユーザーは入札があるときに NFT を買戻しができることがわかる -35. ユーザーは入札があるときに NFT を買戻しできる -36. ユーザーは入札があるときに NFT を買戻しできたことがわかる - -### 入札者 - -1. ユーザーは NFT が出品されたことがわかること -2. ユーザーは NFT のジャンルごとに検索をかけることができること -3. ユーザーは NFT の名前ごとに検索をかけることができること -4. ユーザーは NFT のシリーズごとに検索をかけることができること -5. ユーザーは NFT の作者ごとに検索をかけることができること -6. ユーザーは過去に特定の NFT がいくらで落札されたかわかること -7. ユーザーは GUU を使い LGUU を生成できることがわかること -8. ユーザーは GUU を使い LGUU を生成できること -9. ユーザーは GUU を使い LGUU を生成できたことがわかること -10. ユーザーは LGUU を使い NFT を入札することができることをわかること -11. ユーザーは LGUU を使い NFT を入札することができること -12. ユーザーは LGUU を使い NFT を入札できたことがわかること -13. ユーザーは入札後に最低水準を上回らなかったことがわかること -14. ユーザーは入札中の NFT がいくつあるかわかること -15. ユーザーは NFT を落札できたことがわかること -16. ユーザーは落札した NFT がいくつあるかわかること -17. ユーザーは他の入札が上回ったことがわかること -18. ユーザーは入札されているときに、出品者によって延長されたことがわかること -19. ユーザーは延長時に GUU 手数料がいくら入ったかわかること diff --git a/deprecated/x/nftmarketv1/spec/06_client.md b/deprecated/x/nftmarketv1/spec/06_client.md deleted file mode 100644 index bd66e287a..000000000 --- a/deprecated/x/nftmarketv1/spec/06_client.md +++ /dev/null @@ -1,238 +0,0 @@ - - -# Client - -## CLI - -A user can query and interact with the `nftmarket` module using the CLI. - -### Query - -The `query` commands allow users to query `nftmarket` state. - -```sh -ununifid query nftmarket --help -``` - -#### classes - -The `classes` endpoint allows users to query all listing nft series. - -```sh -ununifid query nftmarket classes [flags] -``` - -Example: - -```sh -ununifid query nftmarket classes -``` - -Example Output: - -```yml -classes: -- id: a10 - name: crypotpunk - description: crypotpunk is awsome - symbol: cryp - uri: http... - uriHash: xxxxx - nft: - - id: ax10 - uri: http... - uriHash: xxxxx - nftCount: 20 -- id: b10 - name: ape - description: ape is awsome - symbol: ape - uri: http... - uriHash: xxxxx - nft: - - id: bx10 - uri: http... - uriHash: xxxxx - nftCount: 5 -pagination: - total: '2' -``` - -### Transactions - -The `tx` commands allow users to interact with the `nftmarket` module. - -```sh -ununifid tx nftmarket --help -``` - -#### listing - -The `listing` command listing NFT. - -```sh -ununifid tx nftmarket listing [class-id] [nft-id] [flags] -``` - -Example: - -```sh -ununifid tx nftmarket listing a10 a10 --from myKeyName --chain-id ununifi-x -``` - - -## gRPC - -A user can query the `nftmarket` module using gRPC endpoints. - -### Classes - -The `Classes` endpoint allows users to query all listing nft series. - -```sh -ununifif.nftmarket.v1beta1.Query/Classes -``` - -Example: - -```sh -grpcurl -plaintext \ - -d '{"nftLimit":"1"}' \ - localhost:9090 \ - ununifif.nftmarket.v1beta1.Query/Classes -``` - -Example Output: - -```json -{ - "classes": [ - { - "id":"a10", - "name":"crypotpunk", - "description":"crypotpunk is awsome", - "symbol":"cryp", - "uri":"http...", - "uriHash":"xxxxx", - "nft":[ - { - "id":"ax10", - "uri":"http...", - "uriHash":"xxxxx" - } - ], - "nftCount":20 - }, - { - "id":"b10", - "name":"ape", - "description":"ape is awsome", - "symbol":"ape", - "uri":"http...", - "uriHash":"xxxxx", - "nft":[ - { - "id":"bx10", - "uri":"http...", - "uriHash":"xxxxx" - } - ], - "nftCount":5 - } - ], - "pagination": { - "total": "2" - } -} -``` - -### Class - -The `Class` endpoint allows users to query listing nft series. - -```sh -ununifif.nftmarket.v1beta1.Query/Class -``` - -Example: - -```sh -grpcurl -plaintext \ - -d '{"classId":"a10", "nftLimit":"1"}' \ - localhost:9090 \ - ununifif.nftmarket.v1beta1.Query/Class -``` - -Example Output: - -```json -{ - "class": { - "id":"a10", - "name":"crypotpunk", - "description":"crypotpunk is awsome", - "symbol":"cryp", - "uri":"http...", - "uriHash":"xxxxx", - "nft":[ - { - "id":"ax10", - "uri":"http...", - "uriHash":"xxxxx", - } - ], - "nftCount":20, - } -} -``` - -### NFT - -The `NFT` endpoint allows users to query nft. - -```sh -ununifif.nftmarket.v1beta1.Query/Nft -``` - -Example: - -```sh -grpcurl -plaintext \ - -d '{"classId":"a10","nftId":"a10"}' \ - localhost:9090 \ - ununifif.nftmarket.v1beta1.Query/Nft -``` - -Example Output: - -```json -{ - "nft":{ - "classId":"a10", - "id":"ax10", - "uri":"http...", - "uriHash":"xxxxx", - "listingType":"DIRECT_ASSET_BORROW", - "bidToken":"uguu", - "state":"BIDDING", - "minBid":"1", - "bidActiverank":"2", - "bids":[ - { - "bidder":"ununifi1...", - "amount":"100uguu", - }, - { - "bidder":"ununifi1...", - "amount":"99uguu", - }, - { - "bidder":"ununifi1...", - "amount":"98uguu", - } - ], - } -} -``` diff --git a/deprecated/x/nftmarketv1/spec/06_security_design.md b/deprecated/x/nftmarketv1/spec/06_security_design.md deleted file mode 100644 index 984e69691..000000000 --- a/deprecated/x/nftmarketv1/spec/06_security_design.md +++ /dev/null @@ -1,76 +0,0 @@ -# security design - -利用状況整理 - ユーザーが、パブリックUIを通してシステムを利用し - トークンやNFTのような資産がブロックチェーンで保管し - 機密性は担保しない - ブロックチェーンでデータそのものを保護する - -現状 - - 守るべきもの - - システムのコンセンサス - - 利用者のNFT - - 利用者の残高 - - トークン価値 - -基本機能 - - アカウント管理 - - 特定 - できない - - 防御 - できない - - 検知 - 多分できない - - 対応 - ブラックリストに入れて、Sendできないようにする - - 復旧 - 新しいアカウントに送付 - - 認証 - Keplerにお任せ - - アクセス制御 - - 特定 - 役割の定義 - - 防御 - 役割によるアクセス制御 - - 検知 - アクセス制御の監視 - - 対応 - アクセス権限の無効化 - - 復旧 - アクセス権限の有効化 - - データ保護 - ブロックチェーンだから省略 - - バックアップ - VPSのバックアップ - チェーンのバックアップ - - 出品 - - 入札 - - 落札 - - 共通機能 - - ログ管理 - - ログ設計 - -直接的 - - 誤認させる - fake NFT→認証プロセスを設ける - - ~~51% attack~~ - - Goldfinger attack - NFT認証を壊す→tendermintに任せつつVPSとしてDDos攻撃に耐える設計にしておく - - ~~Hard Fork~~ - - marketplace manipulation - Mischievously listing items at auction→delay processを設ける - fake nftなどを大量出品して検索させなくする→GUUステーキングを強制させつつX品目から手数料が発生するようにする - - Sybil Attack - misleading bidding→delay processで対応 - Price Manipulation by Bidding→自動刻み入札を採用(like ヤフオク)して、入札ハードルを下げて1位と2位の入札額の差をうめる - - DNS Hijack - ~~BGP Hijack~~ - - Eclipse Attack - 攻撃方法を考える - - Wallet Attack - - DDoS - DDoS msg→システムアーキテクトとして対応する - - ~~Dusting Attack~~ - - attack dapp -間接的 - - Pricefeedの元を乗っ取る→IBC接続に変更する diff --git a/deprecated/x/nftmarketv1/spec/07_query_list.md b/deprecated/x/nftmarketv1/spec/07_query_list.md deleted file mode 100644 index 5b4868e32..000000000 --- a/deprecated/x/nftmarketv1/spec/07_query_list.md +++ /dev/null @@ -1,16 +0,0 @@ -# query list - -## query table - -|No |name |取得できる情報 | -|---|--------------|----------------------------------------------------------------------------------------| -|1 |出品したNFTの情報 |出品したNFTの詳細
 出品状態
 入札の件数
 最高入札金額
 担保率
 ステーブルトークンを発行残高
 担保割れか否か
 罰則開始時間
 罰則発生フラグ
 自動入札延長回数
| -|2 |出品したNFT一覧 |出品しているNFTの数
出品の終了時間
入札件数
最高入札金額
出品状態
担保使用率
担保率
ステーブルトークン発行残高
| -|3 |CDPした一覧 |担保した各NFTの担保率一覧
ステーブルトークンを発行残高一覧
| -|4 |全体で出品したNFTの一覧 |出品したNFT一覧
 NFT名
 NFT画像URL
 ジャンル名
 シリーズ名
 作者名
 価格
 前回落札価格
 オークションタイプ
| -|5 |全体で出品したNFTの検索 |出品したNFT一覧
 NFT名
 NFT画像URL
 ジャンル名
 シリーズ名
 作者名
 価格
 前回落札価格
 オークションタイプ
 出品日時
| -|6 |落札NFTの一覧 |落札したNFT一覧
 NFT名
 NFT画像URL
 ジャンル名
 シリーズ名
 作者名
 価格
 前回落札価格
 オークションタイプ
 落札日時
 出品日時
| -|7 |落札NFTの詳細 |落札したNFT一覧
 NFT名
 NFT画像URL
 ジャンル名
 シリーズ名
 作者名
 価格
 落札価格推移
 オークションタイプ
 落札日時
 出品日時
| -|8 |入札者の入札一覧 |落札したNFT一覧
 NFT名
 NFT画像URL
 ジャンル名
 シリーズ名
 作者名
 価格
 最上位入札者アドレス
 オークションタイプ
 出品日時
 入札日時
| -|9 |落札者の落札一覧 |落札したNFT一覧
 NFT名
 NFT画像URL
 ジャンル名
 シリーズ名
 作者名
 価格
 落札価格推移
 オークションタイプ
 落札日時
 出品日時
| -|10 |個人のNFTFiリワード一覧|残高 | diff --git a/deprecated/x/nftmarketv1/spec/08_dependent_module.md b/deprecated/x/nftmarketv1/spec/08_dependent_module.md deleted file mode 100644 index 9b904db8e..000000000 --- a/deprecated/x/nftmarketv1/spec/08_dependent_module.md +++ /dev/null @@ -1,4 +0,0 @@ -# dependent module - -vaults -nft-certification diff --git a/deprecated/x/nftmarketv1/spec/09_class_diagram.md b/deprecated/x/nftmarketv1/spec/09_class_diagram.md deleted file mode 100644 index a4a247c65..000000000 --- a/deprecated/x/nftmarketv1/spec/09_class_diagram.md +++ /dev/null @@ -1,44 +0,0 @@ -# class diagram - -```mermaid - classDiagram - Listing <|-- collateral - Listing <|-- Bid - Bid <|-- collateral - collateral <|-- stateOperation - Bid <|-- stateOperation - Listing <|-- stateOperation - class Listing{ - +enum tokenType - +enum listingType - +int minimumBid - +any listerInfo - list() - sold() - cancel() - canCancel() - buyBuck(Bid instance) - } - class Bid{ - bid() - cancel() - getTopBidder() - getBidderList() - } - class collateral { - mint() - burn() - } - class stateOperation { - +state - +time - nextState(string msgName) - } - class keeper{ - + collateralRateListByCollateral - + timeList - } -``` - -The collateralRateListByCollaterall is used for liquidation checks. -timeList is used for listing closeout checks. diff --git a/deprecated/x/nftmarketv1/spec/10_Generalized_listing_deposit.md b/deprecated/x/nftmarketv1/spec/10_Generalized_listing_deposit.md deleted file mode 100644 index 13eef6bea..000000000 --- a/deprecated/x/nftmarketv1/spec/10_Generalized_listing_deposit.md +++ /dev/null @@ -1,60 +0,0 @@ -# Generalized listing deposit mechanism for collateral - -The $i$th highest bid price is denoted as $p_i$. - -$n$ is a parameter determined by the NFT exhibitor. The default value is $n=10$. - -In this system, bidders have to deposit their balance in proportion to the bidding price. - -The deposit amount of the bidder of the $i$th highest bid price is denoted as $d_i$. - -We define that - -$$ -d_i = \frac{1}{n} p_i -$$ - -The maximum value of using NFT as a collateral will be denoted as $q$. - -In this system, we define that - -$$ -q = \sum_{i=1}^n d_i = d_1 + \cdots + d_n = \frac{1}{n} \sum_{i=1}^n p_i -$$ - -It means that, the maximum value of using NFT as a collateral is, an average of top $n$ highest bid prices. - -### Bid cancellation fee - -If the bidder want to cancel his bid, some fee may occur. - -The borrowed value by NFT exhibitor is denoted as $b$. - -The cancellation fee of the bidder of the $i$th highest bid price is - -$$ -\begin{cases} -\max\{d_i - (q - b), 0\} & \ \text{if} \ i \le n \\ -0 & \ \text{if} \ i > n -\end{cases} -$$ - -It means that, if the bidder is in bidders of top $n$ highest bid price, their deposit may be forfeited. - -### Settlement with exhibitor’s decision - -The 1st highest bidder have to pay $p_1 - d_1$ during the period of payment. - -If he doesn’t do so, his deposit $d_1$ will be forfeited and he will be removed from bidders. - -### Liquidation - -If $d_1 \ge q$, it means that, the deposit amount of the bidder of the 1st highest bid price is greater than or equal to $q$, the 1st highest bidder will receive the NFT and the charge $d_1 - q$. - -In other cases, the procedure below will be iterated for $n$ times. In the $i$th iteration, - -The $i$th highest bidder have to pay $p_i - d_i$ during the period of payment. - -If he does so, he will receive the NFT and the iteration will be stopped. - -If he doesn’t do so, his deposit $d_i$ will be forfeited and the iteration continues to the next $i$. diff --git a/deprecated/x/nftmarketv1/spec/10_collateralized_liquidation_deposit_auction.md b/deprecated/x/nftmarketv1/spec/10_collateralized_liquidation_deposit_auction.md deleted file mode 100644 index c3865971d..000000000 --- a/deprecated/x/nftmarketv1/spec/10_collateralized_liquidation_deposit_auction.md +++ /dev/null @@ -1,72 +0,0 @@ -# Collateral Liquidation Deposit Auction - -## Definition - -- $i \in I$: index of bids -- $n = |I|$: number of bids -- $\{p_i\}_{i \in I}$: the price of $i$ th bid -- $\{d_i\}_{i \in I}$: the deposit amount of $i$ th bid -- $\{r_i\}_{i \in I}$: the interest rate of $i$ th bid -- $\{t_i\}_{i \in I}$: the expiration date of $i$ th bid -- $q = \frac{1}{n} \sum_{i \in I} p_i$ -- $s = \sum_{i \in I} d_i$: means the amount which lister can borrow with NFT as collateral -- $\{a_i\}_{i \in I}$: means the amount borrowed from $i$ th bid deposit -- $b = \sum_{i \in I} a_i$ -- $i_p(j)$: means the index of the $j$ th highest price bid -- $i_d(j)$: means the index of the $j$ th highest deposit amount bid -- $i_r(j)$: means the index of the $j$ th lowest interest rate bid -- $i_t(j)$: means the index of the $j$ th farthest expiration date bid -- $c$: minimum deposit rate - -## State transition - -### New bid - -When $(p_{\text{new}}, d_{\text{new}}, r_{\text{new}}, t_{\text{new}})$ will be added to the set of bids, the new bids sequence will be - -- $I' = I \cup \{n+1\}$ -- $n' = n + 1$ -- $\{p_i'\}_{i \in I'} = \{p_i\}_{i \in I} \cup \{p_{\text{new}}\}$ -- $\{d_i'\}_{i \in I'} = \{d_i\}_{i \in I} \cup \{d_{\text{new}}\}$ -- $\{r_i'\}_{i \in I'} = \{r_i\}_{i \in I} \cup \{r_{\text{new}}\}$ -- $\{t_i'\}_{i \in I'} = \{t_i\}_{i \in I} \cup \{t_{\text{new}}\}$ -- $q' = \frac{1}{n'} \sum_{i \in I'} p_i'$ -- $s' = \sum_{i \in I'} d_i'$ - -where the prime means the next state. - -The constraint of $d_{n+1}'$ is - -$$ - c p_{n+1}' \le d_{n+1}' \le q' - s -$$ - -In easy expression, it means - -- $c p_{n+1}' \le d_{n+1}'$ -- $s' = s + d_{n+1}' \le q'$ - -where $c$ means minimum deposit rate. - -### New borrowing - -$a_i$ must follow the constraint - -- $a_i \le d_i$ - - Trivially, the following inequation must be satisfied: $b \le s$ -- $a_{i_r(j+1)} = 0 \ \text{if} \ a_{i_r(j)} < d_{i_r(j)}$ - - It means that deposited amount must be consumed (used for lending resource) in ascending order of interest rates. - -## User Interface guideline - -### Deposited amount graph - -- Horizontal axis expresses the time. -- Vertical axis expresses the deposited amount. -- The lower $i_t^{-1}$ of the deposit (the farther expiration date), the lower the deposit will be depicted in the graph as a rectangle. - -### Borrowed amount graph - -- Horizontal axis expresses the time. -- Vertical axis expresses the borrowed amount. -- The lower $i_r^{-1}$ of the deposit (the lower interest rate), the lower the deposit will be depicted in the graph as a rectangle. diff --git a/deprecated/x/nftmarketv1/spec/README.md b/deprecated/x/nftmarketv1/spec/README.md deleted file mode 100644 index 520990034..000000000 --- a/deprecated/x/nftmarketv1/spec/README.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# `nftmarket` - -## Abstract - -This module support functionalities for nft marketplace (list / bid), nft collateral borrowing and liquidation. - -## Contents - -1. **[State](01_state.md)** -2. **[Messages](02_messages.md)** -3. **[Events](03_events.md)** -4. **[Parameters](04_params.md)** diff --git a/deprecated/x/nftmarketv1/types/codec.go b/deprecated/x/nftmarketv1/types/codec.go deleted file mode 100644 index 8e888419c..000000000 --- a/deprecated/x/nftmarketv1/types/codec.go +++ /dev/null @@ -1,35 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgListNft{}, - &MsgCancelNftListing{}, - &MsgExpandListingPeriod{}, - &MsgPlaceBid{}, - &MsgCancelBid{}, - &MsgEndNftListing{}, - &MsgPayFullBid{}, - &MsgBorrow{}, - &MsgRepay{}, - &MsgMintStableCoin{}, - &MsgBurnStableCoin{}, - &MsgLiquidate{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) diff --git a/deprecated/x/nftmarketv1/types/errors.go b/deprecated/x/nftmarketv1/types/errors.go deleted file mode 100644 index e0dbdd9ce..000000000 --- a/deprecated/x/nftmarketv1/types/errors.go +++ /dev/null @@ -1,35 +0,0 @@ -package types - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var ( - ErrNftListingAlreadyExists = sdkerrors.Register(ModuleName, 1, "nft listing already exist") - ErrNftListingDoesNotExist = sdkerrors.Register(ModuleName, 2, "nft listing does not exist") - ErrBidDoesNotExists = sdkerrors.Register(ModuleName, 3, "nft bid does not exist") - ErrNotSupportedBidToken = sdkerrors.Register(ModuleName, 4, "not supported bid token") - ErrNftDoesNotExists = sdkerrors.Register(ModuleName, 5, "specified nft does not exist") - ErrNotNftOwner = sdkerrors.Register(ModuleName, 6, "not the owner of nft") - ErrNotNftListingOwner = sdkerrors.Register(ModuleName, 7, "not the owner of nft listing") - ErrNftBidAlreadyExists = sdkerrors.Register(ModuleName, 8, "bid already exists on the nft") - ErrNftBidDoesNotExists = sdkerrors.Register(ModuleName, 9, "bid does not exists on the nft") - ErrListingIsNotInStatusToBid = sdkerrors.Register(ModuleName, 10, "listing is not in status to bid") - ErrStatusCannotCancelListing = sdkerrors.Register(ModuleName, 11, "listing is in the status where it can not be cancelled") - ErrListingAlreadyEnded = sdkerrors.Register(ModuleName, 12, "listing already ended") - ErrNftListingNotInBidState = sdkerrors.Register(ModuleName, 13, "listing is not on bid state") - ErrInvalidBidDenom = sdkerrors.Register(ModuleName, 14, "invalid bid denom") - ErrBidAlreadyExists = sdkerrors.Register(ModuleName, 15, "bid already exists") - ErrNftListingNotInSuccessfulBidPhase = sdkerrors.Register(ModuleName, 16, "listing is not in successful bid status") - ErrNftListingNotInLiquidation = sdkerrors.Register(ModuleName, 17, "listing is not in liquidation status") - ErrDebtExceedsMaxDebt = sdkerrors.Register(ModuleName, 18, "debts exceeds maximum debt") - ErrRepayAmountExceedsLoanAmount = sdkerrors.Register(ModuleName, 19, "repay amount exceeds loan amount") - ErrInvalidBorrowDenom = sdkerrors.Register(ModuleName, 20, "invalid borrow denom") - ErrInvalidRepayDenom = sdkerrors.Register(ModuleName, 21, "invalid repay denom") - ErrNotTimeForCancel = sdkerrors.Register(ModuleName, 22, "not time for cancel yet") - ErrInvalidBidAmount = sdkerrors.Register(ModuleName, 23, "invalid bid amount") - ErrCannotCancelListingSingleBid = sdkerrors.Register(ModuleName, 24, "cannot cancel single bid of the listing") - ErrBidCancelIsAllowedAfterSomeTime = sdkerrors.Register(ModuleName, 25, "bid cancel is allowed after some time after bid") - ErrListingNeedsToBeBiddingStatus = sdkerrors.Register(ModuleName, 26, "listing needs to be in BIDDING status") - ErrNotBorrowed = sdkerrors.Register(ModuleName, 27, "not borrowed yet once") -) diff --git a/deprecated/x/nftmarketv1/types/expected_keepers.go b/deprecated/x/nftmarketv1/types/expected_keepers.go deleted file mode 100644 index 4ebfe7ac5..000000000 --- a/deprecated/x/nftmarketv1/types/expected_keepers.go +++ /dev/null @@ -1,53 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" -) - -// AccountKeeper expected interface for the account keeper (noalias) -type AccountKeeper interface { - GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI -} - -type BankKeeper interface { - // View - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetSupply(ctx sdk.Context, denom string) sdk.Coin - - // Send - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error -} - -type NftKeeper interface { - GetClass(ctx sdk.Context, classID string) (nfttypes.Class, bool) - SaveClass(ctx sdk.Context, class nfttypes.Class) error - - Mint(ctx sdk.Context, token nfttypes.NFT, receiver sdk.AccAddress) error - Burn(ctx sdk.Context, classID string, nftID string) error - - Update(ctx sdk.Context, token nfttypes.NFT) error - Transfer(ctx sdk.Context, classID string, nftID string, receiver sdk.AccAddress) error - - GetNFT(ctx sdk.Context, classID, nftID string) (nfttypes.NFT, bool) - GetNFTsOfClassByOwner(ctx sdk.Context, classID string, owner sdk.AccAddress) (nfts []nfttypes.NFT) - GetNFTsOfClass(ctx sdk.Context, classID string) (nfts []nfttypes.NFT) - GetOwner(ctx sdk.Context, classID string, nftID string) sdk.AccAddress - GetBalance(ctx sdk.Context, classID string, owner sdk.AccAddress) uint64 - GetTotalSupply(ctx sdk.Context, classID string) uint64 - HasNFT(ctx sdk.Context, classID, id string) bool -} - -type NftmarketHooks interface { - AfterNftListed(ctx sdk.Context, nftIdentifier NftIdentifier, txMemo string) - AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftIdentifier, fee sdk.Coin) - AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftIdentifier) -} diff --git a/deprecated/x/nftmarketv1/types/genesis.go b/deprecated/x/nftmarketv1/types/genesis.go deleted file mode 100644 index dd30043b7..000000000 --- a/deprecated/x/nftmarketv1/types/genesis.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - params := DefaultParams() - return &GenesisState{ - Params: params, - } -} - -func (gs GenesisState) Validate() error { - return nil -} - -func NewGenesisState(params Params) GenesisState { - return GenesisState{ - Params: params, - } -} diff --git a/deprecated/x/nftmarketv1/types/genesis.pb.go b/deprecated/x/nftmarketv1/types/genesis.pb.go deleted file mode 100644 index a801b34e8..000000000 --- a/deprecated/x/nftmarketv1/types/genesis.pb.go +++ /dev/null @@ -1,579 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nftmarketv1/genesis.proto - -package types - -import ( - fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/gogoproto" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the nftmarket module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - Listings []NftListing `protobuf:"bytes,2,rep,name=listings,proto3" json:"listings"` - Bids []NftBid `protobuf:"bytes,3,rep,name=bids,proto3" json:"bids"` - CancelledBids []NftBid `protobuf:"bytes,4,rep,name=cancelled_bids,json=cancelledBids,proto3" json:"cancelled_bids"` - Loans []Loan `protobuf:"bytes,5,rep,name=loans,proto3" json:"loans"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_0e1f41ca48fc8d5c, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetListings() []NftListing { - if m != nil { - return m.Listings - } - return nil -} - -func (m *GenesisState) GetBids() []NftBid { - if m != nil { - return m.Bids - } - return nil -} - -func (m *GenesisState) GetCancelledBids() []NftBid { - if m != nil { - return m.CancelledBids - } - return nil -} - -func (m *GenesisState) GetLoans() []Loan { - if m != nil { - return m.Loans - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.nftmarketv1.GenesisState") -} - -func init() { proto.RegisterFile("nftmarketv1/genesis.proto", fileDescriptor_0e1f41ca48fc8d5c) } - -var fileDescriptor_0e1f41ca48fc8d5c = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbf, 0x4a, 0xc3, 0x40, - 0x18, 0xc0, 0x93, 0xfe, 0x43, 0xae, 0xd6, 0x21, 0x2a, 0xa4, 0x2d, 0x24, 0xa5, 0x53, 0x07, 0xc9, - 0x61, 0xa5, 0x8b, 0x9b, 0x19, 0xaa, 0x48, 0x11, 0xa9, 0x74, 0x71, 0x91, 0x4b, 0x7a, 0xb9, 0x1e, - 0x26, 0x77, 0xa1, 0x77, 0x11, 0xfb, 0x16, 0x3e, 0x56, 0xc7, 0x2e, 0x82, 0x53, 0x91, 0xf6, 0x0d, - 0x7c, 0x02, 0xe9, 0x5d, 0x28, 0x1d, 0x22, 0xb8, 0x5d, 0xf8, 0x7e, 0xbf, 0xdf, 0x17, 0xf8, 0x40, - 0x93, 0x45, 0x32, 0x41, 0xf3, 0x57, 0x2c, 0xdf, 0x2e, 0x21, 0xc1, 0x0c, 0x0b, 0x2a, 0xbc, 0x74, - 0xce, 0x25, 0xb7, 0x4e, 0x33, 0x96, 0x31, 0x1a, 0x51, 0xef, 0x00, 0x69, 0x9d, 0x11, 0x4e, 0xb8, - 0x9a, 0xc3, 0xdd, 0x4b, 0xa3, 0x2d, 0x97, 0x70, 0x4e, 0x62, 0x0c, 0xd5, 0x57, 0x90, 0x45, 0x50, - 0xd2, 0x04, 0x0b, 0x89, 0x92, 0x34, 0x07, 0xda, 0x87, 0x6b, 0xf6, 0x6f, 0x3d, 0xec, 0x7e, 0x96, - 0xc0, 0xf1, 0xad, 0x5e, 0xfd, 0x24, 0x91, 0xc4, 0xd6, 0x3d, 0xa8, 0xa5, 0x68, 0x8e, 0x12, 0x61, - 0x9b, 0x1d, 0xb3, 0x57, 0xef, 0xb7, 0xbd, 0x82, 0x5f, 0xf1, 0x1e, 0x15, 0xe2, 0x9f, 0x2f, 0xd7, - 0xae, 0xf1, 0xb3, 0x76, 0x1b, 0x0b, 0x94, 0xc4, 0xd7, 0x5d, 0x2d, 0x76, 0xc7, 0x79, 0xc1, 0xba, - 0x01, 0x47, 0x31, 0x15, 0x92, 0x32, 0x22, 0xec, 0x52, 0xa7, 0xdc, 0xab, 0xf7, 0xdd, 0xc2, 0xda, - 0x43, 0x24, 0x47, 0x9a, 0xf3, 0x2b, 0xbb, 0xe2, 0x78, 0xaf, 0x59, 0x03, 0x50, 0x09, 0xe8, 0x54, - 0xd8, 0x65, 0xa5, 0xb7, 0xff, 0xd2, 0x7d, 0x3a, 0xcd, 0x55, 0x85, 0x5b, 0x77, 0xe0, 0x24, 0x44, - 0x2c, 0xc4, 0x71, 0x8c, 0xa7, 0x2f, 0x2a, 0x50, 0xf9, 0x6f, 0xa0, 0xb1, 0x17, 0xfd, 0x5d, 0x69, - 0x00, 0xaa, 0x31, 0x47, 0x4c, 0xd8, 0x55, 0x15, 0x68, 0x16, 0x06, 0x46, 0x1c, 0xb1, 0x5c, 0xd7, - 0xb4, 0x3f, 0x5c, 0x6e, 0x1c, 0x73, 0xb5, 0x71, 0xcc, 0xef, 0x8d, 0x63, 0x7e, 0x6c, 0x1d, 0x63, - 0xb5, 0x75, 0x8c, 0xaf, 0xad, 0x63, 0x3c, 0x5f, 0x10, 0x2a, 0x67, 0x59, 0xe0, 0x85, 0x3c, 0x81, - 0x13, 0x36, 0x61, 0x74, 0x48, 0x61, 0x38, 0x43, 0x94, 0xc1, 0x77, 0x78, 0x78, 0x29, 0xb9, 0x48, - 0xb1, 0x08, 0x6a, 0xea, 0x4c, 0x57, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x95, 0xbb, 0xdf, - 0x2c, 0x02, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Loans) > 0 { - for iNdEx := len(m.Loans) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Loans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.CancelledBids) > 0 { - for iNdEx := len(m.CancelledBids) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CancelledBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Bids) > 0 { - for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Bids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Listings) > 0 { - for iNdEx := len(m.Listings) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Listings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.Listings) > 0 { - for _, e := range m.Listings { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Bids) > 0 { - for _, e := range m.Bids { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.CancelledBids) > 0 { - for _, e := range m.CancelledBids { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Loans) > 0 { - for _, e := range m.Loans { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Listings", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Listings = append(m.Listings, NftListing{}) - if err := m.Listings[len(m.Listings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bids = append(m.Bids, NftBid{}) - if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelledBids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CancelledBids = append(m.CancelledBids, NftBid{}) - if err := m.CancelledBids[len(m.CancelledBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loans", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Loans = append(m.Loans, Loan{}) - if err := m.Loans[len(m.Loans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/nftmarketv1/types/hooks.go b/deprecated/x/nftmarketv1/types/hooks.go deleted file mode 100644 index 28d3aac5d..000000000 --- a/deprecated/x/nftmarketv1/types/hooks.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import sdk "github.com/cosmos/cosmos-sdk/types" - -// MultiNftmarketHooks combine multiple nftmarket hooks, all hook functions are run in array sequence -type MultiNftmarketHooks []NftmarketHooks - -// NewMultiNftmarketHooks returns a new MultiNftmarketHooks -func NewMultiNftmarketHooks(hooks ...NftmarketHooks) MultiNftmarketHooks { - return hooks -} - -// AfterNftListed runs after a nft is listed -func (h MultiNftmarketHooks) AfterNftListed(ctx sdk.Context, nftIdentifier NftIdentifier, txMemo string) { - for i := range h { - h[i].AfterNftListed(ctx, nftIdentifier, txMemo) - } -} - -// AfterNftPaymentWithCommission runs after a nft is sold and paid properly -func (h MultiNftmarketHooks) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftIdentifier, fee sdk.Coin) { - for i := range h { - h[i].AfterNftPaymentWithCommission(ctx, nftIdentifier, fee) - } -} - -// AfterNftUnlistedWithoutPayment runs after a nft is unlisted without any payment -func (h MultiNftmarketHooks) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftIdentifier) { - for i := range h { - h[i].AfterNftUnlistedWithoutPayment(ctx, nftIdentifier) - } -} diff --git a/deprecated/x/nftmarketv1/types/hooks_test.go b/deprecated/x/nftmarketv1/types/hooks_test.go deleted file mode 100644 index 28e19a57b..000000000 --- a/deprecated/x/nftmarketv1/types/hooks_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package types_test - -// import ( -// "testing" - -// simapp "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/nftmarketv1/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/stretchr/testify/suite" -// ) - -// type KeeperTestSuite struct { -// suite.Suite - -// ctx sdk.Context -// app *simapp.App -// addrs []sdk.AccAddress -// } - -// func (suite *KeeperTestSuite) SetupTest(hooks types.NftmarketHooks) { -// isCheckTx := false - -// app := simapp.Setup(suite.T(), isCheckTx) - -// suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) -// suite.addrs = simapp.AddTestAddrsIncremental(app, suite.ctx, 1, sdk.NewInt(30000000)) -// suite.app = app - -// if hooks != nil { -// suite.app.NftmarketKeeper.SetHooks(hooks) -// } -// } - -// func TestKeeperSuite(t *testing.T) { -// suite.Run(t, new(KeeperTestSuite)) -// } - -// func dummyAfterNftListedEvent(nftId types.NftIdentifier) sdk.Event { -// return sdk.NewEvent( -// "afterNftListed", -// sdk.NewAttribute("nftId", nftId.String()), -// ) -// } - -// func dummyAfterNftPaymentWithCommissionEvent(nftId types.NftIdentifier) sdk.Event { -// return sdk.NewEvent( -// "afterNftPaymentWithCommission", -// sdk.NewAttribute("nftId", nftId.String()), -// ) -// } - -// func dummyAfterNftUnlistedWithoutPaymentEvent(nftId types.NftIdentifier) sdk.Event { -// return sdk.NewEvent( -// "afterNftUnlistedWithoutPayment", -// sdk.NewAttribute("nftId", nftId.String()), -// ) -// } - -// // dummyNftmarketHook is a struct satisfying the nftmarket hook interface, -// // that maintains a counter for how many times its been succesfully called, -// // and a boolean for whether it should panic during its execution. -// type dummyNftmarketHook struct { -// successCounter int -// shouldPanic bool -// } - -// func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftIdentifier, txMemo string) { -// if hook.shouldPanic { -// panic("dummyNftmarketHook AfterNftListed is panicking") -// } - -// hook.successCounter += 1 -// ctx.EventManager().EmitEvent(dummyAfterNftListedEvent(nftId)) -// } - -// func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, nftId types.NftIdentifier, fee sdk.Coin) { -// if hook.shouldPanic { -// panic("dummyNftmarketHook AfterNftPaymentWithCommission is panicking") -// } - -// hook.successCounter += 1 -// ctx.EventManager().EmitEvent(dummyAfterNftPaymentWithCommissionEvent(nftId)) -// } - -// func (hook *dummyNftmarketHook) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftId types.NftIdentifier) { -// if hook.shouldPanic { -// panic("dummyNftmarketHook AfterNftUnlistedWithoutPayment is panicking") -// } - -// hook.successCounter += 1 -// ctx.EventManager().EmitEvent(dummyAfterNftUnlistedWithoutPaymentEvent(nftId)) -// } - -// func (hook *dummyNftmarketHook) Clone() *dummyNftmarketHook { -// newHook := dummyNftmarketHook{shouldPanic: hook.shouldPanic, successCounter: hook.successCounter} -// return &newHook -// } - -// var _ types.NftmarketHooks = &dummyNftmarketHook{} - -// func (suite *KeeperTestSuite) TestHooksPanicRecovery() { -// panicHook := dummyNftmarketHook{shouldPanic: true} -// noPanicHook := dummyNftmarketHook{shouldPanic: false} -// nftId := types.NftIdentifier{ -// ClassId: "dummyhook", -// NftId: "dummyhook", -// } - -// tests := []struct { -// hooks []dummyNftmarketHook -// expectedCounterValues []int -// lenEvents int -// }{ -// {[]dummyNftmarketHook{noPanicHook}, []int{3}, 3}, -// {[]dummyNftmarketHook{panicHook}, []int{0}, 0}, -// } - -// for tcIndex, tc := range tests { -// suite.SetupTest(nil) -// hookRefs := []types.NftmarketHooks{} - -// for _, hook := range tc.hooks { -// hookRefs = append(hookRefs, hook.Clone()) -// } - -// // insert dummy hook struct as part of NftmarketHooks -// hooks := types.NewMultiNftmarketHooks(hookRefs...) -// // suite.app.NftmarketKeeper.SetHooks(hooks) - -// if tc.lenEvents == 0 { -// suite.Panics(func() { -// hooks.AfterNftListed(suite.ctx, nftId, "test") - -// hooks.AfterNftPaymentWithCommission(suite.ctx, nftId, sdk.Coin{Denom: "uguu", Amount: sdk.OneInt()}) - -// hooks.AfterNftUnlistedWithoutPayment(suite.ctx, nftId) -// }) -// } else { -// suite.NotPanics(func() { -// hooks.AfterNftListed(suite.ctx, nftId, "test") - -// hooks.AfterNftPaymentWithCommission(suite.ctx, nftId, sdk.Coin{Denom: "uguu", Amount: sdk.OneInt()}) - -// hooks.AfterNftUnlistedWithoutPayment(suite.ctx, nftId) -// }) -// } - -// for i := 0; i < len(hooks); i++ { -// nftmarketHook := hookRefs[i].(*dummyNftmarketHook) -// suite.Require().Equal(tc.expectedCounterValues[i], nftmarketHook.successCounter, "test case index %d", tcIndex) -// } -// } -// } diff --git a/deprecated/x/nftmarketv1/types/keys.go b/deprecated/x/nftmarketv1/types/keys.go deleted file mode 100644 index 4a7341ba2..000000000 --- a/deprecated/x/nftmarketv1/types/keys.go +++ /dev/null @@ -1,102 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" -) - -const ( - // ModuleName defines the module name - ModuleName = "nftmarket" - - // Module account for nft trading fee collection - // use ecosystem-incentive module account for now - // [unused] NftTradingFee = "nfttradingfee" - - // StoreKey defines the primary module store key - StoreKey = "ununifinftmarket" - - // RouterKey is the message route for nftmarket - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_capability" -) - -const ( - // nft listing info by nft_id - KeyPrefixNftListing = "nft_listing" - // nft listing by owner - KeyPrefixAddressNftListing = "address_nft_listing" - // active nft listing by end time - KeyPrefixEndTimeNftListing = "end_time_nft_listing" - // full payment period listing by end time - KeyPrefixFullPaymentPeriodListing = "full_payment_period_listing" - // successful bid listing by nft send time - KeyPrefixSuccessfulBidListing = "successful_bid_listing" - // nft bid by nft_id - KeyPrefixNftBid = "nft_bid_original" - // nft bid cancelled - KeyPrefixNftBidCancelled = "nft_bid_cancelled" - // nft bid by owner - KeyPrefixAddressBid = "address_bid" - // nft loan by nft_id - KeyPrefixNftLoan = "nft_loan" - // nft loan by owner - KeyPrefixAddressNftLoan = "address_nft_loan" - // rewards by address - KeyPrefixAddressRewards = "rewards" - // class by address - KeyPrefixClass = "class" -) - -func NftBytes(classId, nftId string) []byte { - return append(append([]byte(classId), byte(0xFF)), []byte(nftId)...) -} - -func NftListingKey(idBytes []byte) []byte { - return append([]byte(KeyPrefixNftListing), idBytes...) -} - -func NftAddressNftListingPrefixKey(addr sdk.AccAddress) []byte { - return append([]byte(KeyPrefixAddressNftListing), address.MustLengthPrefix(addr)...) -} - -func NftAddressNftListingKey(addr sdk.AccAddress, nftIdBytes []byte) []byte { - return append(append([]byte(KeyPrefixAddressNftListing), address.MustLengthPrefix(addr)...), nftIdBytes...) -} - -func NftBidKey(nftIdBytes []byte, bidder sdk.AccAddress) []byte { - return append(append([]byte(KeyPrefixNftBid), nftIdBytes...), address.MustLengthPrefix(bidder)...) -} - -func AddressBidKeyPrefix(bidder sdk.AccAddress) []byte { - return append([]byte(KeyPrefixAddressBid), address.MustLengthPrefix(bidder)...) -} - -func AddressBidKey(nftIdBytes []byte, bidder sdk.AccAddress) []byte { - return append(append([]byte(KeyPrefixAddressBid), address.MustLengthPrefix(bidder)...), nftIdBytes...) -} - -func NftLoanKey(nftIdBytes []byte) []byte { - return append([]byte(KeyPrefixNftLoan), nftIdBytes...) -} - -func AddressNftLoanKey(addr sdk.AccAddress, nftIdBytes []byte) []byte { - return append(append([]byte(KeyPrefixAddressNftLoan), address.MustLengthPrefix(addr)...), nftIdBytes...) -} - -func AddressRewardsKey(addr sdk.AccAddress) []byte { - return append([]byte(KeyPrefixAddressRewards), address.MustLengthPrefix(addr)...) -} - -func ClassKey(addr sdk.AccAddress) []byte { - return append([]byte(KeyPrefixClass), address.MustLengthPrefix(addr)...) -} - -func ClassIdKey(classId string) []byte { - return ClassKey([]byte(classId)) -} diff --git a/deprecated/x/nftmarketv1/types/msgs.go b/deprecated/x/nftmarketv1/types/msgs.go deleted file mode 100644 index 82e72105b..000000000 --- a/deprecated/x/nftmarketv1/types/msgs.go +++ /dev/null @@ -1,463 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgMintNft{} - -func NewMsgMintNft(sender sdk.AccAddress, classId, nftId, uri, uriHash string) MsgMintNft { - return MsgMintNft{ - Sender: sender.Bytes(), - ClassId: classId, - NftId: nftId, - NftUri: uri, - NftUriHash: uriHash, - } -} - -// Route return the message type used for routing the message. -func (msg MsgMintNft) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgMintNft) Type() string { return "mint_nft" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgMintNft) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgMintNft) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgMintNft) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgListNft{} - -// todo: Implementation fields -// BidToken, MinBid, BidHook, ListingType -func NewMsgListNft(sender sdk.AccAddress, nftId NftIdentifier, bidToken string, bidActiveRank uint64, minBid sdk.Int) MsgListNft { - return MsgListNft{ - Sender: sender.Bytes(), - NftId: nftId, - BidToken: bidToken, - MinBid: minBid, - BidActiveRank: bidActiveRank, - } -} - -// Route return the message type used for routing the message. -func (msg MsgListNft) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgListNft) Type() string { return "list_nft" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgListNft) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgListNft) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgListNft) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgCancelNftListing{} - -func NewMsgCancelNftListing(sender sdk.AccAddress, nftId NftIdentifier) MsgCancelNftListing { - return MsgCancelNftListing{ - Sender: sender.Bytes(), - NftId: nftId, - } -} - -// Route return the message type used for routing the message. -func (msg MsgCancelNftListing) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgCancelNftListing) Type() string { return "cancel_nft_listing" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgCancelNftListing) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgCancelNftListing) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgCancelNftListing) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgExpandListingPeriod{} - -func NewMsgExpandListingPeriod(sender sdk.AccAddress, nftId NftIdentifier) MsgExpandListingPeriod { - return MsgExpandListingPeriod{ - Sender: sender.Bytes(), - NftId: nftId, - } -} - -// Route return the message type used for routing the message. -func (msg MsgExpandListingPeriod) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgExpandListingPeriod) Type() string { return "expand_listing_period" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgExpandListingPeriod) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgExpandListingPeriod) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgExpandListingPeriod) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgPlaceBid{} - -// todo -func NewMsgPlaceBid(sender sdk.AccAddress, nftId NftIdentifier, amount sdk.Coin, automaticPayment bool) MsgPlaceBid { - return MsgPlaceBid{ - Sender: sender.Bytes(), - NftId: nftId, - Amount: amount, - AutomaticPayment: automaticPayment, - } -} - -// Route return the message type used for routing the message. -func (msg MsgPlaceBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgPlaceBid) Type() string { return "place_bid" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgPlaceBid) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgPlaceBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgPlaceBid) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgCancelBid{} - -func NewMsgCancelBid(sender sdk.AccAddress, nftId NftIdentifier) MsgCancelBid { - return MsgCancelBid{ - Sender: sender.Bytes(), - NftId: nftId, - } -} - -// Route return the message type used for routing the message. -func (msg MsgCancelBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgCancelBid) Type() string { return "cancel_bid" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgCancelBid) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgCancelBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgCancelBid) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgSellingDecision{} - -func NewMsgSellingDecision(sender sdk.AccAddress, nftId NftIdentifier) MsgSellingDecision { - return MsgSellingDecision{ - Sender: sender.Bytes(), - NftId: nftId, - } -} - -// Route return the message type used for routing the message. -func (msg MsgSellingDecision) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgSellingDecision) Type() string { return "nft_selling_decision" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgSellingDecision) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgSellingDecision) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgSellingDecision) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgEndNftListing{} - -func NewMsgEndNftListing(sender sdk.AccAddress, nftId NftIdentifier) MsgEndNftListing { - return MsgEndNftListing{ - Sender: sender.Bytes(), - NftId: nftId, - } -} - -// Route return the message type used for routing the message. -func (msg MsgEndNftListing) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgEndNftListing) Type() string { return "end_nft_listing" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgEndNftListing) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgEndNftListing) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgEndNftListing) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgPayFullBid{} - -func NewMsgPayFullBid(sender sdk.AccAddress, nftId NftIdentifier) MsgPayFullBid { - return MsgPayFullBid{ - Sender: sender.Bytes(), - NftId: nftId, - } -} - -// Route return the message type used for routing the message. -func (msg MsgPayFullBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgPayFullBid) Type() string { return "pay_full_bid" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgPayFullBid) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgPayFullBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgPayFullBid) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgBorrow{} - -func NewMsgBorrow(sender sdk.AccAddress, nftId NftIdentifier, amount sdk.Coin) MsgBorrow { - return MsgBorrow{ - Sender: sender.Bytes(), - NftId: nftId, - Amount: amount, - } -} - -// Route return the message type used for routing the message. -func (msg MsgBorrow) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgBorrow) Type() string { return "borrow" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgBorrow) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgBorrow) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgBorrow) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgRepay{} - -func NewMsgRepay(sender sdk.AccAddress, nftId NftIdentifier, amount sdk.Coin) MsgRepay { - return MsgRepay{ - Sender: sender.Bytes(), - NftId: nftId, - Amount: amount, - } -} - -// Route return the message type used for routing the message. -func (msg MsgRepay) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgRepay) Type() string { return "repay" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgRepay) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgRepay) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgRepay) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgMintStableCoin{} - -func NewMsgMintStableCoin(sender sdk.AccAddress) MsgMintStableCoin { - return MsgMintStableCoin{ - Sender: sender.Bytes(), - } -} - -// Route return the message type used for routing the message. -func (msg MsgMintStableCoin) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgMintStableCoin) Type() string { return "mint_stable_coin" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgMintStableCoin) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgMintStableCoin) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgMintStableCoin) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgMintStableCoin{} - -func NewMsgBurnStableCoin(sender sdk.AccAddress) MsgBurnStableCoin { - return MsgBurnStableCoin{ - Sender: sender.Bytes(), - } -} - -// Route return the message type used for routing the message. -func (msg MsgBurnStableCoin) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgBurnStableCoin) Type() string { return "burn_stable_coin" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgBurnStableCoin) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgBurnStableCoin) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgBurnStableCoin) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgMintStableCoin{} - -func NewMsgLiquidate(sender sdk.AccAddress) MsgLiquidate { - return MsgLiquidate{ - Sender: sender.Bytes(), - } -} - -// Route return the message type used for routing the message. -func (msg MsgLiquidate) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgLiquidate) Type() string { return "liquidate" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgLiquidate) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgLiquidate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgLiquidate) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Sender.AccAddress()} -} diff --git a/deprecated/x/nftmarketv1/types/nft_listing.go b/deprecated/x/nftmarketv1/types/nft_listing.go deleted file mode 100644 index cfc3d581c..000000000 --- a/deprecated/x/nftmarketv1/types/nft_listing.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -func (m NftListing) IdBytes() []byte { - return m.NftId.IdBytes() -} - -func (m NftListing) ClassIdBytes() []byte { - return m.NftId.ClassIdBytes() -} - -func (m NftListing) IsActive() bool { - return m.State == ListingState_LISTING || m.State == ListingState_BIDDING -} - -func (m NftListing) IsFullPayment() bool { - return m.State == ListingState_SELLING_DECISION || m.State == ListingState_END_LISTING -} - -func (m NftListing) IsSuccessfulBid() bool { - return m.State == ListingState_SUCCESSFUL_BID -} - -func (ni NftIdentifier) IdBytes() []byte { - return NftBytes(ni.ClassId, ni.NftId) -} - -func (ni NftIdentifier) ClassIdBytes() []byte { - return []byte(ni.ClassId) -} - -func (b NftBid) IdBytes() []byte { - return b.NftId.IdBytes() -} diff --git a/deprecated/x/nftmarketv1/types/nftmarket.pb.go b/deprecated/x/nftmarketv1/types/nftmarket.pb.go deleted file mode 100644 index 7a315dd23..000000000 --- a/deprecated/x/nftmarketv1/types/nftmarket.pb.go +++ /dev/null @@ -1,6793 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nftmarketv1/nftmarket.proto - -package types - -import ( - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type ListingType int32 - -const ( - ListingType_DIRECT_ASSET_BORROW ListingType = 0 - ListingType_SYNTHETIC_ASSET_CREATION ListingType = 1 - ListingType_LATE_SHIPPING ListingType = 2 -) - -var ListingType_name = map[int32]string{ - 0: "DIRECT_ASSET_BORROW", - 1: "SYNTHETIC_ASSET_CREATION", - 2: "LATE_SHIPPING", -} - -var ListingType_value = map[string]int32{ - "DIRECT_ASSET_BORROW": 0, - "SYNTHETIC_ASSET_CREATION": 1, - "LATE_SHIPPING": 2, -} - -func (x ListingType) String() string { - return proto.EnumName(ListingType_name, int32(x)) -} - -func (ListingType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{0} -} - -type ListingState int32 - -const ( - ListingState_LISTING ListingState = 0 - ListingState_BIDDING ListingState = 1 - ListingState_SELLING_DECISION ListingState = 2 - ListingState_LIQUIDATION ListingState = 3 - ListingState_END_LISTING ListingState = 4 - ListingState_SUCCESSFUL_BID ListingState = 5 -) - -var ListingState_name = map[int32]string{ - 0: "LISTING", - 1: "BIDDING", - 2: "SELLING_DECISION", - 3: "LIQUIDATION", - 4: "END_LISTING", - 5: "SUCCESSFUL_BID", -} - -var ListingState_value = map[string]int32{ - "LISTING": 0, - "BIDDING": 1, - "SELLING_DECISION": 2, - "LIQUIDATION": 3, - "END_LISTING": 4, - "SUCCESSFUL_BID": 5, -} - -func (x ListingState) String() string { - return proto.EnumName(ListingState_name, int32(x)) -} - -func (ListingState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{1} -} - -type NftIdentifier struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *NftIdentifier) Reset() { *m = NftIdentifier{} } -func (m *NftIdentifier) String() string { return proto.CompactTextString(m) } -func (*NftIdentifier) ProtoMessage() {} -func (*NftIdentifier) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{0} -} -func (m *NftIdentifier) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NftIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NftIdentifier.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NftIdentifier) XXX_Merge(src proto.Message) { - xxx_messageInfo_NftIdentifier.Merge(m, src) -} -func (m *NftIdentifier) XXX_Size() int { - return m.Size() -} -func (m *NftIdentifier) XXX_DiscardUnknown() { - xxx_messageInfo_NftIdentifier.DiscardUnknown(m) -} - -var xxx_messageInfo_NftIdentifier proto.InternalMessageInfo - -func (m *NftIdentifier) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *NftIdentifier) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type Loan struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Loan types.Coin `protobuf:"bytes,2,opt,name=loan,proto3" json:"loan"` -} - -func (m *Loan) Reset() { *m = Loan{} } -func (m *Loan) String() string { return proto.CompactTextString(m) } -func (*Loan) ProtoMessage() {} -func (*Loan) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{1} -} -func (m *Loan) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Loan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Loan.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Loan) XXX_Merge(src proto.Message) { - xxx_messageInfo_Loan.Merge(m, src) -} -func (m *Loan) XXX_Size() int { - return m.Size() -} -func (m *Loan) XXX_DiscardUnknown() { - xxx_messageInfo_Loan.DiscardUnknown(m) -} - -var xxx_messageInfo_Loan proto.InternalMessageInfo - -func (m *Loan) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *Loan) GetLoan() types.Coin { - if m != nil { - return m.Loan - } - return types.Coin{} -} - -type ListedClass struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftIds []string `protobuf:"bytes,2,rep,name=nft_ids,json=nftIds,proto3" json:"nft_ids,omitempty"` -} - -func (m *ListedClass) Reset() { *m = ListedClass{} } -func (m *ListedClass) String() string { return proto.CompactTextString(m) } -func (*ListedClass) ProtoMessage() {} -func (*ListedClass) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{2} -} -func (m *ListedClass) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListedClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListedClass.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ListedClass) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListedClass.Merge(m, src) -} -func (m *ListedClass) XXX_Size() int { - return m.Size() -} -func (m *ListedClass) XXX_DiscardUnknown() { - xxx_messageInfo_ListedClass.DiscardUnknown(m) -} - -var xxx_messageInfo_ListedClass proto.InternalMessageInfo - -func (m *ListedClass) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *ListedClass) GetNftIds() []string { - if m != nil { - return m.NftIds - } - return nil -} - -type ListedNft struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Uri string `protobuf:"bytes,2,opt,name=uri,proto3" json:"uri,omitempty"` - UriHash string `protobuf:"bytes,3,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` -} - -func (m *ListedNft) Reset() { *m = ListedNft{} } -func (m *ListedNft) String() string { return proto.CompactTextString(m) } -func (*ListedNft) ProtoMessage() {} -func (*ListedNft) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{3} -} -func (m *ListedNft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListedNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListedNft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ListedNft) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListedNft.Merge(m, src) -} -func (m *ListedNft) XXX_Size() int { - return m.Size() -} -func (m *ListedNft) XXX_DiscardUnknown() { - xxx_messageInfo_ListedNft.DiscardUnknown(m) -} - -var xxx_messageInfo_ListedNft proto.InternalMessageInfo - -func (m *ListedNft) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *ListedNft) GetUri() string { - if m != nil { - return m.Uri - } - return "" -} - -func (m *ListedNft) GetUriHash() string { - if m != nil { - return m.UriHash - } - return "" -} - -type NftListing struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - ListingType ListingType `protobuf:"varint,3,opt,name=listing_type,json=listingType,proto3,enum=ununifi.nftmarketv1.ListingType" json:"listing_type,omitempty"` - State ListingState `protobuf:"varint,4,opt,name=state,proto3,enum=ununifi.nftmarketv1.ListingState" json:"state,omitempty"` - BidToken string `protobuf:"bytes,5,opt,name=bid_token,json=bidToken,proto3" json:"bid_token,omitempty"` - MinBid github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=min_bid,json=minBid,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_bid" yaml:"min_bid"` - BidActiveRank uint64 `protobuf:"varint,7,opt,name=bid_active_rank,json=bidActiveRank,proto3" json:"bid_active_rank,omitempty"` - StartedAt time.Time `protobuf:"bytes,8,opt,name=started_at,json=startedAt,proto3,stdtime" json:"started_at" yaml:"started_at"` - EndAt time.Time `protobuf:"bytes,9,opt,name=end_at,json=endAt,proto3,stdtime" json:"end_at" yaml:"end_at"` - FullPaymentEndAt time.Time `protobuf:"bytes,10,opt,name=full_payment_end_at,json=fullPaymentEndAt,proto3,stdtime" json:"full_payment_end_at" yaml:"full_payment_end_at"` - SuccessfulBidEndAt time.Time `protobuf:"bytes,11,opt,name=successful_bid_end_at,json=successfulBidEndAt,proto3,stdtime" json:"successful_bid_end_at" yaml:"successful_bid_end_at"` - AutoRelistedCount uint64 `protobuf:"varint,12,opt,name=auto_relisted_count,json=autoRelistedCount,proto3" json:"auto_relisted_count,omitempty"` -} - -func (m *NftListing) Reset() { *m = NftListing{} } -func (m *NftListing) String() string { return proto.CompactTextString(m) } -func (*NftListing) ProtoMessage() {} -func (*NftListing) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{4} -} -func (m *NftListing) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NftListing.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NftListing) XXX_Merge(src proto.Message) { - xxx_messageInfo_NftListing.Merge(m, src) -} -func (m *NftListing) XXX_Size() int { - return m.Size() -} -func (m *NftListing) XXX_DiscardUnknown() { - xxx_messageInfo_NftListing.DiscardUnknown(m) -} - -var xxx_messageInfo_NftListing proto.InternalMessageInfo - -func (m *NftListing) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *NftListing) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *NftListing) GetListingType() ListingType { - if m != nil { - return m.ListingType - } - return ListingType_DIRECT_ASSET_BORROW -} - -func (m *NftListing) GetState() ListingState { - if m != nil { - return m.State - } - return ListingState_LISTING -} - -func (m *NftListing) GetBidToken() string { - if m != nil { - return m.BidToken - } - return "" -} - -func (m *NftListing) GetBidActiveRank() uint64 { - if m != nil { - return m.BidActiveRank - } - return 0 -} - -func (m *NftListing) GetStartedAt() time.Time { - if m != nil { - return m.StartedAt - } - return time.Time{} -} - -func (m *NftListing) GetEndAt() time.Time { - if m != nil { - return m.EndAt - } - return time.Time{} -} - -func (m *NftListing) GetFullPaymentEndAt() time.Time { - if m != nil { - return m.FullPaymentEndAt - } - return time.Time{} -} - -func (m *NftListing) GetSuccessfulBidEndAt() time.Time { - if m != nil { - return m.SuccessfulBidEndAt - } - return time.Time{} -} - -func (m *NftListing) GetAutoRelistedCount() uint64 { - if m != nil { - return m.AutoRelistedCount - } - return 0 -} - -type NftBid struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - AutomaticPayment bool `protobuf:"varint,4,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` - PaidAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=paid_amount,json=paidAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"paid_amount" yaml:"paid_amount"` - BidTime time.Time `protobuf:"bytes,6,opt,name=bid_time,json=bidTime,proto3,stdtime" json:"bid_time" yaml:"bid_time"` -} - -func (m *NftBid) Reset() { *m = NftBid{} } -func (m *NftBid) String() string { return proto.CompactTextString(m) } -func (*NftBid) ProtoMessage() {} -func (*NftBid) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{5} -} -func (m *NftBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NftBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NftBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NftBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_NftBid.Merge(m, src) -} -func (m *NftBid) XXX_Size() int { - return m.Size() -} -func (m *NftBid) XXX_DiscardUnknown() { - xxx_messageInfo_NftBid.DiscardUnknown(m) -} - -var xxx_messageInfo_NftBid proto.InternalMessageInfo - -func (m *NftBid) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *NftBid) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -func (m *NftBid) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *NftBid) GetAutomaticPayment() bool { - if m != nil { - return m.AutomaticPayment - } - return false -} - -func (m *NftBid) GetBidTime() time.Time { - if m != nil { - return m.BidTime - } - return time.Time{} -} - -type Params struct { - MinStakingForListing github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=min_staking_for_listing,json=minStakingForListing,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_staking_for_listing" yaml:"min_staking_for_listing"` - DefaultBidActiveRank uint64 `protobuf:"varint,2,opt,name=default_bid_active_rank,json=defaultBidActiveRank,proto3" json:"default_bid_active_rank,omitempty"` - BidTokens []string `protobuf:"bytes,3,rep,name=bid_tokens,json=bidTokens,proto3" json:"bid_tokens,omitempty"` - AutoRelistingCountIfNoBid uint64 `protobuf:"varint,4,opt,name=auto_relisting_count_if_no_bid,json=autoRelistingCountIfNoBid,proto3" json:"auto_relisting_count_if_no_bid,omitempty"` - NftListingDelaySeconds uint64 `protobuf:"varint,5,opt,name=nft_listing_delay_seconds,json=nftListingDelaySeconds,proto3" json:"nft_listing_delay_seconds,omitempty"` - NftListingPeriodInitial uint64 `protobuf:"varint,6,opt,name=nft_listing_period_initial,json=nftListingPeriodInitial,proto3" json:"nft_listing_period_initial,omitempty"` - NftListingCancelRequiredSeconds uint64 `protobuf:"varint,7,opt,name=nft_listing_cancel_required_seconds,json=nftListingCancelRequiredSeconds,proto3" json:"nft_listing_cancel_required_seconds,omitempty"` - NftListingCancelFeePercentage uint64 `protobuf:"varint,8,opt,name=nft_listing_cancel_fee_percentage,json=nftListingCancelFeePercentage,proto3" json:"nft_listing_cancel_fee_percentage,omitempty"` - NftListingGapTime uint64 `protobuf:"varint,9,opt,name=nft_listing_gap_time,json=nftListingGapTime,proto3" json:"nft_listing_gap_time,omitempty"` - BidCancelRequiredSeconds uint64 `protobuf:"varint,10,opt,name=bid_cancel_required_seconds,json=bidCancelRequiredSeconds,proto3" json:"bid_cancel_required_seconds,omitempty"` - BidTokenDisburseSecondsAfterCancel uint64 `protobuf:"varint,11,opt,name=bid_token_disburse_seconds_after_cancel,json=bidTokenDisburseSecondsAfterCancel,proto3" json:"bid_token_disburse_seconds_after_cancel,omitempty"` - NftListingFullPaymentPeriod uint64 `protobuf:"varint,12,opt,name=nft_listing_full_payment_period,json=nftListingFullPaymentPeriod,proto3" json:"nft_listing_full_payment_period,omitempty"` - NftListingNftDeliveryPeriod uint64 `protobuf:"varint,13,opt,name=nft_listing_nft_delivery_period,json=nftListingNftDeliveryPeriod,proto3" json:"nft_listing_nft_delivery_period,omitempty"` - NftCreatorSharePercentage uint64 `protobuf:"varint,14,opt,name=nft_creator_share_percentage,json=nftCreatorSharePercentage,proto3" json:"nft_creator_share_percentage,omitempty"` - MarketAdministrator string `protobuf:"bytes,15,opt,name=market_administrator,json=marketAdministrator,proto3" json:"market_administrator,omitempty"` - NftListingCommissionFee uint64 `protobuf:"varint,16,opt,name=nft_listing_commission_fee,json=nftListingCommissionFee,proto3" json:"nft_listing_commission_fee,omitempty"` - NftListingExtendSeconds uint64 `protobuf:"varint,17,opt,name=nft_listing_extend_seconds,json=nftListingExtendSeconds,proto3" json:"nft_listing_extend_seconds,omitempty"` - NftListingPeriodExtendFeePerHour types.Coin `protobuf:"bytes,18,opt,name=nft_listing_period_extend_fee_per_hour,json=nftListingPeriodExtendFeePerHour,proto3" json:"nft_listing_period_extend_fee_per_hour"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{6} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetDefaultBidActiveRank() uint64 { - if m != nil { - return m.DefaultBidActiveRank - } - return 0 -} - -func (m *Params) GetBidTokens() []string { - if m != nil { - return m.BidTokens - } - return nil -} - -func (m *Params) GetAutoRelistingCountIfNoBid() uint64 { - if m != nil { - return m.AutoRelistingCountIfNoBid - } - return 0 -} - -func (m *Params) GetNftListingDelaySeconds() uint64 { - if m != nil { - return m.NftListingDelaySeconds - } - return 0 -} - -func (m *Params) GetNftListingPeriodInitial() uint64 { - if m != nil { - return m.NftListingPeriodInitial - } - return 0 -} - -func (m *Params) GetNftListingCancelRequiredSeconds() uint64 { - if m != nil { - return m.NftListingCancelRequiredSeconds - } - return 0 -} - -func (m *Params) GetNftListingCancelFeePercentage() uint64 { - if m != nil { - return m.NftListingCancelFeePercentage - } - return 0 -} - -func (m *Params) GetNftListingGapTime() uint64 { - if m != nil { - return m.NftListingGapTime - } - return 0 -} - -func (m *Params) GetBidCancelRequiredSeconds() uint64 { - if m != nil { - return m.BidCancelRequiredSeconds - } - return 0 -} - -func (m *Params) GetBidTokenDisburseSecondsAfterCancel() uint64 { - if m != nil { - return m.BidTokenDisburseSecondsAfterCancel - } - return 0 -} - -func (m *Params) GetNftListingFullPaymentPeriod() uint64 { - if m != nil { - return m.NftListingFullPaymentPeriod - } - return 0 -} - -func (m *Params) GetNftListingNftDeliveryPeriod() uint64 { - if m != nil { - return m.NftListingNftDeliveryPeriod - } - return 0 -} - -func (m *Params) GetNftCreatorSharePercentage() uint64 { - if m != nil { - return m.NftCreatorSharePercentage - } - return 0 -} - -func (m *Params) GetMarketAdministrator() string { - if m != nil { - return m.MarketAdministrator - } - return "" -} - -func (m *Params) GetNftListingCommissionFee() uint64 { - if m != nil { - return m.NftListingCommissionFee - } - return 0 -} - -func (m *Params) GetNftListingExtendSeconds() uint64 { - if m != nil { - return m.NftListingExtendSeconds - } - return 0 -} - -func (m *Params) GetNftListingPeriodExtendFeePerHour() types.Coin { - if m != nil { - return m.NftListingPeriodExtendFeePerHour - } - return types.Coin{} -} - -type EventListNft struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventListNft) Reset() { *m = EventListNft{} } -func (m *EventListNft) String() string { return proto.CompactTextString(m) } -func (*EventListNft) ProtoMessage() {} -func (*EventListNft) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{7} -} -func (m *EventListNft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventListNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventListNft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventListNft) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventListNft.Merge(m, src) -} -func (m *EventListNft) XXX_Size() int { - return m.Size() -} -func (m *EventListNft) XXX_DiscardUnknown() { - xxx_messageInfo_EventListNft.DiscardUnknown(m) -} - -var xxx_messageInfo_EventListNft proto.InternalMessageInfo - -func (m *EventListNft) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventListNft) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventListNft) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventCancelListNfting struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventCancelListNfting) Reset() { *m = EventCancelListNfting{} } -func (m *EventCancelListNfting) String() string { return proto.CompactTextString(m) } -func (*EventCancelListNfting) ProtoMessage() {} -func (*EventCancelListNfting) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{8} -} -func (m *EventCancelListNfting) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventCancelListNfting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventCancelListNfting.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventCancelListNfting) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCancelListNfting.Merge(m, src) -} -func (m *EventCancelListNfting) XXX_Size() int { - return m.Size() -} -func (m *EventCancelListNfting) XXX_DiscardUnknown() { - xxx_messageInfo_EventCancelListNfting.DiscardUnknown(m) -} - -var xxx_messageInfo_EventCancelListNfting proto.InternalMessageInfo - -func (m *EventCancelListNfting) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventCancelListNfting) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventCancelListNfting) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventExpandListingPeriod struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventExpandListingPeriod) Reset() { *m = EventExpandListingPeriod{} } -func (m *EventExpandListingPeriod) String() string { return proto.CompactTextString(m) } -func (*EventExpandListingPeriod) ProtoMessage() {} -func (*EventExpandListingPeriod) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{9} -} -func (m *EventExpandListingPeriod) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventExpandListingPeriod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventExpandListingPeriod.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventExpandListingPeriod) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventExpandListingPeriod.Merge(m, src) -} -func (m *EventExpandListingPeriod) XXX_Size() int { - return m.Size() -} -func (m *EventExpandListingPeriod) XXX_DiscardUnknown() { - xxx_messageInfo_EventExpandListingPeriod.DiscardUnknown(m) -} - -var xxx_messageInfo_EventExpandListingPeriod proto.InternalMessageInfo - -func (m *EventExpandListingPeriod) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventExpandListingPeriod) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventExpandListingPeriod) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventSellingDecision struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventSellingDecision) Reset() { *m = EventSellingDecision{} } -func (m *EventSellingDecision) String() string { return proto.CompactTextString(m) } -func (*EventSellingDecision) ProtoMessage() {} -func (*EventSellingDecision) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{10} -} -func (m *EventSellingDecision) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventSellingDecision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventSellingDecision.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventSellingDecision) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventSellingDecision.Merge(m, src) -} -func (m *EventSellingDecision) XXX_Size() int { - return m.Size() -} -func (m *EventSellingDecision) XXX_DiscardUnknown() { - xxx_messageInfo_EventSellingDecision.DiscardUnknown(m) -} - -var xxx_messageInfo_EventSellingDecision proto.InternalMessageInfo - -func (m *EventSellingDecision) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventSellingDecision) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventSellingDecision) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventEndListNfting struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventEndListNfting) Reset() { *m = EventEndListNfting{} } -func (m *EventEndListNfting) String() string { return proto.CompactTextString(m) } -func (*EventEndListNfting) ProtoMessage() {} -func (*EventEndListNfting) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{11} -} -func (m *EventEndListNfting) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventEndListNfting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventEndListNfting.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventEndListNfting) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventEndListNfting.Merge(m, src) -} -func (m *EventEndListNfting) XXX_Size() int { - return m.Size() -} -func (m *EventEndListNfting) XXX_DiscardUnknown() { - xxx_messageInfo_EventEndListNfting.DiscardUnknown(m) -} - -var xxx_messageInfo_EventEndListNfting proto.InternalMessageInfo - -func (m *EventEndListNfting) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventEndListNfting) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventEndListNfting) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventPlaceBid struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventPlaceBid) Reset() { *m = EventPlaceBid{} } -func (m *EventPlaceBid) String() string { return proto.CompactTextString(m) } -func (*EventPlaceBid) ProtoMessage() {} -func (*EventPlaceBid) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{12} -} -func (m *EventPlaceBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPlaceBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPlaceBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPlaceBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPlaceBid.Merge(m, src) -} -func (m *EventPlaceBid) XXX_Size() int { - return m.Size() -} -func (m *EventPlaceBid) XXX_DiscardUnknown() { - xxx_messageInfo_EventPlaceBid.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPlaceBid proto.InternalMessageInfo - -func (m *EventPlaceBid) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -func (m *EventPlaceBid) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventPlaceBid) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *EventPlaceBid) GetAmount() string { - if m != nil { - return m.Amount - } - return "" -} - -type EventCancelBid struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventCancelBid) Reset() { *m = EventCancelBid{} } -func (m *EventCancelBid) String() string { return proto.CompactTextString(m) } -func (*EventCancelBid) ProtoMessage() {} -func (*EventCancelBid) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{13} -} -func (m *EventCancelBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventCancelBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventCancelBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventCancelBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCancelBid.Merge(m, src) -} -func (m *EventCancelBid) XXX_Size() int { - return m.Size() -} -func (m *EventCancelBid) XXX_DiscardUnknown() { - xxx_messageInfo_EventCancelBid.DiscardUnknown(m) -} - -var xxx_messageInfo_EventCancelBid proto.InternalMessageInfo - -func (m *EventCancelBid) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -func (m *EventCancelBid) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventCancelBid) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventPayFullBid struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventPayFullBid) Reset() { *m = EventPayFullBid{} } -func (m *EventPayFullBid) String() string { return proto.CompactTextString(m) } -func (*EventPayFullBid) ProtoMessage() {} -func (*EventPayFullBid) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{14} -} -func (m *EventPayFullBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPayFullBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPayFullBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPayFullBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPayFullBid.Merge(m, src) -} -func (m *EventPayFullBid) XXX_Size() int { - return m.Size() -} -func (m *EventPayFullBid) XXX_DiscardUnknown() { - xxx_messageInfo_EventPayFullBid.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPayFullBid proto.InternalMessageInfo - -func (m *EventPayFullBid) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -func (m *EventPayFullBid) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventPayFullBid) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventBorrow struct { - Borrower string `protobuf:"bytes,1,opt,name=borrower,proto3" json:"borrower,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventBorrow) Reset() { *m = EventBorrow{} } -func (m *EventBorrow) String() string { return proto.CompactTextString(m) } -func (*EventBorrow) ProtoMessage() {} -func (*EventBorrow) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{15} -} -func (m *EventBorrow) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventBorrow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventBorrow.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventBorrow) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventBorrow.Merge(m, src) -} -func (m *EventBorrow) XXX_Size() int { - return m.Size() -} -func (m *EventBorrow) XXX_DiscardUnknown() { - xxx_messageInfo_EventBorrow.DiscardUnknown(m) -} - -var xxx_messageInfo_EventBorrow proto.InternalMessageInfo - -func (m *EventBorrow) GetBorrower() string { - if m != nil { - return m.Borrower - } - return "" -} - -func (m *EventBorrow) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventBorrow) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *EventBorrow) GetAmount() string { - if m != nil { - return m.Amount - } - return "" -} - -type EventRepay struct { - Repayer string `protobuf:"bytes,1,opt,name=repayer,proto3" json:"repayer,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventRepay) Reset() { *m = EventRepay{} } -func (m *EventRepay) String() string { return proto.CompactTextString(m) } -func (*EventRepay) ProtoMessage() {} -func (*EventRepay) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{16} -} -func (m *EventRepay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventRepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventRepay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventRepay) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventRepay.Merge(m, src) -} -func (m *EventRepay) XXX_Size() int { - return m.Size() -} -func (m *EventRepay) XXX_DiscardUnknown() { - xxx_messageInfo_EventRepay.DiscardUnknown(m) -} - -var xxx_messageInfo_EventRepay proto.InternalMessageInfo - -func (m *EventRepay) GetRepayer() string { - if m != nil { - return m.Repayer - } - return "" -} - -func (m *EventRepay) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventRepay) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *EventRepay) GetAmount() string { - if m != nil { - return m.Amount - } - return "" -} - -type EventLiquidate struct { - Liquidator string `protobuf:"bytes,1,opt,name=liquidator,proto3" json:"liquidator,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventLiquidate) Reset() { *m = EventLiquidate{} } -func (m *EventLiquidate) String() string { return proto.CompactTextString(m) } -func (*EventLiquidate) ProtoMessage() {} -func (*EventLiquidate) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{17} -} -func (m *EventLiquidate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventLiquidate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventLiquidate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventLiquidate) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventLiquidate.Merge(m, src) -} -func (m *EventLiquidate) XXX_Size() int { - return m.Size() -} -func (m *EventLiquidate) XXX_DiscardUnknown() { - xxx_messageInfo_EventLiquidate.DiscardUnknown(m) -} - -var xxx_messageInfo_EventLiquidate proto.InternalMessageInfo - -func (m *EventLiquidate) GetLiquidator() string { - if m != nil { - return m.Liquidator - } - return "" -} - -func (m *EventLiquidate) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventLiquidate) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type PaymentStatus struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - AutomaticPayment bool `protobuf:"varint,4,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` - PaidAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=paid_amount,json=paidAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"paid_amount" yaml:"paid_amount"` - BidTime time.Time `protobuf:"bytes,6,opt,name=bid_time,json=bidTime,proto3,stdtime" json:"bid_time" yaml:"bid_time"` - State ListingState `protobuf:"varint,7,opt,name=state,proto3,enum=ununifi.nftmarketv1.ListingState" json:"state,omitempty"` - AllPaid bool `protobuf:"varint,8,opt,name=all_paid,json=allPaid,proto3" json:"all_paid,omitempty"` -} - -func (m *PaymentStatus) Reset() { *m = PaymentStatus{} } -func (m *PaymentStatus) String() string { return proto.CompactTextString(m) } -func (*PaymentStatus) ProtoMessage() {} -func (*PaymentStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4d57da6b4abab7e9, []int{18} -} -func (m *PaymentStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PaymentStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PaymentStatus.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PaymentStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_PaymentStatus.Merge(m, src) -} -func (m *PaymentStatus) XXX_Size() int { - return m.Size() -} -func (m *PaymentStatus) XXX_DiscardUnknown() { - xxx_messageInfo_PaymentStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_PaymentStatus proto.InternalMessageInfo - -func (m *PaymentStatus) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *PaymentStatus) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -func (m *PaymentStatus) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *PaymentStatus) GetAutomaticPayment() bool { - if m != nil { - return m.AutomaticPayment - } - return false -} - -func (m *PaymentStatus) GetBidTime() time.Time { - if m != nil { - return m.BidTime - } - return time.Time{} -} - -func (m *PaymentStatus) GetState() ListingState { - if m != nil { - return m.State - } - return ListingState_LISTING -} - -func (m *PaymentStatus) GetAllPaid() bool { - if m != nil { - return m.AllPaid - } - return false -} - -func init() { - proto.RegisterEnum("ununifi.nftmarketv1.ListingType", ListingType_name, ListingType_value) - proto.RegisterEnum("ununifi.nftmarketv1.ListingState", ListingState_name, ListingState_value) - proto.RegisterType((*NftIdentifier)(nil), "ununifi.nftmarketv1.NftIdentifier") - proto.RegisterType((*Loan)(nil), "ununifi.nftmarketv1.Loan") - proto.RegisterType((*ListedClass)(nil), "ununifi.nftmarketv1.ListedClass") - proto.RegisterType((*ListedNft)(nil), "ununifi.nftmarketv1.ListedNft") - proto.RegisterType((*NftListing)(nil), "ununifi.nftmarketv1.NftListing") - proto.RegisterType((*NftBid)(nil), "ununifi.nftmarketv1.NftBid") - proto.RegisterType((*Params)(nil), "ununifi.nftmarketv1.Params") - proto.RegisterType((*EventListNft)(nil), "ununifi.nftmarketv1.EventListNft") - proto.RegisterType((*EventCancelListNfting)(nil), "ununifi.nftmarketv1.EventCancelListNfting") - proto.RegisterType((*EventExpandListingPeriod)(nil), "ununifi.nftmarketv1.EventExpandListingPeriod") - proto.RegisterType((*EventSellingDecision)(nil), "ununifi.nftmarketv1.EventSellingDecision") - proto.RegisterType((*EventEndListNfting)(nil), "ununifi.nftmarketv1.EventEndListNfting") - proto.RegisterType((*EventPlaceBid)(nil), "ununifi.nftmarketv1.EventPlaceBid") - proto.RegisterType((*EventCancelBid)(nil), "ununifi.nftmarketv1.EventCancelBid") - proto.RegisterType((*EventPayFullBid)(nil), "ununifi.nftmarketv1.EventPayFullBid") - proto.RegisterType((*EventBorrow)(nil), "ununifi.nftmarketv1.EventBorrow") - proto.RegisterType((*EventRepay)(nil), "ununifi.nftmarketv1.EventRepay") - proto.RegisterType((*EventLiquidate)(nil), "ununifi.nftmarketv1.EventLiquidate") - proto.RegisterType((*PaymentStatus)(nil), "ununifi.nftmarketv1.PaymentStatus") -} - -func init() { proto.RegisterFile("nftmarketv1/nftmarket.proto", fileDescriptor_4d57da6b4abab7e9) } - -var fileDescriptor_4d57da6b4abab7e9 = []byte{ - // 1680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0xb7, 0x2c, 0x59, 0xb2, 0x9e, 0x62, 0x5b, 0x19, 0x3b, 0x6b, 0xda, 0x4e, 0x64, 0xaf, 0x0a, - 0xa4, 0xc1, 0xb6, 0x95, 0x90, 0x2c, 0x8a, 0x45, 0x5b, 0x14, 0x5b, 0x7d, 0x39, 0x26, 0x20, 0x28, - 0x2e, 0x25, 0x77, 0xbb, 0xdb, 0xa2, 0xc4, 0x88, 0x1c, 0xca, 0x03, 0x93, 0x43, 0x99, 0x1c, 0x3a, - 0x31, 0xd0, 0x53, 0x2f, 0xbd, 0xee, 0x3f, 0x55, 0x60, 0x8f, 0x7b, 0x2c, 0x0a, 0x34, 0x2d, 0x92, - 0x73, 0x2f, 0xfb, 0x17, 0x14, 0xf3, 0x41, 0x89, 0x16, 0xbc, 0xc9, 0xba, 0x2b, 0xa0, 0x97, 0x3d, - 0x89, 0x8f, 0xef, 0xbd, 0xdf, 0xef, 0xcd, 0xbc, 0x8f, 0x19, 0x0a, 0x0e, 0x98, 0xc7, 0x03, 0x1c, - 0x5d, 0x10, 0x7e, 0xf5, 0xb4, 0x39, 0x7b, 0x6e, 0x4c, 0xa3, 0x90, 0x87, 0x68, 0x3b, 0x61, 0x09, - 0xa3, 0x1e, 0x6d, 0x64, 0x8c, 0xf6, 0x77, 0x26, 0xe1, 0x24, 0x94, 0xfa, 0xa6, 0x78, 0x52, 0xa6, - 0xfb, 0x87, 0x93, 0x30, 0x9c, 0xf8, 0xa4, 0x29, 0xa5, 0x71, 0xe2, 0x35, 0x39, 0x0d, 0x48, 0xcc, - 0x71, 0x30, 0xd5, 0x06, 0x35, 0x27, 0x8c, 0x83, 0x30, 0x6e, 0x8e, 0x71, 0x4c, 0x9a, 0x57, 0x4f, - 0xc7, 0x84, 0xe3, 0xa7, 0x4d, 0x27, 0xa4, 0x4c, 0xe9, 0xeb, 0x2d, 0xd8, 0x18, 0x78, 0xdc, 0x74, - 0x09, 0xe3, 0xd4, 0xa3, 0x24, 0x42, 0x7b, 0xb0, 0xee, 0xf8, 0x38, 0x8e, 0x6d, 0xea, 0x1a, 0xb9, - 0xa3, 0xdc, 0x93, 0xb2, 0x55, 0x92, 0xb2, 0xe9, 0xa2, 0x07, 0x50, 0x64, 0x1e, 0x17, 0x8a, 0x55, - 0xa9, 0x58, 0x63, 0xc2, 0xb3, 0xfe, 0x67, 0x28, 0xf4, 0x43, 0xcc, 0xd0, 0xa7, 0x33, 0xb5, 0xf0, - 0xab, 0x3c, 0xab, 0x37, 0x6e, 0x59, 0x47, 0xe3, 0x06, 0x5b, 0xbb, 0xf0, 0xd5, 0xeb, 0xc3, 0x15, - 0x0d, 0x84, 0x3e, 0x86, 0x82, 0x1f, 0x62, 0x26, 0xd1, 0x2b, 0xcf, 0xf6, 0x1a, 0x2a, 0xf4, 0x86, - 0x08, 0xbd, 0xa1, 0x43, 0x6f, 0x74, 0x42, 0xca, 0xb4, 0x97, 0x34, 0xae, 0xb7, 0xa0, 0xd2, 0xa7, - 0x31, 0x27, 0x6e, 0x47, 0x44, 0xf9, 0xae, 0xf0, 0x77, 0xa1, 0xa4, 0xe2, 0x8b, 0x8d, 0xd5, 0xa3, - 0xfc, 0x93, 0xb2, 0x55, 0x94, 0xb4, 0x71, 0xfd, 0x04, 0xca, 0x0a, 0x62, 0xe0, 0x71, 0xb4, 0x09, - 0xab, 0x33, 0xd7, 0x55, 0xea, 0xa2, 0x2a, 0xe4, 0x93, 0x88, 0xea, 0x15, 0x8b, 0x47, 0x41, 0x91, - 0x44, 0xd4, 0x3e, 0xc7, 0xf1, 0xb9, 0x91, 0x57, 0x14, 0x49, 0x44, 0x4f, 0x70, 0x7c, 0x5e, 0xff, - 0x5b, 0x11, 0x60, 0xe0, 0x71, 0x81, 0x46, 0xd9, 0xe4, 0xfb, 0xef, 0xc8, 0x0e, 0xac, 0x85, 0x2f, - 0x19, 0x89, 0xd2, 0x0d, 0x97, 0x02, 0xea, 0xc0, 0x3d, 0x5f, 0x31, 0xd8, 0xfc, 0x7a, 0x4a, 0x64, - 0x10, 0x9b, 0xcf, 0x8e, 0x6e, 0x05, 0xd7, 0xa1, 0x8c, 0xae, 0xa7, 0xc4, 0xaa, 0xf8, 0x73, 0x01, - 0x7d, 0x02, 0x6b, 0x31, 0xc7, 0x9c, 0x18, 0x05, 0xe9, 0xfd, 0xe1, 0xbb, 0xbc, 0x87, 0xc2, 0xd0, - 0x52, 0xf6, 0xe8, 0x00, 0xca, 0x63, 0xea, 0xda, 0x3c, 0xbc, 0x20, 0xcc, 0x58, 0x93, 0x71, 0xad, - 0x8f, 0xa9, 0x3b, 0x12, 0x32, 0xfa, 0x1c, 0x4a, 0x01, 0x65, 0xf6, 0x98, 0xba, 0x46, 0x51, 0xa8, - 0xda, 0xbf, 0x11, 0xcb, 0xf9, 0xc7, 0xeb, 0xc3, 0xc7, 0x13, 0xca, 0xcf, 0x93, 0x71, 0xc3, 0x09, - 0x83, 0xa6, 0x2e, 0x49, 0xf5, 0xf3, 0xb3, 0xd8, 0xbd, 0x68, 0x8a, 0x65, 0xc4, 0x0d, 0x93, 0xf1, - 0x6f, 0x5e, 0x1f, 0x6e, 0x5e, 0xe3, 0xc0, 0xff, 0x65, 0x5d, 0xc3, 0xd4, 0xad, 0x62, 0x40, 0x59, - 0x9b, 0xba, 0xe8, 0x31, 0x6c, 0x09, 0x5e, 0xec, 0x70, 0x7a, 0x45, 0xec, 0x08, 0xb3, 0x0b, 0xa3, - 0x74, 0x94, 0x7b, 0x52, 0xb0, 0x36, 0xc6, 0xd4, 0x6d, 0xc9, 0xb7, 0x16, 0x66, 0x17, 0xe8, 0xf7, - 0x00, 0x31, 0xc7, 0x11, 0x27, 0xae, 0x8d, 0xb9, 0xb1, 0x2e, 0x37, 0x7e, 0xbf, 0xa1, 0xfa, 0xa4, - 0x91, 0xf6, 0x49, 0x63, 0x94, 0xf6, 0x49, 0xfb, 0x91, 0x88, 0xf0, 0x9b, 0xd7, 0x87, 0xf7, 0x15, - 0xef, 0xdc, 0xb7, 0xfe, 0xe5, 0xbf, 0x0e, 0x73, 0x56, 0x59, 0xbf, 0x68, 0x71, 0xd4, 0x87, 0x22, - 0x61, 0x12, 0xb5, 0xfc, 0x5e, 0xd4, 0x3d, 0x8d, 0xba, 0xa1, 0x50, 0x95, 0x9f, 0x42, 0x5c, 0x23, - 0x4c, 0xa0, 0x5d, 0xc2, 0xb6, 0x97, 0xf8, 0xbe, 0x3d, 0xc5, 0xd7, 0x01, 0x61, 0xdc, 0xd6, 0xd0, - 0xf0, 0x5e, 0xe8, 0xc7, 0x1a, 0x7a, 0x5f, 0x41, 0xdf, 0x02, 0xa2, 0x78, 0xaa, 0x42, 0x73, 0xaa, - 0x14, 0x3d, 0x49, 0xf9, 0x12, 0x1e, 0xc4, 0x89, 0xe3, 0x90, 0x38, 0xf6, 0x12, 0x5f, 0xec, 0x6e, - 0x4a, 0x5a, 0x79, 0x2f, 0xe9, 0x13, 0x4d, 0xfa, 0x50, 0xef, 0xd2, 0x6d, 0x30, 0x8a, 0x16, 0xcd, - 0x75, 0x6d, 0xea, 0x2a, 0xe2, 0x06, 0x6c, 0xe3, 0x84, 0x87, 0x76, 0x44, 0x7c, 0xd9, 0x68, 0xb6, - 0x13, 0x26, 0x8c, 0x1b, 0xf7, 0x64, 0xfe, 0xee, 0x0b, 0x95, 0xa5, 0x35, 0x1d, 0xa1, 0xa8, 0xff, - 0x25, 0x0f, 0xc5, 0x81, 0xc7, 0x45, 0xda, 0xbf, 0x77, 0x0f, 0x7d, 0x00, 0xc5, 0x31, 0x75, 0xdd, - 0x59, 0x13, 0x69, 0x09, 0x7d, 0x02, 0x45, 0x1c, 0xc8, 0x30, 0xf2, 0xdf, 0x6d, 0xde, 0x68, 0x73, - 0xf4, 0x13, 0x90, 0x11, 0x07, 0x98, 0x53, 0x27, 0xdd, 0x78, 0xd9, 0x45, 0xeb, 0x56, 0x75, 0xa6, - 0xd0, 0xfb, 0x8e, 0x08, 0x54, 0xa6, 0x58, 0x94, 0xad, 0xa2, 0x92, 0xfd, 0xd2, 0xee, 0xde, 0xb9, - 0x29, 0x90, 0xda, 0xf6, 0x0c, 0x54, 0xdd, 0x02, 0x21, 0xb5, 0x54, 0x4c, 0x16, 0xac, 0xcb, 0xa6, - 0xa4, 0x01, 0x91, 0x8d, 0xf7, 0xee, 0x64, 0x1e, 0xe8, 0x64, 0x6e, 0x29, 0xd4, 0xd4, 0x53, 0xe5, - 0xaf, 0x24, 0x9a, 0x59, 0x48, 0xff, 0x29, 0x43, 0xf1, 0x14, 0x47, 0x38, 0x88, 0xd1, 0x5f, 0x73, - 0xb0, 0x2b, 0x1a, 0x32, 0xe6, 0xf8, 0x42, 0x8c, 0x1d, 0x2f, 0x8c, 0x6c, 0x3d, 0x4c, 0xd4, 0xa8, - 0x6c, 0x9f, 0xde, 0x79, 0x49, 0xb5, 0x79, 0x9f, 0xdf, 0x02, 0x5b, 0xb7, 0x76, 0x02, 0xca, 0x86, - 0x4a, 0x71, 0x1c, 0x46, 0xe9, 0x48, 0xfd, 0x39, 0xec, 0xba, 0xc4, 0xc3, 0x89, 0xcf, 0xed, 0xc5, - 0x69, 0xb0, 0x2a, 0xab, 0x69, 0x47, 0xab, 0xdb, 0x37, 0x86, 0xc2, 0x23, 0x80, 0xd9, 0xd0, 0x8a, - 0x8d, 0xbc, 0x1c, 0xff, 0xe5, 0x74, 0x6a, 0xc5, 0xa8, 0x05, 0xb5, 0x4c, 0x7d, 0x8a, 0x50, 0x64, - 0x81, 0xda, 0xd4, 0xb3, 0x59, 0x28, 0xa7, 0x59, 0x41, 0x82, 0xef, 0xcd, 0x4b, 0x95, 0xb2, 0x89, - 0xac, 0x55, 0xd3, 0x1b, 0x84, 0xa2, 0x4e, 0x7f, 0x01, 0x7b, 0xa2, 0x4e, 0x53, 0x7f, 0x97, 0xf8, - 0xf8, 0xda, 0x8e, 0x89, 0x13, 0x32, 0x37, 0x96, 0x69, 0x2f, 0x58, 0x1f, 0xb0, 0xd9, 0xd1, 0xd0, - 0x15, 0xea, 0xa1, 0xd2, 0xa2, 0x5f, 0xc1, 0x7e, 0xd6, 0x75, 0x4a, 0x22, 0x1a, 0xba, 0x36, 0x65, - 0x94, 0x53, 0xec, 0xcb, 0x74, 0x16, 0xac, 0xdd, 0xb9, 0xef, 0xa9, 0xd4, 0x9b, 0x4a, 0x8d, 0xfa, - 0xf0, 0xa3, 0xac, 0xb3, 0x83, 0x99, 0x43, 0x7c, 0x3b, 0x22, 0x97, 0x09, 0x8d, 0x88, 0x3b, 0x8b, - 0x40, 0x8d, 0xca, 0xc3, 0x39, 0x4a, 0x47, 0x1a, 0x5a, 0xda, 0x2e, 0x0d, 0xe5, 0x04, 0x3e, 0xbc, - 0x05, 0xcd, 0x23, 0x44, 0x44, 0xe5, 0x10, 0xc6, 0xf1, 0x84, 0xc8, 0x99, 0x5a, 0xb0, 0x1e, 0x2d, - 0x62, 0x1d, 0x13, 0x72, 0x3a, 0x33, 0x42, 0x4d, 0xd8, 0xc9, 0x22, 0x4d, 0xf0, 0x54, 0x55, 0x67, - 0x59, 0xf5, 0xfc, 0xdc, 0xf9, 0x39, 0x9e, 0x8a, 0x72, 0x43, 0xbf, 0x86, 0x03, 0x91, 0xa2, 0x6f, - 0x5b, 0x00, 0x48, 0x3f, 0x63, 0x4c, 0xdd, 0xdb, 0x23, 0x1f, 0xc2, 0x8f, 0x67, 0x19, 0xb6, 0x5d, - 0x1a, 0x8f, 0x93, 0x28, 0x26, 0xa9, 0xb7, 0x8d, 0x3d, 0x4e, 0x22, 0x8d, 0x2d, 0xa7, 0x5d, 0xc1, - 0xaa, 0xa7, 0xe9, 0xef, 0x6a, 0x63, 0x8d, 0xd4, 0x12, 0xa6, 0x8a, 0x03, 0x75, 0xe1, 0x30, 0xbb, - 0x88, 0x1b, 0xa3, 0x56, 0xa5, 0x49, 0xcf, 0xb0, 0x83, 0xf9, 0x7a, 0x8e, 0xe7, 0x53, 0x57, 0x65, - 0x6a, 0x11, 0x45, 0x3c, 0xbb, 0xc4, 0xa7, 0x57, 0x24, 0xba, 0x4e, 0x51, 0x36, 0x16, 0x51, 0x06, - 0x1e, 0xef, 0x6a, 0x1b, 0x8d, 0xf2, 0x29, 0x3c, 0x14, 0x9e, 0x4e, 0x44, 0x30, 0x0f, 0x23, 0x3b, - 0x3e, 0xc7, 0xd1, 0x8d, 0xac, 0x6c, 0xaa, 0x0a, 0x65, 0x1e, 0xef, 0x28, 0x93, 0xa1, 0xb0, 0xc8, - 0x64, 0xe4, 0x29, 0xec, 0xa8, 0x79, 0x69, 0x63, 0x37, 0xa0, 0x8c, 0xc6, 0x3c, 0x12, 0x66, 0xc6, - 0x96, 0x1c, 0x8b, 0xdb, 0x4a, 0xd7, 0xca, 0xaa, 0x16, 0x2b, 0xd3, 0x09, 0x83, 0x80, 0xc6, 0x31, - 0x0d, 0x99, 0x28, 0x09, 0xa3, 0xba, 0x58, 0x99, 0x9d, 0x99, 0xfe, 0x98, 0x90, 0x45, 0x67, 0xf2, - 0x8a, 0x8b, 0x63, 0x22, 0xcd, 0xe7, 0xfd, 0x45, 0xe7, 0x9e, 0xd4, 0xa7, 0xe9, 0xbc, 0x84, 0xc7, - 0xb7, 0xf4, 0x84, 0xc6, 0xd0, 0xf5, 0x68, 0x9f, 0x87, 0x49, 0x64, 0xa0, 0xef, 0x36, 0xbd, 0x8f, - 0x16, 0x1b, 0x48, 0xf1, 0xa9, 0xa2, 0x3d, 0x09, 0x93, 0xa8, 0xfe, 0x3b, 0xb8, 0xd7, 0xbb, 0x22, - 0x4c, 0x5a, 0x89, 0x9b, 0xe0, 0xec, 0xf2, 0x95, 0xcb, 0x5e, 0xbe, 0xb2, 0x17, 0xcc, 0xd5, 0x6f, - 0xbb, 0x1f, 0xe7, 0xb3, 0xf7, 0x63, 0x1b, 0x1e, 0x48, 0x5c, 0x55, 0x53, 0x1a, 0x5d, 0xcc, 0xb2, - 0x65, 0x11, 0x8c, 0xc1, 0x90, 0x04, 0xbd, 0x57, 0x53, 0xcc, 0xdc, 0x1b, 0x8b, 0x5c, 0x1a, 0xc7, - 0x9f, 0x60, 0x47, 0x72, 0x0c, 0x89, 0xef, 0xcb, 0xf9, 0xe5, 0x50, 0x91, 0xe7, 0xa5, 0xe1, 0xff, - 0x11, 0x90, 0x5a, 0x83, 0x5a, 0xc0, 0x92, 0x77, 0xe8, 0x12, 0x36, 0x24, 0xfa, 0xa9, 0x8f, 0x1d, - 0x22, 0xa6, 0xf5, 0xfc, 0x52, 0x90, 0xbb, 0x71, 0x29, 0xb8, 0x33, 0xb4, 0x40, 0xd2, 0x67, 0x7b, - 0x41, 0x21, 0xe9, 0xe3, 0xf9, 0x0b, 0xd8, 0xcc, 0x64, 0x7d, 0xa9, 0x9c, 0xf5, 0x3f, 0xc0, 0x96, - 0x5a, 0x0e, 0xbe, 0x16, 0xd3, 0x66, 0xb9, 0xe0, 0x31, 0x54, 0x24, 0x78, 0x3b, 0x8c, 0xa2, 0xf0, - 0x25, 0xda, 0x87, 0xf5, 0xb1, 0x7c, 0x9a, 0x41, 0xcf, 0xe4, 0x25, 0xee, 0xd6, 0x14, 0x40, 0x92, - 0x5a, 0x64, 0x8a, 0xaf, 0x91, 0x01, 0xa5, 0x48, 0x3c, 0xcc, 0x28, 0x53, 0x71, 0x89, 0x8c, 0x63, - 0x9d, 0x9f, 0x3e, 0xbd, 0x4c, 0xa8, 0x2b, 0x3e, 0x6c, 0x6a, 0x00, 0xbe, 0x16, 0xc2, 0x94, 0x38, - 0xf3, 0xe6, 0x7f, 0xd8, 0xca, 0x7f, 0xe6, 0x61, 0x43, 0x1f, 0x05, 0xe2, 0x13, 0x2a, 0x89, 0x7f, - 0xb8, 0xcd, 0xfe, 0xbf, 0x6e, 0xb3, 0xf3, 0xef, 0xdd, 0xd2, 0x1d, 0xbf, 0x77, 0xf7, 0x60, 0x1d, - 0xcb, 0x63, 0x9f, 0xba, 0xf2, 0xe6, 0xb3, 0x6e, 0x95, 0xb0, 0x38, 0xe1, 0xa9, 0xfb, 0xd1, 0x67, - 0xea, 0xbf, 0x87, 0xf4, 0x93, 0x7a, 0x17, 0xb6, 0xbb, 0xa6, 0xd5, 0xeb, 0x8c, 0xec, 0xd6, 0x70, - 0xd8, 0x1b, 0xd9, 0xed, 0x17, 0x96, 0xf5, 0xe2, 0xb3, 0xea, 0x0a, 0x7a, 0x08, 0xc6, 0xf0, 0xf3, - 0xc1, 0xe8, 0xa4, 0x37, 0x32, 0x3b, 0x5a, 0xd7, 0xb1, 0x7a, 0xad, 0x91, 0xf9, 0x62, 0x50, 0xcd, - 0xa1, 0xfb, 0xb0, 0xd1, 0x6f, 0x8d, 0x7a, 0xf6, 0xf0, 0xc4, 0x3c, 0x3d, 0x35, 0x07, 0xcf, 0xab, - 0xab, 0x1f, 0x71, 0xb8, 0x97, 0x0d, 0x05, 0x55, 0xa0, 0xd4, 0x37, 0x87, 0x23, 0xa1, 0x5c, 0x11, - 0x42, 0xdb, 0xec, 0x76, 0x85, 0x90, 0x43, 0x3b, 0x50, 0x1d, 0xf6, 0xfa, 0x7d, 0x73, 0xf0, 0xdc, - 0xee, 0xf6, 0x3a, 0xe6, 0x50, 0x40, 0xae, 0xa2, 0x2d, 0xa8, 0xf4, 0xcd, 0xdf, 0x9e, 0x99, 0x5d, - 0xc5, 0x91, 0x17, 0x2f, 0x7a, 0x83, 0xae, 0x9d, 0x82, 0x14, 0x10, 0x82, 0xcd, 0xe1, 0x59, 0xa7, - 0xd3, 0x1b, 0x0e, 0x8f, 0xcf, 0xfa, 0x76, 0xdb, 0xec, 0x56, 0xd7, 0xda, 0xc7, 0x5f, 0xbd, 0xa9, - 0xe5, 0xbe, 0x7e, 0x53, 0xcb, 0xfd, 0xfb, 0x4d, 0x2d, 0xf7, 0xe5, 0xdb, 0xda, 0xca, 0xd7, 0x6f, - 0x6b, 0x2b, 0x7f, 0x7f, 0x5b, 0x5b, 0xf9, 0xe2, 0xa7, 0x99, 0xd4, 0x9e, 0xb1, 0x33, 0x46, 0x8f, - 0x69, 0xd3, 0x39, 0xc7, 0x94, 0x35, 0x5f, 0x35, 0xb3, 0xff, 0x64, 0xc9, 0x24, 0x8f, 0x8b, 0x32, - 0x49, 0x1f, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xb8, 0x4a, 0x7f, 0xe5, 0x12, 0x00, 0x00, -} - -func (m *NftIdentifier) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NftIdentifier) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftIdentifier) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Loan) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Loan) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Loan) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Loan.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ListedClass) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListedClass) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListedClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftIds) > 0 { - for iNdEx := len(m.NftIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.NftIds[iNdEx]) - copy(dAtA[i:], m.NftIds[iNdEx]) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListedNft) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListedNft) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListedNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.UriHash) > 0 { - i -= len(m.UriHash) - copy(dAtA[i:], m.UriHash) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.UriHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.Uri) > 0 { - i -= len(m.Uri) - copy(dAtA[i:], m.Uri) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Uri))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NftListing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NftListing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AutoRelistedCount != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.AutoRelistedCount)) - i-- - dAtA[i] = 0x60 - } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SuccessfulBidEndAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SuccessfulBidEndAt):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintNftmarket(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x5a - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.FullPaymentEndAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.FullPaymentEndAt):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintNftmarket(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x52 - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndAt):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintNftmarket(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x4a - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartedAt):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintNftmarket(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x42 - if m.BidActiveRank != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.BidActiveRank)) - i-- - dAtA[i] = 0x38 - } - { - size := m.MinBid.Size() - i -= size - if _, err := m.MinBid.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - if len(m.BidToken) > 0 { - i -= len(m.BidToken) - copy(dAtA[i:], m.BidToken) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.BidToken))) - i-- - dAtA[i] = 0x2a - } - if m.State != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x20 - } - if m.ListingType != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.ListingType)) - i-- - dAtA[i] = 0x18 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NftBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NftBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.BidTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.BidTime):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintNftmarket(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0x32 - { - size := m.PaidAmount.Size() - i -= size - if _, err := m.PaidAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.AutomaticPayment { - i-- - if m.AutomaticPayment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftListingPeriodExtendFeePerHour.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - if m.NftListingExtendSeconds != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingExtendSeconds)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.NftListingCommissionFee != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingCommissionFee)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.MarketAdministrator) > 0 { - i -= len(m.MarketAdministrator) - copy(dAtA[i:], m.MarketAdministrator) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.MarketAdministrator))) - i-- - dAtA[i] = 0x7a - } - if m.NftCreatorSharePercentage != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftCreatorSharePercentage)) - i-- - dAtA[i] = 0x70 - } - if m.NftListingNftDeliveryPeriod != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingNftDeliveryPeriod)) - i-- - dAtA[i] = 0x68 - } - if m.NftListingFullPaymentPeriod != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingFullPaymentPeriod)) - i-- - dAtA[i] = 0x60 - } - if m.BidTokenDisburseSecondsAfterCancel != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.BidTokenDisburseSecondsAfterCancel)) - i-- - dAtA[i] = 0x58 - } - if m.BidCancelRequiredSeconds != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.BidCancelRequiredSeconds)) - i-- - dAtA[i] = 0x50 - } - if m.NftListingGapTime != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingGapTime)) - i-- - dAtA[i] = 0x48 - } - if m.NftListingCancelFeePercentage != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingCancelFeePercentage)) - i-- - dAtA[i] = 0x40 - } - if m.NftListingCancelRequiredSeconds != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingCancelRequiredSeconds)) - i-- - dAtA[i] = 0x38 - } - if m.NftListingPeriodInitial != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingPeriodInitial)) - i-- - dAtA[i] = 0x30 - } - if m.NftListingDelaySeconds != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.NftListingDelaySeconds)) - i-- - dAtA[i] = 0x28 - } - if m.AutoRelistingCountIfNoBid != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.AutoRelistingCountIfNoBid)) - i-- - dAtA[i] = 0x20 - } - if len(m.BidTokens) > 0 { - for iNdEx := len(m.BidTokens) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BidTokens[iNdEx]) - copy(dAtA[i:], m.BidTokens[iNdEx]) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.BidTokens[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.DefaultBidActiveRank != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.DefaultBidActiveRank)) - i-- - dAtA[i] = 0x10 - } - { - size := m.MinStakingForListing.Size() - i -= size - if _, err := m.MinStakingForListing.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EventListNft) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventListNft) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventListNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventCancelListNfting) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventCancelListNfting) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventCancelListNfting) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventExpandListingPeriod) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventExpandListingPeriod) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventExpandListingPeriod) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventSellingDecision) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventSellingDecision) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventSellingDecision) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventEndListNfting) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventEndListNfting) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventEndListNfting) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventPlaceBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPlaceBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventCancelBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventCancelBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventCancelBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventPayFullBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPayFullBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPayFullBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventBorrow) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventBorrow) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Borrower) > 0 { - i -= len(m.Borrower) - copy(dAtA[i:], m.Borrower) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Borrower))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventRepay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventRepay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventRepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Repayer) > 0 { - i -= len(m.Repayer) - copy(dAtA[i:], m.Repayer) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Repayer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventLiquidate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventLiquidate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventLiquidate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Liquidator) > 0 { - i -= len(m.Liquidator) - copy(dAtA[i:], m.Liquidator) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Liquidator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PaymentStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PaymentStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PaymentStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AllPaid { - i-- - if m.AllPaid { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.State != 0 { - i = encodeVarintNftmarket(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x38 - } - n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.BidTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.BidTime):]) - if err12 != nil { - return 0, err12 - } - i -= n12 - i = encodeVarintNftmarket(dAtA, i, uint64(n12)) - i-- - dAtA[i] = 0x32 - { - size := m.PaidAmount.Size() - i -= size - if _, err := m.PaidAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.AutomaticPayment { - i-- - if m.AutomaticPayment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftmarket(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftmarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintNftmarket(dAtA []byte, offset int, v uint64) int { - offset -= sovNftmarket(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *NftIdentifier) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *Loan) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftmarket(uint64(l)) - l = m.Loan.Size() - n += 1 + l + sovNftmarket(uint64(l)) - return n -} - -func (m *ListedClass) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - if len(m.NftIds) > 0 { - for _, s := range m.NftIds { - l = len(s) - n += 1 + l + sovNftmarket(uint64(l)) - } - } - return n -} - -func (m *ListedNft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.Uri) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.UriHash) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *NftListing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftmarket(uint64(l)) - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - if m.ListingType != 0 { - n += 1 + sovNftmarket(uint64(m.ListingType)) - } - if m.State != 0 { - n += 1 + sovNftmarket(uint64(m.State)) - } - l = len(m.BidToken) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = m.MinBid.Size() - n += 1 + l + sovNftmarket(uint64(l)) - if m.BidActiveRank != 0 { - n += 1 + sovNftmarket(uint64(m.BidActiveRank)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartedAt) - n += 1 + l + sovNftmarket(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndAt) - n += 1 + l + sovNftmarket(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.FullPaymentEndAt) - n += 1 + l + sovNftmarket(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.SuccessfulBidEndAt) - n += 1 + l + sovNftmarket(uint64(l)) - if m.AutoRelistedCount != 0 { - n += 1 + sovNftmarket(uint64(m.AutoRelistedCount)) - } - return n -} - -func (m *NftBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftmarket(uint64(l)) - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovNftmarket(uint64(l)) - if m.AutomaticPayment { - n += 2 - } - l = m.PaidAmount.Size() - n += 1 + l + sovNftmarket(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.BidTime) - n += 1 + l + sovNftmarket(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MinStakingForListing.Size() - n += 1 + l + sovNftmarket(uint64(l)) - if m.DefaultBidActiveRank != 0 { - n += 1 + sovNftmarket(uint64(m.DefaultBidActiveRank)) - } - if len(m.BidTokens) > 0 { - for _, s := range m.BidTokens { - l = len(s) - n += 1 + l + sovNftmarket(uint64(l)) - } - } - if m.AutoRelistingCountIfNoBid != 0 { - n += 1 + sovNftmarket(uint64(m.AutoRelistingCountIfNoBid)) - } - if m.NftListingDelaySeconds != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingDelaySeconds)) - } - if m.NftListingPeriodInitial != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingPeriodInitial)) - } - if m.NftListingCancelRequiredSeconds != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingCancelRequiredSeconds)) - } - if m.NftListingCancelFeePercentage != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingCancelFeePercentage)) - } - if m.NftListingGapTime != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingGapTime)) - } - if m.BidCancelRequiredSeconds != 0 { - n += 1 + sovNftmarket(uint64(m.BidCancelRequiredSeconds)) - } - if m.BidTokenDisburseSecondsAfterCancel != 0 { - n += 1 + sovNftmarket(uint64(m.BidTokenDisburseSecondsAfterCancel)) - } - if m.NftListingFullPaymentPeriod != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingFullPaymentPeriod)) - } - if m.NftListingNftDeliveryPeriod != 0 { - n += 1 + sovNftmarket(uint64(m.NftListingNftDeliveryPeriod)) - } - if m.NftCreatorSharePercentage != 0 { - n += 1 + sovNftmarket(uint64(m.NftCreatorSharePercentage)) - } - l = len(m.MarketAdministrator) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - if m.NftListingCommissionFee != 0 { - n += 2 + sovNftmarket(uint64(m.NftListingCommissionFee)) - } - if m.NftListingExtendSeconds != 0 { - n += 2 + sovNftmarket(uint64(m.NftListingExtendSeconds)) - } - l = m.NftListingPeriodExtendFeePerHour.Size() - n += 2 + l + sovNftmarket(uint64(l)) - return n -} - -func (m *EventListNft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventCancelListNfting) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventExpandListingPeriod) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventSellingDecision) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventEndListNfting) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventPlaceBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventCancelBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventPayFullBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventBorrow) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Borrower) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventRepay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Repayer) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *EventLiquidate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Liquidator) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - return n -} - -func (m *PaymentStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftmarket(uint64(l)) - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftmarket(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovNftmarket(uint64(l)) - if m.AutomaticPayment { - n += 2 - } - l = m.PaidAmount.Size() - n += 1 + l + sovNftmarket(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.BidTime) - n += 1 + l + sovNftmarket(uint64(l)) - if m.State != 0 { - n += 1 + sovNftmarket(uint64(m.State)) - } - if m.AllPaid { - n += 2 - } - return n -} - -func sovNftmarket(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozNftmarket(x uint64) (n int) { - return sovNftmarket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *NftIdentifier) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftIdentifier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftIdentifier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Loan) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Loan: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Loan: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Loan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListedClass) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListedClass: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListedClass: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftIds = append(m.NftIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListedNft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListedNft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListedNft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UriHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NftListing) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftListing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftListing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ListingType", wireType) - } - m.ListingType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ListingType |= ListingType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= ListingState(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BidToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinBid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BidActiveRank", wireType) - } - m.BidActiveRank = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BidActiveRank |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartedAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartedAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FullPaymentEndAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.FullPaymentEndAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SuccessfulBidEndAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SuccessfulBidEndAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutoRelistedCount", wireType) - } - m.AutoRelistedCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AutoRelistedCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NftBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticPayment", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AutomaticPayment = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaidAmount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PaidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.BidTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStakingForListing", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinStakingForListing.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultBidActiveRank", wireType) - } - m.DefaultBidActiveRank = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DefaultBidActiveRank |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BidTokens = append(m.BidTokens, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutoRelistingCountIfNoBid", wireType) - } - m.AutoRelistingCountIfNoBid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AutoRelistingCountIfNoBid |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingDelaySeconds", wireType) - } - m.NftListingDelaySeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingDelaySeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingPeriodInitial", wireType) - } - m.NftListingPeriodInitial = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingPeriodInitial |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingCancelRequiredSeconds", wireType) - } - m.NftListingCancelRequiredSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingCancelRequiredSeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingCancelFeePercentage", wireType) - } - m.NftListingCancelFeePercentage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingCancelFeePercentage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingGapTime", wireType) - } - m.NftListingGapTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingGapTime |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BidCancelRequiredSeconds", wireType) - } - m.BidCancelRequiredSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BidCancelRequiredSeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTokenDisburseSecondsAfterCancel", wireType) - } - m.BidTokenDisburseSecondsAfterCancel = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BidTokenDisburseSecondsAfterCancel |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingFullPaymentPeriod", wireType) - } - m.NftListingFullPaymentPeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingFullPaymentPeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingNftDeliveryPeriod", wireType) - } - m.NftListingNftDeliveryPeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingNftDeliveryPeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftCreatorSharePercentage", wireType) - } - m.NftCreatorSharePercentage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftCreatorSharePercentage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketAdministrator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MarketAdministrator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingCommissionFee", wireType) - } - m.NftListingCommissionFee = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingCommissionFee |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingExtendSeconds", wireType) - } - m.NftListingExtendSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingExtendSeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 18: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingPeriodExtendFeePerHour", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftListingPeriodExtendFeePerHour.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventListNft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventListNft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventListNft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventCancelListNfting) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventCancelListNfting: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventCancelListNfting: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventExpandListingPeriod) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventExpandListingPeriod: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventExpandListingPeriod: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventSellingDecision) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventSellingDecision: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventSellingDecision: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventEndListNfting) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventEndListNfting: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventEndListNfting: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPlaceBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPlaceBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventCancelBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventCancelBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventCancelBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventPayFullBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPayFullBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPayFullBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventBorrow) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventBorrow: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventBorrow: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Borrower", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Borrower = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventRepay) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventRepay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventRepay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Repayer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Repayer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventLiquidate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventLiquidate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventLiquidate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Liquidator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Liquidator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PaymentStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PaymentStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PaymentStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticPayment", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AutomaticPayment = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaidAmount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PaidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftmarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftmarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.BidTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= ListingState(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllPaid", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftmarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AllPaid = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipNftmarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftmarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipNftmarket(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNftmarket - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNftmarket - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNftmarket - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthNftmarket - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupNftmarket - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthNftmarket - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthNftmarket = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNftmarket = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupNftmarket = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/nftmarketv1/types/params.go b/deprecated/x/nftmarketv1/types/params.go deleted file mode 100644 index dae149e8c..000000000 --- a/deprecated/x/nftmarketv1/types/params.go +++ /dev/null @@ -1,333 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramstype "github.com/cosmos/cosmos-sdk/x/params/types" -) - -// Parameter keys and default values -var ( - DefaultBidToken = "uguu" -) - -// NewParams returns a new params object -func NewParams() Params { - return DefaultParams() -} - -// DefaultParams returns default params for incentive module -func DefaultParams() Params { - return Params{ - MinStakingForListing: sdk.ZeroInt(), - DefaultBidActiveRank: 1, - BidTokens: []string{DefaultBidToken}, - AutoRelistingCountIfNoBid: 1, - NftListingDelaySeconds: 10, - NftListingPeriodInitial: 60, - NftListingCancelRequiredSeconds: 20, - NftListingCancelFeePercentage: 5, - NftListingGapTime: 20, - BidCancelRequiredSeconds: 20, - BidTokenDisburseSecondsAfterCancel: 20, - NftListingFullPaymentPeriod: 30, - NftListingNftDeliveryPeriod: 30, - NftCreatorSharePercentage: 5, - MarketAdministrator: "", - NftListingCommissionFee: 5, - NftListingExtendSeconds: 30, - NftListingPeriodExtendFeePerHour: sdk.NewInt64Coin(DefaultBidToken, 1000000), - } -} - -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstype.KeyTable { - return paramstype.NewKeyTable().RegisterParamSet(&Params{}) -} - -// Parameter keys -var ( - KeyMinStakingForListing = []byte("MinStakingForListing") - KeyDefaultBidActiveRank = []byte("DefaultBidActiveRank") - KeyBidTokens = []byte("BidTokens") - KeyAutoRelistingCountIfNoBid = []byte("AutoRelistingCountIfNoBid") - KeyNftListingDelaySeconds = []byte("NftListingDelaySeconds") - KeyNftListingPeriodInitial = []byte("NftListingPeriodInitial") - KeyNftListingCancelRequiredSeconds = []byte("NftListingCancelRequiredSeconds") - KeyNftListingCancelFeePercentage = []byte("NftListingCancelFeePercentage") - KeyNftListingGapTime = []byte("NftListingGapTime") - KeyBidCancelRequiredSeconds = []byte("BidCancelRequiredSeconds") - KeyBidTokenDisburseSecondsAfterCancel = []byte("BidTokenDisburseSecondsAfterCancel") - KeyNftListingFullPaymentPeriod = []byte("NftListingFullPaymentPeriod") - KeyNftListingNftDeliveryPeriod = []byte("NftListingNftDeliveryPeriod") - KeyNftCreatorSharePercentage = []byte("NftCreatorSharePercentage") - KeyMarketAdministrator = []byte("MarketAdministrator") - KeyNftListingCommissionFee = []byte("NftListingCommissionFee") - KeyNftListingExtendSeconds = []byte("NftListingExtendSeconds") - KeyNftListingPeriodExtendFeePerHour = []byte("NftListingPeriodExtendFeePerHour") -) - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { - return paramstype.ParamSetPairs{ - paramstype.NewParamSetPair(KeyMinStakingForListing, &p.MinStakingForListing, validateMinStakingForListing), - paramstype.NewParamSetPair(KeyDefaultBidActiveRank, &p.DefaultBidActiveRank, validateDefaultBidActiveRank), - paramstype.NewParamSetPair(KeyBidTokens, &p.BidTokens, validateBidTokens), - paramstype.NewParamSetPair(KeyAutoRelistingCountIfNoBid, &p.AutoRelistingCountIfNoBid, validateAutoRelistingCountIfNoBid), - paramstype.NewParamSetPair(KeyNftListingDelaySeconds, &p.NftListingDelaySeconds, validateNftListingDelaySeconds), - paramstype.NewParamSetPair(KeyNftListingPeriodInitial, &p.NftListingPeriodInitial, validateNftListingPeriodInitial), - paramstype.NewParamSetPair(KeyNftListingCancelRequiredSeconds, &p.NftListingCancelRequiredSeconds, validateNftListingCancelRequiredSeconds), - paramstype.NewParamSetPair(KeyNftListingCancelFeePercentage, &p.NftListingCancelFeePercentage, validateNftListingCancelFeePercentage), - paramstype.NewParamSetPair(KeyNftListingGapTime, &p.NftListingGapTime, validateNftListingGapTime), - paramstype.NewParamSetPair(KeyBidCancelRequiredSeconds, &p.BidCancelRequiredSeconds, validateBidCancelRequiredSeconds), - paramstype.NewParamSetPair(KeyBidTokenDisburseSecondsAfterCancel, &p.BidTokenDisburseSecondsAfterCancel, validateBidTokenDisburseSecondsAfterCancel), - paramstype.NewParamSetPair(KeyNftListingFullPaymentPeriod, &p.NftListingFullPaymentPeriod, validateNftListingFullPaymentPeriod), - paramstype.NewParamSetPair(KeyNftListingNftDeliveryPeriod, &p.NftListingNftDeliveryPeriod, validateNftListingNftDeliveryPeriod), - paramstype.NewParamSetPair(KeyNftCreatorSharePercentage, &p.NftCreatorSharePercentage, validateNftCreatorSharePercentage), - paramstype.NewParamSetPair(KeyMarketAdministrator, &p.MarketAdministrator, validateMarketAdministrator), - paramstype.NewParamSetPair(KeyNftListingCommissionFee, &p.NftListingCommissionFee, validateNftListingCommissionFee), - paramstype.NewParamSetPair(KeyNftListingExtendSeconds, &p.NftListingExtendSeconds, validateNftListingExtendSeconds), - paramstype.NewParamSetPair(KeyNftListingPeriodExtendFeePerHour, &p.NftListingPeriodExtendFeePerHour, validateNftListingPeriodExtendFeePerHour), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - - if err := validateMinStakingForListing(p.MinStakingForListing); err != nil { - return err - } - - if err := validateDefaultBidActiveRank(p.DefaultBidActiveRank); err != nil { - return err - } - - if err := validateBidTokens(p.BidTokens); err != nil { - return err - } - - if err := validateAutoRelistingCountIfNoBid(p.AutoRelistingCountIfNoBid); err != nil { - return err - } - - if err := validateNftListingDelaySeconds(p.NftListingDelaySeconds); err != nil { - return err - } - - if err := validateNftListingPeriodInitial(p.NftListingPeriodInitial); err != nil { - return err - } - - if err := validateNftListingCancelRequiredSeconds(p.BidCancelRequiredSeconds); err != nil { - return err - } - - if err := validateNftListingCancelFeePercentage(p.NftListingCancelFeePercentage); err != nil { - return err - } - - if err := validateNftListingGapTime(p.NftListingGapTime); err != nil { - return err - } - - if err := validateBidCancelRequiredSeconds(p.BidCancelRequiredSeconds); err != nil { - return err - } - - if err := validateBidTokenDisburseSecondsAfterCancel(p.BidTokenDisburseSecondsAfterCancel); err != nil { - return err - } - - if err := validateNftListingFullPaymentPeriod(p.NftListingFullPaymentPeriod); err != nil { - return err - } - - if err := validateNftListingNftDeliveryPeriod(p.NftListingNftDeliveryPeriod); err != nil { - return err - } - - if err := validateNftCreatorSharePercentage(p.NftCreatorSharePercentage); err != nil { - return err - } - - if err := validateMarketAdministrator(p.MarketAdministrator); err != nil { - return err - } - - if err := validateNftListingCommissionFee(p.NftListingCommissionFee); err != nil { - return err - } - - if err := validateNftListingExtendSeconds(p.NftListingExtendSeconds); err != nil { - return err - } - - if err := validateNftListingPeriodExtendFeePerHour(p.NftListingPeriodExtendFeePerHour); err != nil { - return err - } - - return nil -} - -func validateMinStakingForListing(i interface{}) error { - _, ok := i.(sdk.Int) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateDefaultBidActiveRank(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateBidTokens(i interface{}) error { - _, ok := i.([]string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateAutoRelistingCountIfNoBid(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingDelaySeconds(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingPeriodInitial(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingCancelRequiredSeconds(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingCancelFeePercentage(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingGapTime(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateBidCancelRequiredSeconds(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateBidTokenDisburseSecondsAfterCancel(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingFullPaymentPeriod(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingNftDeliveryPeriod(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftCreatorSharePercentage(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateMarketAdministrator(i interface{}) error { - _, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingCommissionFee(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingExtendSeconds(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingPeriodExtendFeePerHour(i interface{}) error { - _, ok := i.(sdk.Coin) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} diff --git a/deprecated/x/nftmarketv1/types/query.pb.go b/deprecated/x/nftmarketv1/types/query.pb.go deleted file mode 100644 index df69c22e5..000000000 --- a/deprecated/x/nftmarketv1/types/query.pb.go +++ /dev/null @@ -1,5313 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nftmarketv1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/query" - proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -type QueryNftListingRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryNftListingRequest) Reset() { *m = QueryNftListingRequest{} } -func (m *QueryNftListingRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNftListingRequest) ProtoMessage() {} -func (*QueryNftListingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{2} -} -func (m *QueryNftListingRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNftListingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNftListingRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNftListingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNftListingRequest.Merge(m, src) -} -func (m *QueryNftListingRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryNftListingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNftListingRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNftListingRequest proto.InternalMessageInfo - -func (m *QueryNftListingRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryNftListingRequest) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type QueryNftListingResponse struct { - Listing NftListing `protobuf:"bytes,1,opt,name=listing,proto3" json:"listing"` -} - -func (m *QueryNftListingResponse) Reset() { *m = QueryNftListingResponse{} } -func (m *QueryNftListingResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNftListingResponse) ProtoMessage() {} -func (*QueryNftListingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{3} -} -func (m *QueryNftListingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNftListingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNftListingResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNftListingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNftListingResponse.Merge(m, src) -} -func (m *QueryNftListingResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryNftListingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNftListingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNftListingResponse proto.InternalMessageInfo - -func (m *QueryNftListingResponse) GetListing() NftListing { - if m != nil { - return m.Listing - } - return NftListing{} -} - -type QueryListedNftsRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` -} - -func (m *QueryListedNftsRequest) Reset() { *m = QueryListedNftsRequest{} } -func (m *QueryListedNftsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryListedNftsRequest) ProtoMessage() {} -func (*QueryListedNftsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{4} -} -func (m *QueryListedNftsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryListedNftsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryListedNftsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryListedNftsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryListedNftsRequest.Merge(m, src) -} -func (m *QueryListedNftsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryListedNftsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryListedNftsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryListedNftsRequest proto.InternalMessageInfo - -func (m *QueryListedNftsRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -type QueryListedClassesRequest struct { - NftLimit int32 `protobuf:"varint,1,opt,name=nft_limit,json=nftLimit,proto3" json:"nft_limit,omitempty"` -} - -func (m *QueryListedClassesRequest) Reset() { *m = QueryListedClassesRequest{} } -func (m *QueryListedClassesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryListedClassesRequest) ProtoMessage() {} -func (*QueryListedClassesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{5} -} -func (m *QueryListedClassesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryListedClassesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryListedClassesRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryListedClassesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryListedClassesRequest.Merge(m, src) -} -func (m *QueryListedClassesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryListedClassesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryListedClassesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryListedClassesRequest proto.InternalMessageInfo - -func (m *QueryListedClassesRequest) GetNftLimit() int32 { - if m != nil { - return m.NftLimit - } - return 0 -} - -type QueryListedClassRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftLimit int32 `protobuf:"varint,2,opt,name=nft_limit,json=nftLimit,proto3" json:"nft_limit,omitempty"` -} - -func (m *QueryListedClassRequest) Reset() { *m = QueryListedClassRequest{} } -func (m *QueryListedClassRequest) String() string { return proto.CompactTextString(m) } -func (*QueryListedClassRequest) ProtoMessage() {} -func (*QueryListedClassRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{6} -} -func (m *QueryListedClassRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryListedClassRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryListedClassRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryListedClassRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryListedClassRequest.Merge(m, src) -} -func (m *QueryListedClassRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryListedClassRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryListedClassRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryListedClassRequest proto.InternalMessageInfo - -func (m *QueryListedClassRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryListedClassRequest) GetNftLimit() int32 { - if m != nil { - return m.NftLimit - } - return 0 -} - -type QueryListedNftsResponse struct { - Listings []NftListing `protobuf:"bytes,1,rep,name=listings,proto3" json:"listings"` -} - -func (m *QueryListedNftsResponse) Reset() { *m = QueryListedNftsResponse{} } -func (m *QueryListedNftsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryListedNftsResponse) ProtoMessage() {} -func (*QueryListedNftsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{7} -} -func (m *QueryListedNftsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryListedNftsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryListedNftsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryListedNftsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryListedNftsResponse.Merge(m, src) -} -func (m *QueryListedNftsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryListedNftsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryListedNftsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryListedNftsResponse proto.InternalMessageInfo - -func (m *QueryListedNftsResponse) GetListings() []NftListing { - if m != nil { - return m.Listings - } - return nil -} - -type QueryListedClassesResponse struct { - Classes []*QueryListedClassResponse `protobuf:"bytes,1,rep,name=classes,proto3" json:"classes,omitempty"` -} - -func (m *QueryListedClassesResponse) Reset() { *m = QueryListedClassesResponse{} } -func (m *QueryListedClassesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryListedClassesResponse) ProtoMessage() {} -func (*QueryListedClassesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{8} -} -func (m *QueryListedClassesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryListedClassesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryListedClassesResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryListedClassesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryListedClassesResponse.Merge(m, src) -} -func (m *QueryListedClassesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryListedClassesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryListedClassesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryListedClassesResponse proto.InternalMessageInfo - -func (m *QueryListedClassesResponse) GetClasses() []*QueryListedClassResponse { - if m != nil { - return m.Classes - } - return nil -} - -type QueryListedClassResponse struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` - Uri string `protobuf:"bytes,5,opt,name=uri,proto3" json:"uri,omitempty"` - Urihash string `protobuf:"bytes,6,opt,name=urihash,proto3" json:"urihash,omitempty"` - Nfts []*ListedNft `protobuf:"bytes,7,rep,name=nfts,proto3" json:"nfts,omitempty"` - NftCount uint64 `protobuf:"varint,8,opt,name=nft_count,json=nftCount,proto3" json:"nft_count,omitempty"` -} - -func (m *QueryListedClassResponse) Reset() { *m = QueryListedClassResponse{} } -func (m *QueryListedClassResponse) String() string { return proto.CompactTextString(m) } -func (*QueryListedClassResponse) ProtoMessage() {} -func (*QueryListedClassResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{9} -} -func (m *QueryListedClassResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryListedClassResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryListedClassResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryListedClassResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryListedClassResponse.Merge(m, src) -} -func (m *QueryListedClassResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryListedClassResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryListedClassResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryListedClassResponse proto.InternalMessageInfo - -func (m *QueryListedClassResponse) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryListedClassResponse) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *QueryListedClassResponse) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *QueryListedClassResponse) GetSymbol() string { - if m != nil { - return m.Symbol - } - return "" -} - -func (m *QueryListedClassResponse) GetUri() string { - if m != nil { - return m.Uri - } - return "" -} - -func (m *QueryListedClassResponse) GetUrihash() string { - if m != nil { - return m.Urihash - } - return "" -} - -func (m *QueryListedClassResponse) GetNfts() []*ListedNft { - if m != nil { - return m.Nfts - } - return nil -} - -func (m *QueryListedClassResponse) GetNftCount() uint64 { - if m != nil { - return m.NftCount - } - return 0 -} - -type QueryLoansRequest struct { -} - -func (m *QueryLoansRequest) Reset() { *m = QueryLoansRequest{} } -func (m *QueryLoansRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLoansRequest) ProtoMessage() {} -func (*QueryLoansRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{10} -} -func (m *QueryLoansRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLoansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLoansRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryLoansRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoansRequest.Merge(m, src) -} -func (m *QueryLoansRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryLoansRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoansRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLoansRequest proto.InternalMessageInfo - -type QueryLoansResponse struct { - Loans []Loan `protobuf:"bytes,1,rep,name=loans,proto3" json:"loans"` -} - -func (m *QueryLoansResponse) Reset() { *m = QueryLoansResponse{} } -func (m *QueryLoansResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLoansResponse) ProtoMessage() {} -func (*QueryLoansResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{11} -} -func (m *QueryLoansResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLoansResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLoansResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryLoansResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoansResponse.Merge(m, src) -} -func (m *QueryLoansResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryLoansResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoansResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLoansResponse proto.InternalMessageInfo - -func (m *QueryLoansResponse) GetLoans() []Loan { - if m != nil { - return m.Loans - } - return nil -} - -type QueryLoanRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryLoanRequest) Reset() { *m = QueryLoanRequest{} } -func (m *QueryLoanRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLoanRequest) ProtoMessage() {} -func (*QueryLoanRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{12} -} -func (m *QueryLoanRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLoanRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLoanRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryLoanRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoanRequest.Merge(m, src) -} -func (m *QueryLoanRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryLoanRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoanRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLoanRequest proto.InternalMessageInfo - -func (m *QueryLoanRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryLoanRequest) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type QueryLoanResponse struct { - Loan Loan `protobuf:"bytes,1,opt,name=loan,proto3" json:"loan"` - BorrowingLimit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=borrowing_limit,json=borrowingLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"borrowing_limit" yaml:"borrowing_limit"` -} - -func (m *QueryLoanResponse) Reset() { *m = QueryLoanResponse{} } -func (m *QueryLoanResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLoanResponse) ProtoMessage() {} -func (*QueryLoanResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{13} -} -func (m *QueryLoanResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLoanResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLoanResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryLoanResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoanResponse.Merge(m, src) -} -func (m *QueryLoanResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryLoanResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoanResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLoanResponse proto.InternalMessageInfo - -func (m *QueryLoanResponse) GetLoan() Loan { - if m != nil { - return m.Loan - } - return Loan{} -} - -type QueryCDPsListRequest struct { -} - -func (m *QueryCDPsListRequest) Reset() { *m = QueryCDPsListRequest{} } -func (m *QueryCDPsListRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCDPsListRequest) ProtoMessage() {} -func (*QueryCDPsListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{14} -} -func (m *QueryCDPsListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCDPsListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCDPsListRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryCDPsListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCDPsListRequest.Merge(m, src) -} -func (m *QueryCDPsListRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryCDPsListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCDPsListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCDPsListRequest proto.InternalMessageInfo - -type QueryCDPsListResponse struct { -} - -func (m *QueryCDPsListResponse) Reset() { *m = QueryCDPsListResponse{} } -func (m *QueryCDPsListResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCDPsListResponse) ProtoMessage() {} -func (*QueryCDPsListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{15} -} -func (m *QueryCDPsListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCDPsListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCDPsListResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryCDPsListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCDPsListResponse.Merge(m, src) -} -func (m *QueryCDPsListResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryCDPsListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCDPsListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCDPsListResponse proto.InternalMessageInfo - -type QueryNftBidsRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryNftBidsRequest) Reset() { *m = QueryNftBidsRequest{} } -func (m *QueryNftBidsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNftBidsRequest) ProtoMessage() {} -func (*QueryNftBidsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{16} -} -func (m *QueryNftBidsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNftBidsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNftBidsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNftBidsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNftBidsRequest.Merge(m, src) -} -func (m *QueryNftBidsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryNftBidsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNftBidsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNftBidsRequest proto.InternalMessageInfo - -func (m *QueryNftBidsRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryNftBidsRequest) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type QueryNftBidsResponse struct { - Bids []NftBid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` -} - -func (m *QueryNftBidsResponse) Reset() { *m = QueryNftBidsResponse{} } -func (m *QueryNftBidsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNftBidsResponse) ProtoMessage() {} -func (*QueryNftBidsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{17} -} -func (m *QueryNftBidsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNftBidsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNftBidsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNftBidsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNftBidsResponse.Merge(m, src) -} -func (m *QueryNftBidsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryNftBidsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNftBidsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNftBidsResponse proto.InternalMessageInfo - -func (m *QueryNftBidsResponse) GetBids() []NftBid { - if m != nil { - return m.Bids - } - return nil -} - -type QueryPaymentStatusRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Bidder string `protobuf:"bytes,3,opt,name=bidder,proto3" json:"bidder,omitempty" yaml:"bidder"` -} - -func (m *QueryPaymentStatusRequest) Reset() { *m = QueryPaymentStatusRequest{} } -func (m *QueryPaymentStatusRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPaymentStatusRequest) ProtoMessage() {} -func (*QueryPaymentStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{18} -} -func (m *QueryPaymentStatusRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPaymentStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPaymentStatusRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryPaymentStatusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPaymentStatusRequest.Merge(m, src) -} -func (m *QueryPaymentStatusRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryPaymentStatusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPaymentStatusRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPaymentStatusRequest proto.InternalMessageInfo - -func (m *QueryPaymentStatusRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryPaymentStatusRequest) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *QueryPaymentStatusRequest) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -type QueryPaymentStatusResponse struct { - PaymentStatus PaymentStatus `protobuf:"bytes,1,opt,name=paymentStatus,proto3" json:"paymentStatus"` -} - -func (m *QueryPaymentStatusResponse) Reset() { *m = QueryPaymentStatusResponse{} } -func (m *QueryPaymentStatusResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPaymentStatusResponse) ProtoMessage() {} -func (*QueryPaymentStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{19} -} -func (m *QueryPaymentStatusResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPaymentStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPaymentStatusResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryPaymentStatusResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPaymentStatusResponse.Merge(m, src) -} -func (m *QueryPaymentStatusResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryPaymentStatusResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPaymentStatusResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPaymentStatusResponse proto.InternalMessageInfo - -func (m *QueryPaymentStatusResponse) GetPaymentStatus() PaymentStatus { - if m != nil { - return m.PaymentStatus - } - return PaymentStatus{} -} - -type QueryBidderBidsRequest struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty" yaml:"bidder"` -} - -func (m *QueryBidderBidsRequest) Reset() { *m = QueryBidderBidsRequest{} } -func (m *QueryBidderBidsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBidderBidsRequest) ProtoMessage() {} -func (*QueryBidderBidsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{20} -} -func (m *QueryBidderBidsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBidderBidsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBidderBidsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryBidderBidsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBidderBidsRequest.Merge(m, src) -} -func (m *QueryBidderBidsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBidderBidsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBidderBidsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBidderBidsRequest proto.InternalMessageInfo - -func (m *QueryBidderBidsRequest) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -type QueryBidderBidsResponse struct { - Bids []NftBid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` -} - -func (m *QueryBidderBidsResponse) Reset() { *m = QueryBidderBidsResponse{} } -func (m *QueryBidderBidsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBidderBidsResponse) ProtoMessage() {} -func (*QueryBidderBidsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{21} -} -func (m *QueryBidderBidsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBidderBidsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBidderBidsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryBidderBidsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBidderBidsResponse.Merge(m, src) -} -func (m *QueryBidderBidsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBidderBidsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBidderBidsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBidderBidsResponse proto.InternalMessageInfo - -func (m *QueryBidderBidsResponse) GetBids() []NftBid { - if m != nil { - return m.Bids - } - return nil -} - -type QueryRewardsRequest struct { - Address uint64 `protobuf:"varint,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *QueryRewardsRequest) Reset() { *m = QueryRewardsRequest{} } -func (m *QueryRewardsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRewardsRequest) ProtoMessage() {} -func (*QueryRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{22} -} -func (m *QueryRewardsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRewardsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryRewardsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRewardsRequest.Merge(m, src) -} -func (m *QueryRewardsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRewardsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRewardsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRewardsRequest proto.InternalMessageInfo - -func (m *QueryRewardsRequest) GetAddress() uint64 { - if m != nil { - return m.Address - } - return 0 -} - -type QueryRewardsResponse struct { - Rewards []types.Coin `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards"` -} - -func (m *QueryRewardsResponse) Reset() { *m = QueryRewardsResponse{} } -func (m *QueryRewardsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRewardsResponse) ProtoMessage() {} -func (*QueryRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b68bc50239c7e84d, []int{23} -} -func (m *QueryRewardsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRewardsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryRewardsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRewardsResponse.Merge(m, src) -} -func (m *QueryRewardsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRewardsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRewardsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRewardsResponse proto.InternalMessageInfo - -func (m *QueryRewardsResponse) GetRewards() []types.Coin { - if m != nil { - return m.Rewards - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.nftmarketv1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.nftmarketv1.QueryParamsResponse") - proto.RegisterType((*QueryNftListingRequest)(nil), "ununifi.nftmarketv1.QueryNftListingRequest") - proto.RegisterType((*QueryNftListingResponse)(nil), "ununifi.nftmarketv1.QueryNftListingResponse") - proto.RegisterType((*QueryListedNftsRequest)(nil), "ununifi.nftmarketv1.QueryListedNftsRequest") - proto.RegisterType((*QueryListedClassesRequest)(nil), "ununifi.nftmarketv1.QueryListedClassesRequest") - proto.RegisterType((*QueryListedClassRequest)(nil), "ununifi.nftmarketv1.QueryListedClassRequest") - proto.RegisterType((*QueryListedNftsResponse)(nil), "ununifi.nftmarketv1.QueryListedNftsResponse") - proto.RegisterType((*QueryListedClassesResponse)(nil), "ununifi.nftmarketv1.QueryListedClassesResponse") - proto.RegisterType((*QueryListedClassResponse)(nil), "ununifi.nftmarketv1.QueryListedClassResponse") - proto.RegisterType((*QueryLoansRequest)(nil), "ununifi.nftmarketv1.QueryLoansRequest") - proto.RegisterType((*QueryLoansResponse)(nil), "ununifi.nftmarketv1.QueryLoansResponse") - proto.RegisterType((*QueryLoanRequest)(nil), "ununifi.nftmarketv1.QueryLoanRequest") - proto.RegisterType((*QueryLoanResponse)(nil), "ununifi.nftmarketv1.QueryLoanResponse") - proto.RegisterType((*QueryCDPsListRequest)(nil), "ununifi.nftmarketv1.QueryCDPsListRequest") - proto.RegisterType((*QueryCDPsListResponse)(nil), "ununifi.nftmarketv1.QueryCDPsListResponse") - proto.RegisterType((*QueryNftBidsRequest)(nil), "ununifi.nftmarketv1.QueryNftBidsRequest") - proto.RegisterType((*QueryNftBidsResponse)(nil), "ununifi.nftmarketv1.QueryNftBidsResponse") - proto.RegisterType((*QueryPaymentStatusRequest)(nil), "ununifi.nftmarketv1.QueryPaymentStatusRequest") - proto.RegisterType((*QueryPaymentStatusResponse)(nil), "ununifi.nftmarketv1.QueryPaymentStatusResponse") - proto.RegisterType((*QueryBidderBidsRequest)(nil), "ununifi.nftmarketv1.QueryBidderBidsRequest") - proto.RegisterType((*QueryBidderBidsResponse)(nil), "ununifi.nftmarketv1.QueryBidderBidsResponse") - proto.RegisterType((*QueryRewardsRequest)(nil), "ununifi.nftmarketv1.QueryRewardsRequest") - proto.RegisterType((*QueryRewardsResponse)(nil), "ununifi.nftmarketv1.QueryRewardsResponse") -} - -func init() { proto.RegisterFile("nftmarketv1/query.proto", fileDescriptor_b68bc50239c7e84d) } - -var fileDescriptor_b68bc50239c7e84d = []byte{ - // 1347 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xa6, 0xfe, 0x91, 0xbe, 0x7e, 0xd3, 0x6f, 0x99, 0xb6, 0xa9, 0xe3, 0x54, 0x76, 0x3a, - 0x94, 0x34, 0x29, 0xa9, 0x57, 0x49, 0x0b, 0x94, 0x1e, 0x0a, 0x75, 0xaa, 0x96, 0xf2, 0x23, 0x4a, - 0x5d, 0xf5, 0x40, 0x55, 0x29, 0x5a, 0x7b, 0xd7, 0xce, 0xa8, 0xf6, 0xac, 0xbb, 0x33, 0x6e, 0x09, - 0x51, 0x10, 0xe2, 0xc2, 0x01, 0x24, 0x90, 0x38, 0x80, 0x84, 0x38, 0x71, 0x83, 0x2b, 0x07, 0x24, - 0xfe, 0x81, 0x1e, 0x2b, 0xb8, 0x20, 0x0e, 0x11, 0x4a, 0xf8, 0x0b, 0xf2, 0x17, 0xa0, 0x9d, 0x79, - 0xbb, 0x5e, 0xdb, 0xeb, 0x8d, 0x09, 0xe2, 0xe4, 0x9d, 0x99, 0xf7, 0xe3, 0x33, 0xef, 0xcd, 0x7b, - 0x9f, 0x67, 0x38, 0xc3, 0xeb, 0xb2, 0x65, 0x79, 0x8f, 0x1c, 0xf9, 0x64, 0xc9, 0x7c, 0xdc, 0x71, - 0xbc, 0xcd, 0x52, 0xdb, 0x73, 0xa5, 0x4b, 0x4e, 0x76, 0x78, 0x87, 0xb3, 0x3a, 0x2b, 0x45, 0x04, - 0xf2, 0xa7, 0x1a, 0x6e, 0xc3, 0x55, 0xe7, 0xa6, 0xff, 0xa5, 0x45, 0xf3, 0x67, 0x1b, 0xae, 0xdb, - 0x68, 0x3a, 0xa6, 0xd5, 0x66, 0xa6, 0xc5, 0xb9, 0x2b, 0x2d, 0xc9, 0x5c, 0x2e, 0xf0, 0xf4, 0x62, - 0xcd, 0x15, 0x2d, 0x57, 0x98, 0x55, 0x4b, 0x38, 0xda, 0x83, 0xf9, 0x64, 0xa9, 0xea, 0x48, 0x6b, - 0xc9, 0x6c, 0x5b, 0x0d, 0xc6, 0x95, 0x30, 0xca, 0x16, 0xa2, 0xb2, 0x81, 0x54, 0xcd, 0x65, 0xc1, - 0xf9, 0xb4, 0x3e, 0x5f, 0xd7, 0x10, 0xf4, 0x02, 0x8f, 0x66, 0xa2, 0x17, 0x09, 0xbf, 0xf5, 0x21, - 0x3d, 0x05, 0xe4, 0xae, 0xef, 0x79, 0xcd, 0xf2, 0xac, 0x96, 0xa8, 0x38, 0x8f, 0x3b, 0x8e, 0x90, - 0x74, 0x0d, 0x4e, 0xf6, 0xec, 0x8a, 0xb6, 0xcb, 0x85, 0x43, 0x5e, 0x87, 0x4c, 0x5b, 0xed, 0xe4, - 0x8c, 0x59, 0x63, 0xfe, 0xd8, 0xf2, 0x4c, 0x29, 0x26, 0x14, 0x25, 0xad, 0x54, 0x4e, 0x3d, 0xdb, - 0x29, 0x8e, 0x55, 0x50, 0x81, 0xbe, 0x0d, 0x53, 0xca, 0xe2, 0x6a, 0x5d, 0xbe, 0xcb, 0x84, 0x64, - 0xbc, 0x81, 0xbe, 0xc8, 0x34, 0x4c, 0xd4, 0x9a, 0x96, 0x10, 0xeb, 0xcc, 0x56, 0x66, 0x8f, 0x56, - 0xb2, 0x6a, 0x7d, 0xc7, 0x26, 0xa7, 0x21, 0xc3, 0xeb, 0xd2, 0x3f, 0x18, 0x57, 0x07, 0x69, 0x5e, - 0x97, 0x77, 0x6c, 0xfa, 0x00, 0xce, 0x0c, 0xd8, 0x42, 0x84, 0x6f, 0x40, 0xb6, 0xa9, 0xb7, 0x10, - 0x62, 0x31, 0x16, 0x62, 0x57, 0x13, 0x61, 0x06, 0x5a, 0x54, 0x20, 0x4e, 0xff, 0xd8, 0xb1, 0x57, - 0xeb, 0x32, 0x88, 0x09, 0x79, 0x1f, 0xd2, 0xee, 0x53, 0xee, 0x78, 0x1a, 0x64, 0x79, 0x65, 0x7f, - 0xa7, 0xf8, 0xbf, 0x4d, 0xab, 0xd5, 0xbc, 0x46, 0xd5, 0x36, 0xfd, 0xf5, 0xa7, 0x4b, 0x66, 0x83, - 0xc9, 0x8d, 0x4e, 0xb5, 0x54, 0x73, 0x5b, 0xe6, 0x7d, 0x7e, 0x9f, 0xb3, 0x5b, 0xcc, 0xac, 0x6d, - 0x58, 0x8c, 0x9b, 0x72, 0xb3, 0xed, 0x88, 0xd2, 0x3d, 0xe9, 0x31, 0xde, 0xb8, 0x51, 0xab, 0xdd, - 0xb0, 0x6d, 0xcf, 0x11, 0xa2, 0xa2, 0x2d, 0xd2, 0xab, 0x30, 0x1d, 0x71, 0xba, 0xe2, 0xdf, 0xde, - 0x09, 0xfd, 0xce, 0xc0, 0x51, 0x3f, 0x08, 0x4d, 0xd6, 0x62, 0x52, 0xf9, 0x4e, 0x57, 0x26, 0xb8, - 0x8f, 0xbf, 0xc5, 0x24, 0xbd, 0x8b, 0xa1, 0x88, 0x68, 0x8e, 0x10, 0xd7, 0x1e, 0x93, 0xe3, 0x7d, - 0x26, 0x1f, 0xf6, 0x98, 0xd4, 0x11, 0xc0, 0xe8, 0xde, 0x80, 0x09, 0x8c, 0x93, 0xff, 0x02, 0x8e, - 0x8c, 0x1e, 0xde, 0x50, 0x8d, 0x3a, 0x90, 0x8f, 0xbb, 0x2a, 0x3a, 0xb8, 0x0d, 0x1a, 0xa3, 0x13, - 0xd8, 0xbf, 0x14, 0x6b, 0x7f, 0xf0, 0xca, 0x5a, 0xbf, 0x12, 0x68, 0xd3, 0x8f, 0xc7, 0x21, 0x37, - 0x4c, 0x2a, 0x29, 0x32, 0x04, 0x52, 0xdc, 0x6a, 0x39, 0xf8, 0xde, 0xd4, 0x37, 0x99, 0x85, 0x63, - 0xb6, 0x23, 0x6a, 0x1e, 0x6b, 0xfb, 0xf5, 0x98, 0x3b, 0xa2, 0x8e, 0xa2, 0x5b, 0x64, 0x0a, 0x32, - 0x62, 0xb3, 0x55, 0x75, 0x9b, 0xb9, 0x94, 0x3a, 0xc4, 0x15, 0x39, 0x01, 0x47, 0x3a, 0x1e, 0xcb, - 0xa5, 0xd5, 0xa6, 0xff, 0x49, 0x72, 0x90, 0xed, 0x78, 0x6c, 0xc3, 0x12, 0x1b, 0xb9, 0x8c, 0xf6, - 0x8c, 0x4b, 0xb2, 0x0c, 0x29, 0x5e, 0x97, 0x22, 0x97, 0x55, 0xf7, 0x2e, 0xc4, 0xde, 0x3b, 0x4c, - 0x49, 0x45, 0xc9, 0x06, 0x79, 0xac, 0xb9, 0x1d, 0x2e, 0x73, 0x13, 0xb3, 0xc6, 0x7c, 0x4a, 0xe5, - 0x71, 0xc5, 0x5f, 0xd3, 0x93, 0xf0, 0x82, 0x8e, 0x80, 0x6b, 0xf1, 0xb0, 0xb0, 0xdf, 0xc1, 0x72, - 0xc7, 0x4d, 0x0c, 0xc8, 0x2b, 0x90, 0x6e, 0xfa, 0x1b, 0x18, 0xf4, 0xe9, 0x78, 0xe7, 0xae, 0xc5, - 0x31, 0x9d, 0x5a, 0x9a, 0xde, 0x84, 0x13, 0xa1, 0xb1, 0xc3, 0x57, 0xf3, 0x2f, 0x46, 0x04, 0x68, - 0x08, 0xe9, 0x32, 0xa4, 0x7c, 0x27, 0x58, 0xc5, 0x07, 0x22, 0x52, 0xc2, 0xe4, 0x31, 0xfc, 0xbf, - 0xea, 0x7a, 0x9e, 0xfb, 0x94, 0xf1, 0x46, 0xe4, 0x75, 0x1f, 0x2d, 0xbf, 0xe5, 0x0b, 0xfd, 0xb1, - 0x53, 0x9c, 0x8b, 0x14, 0x28, 0x36, 0x54, 0xfd, 0x73, 0x49, 0xd8, 0x8f, 0xb0, 0x48, 0xef, 0x70, - 0xb9, 0xbf, 0x53, 0x9c, 0xd2, 0xa5, 0xdd, 0x67, 0x8e, 0x56, 0x8e, 0x87, 0x3b, 0xba, 0x5a, 0xa6, - 0xe0, 0x94, 0x02, 0xbf, 0x72, 0x73, 0x4d, 0xf8, 0xe9, 0x09, 0x02, 0x7d, 0x06, 0x4e, 0xf7, 0xed, - 0xeb, 0x8b, 0xd1, 0xdb, 0xd8, 0x5a, 0x57, 0xeb, 0xb2, 0xcc, 0x6c, 0x71, 0xf8, 0xb8, 0xbd, 0x87, - 0x9e, 0x43, 0x43, 0x61, 0x32, 0x53, 0x55, 0x66, 0x07, 0xb9, 0x9c, 0x19, 0x56, 0xa0, 0x65, 0x66, - 0x07, 0xb1, 0xf3, 0xc5, 0xe9, 0x8f, 0x06, 0x36, 0xa1, 0x35, 0x6b, 0xb3, 0xe5, 0x70, 0x79, 0x4f, - 0x5a, 0xb2, 0x73, 0x78, 0x78, 0xe4, 0x21, 0x64, 0xaa, 0xcc, 0xb6, 0x1d, 0x4f, 0x17, 0x4c, 0xf9, - 0xe6, 0xfe, 0x4e, 0x71, 0x12, 0x83, 0xaa, 0xf6, 0x0f, 0xd5, 0x30, 0xd1, 0x26, 0x6d, 0x62, 0x1b, - 0xe9, 0x03, 0x8b, 0x21, 0x58, 0x85, 0xc9, 0x76, 0xf4, 0x00, 0x5f, 0x11, 0x1d, 0x42, 0x57, 0x11, - 0x49, 0x0c, 0x49, 0xaf, 0x3a, 0x7d, 0x82, 0xa4, 0x50, 0x56, 0xce, 0xa3, 0x69, 0xeb, 0xde, 0xd2, - 0xf8, 0x0f, 0x6e, 0xb9, 0x86, 0xad, 0x38, 0xea, 0xf7, 0xdf, 0x65, 0xd9, 0xc4, 0xd7, 0x57, 0x71, - 0x9e, 0x5a, 0x5e, 0xf7, 0x1a, 0x39, 0xc8, 0x5a, 0xda, 0xb7, 0xba, 0x47, 0xaa, 0x12, 0x2c, 0xe9, - 0x5d, 0x7c, 0x65, 0xa1, 0x42, 0x38, 0x0a, 0x64, 0x3d, 0xbd, 0x15, 0x36, 0x0d, 0x1c, 0x3a, 0xfc, - 0x09, 0xa5, 0x84, 0x13, 0x4a, 0x69, 0xc5, 0x65, 0x41, 0x89, 0x06, 0xf2, 0xcb, 0xdf, 0x1d, 0x87, - 0xb4, 0xb2, 0x49, 0x3e, 0x82, 0x8c, 0x1e, 0x16, 0xc8, 0x85, 0xe1, 0x7d, 0xbe, 0x67, 0x32, 0xc9, - 0xcf, 0x1f, 0x2c, 0x88, 0x85, 0x76, 0xee, 0x93, 0xdf, 0xfe, 0xfa, 0x6a, 0x7c, 0x86, 0x4c, 0x9b, - 0xa8, 0xd1, 0x9d, 0x7d, 0x4c, 0x3d, 0x94, 0x90, 0xef, 0x0d, 0x80, 0x2e, 0x57, 0x91, 0x97, 0x87, - 0xdb, 0x1e, 0x18, 0x5b, 0xf2, 0x8b, 0xa3, 0x09, 0x23, 0x98, 0x6b, 0x0a, 0xcc, 0x15, 0xb2, 0x1c, - 0x03, 0x46, 0x53, 0xb1, 0x92, 0x37, 0xb7, 0x82, 0x2a, 0xdb, 0x36, 0xb7, 0x74, 0x55, 0x6d, 0x93, - 0x2f, 0x0c, 0x80, 0x2e, 0x19, 0x27, 0xa1, 0x1c, 0x18, 0x5a, 0x92, 0x50, 0x0e, 0xf2, 0x3b, 0x9d, - 0x53, 0x28, 0x67, 0x49, 0x21, 0x06, 0x65, 0x53, 0x89, 0xaf, 0x2b, 0xde, 0xf9, 0xd6, 0x80, 0xc9, - 0x1e, 0x02, 0x27, 0xa5, 0x91, 0x78, 0x3a, 0x1c, 0x6a, 0xf2, 0xe6, 0xc8, 0xf2, 0x08, 0x6d, 0x41, - 0x41, 0x7b, 0x91, 0x9c, 0x1b, 0x0e, 0x0d, 0xb9, 0x9f, 0xfc, 0x60, 0xc0, 0xb1, 0x88, 0x11, 0xb2, - 0x38, 0xe2, 0x0c, 0xa1, 0x91, 0xfd, 0xb3, 0x89, 0x83, 0x5e, 0x57, 0xb8, 0xae, 0x92, 0x57, 0x0f, - 0xc0, 0x35, 0x90, 0x59, 0xc5, 0x27, 0xdb, 0xe4, 0x43, 0x48, 0x2b, 0x2e, 0x26, 0x73, 0x09, 0x7e, - 0x23, 0x0c, 0x9e, 0xbf, 0x70, 0xa0, 0x1c, 0x22, 0x9b, 0x55, 0xc8, 0xf2, 0x24, 0x17, 0x87, 0x4c, - 0xb9, 0xfc, 0xcc, 0x80, 0x94, 0xaf, 0x43, 0x5e, 0x4a, 0xb6, 0x19, 0xb8, 0x9e, 0x3b, 0x48, 0x0c, - 0x3d, 0x5f, 0x51, 0x9e, 0x4b, 0x64, 0x71, 0x98, 0xe7, 0xd8, 0x67, 0xfe, 0xa9, 0x01, 0x13, 0x01, - 0x5b, 0x92, 0x85, 0xe1, 0xae, 0xfa, 0x98, 0x36, 0x7f, 0x71, 0x14, 0x51, 0x44, 0x76, 0x5e, 0x21, - 0x2b, 0x90, 0xb3, 0x31, 0xc8, 0x6a, 0x76, 0x5b, 0xa8, 0x3a, 0x24, 0x5f, 0x1b, 0x90, 0x45, 0x56, - 0x25, 0xf3, 0x89, 0x65, 0x1e, 0xa1, 0x82, 0xfc, 0xc2, 0x08, 0x92, 0x08, 0xe3, 0x35, 0x05, 0x63, - 0x89, 0x98, 0x43, 0xba, 0x81, 0xdf, 0xaa, 0x63, 0x63, 0xf4, 0x8d, 0x01, 0xd0, 0x25, 0x83, 0xa4, - 0x56, 0x30, 0x40, 0x55, 0x49, 0xad, 0x60, 0x90, 0x5f, 0xa8, 0xa9, 0x20, 0x2e, 0x90, 0x0b, 0x31, - 0x10, 0x35, 0x3b, 0x21, 0x4a, 0xbd, 0xd8, 0x26, 0x3f, 0x1b, 0x30, 0xd9, 0x43, 0xa5, 0x49, 0x3d, - 0x21, 0x6e, 0xc6, 0x48, 0xea, 0x09, 0xb1, 0x34, 0x4f, 0x6f, 0x29, 0x8c, 0x6f, 0x92, 0xeb, 0xb1, - 0x1d, 0x5e, 0x69, 0xac, 0x0b, 0xa5, 0x12, 0x17, 0xcc, 0x2e, 0xf4, 0xcf, 0x0d, 0xc8, 0x22, 0xbf, - 0x25, 0xe5, 0xbb, 0x97, 0x33, 0x93, 0xf2, 0xdd, 0x47, 0x96, 0x74, 0x51, 0x01, 0x9d, 0x23, 0xe7, - 0x63, 0x80, 0x22, 0x2b, 0x9a, 0x5b, 0xc8, 0xb8, 0xdb, 0xe5, 0x5b, 0xcf, 0x76, 0x0b, 0xc6, 0xf3, - 0xdd, 0x82, 0xf1, 0xe7, 0x6e, 0xc1, 0xf8, 0x72, 0xaf, 0x30, 0xf6, 0x7c, 0xaf, 0x30, 0xf6, 0xfb, - 0x5e, 0x61, 0xec, 0xc1, 0xe2, 0xd0, 0x41, 0xe2, 0x03, 0x33, 0xfa, 0x27, 0x5f, 0x8d, 0x15, 0xd5, - 0x8c, 0xfa, 0x87, 0x7f, 0xf9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xd5, 0xf2, 0xdf, 0xc9, - 0x10, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - NftListing(ctx context.Context, in *QueryNftListingRequest, opts ...grpc.CallOption) (*QueryNftListingResponse, error) - ListedNfts(ctx context.Context, in *QueryListedNftsRequest, opts ...grpc.CallOption) (*QueryListedNftsResponse, error) - ListedClasses(ctx context.Context, in *QueryListedClassesRequest, opts ...grpc.CallOption) (*QueryListedClassesResponse, error) - ListedClass(ctx context.Context, in *QueryListedClassRequest, opts ...grpc.CallOption) (*QueryListedClassResponse, error) - Loans(ctx context.Context, in *QueryLoansRequest, opts ...grpc.CallOption) (*QueryLoansResponse, error) - Loan(ctx context.Context, in *QueryLoanRequest, opts ...grpc.CallOption) (*QueryLoanResponse, error) - CDPsList(ctx context.Context, in *QueryCDPsListRequest, opts ...grpc.CallOption) (*QueryCDPsListResponse, error) - NftBids(ctx context.Context, in *QueryNftBidsRequest, opts ...grpc.CallOption) (*QueryNftBidsResponse, error) - BidderBids(ctx context.Context, in *QueryBidderBidsRequest, opts ...grpc.CallOption) (*QueryBidderBidsResponse, error) - PaymentStatus(ctx context.Context, in *QueryPaymentStatusRequest, opts ...grpc.CallOption) (*QueryPaymentStatusResponse, error) - Rewards(ctx context.Context, in *QueryRewardsRequest, opts ...grpc.CallOption) (*QueryRewardsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) NftListing(ctx context.Context, in *QueryNftListingRequest, opts ...grpc.CallOption) (*QueryNftListingResponse, error) { - out := new(QueryNftListingResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/NftListing", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ListedNfts(ctx context.Context, in *QueryListedNftsRequest, opts ...grpc.CallOption) (*QueryListedNftsResponse, error) { - out := new(QueryListedNftsResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/ListedNfts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ListedClasses(ctx context.Context, in *QueryListedClassesRequest, opts ...grpc.CallOption) (*QueryListedClassesResponse, error) { - out := new(QueryListedClassesResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/ListedClasses", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ListedClass(ctx context.Context, in *QueryListedClassRequest, opts ...grpc.CallOption) (*QueryListedClassResponse, error) { - out := new(QueryListedClassResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/ListedClass", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Loans(ctx context.Context, in *QueryLoansRequest, opts ...grpc.CallOption) (*QueryLoansResponse, error) { - out := new(QueryLoansResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/Loans", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Loan(ctx context.Context, in *QueryLoanRequest, opts ...grpc.CallOption) (*QueryLoanResponse, error) { - out := new(QueryLoanResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/Loan", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) CDPsList(ctx context.Context, in *QueryCDPsListRequest, opts ...grpc.CallOption) (*QueryCDPsListResponse, error) { - out := new(QueryCDPsListResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/CDPsList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) NftBids(ctx context.Context, in *QueryNftBidsRequest, opts ...grpc.CallOption) (*QueryNftBidsResponse, error) { - out := new(QueryNftBidsResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/NftBids", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) BidderBids(ctx context.Context, in *QueryBidderBidsRequest, opts ...grpc.CallOption) (*QueryBidderBidsResponse, error) { - out := new(QueryBidderBidsResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/BidderBids", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) PaymentStatus(ctx context.Context, in *QueryPaymentStatusRequest, opts ...grpc.CallOption) (*QueryPaymentStatusResponse, error) { - out := new(QueryPaymentStatusResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/PaymentStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Rewards(ctx context.Context, in *QueryRewardsRequest, opts ...grpc.CallOption) (*QueryRewardsResponse, error) { - out := new(QueryRewardsResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Query/Rewards", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - NftListing(context.Context, *QueryNftListingRequest) (*QueryNftListingResponse, error) - ListedNfts(context.Context, *QueryListedNftsRequest) (*QueryListedNftsResponse, error) - ListedClasses(context.Context, *QueryListedClassesRequest) (*QueryListedClassesResponse, error) - ListedClass(context.Context, *QueryListedClassRequest) (*QueryListedClassResponse, error) - Loans(context.Context, *QueryLoansRequest) (*QueryLoansResponse, error) - Loan(context.Context, *QueryLoanRequest) (*QueryLoanResponse, error) - CDPsList(context.Context, *QueryCDPsListRequest) (*QueryCDPsListResponse, error) - NftBids(context.Context, *QueryNftBidsRequest) (*QueryNftBidsResponse, error) - BidderBids(context.Context, *QueryBidderBidsRequest) (*QueryBidderBidsResponse, error) - PaymentStatus(context.Context, *QueryPaymentStatusRequest) (*QueryPaymentStatusResponse, error) - Rewards(context.Context, *QueryRewardsRequest) (*QueryRewardsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) NftListing(ctx context.Context, req *QueryNftListingRequest) (*QueryNftListingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NftListing not implemented") -} -func (*UnimplementedQueryServer) ListedNfts(ctx context.Context, req *QueryListedNftsRequest) (*QueryListedNftsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListedNfts not implemented") -} -func (*UnimplementedQueryServer) ListedClasses(ctx context.Context, req *QueryListedClassesRequest) (*QueryListedClassesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListedClasses not implemented") -} -func (*UnimplementedQueryServer) ListedClass(ctx context.Context, req *QueryListedClassRequest) (*QueryListedClassResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListedClass not implemented") -} -func (*UnimplementedQueryServer) Loans(ctx context.Context, req *QueryLoansRequest) (*QueryLoansResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Loans not implemented") -} -func (*UnimplementedQueryServer) Loan(ctx context.Context, req *QueryLoanRequest) (*QueryLoanResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Loan not implemented") -} -func (*UnimplementedQueryServer) CDPsList(ctx context.Context, req *QueryCDPsListRequest) (*QueryCDPsListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CDPsList not implemented") -} -func (*UnimplementedQueryServer) NftBids(ctx context.Context, req *QueryNftBidsRequest) (*QueryNftBidsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NftBids not implemented") -} -func (*UnimplementedQueryServer) BidderBids(ctx context.Context, req *QueryBidderBidsRequest) (*QueryBidderBidsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BidderBids not implemented") -} -func (*UnimplementedQueryServer) PaymentStatus(ctx context.Context, req *QueryPaymentStatusRequest) (*QueryPaymentStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PaymentStatus not implemented") -} -func (*UnimplementedQueryServer) Rewards(ctx context.Context, req *QueryRewardsRequest) (*QueryRewardsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Rewards not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_NftListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNftListingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).NftListing(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/NftListing", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NftListing(ctx, req.(*QueryNftListingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ListedNfts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryListedNftsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ListedNfts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/ListedNfts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ListedNfts(ctx, req.(*QueryListedNftsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ListedClasses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryListedClassesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ListedClasses(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/ListedClasses", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ListedClasses(ctx, req.(*QueryListedClassesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ListedClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryListedClassRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ListedClass(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/ListedClass", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ListedClass(ctx, req.(*QueryListedClassRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Loans_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLoansRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Loans(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/Loans", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Loans(ctx, req.(*QueryLoansRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Loan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLoanRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Loan(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/Loan", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Loan(ctx, req.(*QueryLoanRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_CDPsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCDPsListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CDPsList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/CDPsList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CDPsList(ctx, req.(*QueryCDPsListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_NftBids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNftBidsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).NftBids(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/NftBids", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NftBids(ctx, req.(*QueryNftBidsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_BidderBids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBidderBidsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).BidderBids(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/BidderBids", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BidderBids(ctx, req.(*QueryBidderBidsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_PaymentStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPaymentStatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).PaymentStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/PaymentStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PaymentStatus(ctx, req.(*QueryPaymentStatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Rewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRewardsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Rewards(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Query/Rewards", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Rewards(ctx, req.(*QueryRewardsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.nftmarketv1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "NftListing", - Handler: _Query_NftListing_Handler, - }, - { - MethodName: "ListedNfts", - Handler: _Query_ListedNfts_Handler, - }, - { - MethodName: "ListedClasses", - Handler: _Query_ListedClasses_Handler, - }, - { - MethodName: "ListedClass", - Handler: _Query_ListedClass_Handler, - }, - { - MethodName: "Loans", - Handler: _Query_Loans_Handler, - }, - { - MethodName: "Loan", - Handler: _Query_Loan_Handler, - }, - { - MethodName: "CDPsList", - Handler: _Query_CDPsList_Handler, - }, - { - MethodName: "NftBids", - Handler: _Query_NftBids_Handler, - }, - { - MethodName: "BidderBids", - Handler: _Query_BidderBids_Handler, - }, - { - MethodName: "PaymentStatus", - Handler: _Query_PaymentStatus_Handler, - }, - { - MethodName: "Rewards", - Handler: _Query_Rewards_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "nftmarketv1/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryNftListingRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryNftListingRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNftListingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryNftListingResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryNftListingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNftListingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Listing.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryListedNftsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryListedNftsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryListedNftsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryListedClassesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryListedClassesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryListedClassesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NftLimit != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NftLimit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryListedClassRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryListedClassRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryListedClassRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NftLimit != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NftLimit)) - i-- - dAtA[i] = 0x10 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryListedNftsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryListedNftsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryListedNftsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Listings) > 0 { - for iNdEx := len(m.Listings) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Listings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryListedClassesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryListedClassesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryListedClassesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Classes) > 0 { - for iNdEx := len(m.Classes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Classes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryListedClassResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryListedClassResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryListedClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NftCount != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NftCount)) - i-- - dAtA[i] = 0x40 - } - if len(m.Nfts) > 0 { - for iNdEx := len(m.Nfts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Nfts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.Urihash) > 0 { - i -= len(m.Urihash) - copy(dAtA[i:], m.Urihash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Urihash))) - i-- - dAtA[i] = 0x32 - } - if len(m.Uri) > 0 { - i -= len(m.Uri) - copy(dAtA[i:], m.Uri) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Uri))) - i-- - dAtA[i] = 0x2a - } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0x22 - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryLoansRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryLoansRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLoansRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryLoansResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryLoansResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLoansResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Loans) > 0 { - for iNdEx := len(m.Loans) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Loans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryLoanRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryLoanRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLoanRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryLoanResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryLoanResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLoanResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.BorrowingLimit.Size() - i -= size - if _, err := m.BorrowingLimit.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Loan.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryCDPsListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryCDPsListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryCDPsListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryCDPsListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryCDPsListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryCDPsListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryNftBidsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryNftBidsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNftBidsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryNftBidsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryNftBidsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNftBidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Bids) > 0 { - for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Bids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryPaymentStatusRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryPaymentStatusRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPaymentStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryPaymentStatusResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryPaymentStatusResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPaymentStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.PaymentStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryBidderBidsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryBidderBidsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBidderBidsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBidderBidsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryBidderBidsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBidderBidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Bids) > 0 { - for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Bids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryRewardsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryRewardsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Address != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Address)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryRewardsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryRewardsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Rewards) > 0 { - for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryNftListingRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNftListingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Listing.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryListedNftsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryListedClassesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NftLimit != 0 { - n += 1 + sovQuery(uint64(m.NftLimit)) - } - return n -} - -func (m *QueryListedClassRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.NftLimit != 0 { - n += 1 + sovQuery(uint64(m.NftLimit)) - } - return n -} - -func (m *QueryListedNftsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Listings) > 0 { - for _, e := range m.Listings { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryListedClassesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Classes) > 0 { - for _, e := range m.Classes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryListedClassResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Uri) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Urihash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.Nfts) > 0 { - for _, e := range m.Nfts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.NftCount != 0 { - n += 1 + sovQuery(uint64(m.NftCount)) - } - return n -} - -func (m *QueryLoansRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryLoansResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Loans) > 0 { - for _, e := range m.Loans { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryLoanRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryLoanResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Loan.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.BorrowingLimit.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryCDPsListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryCDPsListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryNftBidsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNftBidsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Bids) > 0 { - for _, e := range m.Bids { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryPaymentStatusRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryPaymentStatusResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.PaymentStatus.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryBidderBidsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBidderBidsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Bids) > 0 { - for _, e := range m.Bids { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryRewardsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Address != 0 { - n += 1 + sovQuery(uint64(m.Address)) - } - return n -} - -func (m *QueryRewardsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Rewards) > 0 { - for _, e := range m.Rewards { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNftListingRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNftListingRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNftListingRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNftListingResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNftListingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNftListingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Listing", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Listing.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryListedNftsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryListedNftsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListedNftsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryListedClassesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryListedClassesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListedClassesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftLimit", wireType) - } - m.NftLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftLimit |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryListedClassRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryListedClassRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListedClassRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftLimit", wireType) - } - m.NftLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftLimit |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryListedNftsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryListedNftsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListedNftsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Listings", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Listings = append(m.Listings, NftListing{}) - if err := m.Listings[len(m.Listings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryListedClassesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryListedClassesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListedClassesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Classes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Classes = append(m.Classes, &QueryListedClassResponse{}) - if err := m.Classes[len(m.Classes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryListedClassResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryListedClassResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryListedClassResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Symbol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Urihash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Urihash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nfts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Nfts = append(m.Nfts, &ListedNft{}) - if err := m.Nfts[len(m.Nfts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftCount", wireType) - } - m.NftCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryLoansRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLoansRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoansRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryLoansResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLoansResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoansResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loans", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Loans = append(m.Loans, Loan{}) - if err := m.Loans[len(m.Loans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryLoanRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLoanRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoanRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryLoanResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLoanResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoanResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Loan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BorrowingLimit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BorrowingLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryCDPsListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryCDPsListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCDPsListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryCDPsListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryCDPsListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCDPsListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNftBidsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNftBidsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNftBidsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNftBidsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNftBidsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNftBidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bids = append(m.Bids, NftBid{}) - if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPaymentStatusRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryPaymentStatusRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPaymentStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPaymentStatusResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryPaymentStatusResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPaymentStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaymentStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PaymentStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBidderBidsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryBidderBidsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBidderBidsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBidderBidsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryBidderBidsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBidderBidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bids = append(m.Bids, NftBid{}) - if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRewardsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryRewardsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - m.Address = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Address |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRewardsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryRewardsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Rewards = append(m.Rewards, types.Coin{}) - if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/nftmarketv1/types/query.pb.gw.go b/deprecated/x/nftmarketv1/types/query.pb.gw.go deleted file mode 100644 index b1d99f9e8..000000000 --- a/deprecated/x/nftmarketv1/types/query.pb.gw.go +++ /dev/null @@ -1,1250 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: nftmarketv1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_NftListing_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNftListingRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.NftListing(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_NftListing_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNftListingRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.NftListing(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ListedNfts_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ListedNfts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryListedNftsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListedNfts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListedNfts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ListedNfts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryListedNftsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListedNfts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListedNfts(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ListedClasses_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ListedClasses_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryListedClassesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListedClasses_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListedClasses(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ListedClasses_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryListedClassesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListedClasses_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListedClasses(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ListedClass_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryListedClassRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_limit"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_limit") - } - - protoReq.NftLimit, err = runtime.Int32(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_limit", err) - } - - msg, err := client.ListedClass(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ListedClass_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryListedClassRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_limit"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_limit") - } - - protoReq.NftLimit, err = runtime.Int32(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_limit", err) - } - - msg, err := server.ListedClass(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Loans_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoansRequest - var metadata runtime.ServerMetadata - - msg, err := client.Loans(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Loans_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoansRequest - var metadata runtime.ServerMetadata - - msg, err := server.Loans(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Loan_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoanRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.Loan(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Loan_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoanRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.Loan(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_CDPsList_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCDPsListRequest - var metadata runtime.ServerMetadata - - msg, err := client.CDPsList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_CDPsList_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCDPsListRequest - var metadata runtime.ServerMetadata - - msg, err := server.CDPsList(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_NftBids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNftBidsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.NftBids(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_NftBids_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNftBidsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.NftBids(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_BidderBids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBidderBidsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["bidder"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") - } - - protoReq.Bidder, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) - } - - msg, err := client.BidderBids(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_BidderBids_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBidderBidsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["bidder"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") - } - - protoReq.Bidder, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) - } - - msg, err := server.BidderBids(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_PaymentStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPaymentStatusRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - val, ok = pathParams["bidder"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") - } - - protoReq.Bidder, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) - } - - msg, err := client.PaymentStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_PaymentStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPaymentStatusRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - val, ok = pathParams["bidder"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") - } - - protoReq.Bidder, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) - } - - msg, err := server.PaymentStatus(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Rewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRewardsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := client.Rewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Rewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRewardsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := server.Rewards(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NftListing_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_NftListing_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_NftListing_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ListedNfts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ListedNfts_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ListedNfts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ListedClasses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ListedClasses_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ListedClasses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ListedClass_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ListedClass_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ListedClass_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Loans_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Loans_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Loans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Loan_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Loan_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Loan_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_CDPsList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_CDPsList_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CDPsList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NftBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_NftBids_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_NftBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_BidderBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_BidderBids_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_BidderBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_PaymentStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_PaymentStatus_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_PaymentStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Rewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Rewards_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Rewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NftListing_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_NftListing_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_NftListing_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ListedNfts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ListedNfts_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ListedNfts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ListedClasses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ListedClasses_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ListedClasses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ListedClass_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ListedClass_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ListedClass_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Loans_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Loans_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Loans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Loan_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Loan_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Loan_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_CDPsList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_CDPsList_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CDPsList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NftBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_NftBids_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_NftBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_BidderBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_BidderBids_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_BidderBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_PaymentStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_PaymentStatus_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_PaymentStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Rewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Rewards_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Rewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftmarket", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_NftListing_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftmarket", "nft_listing", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ListedNfts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftmarket", "listed_nfts"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ListedClasses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftmarket", "listed_classes"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ListedClass_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftmarket", "listed_class", "class_id", "nft_limit"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Loans_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftmarket", "loans"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Loan_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftmarket", "loans", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_CDPsList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftmarket", "cdps_list"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_NftBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftmarket", "nft_bids", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_BidderBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftmarket", "bidder_bids", "bidder"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_PaymentStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"ununifi", "nftmarket", "payment_status", "class_id", "nft_id", "bidder"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Rewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftmarket", "rewards", "address"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_NftListing_0 = runtime.ForwardResponseMessage - - forward_Query_ListedNfts_0 = runtime.ForwardResponseMessage - - forward_Query_ListedClasses_0 = runtime.ForwardResponseMessage - - forward_Query_ListedClass_0 = runtime.ForwardResponseMessage - - forward_Query_Loans_0 = runtime.ForwardResponseMessage - - forward_Query_Loan_0 = runtime.ForwardResponseMessage - - forward_Query_CDPsList_0 = runtime.ForwardResponseMessage - - forward_Query_NftBids_0 = runtime.ForwardResponseMessage - - forward_Query_BidderBids_0 = runtime.ForwardResponseMessage - - forward_Query_PaymentStatus_0 = runtime.ForwardResponseMessage - - forward_Query_Rewards_0 = runtime.ForwardResponseMessage -) diff --git a/deprecated/x/nftmarketv1/types/tx.pb.go b/deprecated/x/nftmarketv1/types/tx.pb.go deleted file mode 100644 index b9f0a9c87..000000000 --- a/deprecated/x/nftmarketv1/types/tx.pb.go +++ /dev/null @@ -1,5904 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nftmarketv1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgMintNft struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - ClassId string `protobuf:"bytes,2,opt,name=classId,proto3" json:"classId,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nftId,proto3" json:"nftId,omitempty"` - NftUri string `protobuf:"bytes,4,opt,name=nftUri,proto3" json:"nftUri,omitempty"` - NftUriHash string `protobuf:"bytes,5,opt,name=nftUriHash,proto3" json:"nftUriHash,omitempty"` -} - -func (m *MsgMintNft) Reset() { *m = MsgMintNft{} } -func (m *MsgMintNft) String() string { return proto.CompactTextString(m) } -func (*MsgMintNft) ProtoMessage() {} -func (*MsgMintNft) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{0} -} -func (m *MsgMintNft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintNft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMintNft) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNft.Merge(m, src) -} -func (m *MsgMintNft) XXX_Size() int { - return m.Size() -} -func (m *MsgMintNft) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNft.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintNft proto.InternalMessageInfo - -func (m *MsgMintNft) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *MsgMintNft) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *MsgMintNft) GetNftUri() string { - if m != nil { - return m.NftUri - } - return "" -} - -func (m *MsgMintNft) GetNftUriHash() string { - if m != nil { - return m.NftUriHash - } - return "" -} - -type MsgMintNftResponse struct { -} - -func (m *MsgMintNftResponse) Reset() { *m = MsgMintNftResponse{} } -func (m *MsgMintNftResponse) String() string { return proto.CompactTextString(m) } -func (*MsgMintNftResponse) ProtoMessage() {} -func (*MsgMintNftResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{1} -} -func (m *MsgMintNftResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintNftResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintNftResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMintNftResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNftResponse.Merge(m, src) -} -func (m *MsgMintNftResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgMintNftResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNftResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintNftResponse proto.InternalMessageInfo - -type MsgListNft struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - ListingType ListingType `protobuf:"varint,3,opt,name=listing_type,json=listingType,proto3,enum=ununifi.nftmarketv1.ListingType" json:"listing_type,omitempty"` - BidToken string `protobuf:"bytes,4,opt,name=bid_token,json=bidToken,proto3" json:"bid_token,omitempty"` - MinBid github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=min_bid,json=minBid,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_bid" yaml:"min_bid"` - BidActiveRank uint64 `protobuf:"varint,6,opt,name=bid_active_rank,json=bidActiveRank,proto3" json:"bid_active_rank,omitempty"` -} - -func (m *MsgListNft) Reset() { *m = MsgListNft{} } -func (m *MsgListNft) String() string { return proto.CompactTextString(m) } -func (*MsgListNft) ProtoMessage() {} -func (*MsgListNft) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{2} -} -func (m *MsgListNft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgListNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgListNft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgListNft) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgListNft.Merge(m, src) -} -func (m *MsgListNft) XXX_Size() int { - return m.Size() -} -func (m *MsgListNft) XXX_DiscardUnknown() { - xxx_messageInfo_MsgListNft.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgListNft proto.InternalMessageInfo - -func (m *MsgListNft) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *MsgListNft) GetListingType() ListingType { - if m != nil { - return m.ListingType - } - return ListingType_DIRECT_ASSET_BORROW -} - -func (m *MsgListNft) GetBidToken() string { - if m != nil { - return m.BidToken - } - return "" -} - -func (m *MsgListNft) GetBidActiveRank() uint64 { - if m != nil { - return m.BidActiveRank - } - return 0 -} - -type MsgListNftResponse struct { -} - -func (m *MsgListNftResponse) Reset() { *m = MsgListNftResponse{} } -func (m *MsgListNftResponse) String() string { return proto.CompactTextString(m) } -func (*MsgListNftResponse) ProtoMessage() {} -func (*MsgListNftResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{3} -} -func (m *MsgListNftResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgListNftResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgListNftResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgListNftResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgListNftResponse.Merge(m, src) -} -func (m *MsgListNftResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgListNftResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgListNftResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgListNftResponse proto.InternalMessageInfo - -type MsgCancelNftListing struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgCancelNftListing) Reset() { *m = MsgCancelNftListing{} } -func (m *MsgCancelNftListing) String() string { return proto.CompactTextString(m) } -func (*MsgCancelNftListing) ProtoMessage() {} -func (*MsgCancelNftListing) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{4} -} -func (m *MsgCancelNftListing) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCancelNftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCancelNftListing.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCancelNftListing) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelNftListing.Merge(m, src) -} -func (m *MsgCancelNftListing) XXX_Size() int { - return m.Size() -} -func (m *MsgCancelNftListing) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelNftListing.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCancelNftListing proto.InternalMessageInfo - -func (m *MsgCancelNftListing) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgCancelNftListingResponse struct { -} - -func (m *MsgCancelNftListingResponse) Reset() { *m = MsgCancelNftListingResponse{} } -func (m *MsgCancelNftListingResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCancelNftListingResponse) ProtoMessage() {} -func (*MsgCancelNftListingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{5} -} -func (m *MsgCancelNftListingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCancelNftListingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCancelNftListingResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCancelNftListingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelNftListingResponse.Merge(m, src) -} -func (m *MsgCancelNftListingResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCancelNftListingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelNftListingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCancelNftListingResponse proto.InternalMessageInfo - -type MsgExpandListingPeriod struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgExpandListingPeriod) Reset() { *m = MsgExpandListingPeriod{} } -func (m *MsgExpandListingPeriod) String() string { return proto.CompactTextString(m) } -func (*MsgExpandListingPeriod) ProtoMessage() {} -func (*MsgExpandListingPeriod) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{6} -} -func (m *MsgExpandListingPeriod) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExpandListingPeriod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExpandListingPeriod.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgExpandListingPeriod) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExpandListingPeriod.Merge(m, src) -} -func (m *MsgExpandListingPeriod) XXX_Size() int { - return m.Size() -} -func (m *MsgExpandListingPeriod) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExpandListingPeriod.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExpandListingPeriod proto.InternalMessageInfo - -func (m *MsgExpandListingPeriod) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgExpandListingPeriodResponse struct { -} - -func (m *MsgExpandListingPeriodResponse) Reset() { *m = MsgExpandListingPeriodResponse{} } -func (m *MsgExpandListingPeriodResponse) String() string { return proto.CompactTextString(m) } -func (*MsgExpandListingPeriodResponse) ProtoMessage() {} -func (*MsgExpandListingPeriodResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{7} -} -func (m *MsgExpandListingPeriodResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExpandListingPeriodResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExpandListingPeriodResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgExpandListingPeriodResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExpandListingPeriodResponse.Merge(m, src) -} -func (m *MsgExpandListingPeriodResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgExpandListingPeriodResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExpandListingPeriodResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExpandListingPeriodResponse proto.InternalMessageInfo - -type MsgPlaceBid struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - AutomaticPayment bool `protobuf:"varint,4,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` -} - -func (m *MsgPlaceBid) Reset() { *m = MsgPlaceBid{} } -func (m *MsgPlaceBid) String() string { return proto.CompactTextString(m) } -func (*MsgPlaceBid) ProtoMessage() {} -func (*MsgPlaceBid) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{8} -} -func (m *MsgPlaceBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPlaceBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPlaceBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgPlaceBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPlaceBid.Merge(m, src) -} -func (m *MsgPlaceBid) XXX_Size() int { - return m.Size() -} -func (m *MsgPlaceBid) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPlaceBid.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPlaceBid proto.InternalMessageInfo - -func (m *MsgPlaceBid) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *MsgPlaceBid) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *MsgPlaceBid) GetAutomaticPayment() bool { - if m != nil { - return m.AutomaticPayment - } - return false -} - -type MsgPlaceBidResponse struct { -} - -func (m *MsgPlaceBidResponse) Reset() { *m = MsgPlaceBidResponse{} } -func (m *MsgPlaceBidResponse) String() string { return proto.CompactTextString(m) } -func (*MsgPlaceBidResponse) ProtoMessage() {} -func (*MsgPlaceBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{9} -} -func (m *MsgPlaceBidResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPlaceBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPlaceBidResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgPlaceBidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPlaceBidResponse.Merge(m, src) -} -func (m *MsgPlaceBidResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgPlaceBidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPlaceBidResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPlaceBidResponse proto.InternalMessageInfo - -type MsgCancelBid struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgCancelBid) Reset() { *m = MsgCancelBid{} } -func (m *MsgCancelBid) String() string { return proto.CompactTextString(m) } -func (*MsgCancelBid) ProtoMessage() {} -func (*MsgCancelBid) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{10} -} -func (m *MsgCancelBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCancelBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCancelBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCancelBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelBid.Merge(m, src) -} -func (m *MsgCancelBid) XXX_Size() int { - return m.Size() -} -func (m *MsgCancelBid) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelBid.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCancelBid proto.InternalMessageInfo - -func (m *MsgCancelBid) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgCancelBidResponse struct { -} - -func (m *MsgCancelBidResponse) Reset() { *m = MsgCancelBidResponse{} } -func (m *MsgCancelBidResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCancelBidResponse) ProtoMessage() {} -func (*MsgCancelBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{11} -} -func (m *MsgCancelBidResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCancelBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCancelBidResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCancelBidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelBidResponse.Merge(m, src) -} -func (m *MsgCancelBidResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCancelBidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelBidResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCancelBidResponse proto.InternalMessageInfo - -type MsgEndNftListing struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgEndNftListing) Reset() { *m = MsgEndNftListing{} } -func (m *MsgEndNftListing) String() string { return proto.CompactTextString(m) } -func (*MsgEndNftListing) ProtoMessage() {} -func (*MsgEndNftListing) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{12} -} -func (m *MsgEndNftListing) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEndNftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEndNftListing.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgEndNftListing) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEndNftListing.Merge(m, src) -} -func (m *MsgEndNftListing) XXX_Size() int { - return m.Size() -} -func (m *MsgEndNftListing) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEndNftListing.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEndNftListing proto.InternalMessageInfo - -func (m *MsgEndNftListing) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgEndNftListingResponse struct { -} - -func (m *MsgEndNftListingResponse) Reset() { *m = MsgEndNftListingResponse{} } -func (m *MsgEndNftListingResponse) String() string { return proto.CompactTextString(m) } -func (*MsgEndNftListingResponse) ProtoMessage() {} -func (*MsgEndNftListingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{13} -} -func (m *MsgEndNftListingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEndNftListingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEndNftListingResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgEndNftListingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEndNftListingResponse.Merge(m, src) -} -func (m *MsgEndNftListingResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgEndNftListingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEndNftListingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEndNftListingResponse proto.InternalMessageInfo - -type MsgSellingDecision struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgSellingDecision) Reset() { *m = MsgSellingDecision{} } -func (m *MsgSellingDecision) String() string { return proto.CompactTextString(m) } -func (*MsgSellingDecision) ProtoMessage() {} -func (*MsgSellingDecision) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{14} -} -func (m *MsgSellingDecision) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSellingDecision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSellingDecision.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSellingDecision) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSellingDecision.Merge(m, src) -} -func (m *MsgSellingDecision) XXX_Size() int { - return m.Size() -} -func (m *MsgSellingDecision) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSellingDecision.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSellingDecision proto.InternalMessageInfo - -func (m *MsgSellingDecision) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgSellingDecisionResponse struct { -} - -func (m *MsgSellingDecisionResponse) Reset() { *m = MsgSellingDecisionResponse{} } -func (m *MsgSellingDecisionResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSellingDecisionResponse) ProtoMessage() {} -func (*MsgSellingDecisionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{15} -} -func (m *MsgSellingDecisionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSellingDecisionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSellingDecisionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSellingDecisionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSellingDecisionResponse.Merge(m, src) -} -func (m *MsgSellingDecisionResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSellingDecisionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSellingDecisionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSellingDecisionResponse proto.InternalMessageInfo - -type MsgPayFullBid struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgPayFullBid) Reset() { *m = MsgPayFullBid{} } -func (m *MsgPayFullBid) String() string { return proto.CompactTextString(m) } -func (*MsgPayFullBid) ProtoMessage() {} -func (*MsgPayFullBid) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{16} -} -func (m *MsgPayFullBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPayFullBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPayFullBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgPayFullBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPayFullBid.Merge(m, src) -} -func (m *MsgPayFullBid) XXX_Size() int { - return m.Size() -} -func (m *MsgPayFullBid) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPayFullBid.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPayFullBid proto.InternalMessageInfo - -func (m *MsgPayFullBid) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgPayFullBidResponse struct { -} - -func (m *MsgPayFullBidResponse) Reset() { *m = MsgPayFullBidResponse{} } -func (m *MsgPayFullBidResponse) String() string { return proto.CompactTextString(m) } -func (*MsgPayFullBidResponse) ProtoMessage() {} -func (*MsgPayFullBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{17} -} -func (m *MsgPayFullBidResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPayFullBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPayFullBidResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgPayFullBidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPayFullBidResponse.Merge(m, src) -} -func (m *MsgPayFullBidResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgPayFullBidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPayFullBidResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPayFullBidResponse proto.InternalMessageInfo - -type MsgBorrow struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *MsgBorrow) Reset() { *m = MsgBorrow{} } -func (m *MsgBorrow) String() string { return proto.CompactTextString(m) } -func (*MsgBorrow) ProtoMessage() {} -func (*MsgBorrow) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{18} -} -func (m *MsgBorrow) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBorrow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBorrow.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgBorrow) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBorrow.Merge(m, src) -} -func (m *MsgBorrow) XXX_Size() int { - return m.Size() -} -func (m *MsgBorrow) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBorrow.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBorrow proto.InternalMessageInfo - -func (m *MsgBorrow) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *MsgBorrow) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -type MsgBorrowResponse struct { -} - -func (m *MsgBorrowResponse) Reset() { *m = MsgBorrowResponse{} } -func (m *MsgBorrowResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBorrowResponse) ProtoMessage() {} -func (*MsgBorrowResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{19} -} -func (m *MsgBorrowResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBorrowResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBorrowResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgBorrowResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBorrowResponse.Merge(m, src) -} -func (m *MsgBorrowResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgBorrowResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBorrowResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBorrowResponse proto.InternalMessageInfo - -type MsgRepay struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *MsgRepay) Reset() { *m = MsgRepay{} } -func (m *MsgRepay) String() string { return proto.CompactTextString(m) } -func (*MsgRepay) ProtoMessage() {} -func (*MsgRepay) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{20} -} -func (m *MsgRepay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRepay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRepay) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRepay.Merge(m, src) -} -func (m *MsgRepay) XXX_Size() int { - return m.Size() -} -func (m *MsgRepay) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRepay.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRepay proto.InternalMessageInfo - -func (m *MsgRepay) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *MsgRepay) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -type MsgRepayResponse struct { -} - -func (m *MsgRepayResponse) Reset() { *m = MsgRepayResponse{} } -func (m *MsgRepayResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRepayResponse) ProtoMessage() {} -func (*MsgRepayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{21} -} -func (m *MsgRepayResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRepayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRepayResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRepayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRepayResponse.Merge(m, src) -} -func (m *MsgRepayResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRepayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRepayResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRepayResponse proto.InternalMessageInfo - -type MsgMintStableCoin struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` -} - -func (m *MsgMintStableCoin) Reset() { *m = MsgMintStableCoin{} } -func (m *MsgMintStableCoin) String() string { return proto.CompactTextString(m) } -func (*MsgMintStableCoin) ProtoMessage() {} -func (*MsgMintStableCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{22} -} -func (m *MsgMintStableCoin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintStableCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintStableCoin.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMintStableCoin) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintStableCoin.Merge(m, src) -} -func (m *MsgMintStableCoin) XXX_Size() int { - return m.Size() -} -func (m *MsgMintStableCoin) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintStableCoin.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintStableCoin proto.InternalMessageInfo - -type MsgMintStableCoinResponse struct { -} - -func (m *MsgMintStableCoinResponse) Reset() { *m = MsgMintStableCoinResponse{} } -func (m *MsgMintStableCoinResponse) String() string { return proto.CompactTextString(m) } -func (*MsgMintStableCoinResponse) ProtoMessage() {} -func (*MsgMintStableCoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{23} -} -func (m *MsgMintStableCoinResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintStableCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintStableCoinResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMintStableCoinResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintStableCoinResponse.Merge(m, src) -} -func (m *MsgMintStableCoinResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgMintStableCoinResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintStableCoinResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintStableCoinResponse proto.InternalMessageInfo - -type MsgBurnStableCoin struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` -} - -func (m *MsgBurnStableCoin) Reset() { *m = MsgBurnStableCoin{} } -func (m *MsgBurnStableCoin) String() string { return proto.CompactTextString(m) } -func (*MsgBurnStableCoin) ProtoMessage() {} -func (*MsgBurnStableCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{24} -} -func (m *MsgBurnStableCoin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBurnStableCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBurnStableCoin.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgBurnStableCoin) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurnStableCoin.Merge(m, src) -} -func (m *MsgBurnStableCoin) XXX_Size() int { - return m.Size() -} -func (m *MsgBurnStableCoin) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurnStableCoin.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBurnStableCoin proto.InternalMessageInfo - -type MsgBurnStableCoinResponse struct { -} - -func (m *MsgBurnStableCoinResponse) Reset() { *m = MsgBurnStableCoinResponse{} } -func (m *MsgBurnStableCoinResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBurnStableCoinResponse) ProtoMessage() {} -func (*MsgBurnStableCoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{25} -} -func (m *MsgBurnStableCoinResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBurnStableCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBurnStableCoinResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgBurnStableCoinResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurnStableCoinResponse.Merge(m, src) -} -func (m *MsgBurnStableCoinResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgBurnStableCoinResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurnStableCoinResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBurnStableCoinResponse proto.InternalMessageInfo - -type MsgLiquidate struct { - Sender github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=sender,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"sender" yaml:"sender"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` -} - -func (m *MsgLiquidate) Reset() { *m = MsgLiquidate{} } -func (m *MsgLiquidate) String() string { return proto.CompactTextString(m) } -func (*MsgLiquidate) ProtoMessage() {} -func (*MsgLiquidate) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{26} -} -func (m *MsgLiquidate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgLiquidate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgLiquidate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgLiquidate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgLiquidate.Merge(m, src) -} -func (m *MsgLiquidate) XXX_Size() int { - return m.Size() -} -func (m *MsgLiquidate) XXX_DiscardUnknown() { - xxx_messageInfo_MsgLiquidate.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgLiquidate proto.InternalMessageInfo - -func (m *MsgLiquidate) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -type MsgLiquidateResponse struct { -} - -func (m *MsgLiquidateResponse) Reset() { *m = MsgLiquidateResponse{} } -func (m *MsgLiquidateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgLiquidateResponse) ProtoMessage() {} -func (*MsgLiquidateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3d4579fb091254fd, []int{27} -} -func (m *MsgLiquidateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgLiquidateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgLiquidateResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgLiquidateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgLiquidateResponse.Merge(m, src) -} -func (m *MsgLiquidateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgLiquidateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgLiquidateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgLiquidateResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgMintNft)(nil), "ununifi.nftmarketv1.MsgMintNft") - proto.RegisterType((*MsgMintNftResponse)(nil), "ununifi.nftmarketv1.MsgMintNftResponse") - proto.RegisterType((*MsgListNft)(nil), "ununifi.nftmarketv1.MsgListNft") - proto.RegisterType((*MsgListNftResponse)(nil), "ununifi.nftmarketv1.MsgListNftResponse") - proto.RegisterType((*MsgCancelNftListing)(nil), "ununifi.nftmarketv1.MsgCancelNftListing") - proto.RegisterType((*MsgCancelNftListingResponse)(nil), "ununifi.nftmarketv1.MsgCancelNftListingResponse") - proto.RegisterType((*MsgExpandListingPeriod)(nil), "ununifi.nftmarketv1.MsgExpandListingPeriod") - proto.RegisterType((*MsgExpandListingPeriodResponse)(nil), "ununifi.nftmarketv1.MsgExpandListingPeriodResponse") - proto.RegisterType((*MsgPlaceBid)(nil), "ununifi.nftmarketv1.MsgPlaceBid") - proto.RegisterType((*MsgPlaceBidResponse)(nil), "ununifi.nftmarketv1.MsgPlaceBidResponse") - proto.RegisterType((*MsgCancelBid)(nil), "ununifi.nftmarketv1.MsgCancelBid") - proto.RegisterType((*MsgCancelBidResponse)(nil), "ununifi.nftmarketv1.MsgCancelBidResponse") - proto.RegisterType((*MsgEndNftListing)(nil), "ununifi.nftmarketv1.MsgEndNftListing") - proto.RegisterType((*MsgEndNftListingResponse)(nil), "ununifi.nftmarketv1.MsgEndNftListingResponse") - proto.RegisterType((*MsgSellingDecision)(nil), "ununifi.nftmarketv1.MsgSellingDecision") - proto.RegisterType((*MsgSellingDecisionResponse)(nil), "ununifi.nftmarketv1.MsgSellingDecisionResponse") - proto.RegisterType((*MsgPayFullBid)(nil), "ununifi.nftmarketv1.MsgPayFullBid") - proto.RegisterType((*MsgPayFullBidResponse)(nil), "ununifi.nftmarketv1.MsgPayFullBidResponse") - proto.RegisterType((*MsgBorrow)(nil), "ununifi.nftmarketv1.MsgBorrow") - proto.RegisterType((*MsgBorrowResponse)(nil), "ununifi.nftmarketv1.MsgBorrowResponse") - proto.RegisterType((*MsgRepay)(nil), "ununifi.nftmarketv1.MsgRepay") - proto.RegisterType((*MsgRepayResponse)(nil), "ununifi.nftmarketv1.MsgRepayResponse") - proto.RegisterType((*MsgMintStableCoin)(nil), "ununifi.nftmarketv1.MsgMintStableCoin") - proto.RegisterType((*MsgMintStableCoinResponse)(nil), "ununifi.nftmarketv1.MsgMintStableCoinResponse") - proto.RegisterType((*MsgBurnStableCoin)(nil), "ununifi.nftmarketv1.MsgBurnStableCoin") - proto.RegisterType((*MsgBurnStableCoinResponse)(nil), "ununifi.nftmarketv1.MsgBurnStableCoinResponse") - proto.RegisterType((*MsgLiquidate)(nil), "ununifi.nftmarketv1.MsgLiquidate") - proto.RegisterType((*MsgLiquidateResponse)(nil), "ununifi.nftmarketv1.MsgLiquidateResponse") -} - -func init() { proto.RegisterFile("nftmarketv1/tx.proto", fileDescriptor_3d4579fb091254fd) } - -var fileDescriptor_3d4579fb091254fd = []byte{ - // 1070 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4f, 0x6f, 0xdc, 0x44, - 0x14, 0x8f, 0x9b, 0x64, 0x93, 0xbc, 0x34, 0x69, 0xea, 0xa4, 0x61, 0xeb, 0x50, 0xef, 0xd6, 0x52, - 0x43, 0xa0, 0xd4, 0x26, 0xe9, 0x01, 0x89, 0x0b, 0x64, 0x03, 0x51, 0x23, 0x65, 0xa3, 0x68, 0xd3, - 0x20, 0x15, 0x21, 0x2d, 0x63, 0x7b, 0xd6, 0x19, 0xad, 0x3d, 0x5e, 0x3c, 0xe3, 0x34, 0xfb, 0x2d, - 0x38, 0x20, 0xbe, 0x07, 0x48, 0x08, 0x24, 0xbe, 0x40, 0x2f, 0x48, 0x3d, 0x21, 0xc4, 0x21, 0x42, - 0x89, 0x04, 0xf7, 0x7e, 0x02, 0x64, 0x7b, 0x76, 0xf6, 0x4f, 0xd6, 0x49, 0x38, 0x40, 0xb5, 0x3d, - 0xad, 0xc7, 0xef, 0x37, 0xbf, 0xf7, 0x7e, 0x6f, 0x66, 0xde, 0x1b, 0x2f, 0x2c, 0xd1, 0x06, 0x0f, - 0x50, 0xd4, 0xc4, 0xfc, 0x78, 0xdd, 0xe2, 0x27, 0x66, 0x2b, 0x0a, 0x79, 0xa8, 0x2e, 0xc6, 0x34, - 0xa6, 0xa4, 0x41, 0xcc, 0x1e, 0xab, 0xb6, 0xe4, 0x85, 0x5e, 0x98, 0xda, 0xad, 0xe4, 0x29, 0x83, - 0x6a, 0x25, 0x2f, 0x0c, 0x3d, 0x1f, 0x5b, 0xe9, 0xc8, 0x8e, 0x1b, 0x16, 0x27, 0x01, 0x66, 0x1c, - 0x05, 0x2d, 0x01, 0xd0, 0x9d, 0x90, 0x05, 0x21, 0xb3, 0x6c, 0xc4, 0xb0, 0x75, 0xbc, 0x6e, 0x63, - 0x8e, 0xd6, 0x2d, 0x27, 0x24, 0x54, 0xd8, 0x57, 0x7a, 0x23, 0x90, 0xcf, 0x99, 0xd1, 0xf8, 0x4d, - 0x01, 0xa8, 0x32, 0xaf, 0x4a, 0x28, 0xdf, 0x6b, 0x70, 0xf5, 0x2b, 0x28, 0x30, 0x4c, 0x5d, 0x1c, - 0x15, 0x95, 0xb2, 0xb2, 0x36, 0x53, 0x79, 0xf2, 0xe2, 0xb4, 0x34, 0xf6, 0xc7, 0x69, 0xc9, 0xf2, - 0x08, 0x3f, 0x8a, 0x6d, 0xd3, 0x09, 0x03, 0xeb, 0x90, 0x1e, 0x52, 0xb2, 0x4d, 0x2c, 0xe7, 0x08, - 0x11, 0x6a, 0xf1, 0x76, 0x0b, 0x33, 0xf3, 0x80, 0x47, 0x84, 0x7a, 0x9b, 0x8e, 0xb3, 0xe9, 0xba, - 0x11, 0x66, 0xec, 0xd5, 0x69, 0x69, 0xae, 0x8d, 0x02, 0xff, 0x23, 0x23, 0xa3, 0x33, 0x6a, 0x82, - 0x57, 0x2d, 0xc2, 0x94, 0xe3, 0x23, 0xc6, 0x76, 0xdc, 0xe2, 0x8d, 0xc4, 0x45, 0xad, 0x33, 0x54, - 0x97, 0x60, 0x92, 0x36, 0xf8, 0x8e, 0x5b, 0x1c, 0x4f, 0xdf, 0x67, 0x03, 0x75, 0x19, 0x0a, 0xb4, - 0xc1, 0x0f, 0x23, 0x52, 0x9c, 0x48, 0x5f, 0x8b, 0x91, 0xaa, 0x03, 0x64, 0x4f, 0x4f, 0x10, 0x3b, - 0x2a, 0x4e, 0xa6, 0xb6, 0x9e, 0x37, 0xc6, 0x12, 0xa8, 0x5d, 0x5d, 0x35, 0xcc, 0x5a, 0x21, 0x65, - 0xd8, 0xf8, 0x76, 0x3c, 0x95, 0xbb, 0x4b, 0xd8, 0xff, 0x24, 0xf7, 0xe3, 0x34, 0xfc, 0x3a, 0xc9, - 0xd4, 0xce, 0x6e, 0x18, 0xe6, 0x90, 0x95, 0x37, 0xf7, 0x12, 0xa9, 0x98, 0x72, 0xd2, 0x20, 0x38, - 0xaa, 0x4c, 0x24, 0x51, 0x74, 0xf4, 0x6f, 0xc1, 0x4d, 0x9f, 0x30, 0x4e, 0xa8, 0x57, 0x4f, 0x7c, - 0xa7, 0xc9, 0x99, 0xdf, 0x28, 0x0f, 0xa5, 0xd9, 0xcd, 0x80, 0x4f, 0xdb, 0x2d, 0x5c, 0x9b, 0xf5, - 0xbb, 0x03, 0x75, 0x05, 0x66, 0x6c, 0xe2, 0xd6, 0x79, 0xd8, 0xc4, 0x54, 0xe4, 0x71, 0xda, 0x26, - 0xee, 0xd3, 0x64, 0xac, 0x3e, 0x83, 0xa9, 0x80, 0xd0, 0xba, 0x4d, 0xdc, 0x2c, 0x8d, 0x95, 0x4f, - 0x44, 0x16, 0x56, 0x7b, 0xb2, 0x20, 0xf6, 0x58, 0xf6, 0xf3, 0x88, 0xb9, 0x4d, 0x91, 0x89, 0x1d, - 0xca, 0x5f, 0x9d, 0x96, 0xe6, 0x33, 0xf1, 0x82, 0xc6, 0xa8, 0x15, 0x02, 0x42, 0x2b, 0xc4, 0x55, - 0x57, 0xe1, 0x56, 0xe2, 0x17, 0x39, 0x9c, 0x1c, 0xe3, 0x7a, 0x84, 0x68, 0xb3, 0x58, 0x28, 0x2b, - 0x6b, 0x13, 0xb5, 0x39, 0x9b, 0xb8, 0x9b, 0xe9, 0xdb, 0x1a, 0xa2, 0x4d, 0xb1, 0x58, 0x62, 0x55, - 0xe4, 0x62, 0xfd, 0xac, 0xc0, 0x62, 0x95, 0x79, 0x5b, 0x88, 0x3a, 0xd8, 0xdf, 0x6b, 0x70, 0x21, - 0x6f, 0x04, 0x56, 0xcd, 0xb8, 0x07, 0x2b, 0x43, 0x22, 0x97, 0xca, 0x7e, 0x51, 0x60, 0xb9, 0xca, - 0xbc, 0xcf, 0x4e, 0x5a, 0x88, 0xba, 0xc2, 0xb8, 0x8f, 0x23, 0x12, 0xba, 0xa3, 0x20, 0xae, 0x0c, - 0xfa, 0xf0, 0xe0, 0xa5, 0xbe, 0xef, 0x6e, 0xc0, 0x6c, 0x95, 0x79, 0xfb, 0x3e, 0x72, 0x70, 0xb2, - 0x0f, 0x46, 0xe0, 0x9c, 0x7d, 0x08, 0x05, 0x14, 0x84, 0x31, 0xe5, 0xe9, 0x09, 0x9b, 0xdd, 0xb8, - 0x6b, 0x66, 0x7b, 0xdd, 0x4c, 0xca, 0xaa, 0x29, 0xca, 0xaa, 0xb9, 0x15, 0x12, 0x2a, 0xe6, 0x09, - 0xb8, 0xfa, 0x10, 0x6e, 0xa3, 0x98, 0x87, 0x01, 0xe2, 0xc4, 0xa9, 0xb7, 0x50, 0x3b, 0xc0, 0x94, - 0xa7, 0x67, 0x6c, 0xba, 0xb6, 0x20, 0x0d, 0xfb, 0xd9, 0x7b, 0xe3, 0x4e, 0xba, 0xa3, 0x3b, 0x79, - 0x91, 0xf9, 0xfa, 0x5e, 0x81, 0x9b, 0x72, 0xbf, 0x8c, 0x46, 0xc2, 0x8c, 0x65, 0x58, 0xea, 0x0d, - 0x59, 0x6a, 0xf9, 0x51, 0x81, 0x85, 0x64, 0x7b, 0x50, 0x77, 0xb4, 0x8e, 0xac, 0x06, 0xc5, 0xc1, - 0xb0, 0xa5, 0xa6, 0x9f, 0x94, 0xb4, 0x40, 0x1d, 0x60, 0xdf, 0x27, 0xd4, 0xfb, 0x14, 0x3b, 0x84, - 0x91, 0x90, 0x8e, 0x82, 0xaa, 0xb7, 0x41, 0xbb, 0x18, 0xb8, 0xd4, 0xf5, 0x83, 0x02, 0x73, 0xc9, - 0x7e, 0x44, 0xed, 0xed, 0xd8, 0x1f, 0x95, 0x8d, 0xf7, 0x16, 0xdc, 0xe9, 0x8b, 0x59, 0xaa, 0xf9, - 0x5b, 0x81, 0x99, 0x2a, 0xf3, 0x2a, 0x61, 0x14, 0x85, 0xcf, 0xdf, 0xe4, 0x9a, 0x63, 0x2c, 0xc2, - 0x6d, 0x29, 0x54, 0xca, 0xff, 0x4b, 0x81, 0xe9, 0x2a, 0xf3, 0x6a, 0xb8, 0x85, 0xda, 0x6f, 0xb4, - 0x7a, 0x35, 0x2d, 0x30, 0xa9, 0x4e, 0x29, 0x3e, 0x4e, 0x33, 0x92, 0x5c, 0xf7, 0x0e, 0x38, 0xb2, - 0x7d, 0x9c, 0x4c, 0xfb, 0xef, 0x93, 0x60, 0xac, 0xc0, 0xdd, 0x0b, 0x6e, 0x07, 0x62, 0xaa, 0xc4, - 0x11, 0x7d, 0x0d, 0x31, 0xf5, 0xbb, 0x1d, 0xec, 0x34, 0xbb, 0xe4, 0xeb, 0x98, 0xb8, 0x88, 0xe3, - 0xd1, 0xe9, 0x34, 0x32, 0xe4, 0x8e, 0x96, 0x8d, 0x5f, 0x01, 0xc6, 0xab, 0xcc, 0x53, 0x0f, 0x60, - 0xaa, 0xf3, 0xfd, 0x52, 0x1a, 0xca, 0xdd, 0xfd, 0x10, 0xd0, 0xde, 0xb9, 0x02, 0xd0, 0x21, 0x4f, - 0x48, 0x3b, 0x5f, 0x09, 0xb9, 0xa4, 0x02, 0x90, 0x4f, 0x3a, 0x70, 0xa3, 0x55, 0x29, 0x2c, 0x5c, - 0xb8, 0xcd, 0xae, 0xe5, 0x4d, 0x1e, 0x44, 0x6a, 0x1f, 0x5c, 0x17, 0x29, 0xfd, 0x3d, 0x87, 0xc5, - 0x61, 0x77, 0xcc, 0x87, 0x79, 0x44, 0x43, 0xc0, 0xda, 0xe3, 0x7f, 0x01, 0x96, 0x8e, 0x3f, 0x87, - 0x69, 0x79, 0xf9, 0x2b, 0xe7, 0x11, 0x74, 0x10, 0xda, 0xda, 0x55, 0x08, 0xc9, 0xfb, 0x0c, 0x66, - 0xba, 0x97, 0xa4, 0xfb, 0x97, 0xe7, 0x23, 0x61, 0x7e, 0xf7, 0x4a, 0x88, 0xa4, 0x6e, 0xc2, 0xad, - 0xc1, 0xfe, 0x9e, 0xbb, 0xae, 0x03, 0x40, 0xcd, 0xba, 0x26, 0x50, 0x3a, 0xc3, 0x30, 0xd7, 0x7f, - 0x41, 0x7a, 0x90, 0x9b, 0xe5, 0x5e, 0x98, 0xf6, 0xe8, 0x5a, 0x30, 0xe9, 0xe6, 0x4b, 0x80, 0x9e, - 0xde, 0x6e, 0xe4, 0xa6, 0x59, 0x62, 0xb4, 0xf7, 0xae, 0xc6, 0x48, 0xf6, 0x7d, 0x28, 0x88, 0x5e, - 0xab, 0xe7, 0xcd, 0xca, 0xec, 0xda, 0xea, 0xe5, 0x76, 0xc9, 0x58, 0x85, 0xc9, 0xac, 0x7d, 0xdd, - 0xcb, 0x9b, 0x90, 0x9a, 0xb5, 0x07, 0x97, 0x9a, 0x25, 0xdd, 0x11, 0xcc, 0x0f, 0x74, 0x84, 0xd5, - 0xcb, 0x8e, 0x7f, 0x17, 0xa7, 0x99, 0xd7, 0xc3, 0xf5, 0x7a, 0x1a, 0xa8, 0xf3, 0xf9, 0x92, 0xfb, - 0x70, 0xf9, 0x9e, 0x86, 0x17, 0xf0, 0xe4, 0x04, 0x74, 0x8b, 0xf7, 0xfd, 0xfc, 0xc2, 0x23, 0x20, - 0xf9, 0x27, 0xe0, 0x42, 0x3d, 0xad, 0x6c, 0xbf, 0x38, 0xd3, 0x95, 0x97, 0x67, 0xba, 0xf2, 0xe7, - 0x99, 0xae, 0x7c, 0x73, 0xae, 0x8f, 0xbd, 0x3c, 0xd7, 0xc7, 0x7e, 0x3f, 0xd7, 0xc7, 0xbe, 0x78, - 0x3f, 0xb7, 0x19, 0x9c, 0x58, 0x7d, 0xff, 0x6f, 0x25, 0xad, 0xc1, 0x2e, 0xa4, 0x7f, 0x2d, 0x3d, - 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xf8, 0xd7, 0xb4, 0xba, 0xfb, 0x12, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - MintNft(ctx context.Context, in *MsgMintNft, opts ...grpc.CallOption) (*MsgMintNftResponse, error) - ListNft(ctx context.Context, in *MsgListNft, opts ...grpc.CallOption) (*MsgListNftResponse, error) - CancelNftListing(ctx context.Context, in *MsgCancelNftListing, opts ...grpc.CallOption) (*MsgCancelNftListingResponse, error) - ExpandListingPeriod(ctx context.Context, in *MsgExpandListingPeriod, opts ...grpc.CallOption) (*MsgExpandListingPeriodResponse, error) - PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) - CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) - SellingDecision(ctx context.Context, in *MsgSellingDecision, opts ...grpc.CallOption) (*MsgSellingDecisionResponse, error) - EndNftListing(ctx context.Context, in *MsgEndNftListing, opts ...grpc.CallOption) (*MsgEndNftListingResponse, error) - PayFullBid(ctx context.Context, in *MsgPayFullBid, opts ...grpc.CallOption) (*MsgPayFullBidResponse, error) - Borrow(ctx context.Context, in *MsgBorrow, opts ...grpc.CallOption) (*MsgBorrowResponse, error) - Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) - MintStableCoin(ctx context.Context, in *MsgMintStableCoin, opts ...grpc.CallOption) (*MsgMintStableCoinResponse, error) - BurnStableCoin(ctx context.Context, in *MsgBurnStableCoin, opts ...grpc.CallOption) (*MsgBurnStableCoinResponse, error) - Liquidate(ctx context.Context, in *MsgLiquidate, opts ...grpc.CallOption) (*MsgLiquidateResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) MintNft(ctx context.Context, in *MsgMintNft, opts ...grpc.CallOption) (*MsgMintNftResponse, error) { - out := new(MsgMintNftResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/MintNft", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ListNft(ctx context.Context, in *MsgListNft, opts ...grpc.CallOption) (*MsgListNftResponse, error) { - out := new(MsgListNftResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/ListNft", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) CancelNftListing(ctx context.Context, in *MsgCancelNftListing, opts ...grpc.CallOption) (*MsgCancelNftListingResponse, error) { - out := new(MsgCancelNftListingResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/CancelNftListing", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ExpandListingPeriod(ctx context.Context, in *MsgExpandListingPeriod, opts ...grpc.CallOption) (*MsgExpandListingPeriodResponse, error) { - out := new(MsgExpandListingPeriodResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/ExpandListingPeriod", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) { - out := new(MsgPlaceBidResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/PlaceBid", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) { - out := new(MsgCancelBidResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/CancelBid", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) SellingDecision(ctx context.Context, in *MsgSellingDecision, opts ...grpc.CallOption) (*MsgSellingDecisionResponse, error) { - out := new(MsgSellingDecisionResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/SellingDecision", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) EndNftListing(ctx context.Context, in *MsgEndNftListing, opts ...grpc.CallOption) (*MsgEndNftListingResponse, error) { - out := new(MsgEndNftListingResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/EndNftListing", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) PayFullBid(ctx context.Context, in *MsgPayFullBid, opts ...grpc.CallOption) (*MsgPayFullBidResponse, error) { - out := new(MsgPayFullBidResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/PayFullBid", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Borrow(ctx context.Context, in *MsgBorrow, opts ...grpc.CallOption) (*MsgBorrowResponse, error) { - out := new(MsgBorrowResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/Borrow", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) { - out := new(MsgRepayResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/Repay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) MintStableCoin(ctx context.Context, in *MsgMintStableCoin, opts ...grpc.CallOption) (*MsgMintStableCoinResponse, error) { - out := new(MsgMintStableCoinResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/MintStableCoin", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) BurnStableCoin(ctx context.Context, in *MsgBurnStableCoin, opts ...grpc.CallOption) (*MsgBurnStableCoinResponse, error) { - out := new(MsgBurnStableCoinResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/BurnStableCoin", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Liquidate(ctx context.Context, in *MsgLiquidate, opts ...grpc.CallOption) (*MsgLiquidateResponse, error) { - out := new(MsgLiquidateResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftmarketv1.Msg/Liquidate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - MintNft(context.Context, *MsgMintNft) (*MsgMintNftResponse, error) - ListNft(context.Context, *MsgListNft) (*MsgListNftResponse, error) - CancelNftListing(context.Context, *MsgCancelNftListing) (*MsgCancelNftListingResponse, error) - ExpandListingPeriod(context.Context, *MsgExpandListingPeriod) (*MsgExpandListingPeriodResponse, error) - PlaceBid(context.Context, *MsgPlaceBid) (*MsgPlaceBidResponse, error) - CancelBid(context.Context, *MsgCancelBid) (*MsgCancelBidResponse, error) - SellingDecision(context.Context, *MsgSellingDecision) (*MsgSellingDecisionResponse, error) - EndNftListing(context.Context, *MsgEndNftListing) (*MsgEndNftListingResponse, error) - PayFullBid(context.Context, *MsgPayFullBid) (*MsgPayFullBidResponse, error) - Borrow(context.Context, *MsgBorrow) (*MsgBorrowResponse, error) - Repay(context.Context, *MsgRepay) (*MsgRepayResponse, error) - MintStableCoin(context.Context, *MsgMintStableCoin) (*MsgMintStableCoinResponse, error) - BurnStableCoin(context.Context, *MsgBurnStableCoin) (*MsgBurnStableCoinResponse, error) - Liquidate(context.Context, *MsgLiquidate) (*MsgLiquidateResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) MintNft(ctx context.Context, req *MsgMintNft) (*MsgMintNftResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MintNft not implemented") -} -func (*UnimplementedMsgServer) ListNft(ctx context.Context, req *MsgListNft) (*MsgListNftResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListNft not implemented") -} -func (*UnimplementedMsgServer) CancelNftListing(ctx context.Context, req *MsgCancelNftListing) (*MsgCancelNftListingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelNftListing not implemented") -} -func (*UnimplementedMsgServer) ExpandListingPeriod(ctx context.Context, req *MsgExpandListingPeriod) (*MsgExpandListingPeriodResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ExpandListingPeriod not implemented") -} -func (*UnimplementedMsgServer) PlaceBid(ctx context.Context, req *MsgPlaceBid) (*MsgPlaceBidResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlaceBid not implemented") -} -func (*UnimplementedMsgServer) CancelBid(ctx context.Context, req *MsgCancelBid) (*MsgCancelBidResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelBid not implemented") -} -func (*UnimplementedMsgServer) SellingDecision(ctx context.Context, req *MsgSellingDecision) (*MsgSellingDecisionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SellingDecision not implemented") -} -func (*UnimplementedMsgServer) EndNftListing(ctx context.Context, req *MsgEndNftListing) (*MsgEndNftListingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EndNftListing not implemented") -} -func (*UnimplementedMsgServer) PayFullBid(ctx context.Context, req *MsgPayFullBid) (*MsgPayFullBidResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PayFullBid not implemented") -} -func (*UnimplementedMsgServer) Borrow(ctx context.Context, req *MsgBorrow) (*MsgBorrowResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Borrow not implemented") -} -func (*UnimplementedMsgServer) Repay(ctx context.Context, req *MsgRepay) (*MsgRepayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Repay not implemented") -} -func (*UnimplementedMsgServer) MintStableCoin(ctx context.Context, req *MsgMintStableCoin) (*MsgMintStableCoinResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MintStableCoin not implemented") -} -func (*UnimplementedMsgServer) BurnStableCoin(ctx context.Context, req *MsgBurnStableCoin) (*MsgBurnStableCoinResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BurnStableCoin not implemented") -} -func (*UnimplementedMsgServer) Liquidate(ctx context.Context, req *MsgLiquidate) (*MsgLiquidateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Liquidate not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_MintNft_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgMintNft) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).MintNft(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/MintNft", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).MintNft(ctx, req.(*MsgMintNft)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ListNft_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgListNft) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ListNft(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/ListNft", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ListNft(ctx, req.(*MsgListNft)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_CancelNftListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCancelNftListing) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CancelNftListing(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/CancelNftListing", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CancelNftListing(ctx, req.(*MsgCancelNftListing)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ExpandListingPeriod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgExpandListingPeriod) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ExpandListingPeriod(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/ExpandListingPeriod", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ExpandListingPeriod(ctx, req.(*MsgExpandListingPeriod)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_PlaceBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgPlaceBid) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).PlaceBid(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/PlaceBid", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PlaceBid(ctx, req.(*MsgPlaceBid)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_CancelBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCancelBid) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CancelBid(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/CancelBid", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CancelBid(ctx, req.(*MsgCancelBid)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_SellingDecision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSellingDecision) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SellingDecision(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/SellingDecision", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SellingDecision(ctx, req.(*MsgSellingDecision)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_EndNftListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgEndNftListing) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).EndNftListing(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/EndNftListing", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).EndNftListing(ctx, req.(*MsgEndNftListing)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_PayFullBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgPayFullBid) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).PayFullBid(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/PayFullBid", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PayFullBid(ctx, req.(*MsgPayFullBid)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Borrow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBorrow) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Borrow(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/Borrow", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Borrow(ctx, req.(*MsgBorrow)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Repay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRepay) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Repay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/Repay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Repay(ctx, req.(*MsgRepay)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_MintStableCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgMintStableCoin) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).MintStableCoin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/MintStableCoin", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).MintStableCoin(ctx, req.(*MsgMintStableCoin)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_BurnStableCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBurnStableCoin) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).BurnStableCoin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/BurnStableCoin", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BurnStableCoin(ctx, req.(*MsgBurnStableCoin)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Liquidate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgLiquidate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Liquidate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftmarketv1.Msg/Liquidate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Liquidate(ctx, req.(*MsgLiquidate)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.nftmarketv1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "MintNft", - Handler: _Msg_MintNft_Handler, - }, - { - MethodName: "ListNft", - Handler: _Msg_ListNft_Handler, - }, - { - MethodName: "CancelNftListing", - Handler: _Msg_CancelNftListing_Handler, - }, - { - MethodName: "ExpandListingPeriod", - Handler: _Msg_ExpandListingPeriod_Handler, - }, - { - MethodName: "PlaceBid", - Handler: _Msg_PlaceBid_Handler, - }, - { - MethodName: "CancelBid", - Handler: _Msg_CancelBid_Handler, - }, - { - MethodName: "SellingDecision", - Handler: _Msg_SellingDecision_Handler, - }, - { - MethodName: "EndNftListing", - Handler: _Msg_EndNftListing_Handler, - }, - { - MethodName: "PayFullBid", - Handler: _Msg_PayFullBid_Handler, - }, - { - MethodName: "Borrow", - Handler: _Msg_Borrow_Handler, - }, - { - MethodName: "Repay", - Handler: _Msg_Repay_Handler, - }, - { - MethodName: "MintStableCoin", - Handler: _Msg_MintStableCoin_Handler, - }, - { - MethodName: "BurnStableCoin", - Handler: _Msg_BurnStableCoin_Handler, - }, - { - MethodName: "Liquidate", - Handler: _Msg_Liquidate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "nftmarketv1/tx.proto", -} - -func (m *MsgMintNft) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgMintNft) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftUriHash) > 0 { - i -= len(m.NftUriHash) - copy(dAtA[i:], m.NftUriHash) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftUriHash))) - i-- - dAtA[i] = 0x2a - } - if len(m.NftUri) > 0 { - i -= len(m.NftUri) - copy(dAtA[i:], m.NftUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftUri))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgMintNftResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgMintNftResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgListNft) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgListNft) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgListNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BidActiveRank != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.BidActiveRank)) - i-- - dAtA[i] = 0x30 - } - { - size := m.MinBid.Size() - i -= size - if _, err := m.MinBid.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.BidToken) > 0 { - i -= len(m.BidToken) - copy(dAtA[i:], m.BidToken) - i = encodeVarintTx(dAtA, i, uint64(len(m.BidToken))) - i-- - dAtA[i] = 0x22 - } - if m.ListingType != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ListingType)) - i-- - dAtA[i] = 0x18 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgListNftResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgListNftResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgListNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCancelNftListing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCancelNftListing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCancelNftListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgCancelNftListingResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCancelNftListingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCancelNftListingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgExpandListingPeriod) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgExpandListingPeriod) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExpandListingPeriod) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgExpandListingPeriodResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgExpandListingPeriodResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExpandListingPeriodResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgPlaceBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgPlaceBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AutomaticPayment { - i-- - if m.AutomaticPayment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgPlaceBidResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgPlaceBidResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPlaceBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCancelBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCancelBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCancelBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgCancelBidResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCancelBidResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCancelBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgEndNftListing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgEndNftListing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEndNftListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgEndNftListingResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgEndNftListingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEndNftListingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgSellingDecision) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSellingDecision) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSellingDecision) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgSellingDecisionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSellingDecisionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSellingDecisionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgPayFullBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgPayFullBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPayFullBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgPayFullBidResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgPayFullBidResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPayFullBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgBorrow) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgBorrow) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgBorrowResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgBorrowResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBorrowResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgRepay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRepay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgRepayResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRepayResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRepayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgMintStableCoin) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgMintStableCoin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintStableCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgMintStableCoinResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgMintStableCoinResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintStableCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgBurnStableCoin) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgBurnStableCoin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBurnStableCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgBurnStableCoinResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgBurnStableCoinResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBurnStableCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgLiquidate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgLiquidate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgLiquidate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Sender.Size() - i -= size - if _, err := m.Sender.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgLiquidateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgLiquidateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgLiquidateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgMintNft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftUri) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftUriHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMintNftResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgListNft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - if m.ListingType != 0 { - n += 1 + sovTx(uint64(m.ListingType)) - } - l = len(m.BidToken) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.MinBid.Size() - n += 1 + l + sovTx(uint64(l)) - if m.BidActiveRank != 0 { - n += 1 + sovTx(uint64(m.BidActiveRank)) - } - return n -} - -func (m *MsgListNftResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgCancelNftListing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgCancelNftListingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgExpandListingPeriod) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgExpandListingPeriodResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgPlaceBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - if m.AutomaticPayment { - n += 2 - } - return n -} - -func (m *MsgPlaceBidResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgCancelBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgCancelBidResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgEndNftListing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgEndNftListingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgSellingDecision) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgSellingDecisionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgPayFullBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgPayFullBidResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBorrow) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgBorrowResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgRepay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgRepayResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgMintStableCoin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgMintStableCoinResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBurnStableCoin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgBurnStableCoinResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgLiquidate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Sender.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgLiquidateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgMintNft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMintNft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftUriHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftUriHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgMintNftResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMintNftResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNftResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgListNft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgListNft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgListNft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ListingType", wireType) - } - m.ListingType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ListingType |= ListingType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BidToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinBid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BidActiveRank", wireType) - } - m.BidActiveRank = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BidActiveRank |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgListNftResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgListNftResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgListNftResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCancelNftListing) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCancelNftListing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelNftListing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCancelNftListingResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCancelNftListingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelNftListingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExpandListingPeriod) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgExpandListingPeriod: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExpandListingPeriod: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExpandListingPeriodResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgExpandListingPeriodResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExpandListingPeriodResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgPlaceBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPlaceBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticPayment", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AutomaticPayment = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPlaceBidResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgPlaceBidResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPlaceBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCancelBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCancelBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCancelBidResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCancelBidResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgEndNftListing) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgEndNftListing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEndNftListing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgEndNftListingResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgEndNftListingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEndNftListingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSellingDecision) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSellingDecision: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSellingDecision: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSellingDecisionResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSellingDecisionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSellingDecisionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPayFullBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgPayFullBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPayFullBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPayFullBidResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgPayFullBidResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPayFullBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBorrow) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgBorrow: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBorrow: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBorrowResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgBorrowResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBorrowResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRepay) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRepay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRepay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRepayResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRepayResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRepayResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgMintStableCoin) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMintStableCoin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintStableCoin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgMintStableCoinResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMintStableCoinResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintStableCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBurnStableCoin) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgBurnStableCoin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnStableCoin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBurnStableCoinResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgBurnStableCoinResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnStableCoinResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgLiquidate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgLiquidate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgLiquidate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Sender.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgLiquidateResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgLiquidateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgLiquidateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/ununifidist/abci.go b/deprecated/x/ununifidist/abci.go deleted file mode 100644 index fad7b9e88..000000000 --- a/deprecated/x/ununifidist/abci.go +++ /dev/null @@ -1,14 +0,0 @@ -package ununifidist - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/keeper" -) - -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - err := k.MintPeriodInflation(ctx) - if err != nil { - panic(err) - } -} diff --git a/deprecated/x/ununifidist/client/cli/query.go b/deprecated/x/ununifidist/client/cli/query.go deleted file mode 100644 index 3a7931bc5..000000000 --- a/deprecated/x/ununifidist/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group ununifidist queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListReward()) - - return cmd -} diff --git a/deprecated/x/ununifidist/client/cli/query_balances.go b/deprecated/x/ununifidist/client/cli/query_balances.go deleted file mode 100644 index 89b52dc24..000000000 --- a/deprecated/x/ununifidist/client/cli/query_balances.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -func CmdListReward() *cobra.Command { - cmd := &cobra.Command{ - Use: "balances", - Short: "show ununifidist module account balances", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGetBalancesRequest{} - - res, err := queryClient.Balances(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/ununifidist/client/cli/query_params.go b/deprecated/x/ununifidist/client/cli/query_params.go deleted file mode 100644 index bb274e32e..000000000 --- a/deprecated/x/ununifidist/client/cli/query_params.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows a params", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/ununifidist/client/cli/tx.go b/deprecated/x/ununifidist/client/cli/tx.go deleted file mode 100644 index 0051e80fb..000000000 --- a/deprecated/x/ununifidist/client/cli/tx.go +++ /dev/null @@ -1,26 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/deprecated/x/ununifidist/genesis.go b/deprecated/x/ununifidist/genesis.go deleted file mode 100644 index b8faa2e48..000000000 --- a/deprecated/x/ununifidist/genesis.go +++ /dev/null @@ -1,46 +0,0 @@ -package ununifidist - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/keeper" - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -// InitGenesis initializes the store state from a genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKeeper, gs types.GenesisState) { - if err := gs.Validate(); err != nil { - panic(fmt.Sprintf("failed to validate %s genesis state: %s", types.ModuleName, err)) - } - - k.SetParams(ctx, gs.Params) - - // only set the previous block time if it's different than default - if !gs.PreviousBlockTime.Equal(types.DefaultPreviousBlockTime) { - k.SetPreviousBlockTime(ctx, gs.PreviousBlockTime) - } - - // check if the module account exists - moduleAcc := accountKeeper.GetModuleAccount(ctx, types.UnunifidistMacc) - if moduleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", types.UnunifidistMacc)) - } - - k.SetGovDenom(ctx, gs.GovDenom) -} - -// ExportGenesis export genesis state for cdp module -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { - params := k.GetParams(ctx) - previousBlockTime, found := k.GetPreviousBlockTime(ctx) - if !found { - previousBlockTime = types.DefaultPreviousBlockTime - } - govDenom, found := k.GetGovDenom(ctx) - if !found { - govDenom = types.DefaultGovDenom - } - return types.NewGenesisState(params, previousBlockTime, govDenom) -} diff --git a/deprecated/x/ununifidist/handler.go b/deprecated/x/ununifidist/handler.go deleted file mode 100644 index 8d1be88ca..000000000 --- a/deprecated/x/ununifidist/handler.go +++ /dev/null @@ -1,25 +0,0 @@ -package ununifidist - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/keeper" - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - // this line is used by starport scaffolding # 1 - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/deprecated/x/ununifidist/keeper/grpc_query.go b/deprecated/x/ununifidist/keeper/grpc_query.go deleted file mode 100644 index 48a82ba08..000000000 --- a/deprecated/x/ununifidist/keeper/grpc_query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/deprecated/x/ununifidist/keeper/grpc_query_balances.go b/deprecated/x/ununifidist/keeper/grpc_query_balances.go deleted file mode 100644 index 874f76360..000000000 --- a/deprecated/x/ununifidist/keeper/grpc_query_balances.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -func (k Keeper) Balances(c context.Context, req *types.QueryGetBalancesRequest) (*types.QueryGetBalancesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var balances sdk.Coins - ctx := sdk.UnwrapSDKContext(c) - - acc := k.accountKeeper.GetModuleAccount(ctx, types.UnunifidistMacc) - balances = k.bankKeeper.GetAllBalances(ctx, acc.GetAddress()) - - return &types.QueryGetBalancesResponse{Balances: balances}, nil -} diff --git a/deprecated/x/ununifidist/keeper/grpc_query_params.go b/deprecated/x/ununifidist/keeper/grpc_query_params.go deleted file mode 100644 index 7a86b137f..000000000 --- a/deprecated/x/ununifidist/keeper/grpc_query_params.go +++ /dev/null @@ -1,26 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var params types.Params - ctx := sdk.UnwrapSDKContext(c) - - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ParamsKey)) - k.cdc.MustUnmarshal(store.Get(types.KeyPrefix(types.ParamsKey)), ¶ms) - - return &types.QueryParamsResponse{Params: ¶ms}, nil -} diff --git a/deprecated/x/ununifidist/keeper/keeper.go b/deprecated/x/ununifidist/keeper/keeper.go deleted file mode 100644 index 0a4e86985..000000000 --- a/deprecated/x/ununifidist/keeper/keeper.go +++ /dev/null @@ -1,79 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -type ( - Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramSpace paramtypes.Subspace - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - } -) - -func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, -) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramSpace: paramSpace, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// GetPreviousBlockTime get the blocktime for the previous block -func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, found bool) { - store := ctx.KVStore(k.storeKey) - b := store.Get(types.KeyPrefix(types.PreviousBlockTimeKey)) - if b == nil { - return time.Time{}, false - } - blockTime.UnmarshalBinary(b) - - return blockTime, true -} - -// SetPreviousBlockTime set the time of the previous block -func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time) { - store := ctx.KVStore(k.storeKey) - b, _ := blockTime.MarshalBinary() - store.Set(types.KeyPrefix(types.PreviousBlockTimeKey), b) -} - -func (k Keeper) GetGovDenom(ctx sdk.Context) (govDenom string, found bool) { - store := ctx.KVStore(k.storeKey) - b := store.Get(types.KeyPrefix(types.GovDenomKey)) - govDenom = string(b) - - return govDenom, true -} - -func (k Keeper) SetGovDenom(ctx sdk.Context, govDenom string) { - store := ctx.KVStore(k.storeKey) - b := []byte(govDenom) - store.Set(types.KeyPrefix(types.GovDenomKey), b) -} diff --git a/deprecated/x/ununifidist/keeper/mint.go b/deprecated/x/ununifidist/keeper/mint.go deleted file mode 100644 index 9c9b21d37..000000000 --- a/deprecated/x/ununifidist/keeper/mint.go +++ /dev/null @@ -1,94 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -// MintPeriodInflation mints new tokens according to the inflation schedule specified in the parameters -func (k Keeper) MintPeriodInflation(ctx sdk.Context) error { - params := k.GetParams(ctx) - if !params.Active { - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeUnunifidist, - sdk.NewAttribute(types.AttributeKeyStatus, types.AttributeValueInactive), - ), - ) - return nil - } - - previousBlockTime, found := k.GetPreviousBlockTime(ctx) - if !found { - previousBlockTime = ctx.BlockTime() - k.SetPreviousBlockTime(ctx, previousBlockTime) - return nil - } - - var err error - for _, period := range params.Periods { - switch { - // Case 1 - period is fully expired - case period.End.Before(previousBlockTime): - continue - - // Case 2 - period has ended since the previous block time - case period.End.After(previousBlockTime) && period.End.Before(ctx.BlockTime()): - // calculate time elapsed relative to the periods end time - timeElapsed := sdk.NewInt(period.End.Unix() - previousBlockTime.Unix()) - govDenom, _ := k.GetGovDenom(ctx) - err = k.mintInflationaryCoins(ctx, period.Inflation, timeElapsed, govDenom) - // update the value of previousBlockTime so that the next period starts from the end of the last - // period and not the original value of previousBlockTime - previousBlockTime = period.End - - // Case 3 - period is ongoing - case (period.Start.Before(previousBlockTime) || period.Start.Equal(previousBlockTime)) && period.End.After(ctx.BlockTime()): - // calculate time elapsed relative to the current block time - timeElapsed := sdk.NewInt(ctx.BlockTime().Unix() - previousBlockTime.Unix()) - govDenom, _ := k.GetGovDenom(ctx) - err = k.mintInflationaryCoins(ctx, period.Inflation, timeElapsed, govDenom) - - // Case 4 - period hasn't started - case period.Start.After(ctx.BlockTime()) || period.Start.Equal(ctx.BlockTime()): - continue - } - - if err != nil { - return err - } - } - k.SetPreviousBlockTime(ctx, ctx.BlockTime()) - return nil -} - -func (k Keeper) mintInflationaryCoins(ctx sdk.Context, inflationRate sdk.Dec, timePeriods sdk.Int, denom string) error { - totalSupply := k.bankKeeper.GetSupply(ctx, denom).Amount - // used to scale accumulator calculations by 10^18 - scalar := sdk.NewInt(1000000000000000000) - // convert inflation rate to integer - inflationInt := inflationRate.Mul(sdk.NewDecFromInt(scalar)).TruncateInt() - // calculate the multiplier (amount to multiply the total supply by to achieve the desired inflation) - // multiply the result by 10^-18 because RelativePow returns the result scaled by 10^18 - accumulator := sdk.NewDecFromInt(cdptypes.RelativePow(inflationInt, timePeriods, scalar)).Mul(sdk.SmallestDec()) - // calculate the number of coins to mint - amountToMint := (sdk.NewDecFromInt(totalSupply).Mul(accumulator)).Sub(sdk.NewDecFromInt(totalSupply)).TruncateInt() - if amountToMint.IsZero() { - return nil - } - err := k.bankKeeper.MintCoins(ctx, types.UnunifidistMacc, sdk.NewCoins(sdk.NewCoin(denom, amountToMint))) - if err != nil { - return err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeUnunifidist, - sdk.NewAttribute(types.AttributeKeyInflation, sdk.NewCoin(denom, amountToMint).String()), - ), - ) - - return nil -} diff --git a/deprecated/x/ununifidist/keeper/mint_test.go b/deprecated/x/ununifidist/keeper/mint_test.go deleted file mode 100644 index 81ce956fd..000000000 --- a/deprecated/x/ununifidist/keeper/mint_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/stretchr/testify/suite" - -// sdk "github.com/cosmos/cosmos-sdk/types" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// tmtime "github.com/cometbft/cometbft/types/time" - -// "github.com/UnUniFi/chain/app" -// "github.com/UnUniFi/chain/deprecated/x/ununifidist/keeper" -// ununifidisttypes "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -// ) - -// type KeeperTestSuite struct { -// suite.Suite - -// keeper keeper.Keeper -// // supplyKeeper ununifidisttypes.SupplyKeeper -// accountKeeper ununifidisttypes.AccountKeeper -// bankKeeper ununifidisttypes.BankKeeper -// app app.TestApp -// ctx sdk.Context -// } - -// var ( -// testPeriods = ununifidisttypes.Periods{ -// ununifidisttypes.Period{ -// Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), -// End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), -// Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), -// }, -// } -// ) - -// func (suite *KeeperTestSuite) SetupTest() { -// // config := sdk.GetConfig() -// // app.SetBech32AddressPrefixes(config) -// tApp := app.NewTestApp() -// _, addrs := app.GeneratePrivKeyAddressPairs(1) -// coins := []sdk.Coins{sdk.NewCoins(sdk.NewCoin("uguu", sdk.NewInt(1000000000000)))} -// authGS := app.NewAuthGenState( -// tApp, addrs, coins) - -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - -// params := ununifidisttypes.NewParams(true, testPeriods) -// guuGs := ununifidisttypes.NewGenesisState(params, ununifidisttypes.DefaultPreviousBlockTime, ununifidisttypes.DefaultGovDenom) -// // gs := app.GenesisState{ununifidisttypes.ModuleName: ununifidisttypes.ModuleCdc.MustMarshalJSON(ununifidisttypes.NewGenesisState(params, ununifidisttypes.DefaultPreviousBlockTime))} -// gs := app.GenesisState{ununifidisttypes.ModuleName: ununifidisttypes.ModuleCdc.MustMarshalJSON(&guuGs)} -// tApp.InitializeFromGenesisStates( -// authGS, -// gs, -// ) -// // keeper := tApp.GetKavadistKeeper() -// // sk := tApp.GetSupplyKeeper() -// keeper := tApp.GetUnunifidistKeeper() -// sk := tApp.GetBankKeeper() -// suite.app = tApp -// suite.ctx = ctx -// suite.keeper = keeper -// // suite.supplyKeeper = sk -// suite.accountKeeper = tApp.AccountKeeper -// suite.bankKeeper = sk -// } - -// func (suite *KeeperTestSuite) TestMintExpiredPeriod() { -// govDenom, _ := suite.keeper.GetGovDenom(suite.ctx) -// initialSupply := suite.bankKeeper.GetSupply(suite.ctx, govDenom).Amount -// suite.NotPanics(func() { suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC)) }) -// ctx := suite.ctx.WithBlockTime(time.Date(2022, 1, 1, 0, 7, 0, 0, time.UTC)) -// err := suite.keeper.MintPeriodInflation(ctx) -// suite.NoError(err) -// finalSupply := suite.bankKeeper.GetSupply(ctx, govDenom).Amount -// suite.Equal(initialSupply, finalSupply) -// } - -// func (suite *KeeperTestSuite) TestMintPeriodNotStarted() { -// govDenom, _ := suite.keeper.GetGovDenom(suite.ctx) -// // initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// initialSupply := suite.bankKeeper.GetSupply(suite.ctx, govDenom).Amount -// suite.NotPanics(func() { suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)) }) -// ctx := suite.ctx.WithBlockTime(time.Date(2019, 1, 1, 0, 7, 0, 0, time.UTC)) -// err := suite.keeper.MintPeriodInflation(ctx) -// suite.NoError(err) -// // finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// finalSupply := suite.bankKeeper.GetSupply(ctx, govDenom).Amount -// suite.Equal(initialSupply, finalSupply) -// } - -// func (suite *KeeperTestSuite) TestMintOngoingPeriod() { -// govDenom, _ := suite.keeper.GetGovDenom(suite.ctx) -// // initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// initialSupply := suite.bankKeeper.GetSupply(suite.ctx, govDenom).Amount -// suite.NotPanics(func() { -// suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2020, time.March, 1, 1, 0, 1, 0, time.UTC)) -// }) -// ctx := suite.ctx.WithBlockTime(time.Date(2021, 2, 28, 23, 59, 59, 0, time.UTC)) -// err := suite.keeper.MintPeriodInflation(ctx) -// suite.NoError(err) -// // finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// finalSupply := suite.bankKeeper.GetSupply(ctx, govDenom).Amount -// suite.True(finalSupply.GT(initialSupply)) -// // mAcc := suite.supplyKeeper.GetModuleAccount(ctx, ununifidisttypes.ModuleName) -// // mAccSupply := mAcc.GetCoins().AmountOf(ununifidisttypes.GovDenom) -// // suite.True(mAccSupply.Equal(finalSupply.Sub(initialSupply))) -// mAddr := suite.accountKeeper.GetModuleAddress(ununifidisttypes.ModuleName) -// mAddrSupply := suite.bankKeeper.GetAllBalances(ctx, mAddr).AmountOf(govDenom) -// suite.True(mAddrSupply.Equal(finalSupply.Sub(initialSupply))) -// // expect that inflation is ~10% -// expectedSupply := sdk.NewDecFromInt(initialSupply).Mul(sdk.MustNewDecFromStr("1.1")) -// supplyError := sdk.OneDec().Sub((sdk.NewDecFromInt(finalSupply).Quo(expectedSupply))).Abs() -// suite.True(supplyError.LTE(sdk.MustNewDecFromStr("0.001"))) -// } - -// func (suite *KeeperTestSuite) TestMintPeriodTransition() { -// govDenom, _ := suite.keeper.GetGovDenom(suite.ctx) -// // initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// initialSupply := suite.bankKeeper.GetSupply(suite.ctx, govDenom).Amount -// params := suite.keeper.GetParams(suite.ctx) -// periods := ununifidisttypes.Periods{ -// testPeriods[0], -// ununifidisttypes.Period{ -// Start: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), -// End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), -// Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), -// }, -// } -// params.Periods = periods -// suite.NotPanics(func() { -// suite.keeper.SetParams(suite.ctx, params) -// }) -// suite.NotPanics(func() { -// suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2020, time.March, 1, 1, 0, 1, 0, time.UTC)) -// }) -// ctx := suite.ctx.WithBlockTime(time.Date(2021, 3, 10, 0, 0, 0, 0, time.UTC)) -// err := suite.keeper.MintPeriodInflation(ctx) -// suite.NoError(err) -// // finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// finalSupply := suite.bankKeeper.GetSupply(ctx, govDenom).Amount -// suite.True(finalSupply.GT(initialSupply)) -// } - -// func (suite *KeeperTestSuite) TestMintNotActive() { -// govDenom, _ := suite.keeper.GetGovDenom(suite.ctx) -// // initialSupply := suite.supplyKeeper.GetSupply(suite.ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// initialSupply := suite.bankKeeper.GetSupply(suite.ctx, govDenom).Amount -// params := suite.keeper.GetParams(suite.ctx) -// params.Active = false -// suite.NotPanics(func() { -// suite.keeper.SetParams(suite.ctx, params) -// }) -// suite.NotPanics(func() { -// suite.keeper.SetPreviousBlockTime(suite.ctx, time.Date(2020, time.March, 1, 1, 0, 1, 0, time.UTC)) -// }) -// ctx := suite.ctx.WithBlockTime(time.Date(2021, 2, 28, 23, 59, 59, 0, time.UTC)) -// err := suite.keeper.MintPeriodInflation(ctx) -// suite.NoError(err) -// // finalSupply := suite.supplyKeeper.GetSupply(ctx).GetTotal().AmountOf(ununifidisttypes.GovDenom) -// finalSupply := suite.bankKeeper.GetSupply(ctx, govDenom).Amount -// suite.Equal(initialSupply, finalSupply) -// } - -// // func TestKeeperTestSuite(t *testing.T) { -// // suite.Run(t, new(KeeperTestSuite)) -// // } diff --git a/deprecated/x/ununifidist/keeper/params.go b/deprecated/x/ununifidist/keeper/params.go deleted file mode 100644 index 23bd0b49a..000000000 --- a/deprecated/x/ununifidist/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return params -} - -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} diff --git a/deprecated/x/ununifidist/module.go b/deprecated/x/ununifidist/module.go deleted file mode 100644 index ef1dbdf49..000000000 --- a/deprecated/x/ununifidist/module.go +++ /dev/null @@ -1,166 +0,0 @@ -package ununifidist - -import ( - "encoding/json" - "fmt" - - "context" - - // this line is used by starport scaffolding # 1 - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/UnUniFi/chain/deprecated/x/ununifidist/client/cli" - "github.com/UnUniFi/chain/deprecated/x/ununifidist/keeper" - "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, am.accountKeeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(&genState) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) -} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/deprecated/x/ununifidist/types/codec.go b/deprecated/x/ununifidist/types/codec.go deleted file mode 100644 index 8fb9abf55..000000000 --- a/deprecated/x/ununifidist/types/codec.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - // this line is used by starport scaffolding # 1 -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 -} - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) diff --git a/deprecated/x/ununifidist/types/errors.go b/deprecated/x/ununifidist/types/errors.go deleted file mode 100644 index 614ffb37e..000000000 --- a/deprecated/x/ununifidist/types/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/ununifidist module sentinel errors -var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") -) diff --git a/deprecated/x/ununifidist/types/events.go b/deprecated/x/ununifidist/types/events.go deleted file mode 100644 index 64be3285a..000000000 --- a/deprecated/x/ununifidist/types/events.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -// Event types for ununifidist module -const ( - EventTypeUnunifidist = ModuleName - AttributeKeyInflation = "ununifi_dist_inflation" - AttributeKeyStatus = "ununifi_dist_status" - AttributeValueInactive = "inactive" -) diff --git a/deprecated/x/ununifidist/types/expected_keepers.go b/deprecated/x/ununifidist/types/expected_keepers.go deleted file mode 100644 index 6c26a1caf..000000000 --- a/deprecated/x/ununifidist/types/expected_keepers.go +++ /dev/null @@ -1,86 +0,0 @@ -package types - -import ( - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -// AccountKeeper expected interface for the account keeper (noalias) -type AccountKeeper interface { - // Return a new account with the next account number and the specified address. Does not save the new account to the store. - NewAccountWithAddress(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Return a new account with the next account number. Does not save the new account to the store. - NewAccount(sdk.Context, authtypes.AccountI) authtypes.AccountI - - // Retrieve an account from the store. - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI - - // Set an account in the store. - SetAccount(sdk.Context, authtypes.AccountI) - - // Remove an account from the store. - RemoveAccount(sdk.Context, authtypes.AccountI) - - // Iterate over all accounts, calling the provided function. Stop iteraiton when it returns false. - IterateAccounts(sdk.Context, func(authtypes.AccountI) bool) - - // Fetch the public key of an account at a specified address - GetPubKey(sdk.Context, sdk.AccAddress) (cryptotypes.PubKey, error) - - // Fetch the sequence of an account at a specified address. - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) - - GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI -} - -type BankKeeper interface { - // View - ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error - HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool - - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetAccountsBalances(ctx sdk.Context) []banktypes.Balance - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(coin sdk.Coin) (stop bool)) - IterateAllBalances(ctx sdk.Context, cb func(address sdk.AccAddress, coin sdk.Coin) (stop bool)) - - // Send - InputOutputCoins(ctx sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - - GetParams(ctx sdk.Context) banktypes.Params - SetParams(ctx sdk.Context, params banktypes.Params) error - - BlockedAddr(addr sdk.AccAddress) bool - - // - InitGenesis(sdk.Context, *banktypes.GenesisState) - ExportGenesis(sdk.Context) *banktypes.GenesisState - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error) - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) - IterateAllDenomMetaData(ctx sdk.Context, cb func(banktypes.Metadata) bool) - - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - - DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error - UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error -} diff --git a/deprecated/x/ununifidist/types/genesis.go b/deprecated/x/ununifidist/types/genesis.go deleted file mode 100644 index 6d8ca87b3..000000000 --- a/deprecated/x/ununifidist/types/genesis.go +++ /dev/null @@ -1,61 +0,0 @@ -package types - -import ( - "bytes" - fmt "fmt" - time "time" -) - -// this line is used by starport scaffolding # genesis/types/import - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - PreviousBlockTime: DefaultPreviousBlockTime, - GovDenom: DefaultGovDenom, - // this line is used by starport scaffolding # genesis/types/default - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - // return nil - if err := gs.Params.Validate(); err != nil { - return err - } - if gs.PreviousBlockTime.Equal(time.Time{}) { - return fmt.Errorf("previous block time not set") - } - if len(gs.GovDenom) == 0 { - return fmt.Errorf("GovDenom is nil or empty") - } - return nil -} - -// NewGenesisState returns a new genesis state -func NewGenesisState(params Params, previousBlockTime time.Time, govDenom string) GenesisState { - return GenesisState{ - Params: params, - PreviousBlockTime: previousBlockTime, - GovDenom: govDenom, - } -} - -// Equal checks whether two gov GenesisState structs are equivalent -func (gs GenesisState) Equal(gs2 GenesisState) bool { - b1 := ModuleCdc.MustMarshal(&gs) - b2 := ModuleCdc.MustMarshal(&gs2) - return bytes.Equal(b1, b2) -} - -// IsEmpty returns true if a GenesisState is empty -func (gs GenesisState) IsEmpty() bool { - return gs.Equal(GenesisState{}) -} diff --git a/deprecated/x/ununifidist/types/genesis.pb.go b/deprecated/x/ununifidist/types/genesis.pb.go deleted file mode 100644 index c8f552d4c..000000000 --- a/deprecated/x/ununifidist/types/genesis.pb.go +++ /dev/null @@ -1,435 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ununifidist/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the ununifidist module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - PreviousBlockTime time.Time `protobuf:"bytes,2,opt,name=previous_block_time,json=previousBlockTime,proto3,stdtime" json:"previous_block_time" yaml:"previous_block_time"` - GovDenom string `protobuf:"bytes,3,opt,name=gov_denom,json=govDenom,proto3" json:"gov_denom,omitempty" yaml:"gov_denom"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_1bbb17c1ad26e40a, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetPreviousBlockTime() time.Time { - if m != nil { - return m.PreviousBlockTime - } - return time.Time{} -} - -func (m *GenesisState) GetGovDenom() string { - if m != nil { - return m.GovDenom - } - return "" -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.ununifidist.GenesisState") -} - -func init() { proto.RegisterFile("ununifidist/genesis.proto", fileDescriptor_1bbb17c1ad26e40a) } - -var fileDescriptor_1bbb17c1ad26e40a = []byte{ - // 330 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xc2, 0x40, - 0x18, 0xc7, 0x7b, 0x98, 0x10, 0xa9, 0x9a, 0x68, 0xc1, 0x04, 0x6b, 0x6c, 0x49, 0x07, 0xc3, 0x60, - 0xee, 0xa2, 0x6e, 0x8e, 0x8d, 0xc1, 0xc4, 0xc9, 0xa0, 0x2c, 0x2e, 0xa4, 0x85, 0xe3, 0xb8, 0x48, - 0xef, 0x6b, 0x7a, 0x57, 0x22, 0xa3, 0x6f, 0xc0, 0x63, 0x31, 0x32, 0x3a, 0xa1, 0x81, 0x37, 0xe0, - 0x09, 0x4c, 0x7b, 0xc5, 0x34, 0xd1, 0xed, 0x6b, 0x7e, 0xff, 0xef, 0xf7, 0xfd, 0x7b, 0xe6, 0x59, - 0x2a, 0x52, 0xc1, 0x47, 0x7c, 0xc8, 0xa5, 0x22, 0x8c, 0x0a, 0x2a, 0xb9, 0xc4, 0x71, 0x02, 0x0a, - 0xac, 0x7a, 0x81, 0x70, 0x29, 0x62, 0x37, 0x18, 0x30, 0xc8, 0x39, 0xc9, 0x26, 0x1d, 0xb5, 0x5d, - 0x06, 0xc0, 0x26, 0x94, 0xe4, 0x5f, 0x61, 0x3a, 0x22, 0x8a, 0x47, 0x54, 0xaa, 0x20, 0x8a, 0x8b, - 0xc0, 0x45, 0xf9, 0x4c, 0x69, 0xd6, 0xd8, 0xfb, 0xa8, 0x98, 0x87, 0x0f, 0xfa, 0xf8, 0xb3, 0x0a, - 0x14, 0xb5, 0x1e, 0xcd, 0x6a, 0x1c, 0x24, 0x41, 0x24, 0x9b, 0xa8, 0x85, 0xda, 0x07, 0x37, 0xe7, - 0xf8, 0x9f, 0x32, 0xf8, 0x29, 0x8f, 0xf8, 0xa7, 0x8b, 0x95, 0x6b, 0x6c, 0x57, 0xee, 0xd1, 0x2c, - 0x88, 0x26, 0x77, 0x9e, 0x5e, 0xf4, 0xba, 0x85, 0xc1, 0x4a, 0xcc, 0x7a, 0x9c, 0xd0, 0x29, 0x87, - 0x54, 0xf6, 0xc3, 0x09, 0x0c, 0xde, 0xfa, 0x59, 0xbb, 0x66, 0x25, 0x17, 0xdb, 0x58, 0x57, 0xc7, - 0xbb, 0xea, 0xf8, 0x65, 0x57, 0xdd, 0xbf, 0x2c, 0xbc, 0x76, 0xe1, 0xfd, 0x2b, 0xf1, 0xe6, 0x5f, - 0x2e, 0xea, 0x9e, 0xec, 0x88, 0x9f, 0x81, 0x6c, 0xdf, 0xba, 0x36, 0x6b, 0x0c, 0xa6, 0xfd, 0x21, - 0x15, 0x10, 0x35, 0xf7, 0x5a, 0xa8, 0x5d, 0xf3, 0x1b, 0xdb, 0x95, 0x7b, 0xac, 0x4d, 0xbf, 0xc8, - 0xeb, 0xee, 0x33, 0x98, 0xde, 0x67, 0xa3, 0xdf, 0x59, 0xac, 0x1d, 0xb4, 0x5c, 0x3b, 0xe8, 0x7b, - 0xed, 0xa0, 0xf9, 0xc6, 0x31, 0x96, 0x1b, 0xc7, 0xf8, 0xdc, 0x38, 0xc6, 0xeb, 0x15, 0xe3, 0x6a, - 0x9c, 0x86, 0x78, 0x00, 0x11, 0xe9, 0x89, 0x9e, 0xe0, 0x1d, 0x4e, 0x06, 0xe3, 0x80, 0x0b, 0xf2, - 0x5e, 0x7e, 0x4b, 0xa2, 0x66, 0x31, 0x95, 0x61, 0x35, 0xff, 0x93, 0xdb, 0x9f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x78, 0x96, 0xc1, 0x7b, 0xda, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GovDenom) > 0 { - i -= len(m.GovDenom) - copy(dAtA[i:], m.GovDenom) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.GovDenom))) - i-- - dAtA[i] = 0x1a - } - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.PreviousBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousBlockTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintGenesis(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x12 - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.PreviousBlockTime) - n += 1 + l + sovGenesis(uint64(l)) - l = len(m.GovDenom) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreviousBlockTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.PreviousBlockTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GovDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GovDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/ununifidist/types/keys.go b/deprecated/x/ununifidist/types/keys.go deleted file mode 100644 index 47c142007..000000000 --- a/deprecated/x/ununifidist/types/keys.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "ununifidist" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_capability" - - // UnunifidistMacc module account for ununifidist - UnunifidistMacc = ModuleName -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} - -const ( - ParamsKey = "Params-value-" - RewardKey = "Reward-value-" - RewardCountKey = "Reward-count-" - PreviousBlockTimeKey = "PreviousBlockTime" - GovDenomKey = "GovDenom" -) diff --git a/deprecated/x/ununifidist/types/params.go b/deprecated/x/ununifidist/types/params.go deleted file mode 100644 index 70dbf3515..000000000 --- a/deprecated/x/ununifidist/types/params.go +++ /dev/null @@ -1,118 +0,0 @@ -package types - -import ( - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramstype "github.com/cosmos/cosmos-sdk/x/params/types" - - tmtime "github.com/cometbft/cometbft/types/time" - - cdptypes "github.com/UnUniFi/chain/deprecated/x/cdp/types" -) - -// Parameter keys and default values -var ( - KeyActive = []byte("Active") - KeyPeriods = []byte("Periods") - DefaultActive = false - DefaultPeriods = Periods{} - DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(1, 0)) - DefaultGovDenom = cdptypes.DefaultGovDenom -) - -// NewPeriod returns a new instance of Period -func NewPeriod(start time.Time, end time.Time, inflation sdk.Dec) Period { - return Period{ - Start: start, - End: end, - Inflation: inflation, - } -} - -// Periods array of Period -type Periods []Period - -// String implements fmt.Stringer -func (prs Periods) String() string { - out := "Periods\n" - for _, pr := range prs { - out += fmt.Sprintf("%s\n", pr) - } - return out -} - -// NewParams returns a new params object -func NewParams(active bool, periods Periods) Params { - return Params{ - Active: active, - Periods: periods, - } -} - -// DefaultParams returns default params for ununifidist module -func DefaultParams() Params { - return NewParams(DefaultActive, DefaultPeriods) -} - -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstype.KeyTable { - return paramstype.NewKeyTable().RegisterParamSet(&Params{}) -} - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { - return paramstype.ParamSetPairs{ - paramstype.NewParamSetPair(KeyActive, &p.Active, validateActiveParam), - paramstype.NewParamSetPair(KeyPeriods, &p.Periods, validatePeriodsParams), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - if err := validateActiveParam(p.Active); err != nil { - return err - } - - return validatePeriodsParams(p.Periods) -} - -func validateActiveParam(i interface{}) error { - _, ok := i.(bool) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validatePeriodsParams(i interface{}) error { - periods, ok := i.(Periods) - if !ok { - periods, ok = i.([]Period) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - } - - prevEnd := tmtime.Canonical(time.Unix(0, 0)) - for _, pr := range periods { - if pr.End.Before(pr.Start) { - return fmt.Errorf("end time for period is before start time: %s", pr) - } - - if pr.Start.Before(prevEnd) { - return fmt.Errorf("periods must be in chronological order: %s", periods) - } - prevEnd = pr.End - - if pr.Start.Unix() <= 0 || pr.End.Unix() <= 0 { - return fmt.Errorf("start or end time cannot be zero: %s", pr) - } - - //TODO: validate period Inflation? - } - - return nil -} diff --git a/deprecated/x/ununifidist/types/params_test.go b/deprecated/x/ununifidist/types/params_test.go deleted file mode 100644 index 676cd91ed..000000000 --- a/deprecated/x/ununifidist/types/params_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package types_test - -import ( - "time" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - - ununifidisttypes "github.com/UnUniFi/chain/deprecated/x/ununifidist/types" -) - -type paramTest struct { - params ununifidisttypes.Params - expectPass bool -} - -type ParamTestSuite struct { - suite.Suite - - tests []paramTest -} - -func (suite *ParamTestSuite) SetupTest() { - p1 := ununifidisttypes.Params{ - Active: true, - Periods: ununifidisttypes.Periods{ - ununifidisttypes.Period{ - Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), - End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), - }, - ununifidisttypes.Period{ - Start: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), - }, - }, - } - p2 := ununifidisttypes.Params{ - Active: true, - Periods: ununifidisttypes.Periods{ - ununifidisttypes.Period{ - Start: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), - }, - ununifidisttypes.Period{ - Start: time.Date(2023, time.March, 1, 1, 0, 0, 0, time.UTC), - End: time.Date(2024, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), - }, - }, - } - p3 := ununifidisttypes.Params{ - Active: true, - Periods: ununifidisttypes.Periods{ - ununifidisttypes.Period{ - Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), - End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), - }, - ununifidisttypes.Period{ - Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), - End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), - }, - }, - } - - suite.tests = []paramTest{ - { - params: p1, - expectPass: true, - }, - { - params: p2, - expectPass: false, - }, - { - params: p3, - expectPass: false, - }, - } -} - -func (suite *ParamTestSuite) TestParamValidation() { - for _, t := range suite.tests { - err := t.params.Validate() - if t.expectPass { - suite.NoError(err) - } else { - suite.Error(err) - } - } -} - -// func TestGenesisTestSuite(t *testing.T) { -// suite.Run(t, new(ParamTestSuite)) -// } diff --git a/deprecated/x/ununifidist/types/query.go b/deprecated/x/ununifidist/types/query.go deleted file mode 100644 index ab1254f4c..000000000 --- a/deprecated/x/ununifidist/types/query.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/deprecated/x/ununifidist/types/query.pb.go b/deprecated/x/ununifidist/types/query.pb.go deleted file mode 100644 index 40447f7fd..000000000 --- a/deprecated/x/ununifidist/types/query.pb.go +++ /dev/null @@ -1,885 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ununifidist/query.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9486480282de2c6, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9486480282de2c6, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - -type QueryGetBalancesRequest struct { -} - -func (m *QueryGetBalancesRequest) Reset() { *m = QueryGetBalancesRequest{} } -func (m *QueryGetBalancesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetBalancesRequest) ProtoMessage() {} -func (*QueryGetBalancesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9486480282de2c6, []int{2} -} -func (m *QueryGetBalancesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetBalancesRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetBalancesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBalancesRequest.Merge(m, src) -} -func (m *QueryGetBalancesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetBalancesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBalancesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetBalancesRequest proto.InternalMessageInfo - -type QueryGetBalancesResponse struct { - Balances []types.Coin `protobuf:"bytes,1,rep,name=balances,proto3" json:"balances"` -} - -func (m *QueryGetBalancesResponse) Reset() { *m = QueryGetBalancesResponse{} } -func (m *QueryGetBalancesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetBalancesResponse) ProtoMessage() {} -func (*QueryGetBalancesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9486480282de2c6, []int{3} -} -func (m *QueryGetBalancesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetBalancesResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetBalancesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBalancesResponse.Merge(m, src) -} -func (m *QueryGetBalancesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetBalancesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBalancesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetBalancesResponse proto.InternalMessageInfo - -func (m *QueryGetBalancesResponse) GetBalances() []types.Coin { - if m != nil { - return m.Balances - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.ununifidist.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.ununifidist.QueryParamsResponse") - proto.RegisterType((*QueryGetBalancesRequest)(nil), "ununifi.ununifidist.QueryGetBalancesRequest") - proto.RegisterType((*QueryGetBalancesResponse)(nil), "ununifi.ununifidist.QueryGetBalancesResponse") -} - -func init() { proto.RegisterFile("ununifidist/query.proto", fileDescriptor_d9486480282de2c6) } - -var fileDescriptor_d9486480282de2c6 = []byte{ - // 401 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x6b, 0x1a, 0x41, - 0x1c, 0xc5, 0x77, 0x6c, 0x2b, 0x32, 0xde, 0x46, 0x41, 0x5d, 0xeb, 0x2a, 0x5b, 0x4a, 0xa5, 0xd8, - 0x19, 0xd4, 0x63, 0x6f, 0x16, 0x2c, 0xf4, 0xd4, 0x0a, 0x52, 0xe8, 0x6d, 0x76, 0x3b, 0x5d, 0x07, - 0x74, 0x66, 0x75, 0x66, 0x4b, 0xbc, 0x85, 0x7c, 0x80, 0x10, 0xc8, 0x31, 0x5f, 0xc8, 0xa3, 0x90, - 0x4b, 0x4e, 0x21, 0x68, 0x3e, 0x48, 0x70, 0x77, 0x56, 0x56, 0x34, 0x24, 0xb7, 0xe5, 0xff, 0x7e, - 0xf3, 0xff, 0xbf, 0xf7, 0x58, 0x58, 0x89, 0x44, 0x24, 0xf8, 0x3f, 0xfe, 0x97, 0x2b, 0x4d, 0xe6, - 0x11, 0x5b, 0x2c, 0x71, 0xb8, 0x90, 0x5a, 0xa2, 0x92, 0x11, 0x70, 0x06, 0xb0, 0xcb, 0x81, 0x0c, - 0x64, 0xac, 0x93, 0xdd, 0x57, 0x82, 0xda, 0xef, 0x03, 0x29, 0x83, 0x29, 0x23, 0x34, 0xe4, 0x84, - 0x0a, 0x21, 0x35, 0xd5, 0x5c, 0x0a, 0x65, 0xd4, 0xcf, 0xbe, 0x54, 0x33, 0xa9, 0x88, 0x47, 0x15, - 0x4b, 0x2e, 0x90, 0xff, 0x5d, 0x8f, 0x69, 0xda, 0x25, 0x21, 0x0d, 0xb8, 0x88, 0x61, 0xc3, 0x3a, - 0x59, 0x36, 0xa5, 0x7c, 0xc9, 0x53, 0xbd, 0x91, 0x75, 0x9b, 0xf9, 0x4e, 0x64, 0xb7, 0x0c, 0xd1, - 0xaf, 0xdd, 0x81, 0x9f, 0x74, 0x41, 0x67, 0x6a, 0xc4, 0xe6, 0x11, 0x53, 0xda, 0xfd, 0x01, 0x4b, - 0x07, 0x53, 0x15, 0x4a, 0xa1, 0x18, 0xea, 0xc3, 0x7c, 0x18, 0x4f, 0xaa, 0xa0, 0x05, 0xda, 0xc5, - 0x5e, 0x1d, 0x9f, 0x48, 0x8c, 0xcd, 0x23, 0x83, 0xba, 0x35, 0x58, 0x89, 0x77, 0x7d, 0x67, 0x7a, - 0x40, 0xa7, 0x54, 0xf8, 0x6c, 0x7f, 0xe6, 0x37, 0xac, 0x1e, 0x4b, 0xe6, 0xd6, 0x57, 0x58, 0xf0, - 0xcc, 0xac, 0x0a, 0x5a, 0x6f, 0xda, 0xc5, 0x5e, 0x0d, 0x27, 0x51, 0xf1, 0x2e, 0x2a, 0x36, 0x51, - 0xf1, 0x37, 0xc9, 0xc5, 0xe0, 0xed, 0xea, 0xbe, 0x69, 0x8d, 0xf6, 0x0f, 0x7a, 0x37, 0x39, 0xf8, - 0x2e, 0xde, 0x8c, 0xce, 0x01, 0xcc, 0x27, 0x86, 0xd0, 0xa7, 0x93, 0x6e, 0x8f, 0xd3, 0xdb, 0xed, - 0x97, 0xc1, 0xc4, 0xa4, 0xfb, 0xe1, 0xe2, 0xf6, 0xf1, 0x3a, 0xd7, 0x40, 0xf5, 0xb4, 0xd9, 0x6c, - 0xc3, 0x24, 0x29, 0x00, 0x5d, 0x02, 0x58, 0x48, 0xe3, 0xa1, 0xce, 0xf3, 0xbb, 0x8f, 0x0b, 0xb2, - 0xbf, 0xbc, 0x92, 0x36, 0x76, 0x3e, 0xc6, 0x76, 0x9a, 0xa8, 0x71, 0xd2, 0x4e, 0xda, 0xce, 0x60, - 0xb8, 0xda, 0x38, 0x60, 0xbd, 0x71, 0xc0, 0xc3, 0xc6, 0x01, 0x57, 0x5b, 0xc7, 0x5a, 0x6f, 0x1d, - 0xeb, 0x6e, 0xeb, 0x58, 0x7f, 0x3a, 0x01, 0xd7, 0x93, 0xc8, 0xc3, 0xbe, 0x9c, 0x91, 0xb1, 0x18, - 0x0b, 0x3e, 0xe4, 0xc4, 0x9f, 0x50, 0x2e, 0xc8, 0xd9, 0xc1, 0x2a, 0xbd, 0x0c, 0x99, 0xf2, 0xf2, - 0xf1, 0x2f, 0xd4, 0x7f, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xca, 0x40, 0xd0, 0x11, 0x03, 0x00, - 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // this line is used by starport scaffolding # 2 - Balances(ctx context.Context, in *QueryGetBalancesRequest, opts ...grpc.CallOption) (*QueryGetBalancesResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/ununifi.ununifidist.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Balances(ctx context.Context, in *QueryGetBalancesRequest, opts ...grpc.CallOption) (*QueryGetBalancesResponse, error) { - out := new(QueryGetBalancesResponse) - err := c.cc.Invoke(ctx, "/ununifi.ununifidist.Query/Balances", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // this line is used by starport scaffolding # 2 - Balances(context.Context, *QueryGetBalancesRequest) (*QueryGetBalancesResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) Balances(ctx context.Context, req *QueryGetBalancesRequest) (*QueryGetBalancesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Balances not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.ununifidist.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Balances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetBalancesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Balances(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.ununifidist.Query/Balances", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Balances(ctx, req.(*QueryGetBalancesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.ununifidist.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Balances", - Handler: _Query_Balances_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ununifidist/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGetBalancesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetBalancesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetBalancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryGetBalancesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetBalancesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Balances) > 0 { - for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Balances[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetBalancesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryGetBalancesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Balances) > 0 { - for _, e := range m.Balances { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetBalancesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetBalancesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetBalancesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetBalancesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balances", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Balances = append(m.Balances, types.Coin{}) - if err := m.Balances[len(m.Balances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/ununifidist/types/query.pb.gw.go b/deprecated/x/ununifidist/types/query.pb.gw.go deleted file mode 100644 index 165c72662..000000000 --- a/deprecated/x/ununifidist/types/query.pb.gw.go +++ /dev/null @@ -1,210 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: ununifidist/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetBalancesRequest - var metadata runtime.ServerMetadata - - msg, err := client.Balances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetBalancesRequest - var metadata runtime.ServerMetadata - - msg, err := server.Balances(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Balances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Balances_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Balances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Balances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Balances_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Balances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "ununifidist", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Balances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "ununifidist", "balances"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_Balances_0 = runtime.ForwardResponseMessage -) diff --git a/deprecated/x/ununifidist/types/types.go b/deprecated/x/ununifidist/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/deprecated/x/ununifidist/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/deprecated/x/ununifidist/types/ununifidist.pb.go b/deprecated/x/ununifidist/types/ununifidist.pb.go deleted file mode 100644 index 58f9f1151..000000000 --- a/deprecated/x/ununifidist/types/ununifidist.pb.go +++ /dev/null @@ -1,656 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ununifidist/ununifidist.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Params struct { - Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty" yaml:"active"` - Periods []Period `protobuf:"bytes,2,rep,name=periods,proto3" json:"periods" yaml:"periods"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_57b198cfe07074af, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetActive() bool { - if m != nil { - return m.Active - } - return false -} - -func (m *Params) GetPeriods() []Period { - if m != nil { - return m.Periods - } - return nil -} - -type Period struct { - Start time.Time `protobuf:"bytes,1,opt,name=start,proto3,stdtime" json:"start" yaml:"start"` - End time.Time `protobuf:"bytes,2,opt,name=end,proto3,stdtime" json:"end" yaml:"end"` - Inflation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=inflation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation" yaml:"inflation"` -} - -func (m *Period) Reset() { *m = Period{} } -func (m *Period) String() string { return proto.CompactTextString(m) } -func (*Period) ProtoMessage() {} -func (*Period) Descriptor() ([]byte, []int) { - return fileDescriptor_57b198cfe07074af, []int{1} -} -func (m *Period) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Period) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Period.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Period) XXX_Merge(src proto.Message) { - xxx_messageInfo_Period.Merge(m, src) -} -func (m *Period) XXX_Size() int { - return m.Size() -} -func (m *Period) XXX_DiscardUnknown() { - xxx_messageInfo_Period.DiscardUnknown(m) -} - -var xxx_messageInfo_Period proto.InternalMessageInfo - -func (m *Period) GetStart() time.Time { - if m != nil { - return m.Start - } - return time.Time{} -} - -func (m *Period) GetEnd() time.Time { - if m != nil { - return m.End - } - return time.Time{} -} - -func init() { - proto.RegisterType((*Params)(nil), "ununifi.ununifidist.Params") - proto.RegisterType((*Period)(nil), "ununifi.ununifidist.Period") -} - -func init() { proto.RegisterFile("ununifidist/ununifidist.proto", fileDescriptor_57b198cfe07074af) } - -var fileDescriptor_57b198cfe07074af = []byte{ - // 396 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x33, 0x2d, 0x56, 0x3b, 0x55, 0xd1, 0x28, 0x12, 0x2a, 0x26, 0x25, 0x07, 0xa9, 0xa0, - 0x33, 0xb4, 0xde, 0x3c, 0x86, 0xd2, 0x83, 0x20, 0x94, 0x60, 0x2f, 0x9e, 0x9c, 0x24, 0xd3, 0x74, - 0xb0, 0x99, 0x09, 0x99, 0x49, 0xb1, 0x57, 0x3f, 0x41, 0x3f, 0x56, 0x8f, 0x3d, 0x8a, 0x87, 0xb8, - 0xb4, 0xdf, 0xa0, 0xe7, 0x3d, 0x2c, 0xc9, 0x24, 0xbb, 0x39, 0x2c, 0xec, 0x29, 0x2f, 0xef, 0xfd, - 0xdf, 0xef, 0xfd, 0xff, 0x21, 0xf0, 0x5d, 0xce, 0x73, 0xce, 0x56, 0x2c, 0x62, 0x52, 0xe1, 0x56, - 0x8d, 0xd2, 0x4c, 0x28, 0x61, 0xbe, 0xaa, 0x5b, 0xa8, 0x35, 0x1a, 0xbe, 0x8e, 0x45, 0x2c, 0xaa, - 0x39, 0x2e, 0x2b, 0x2d, 0x1d, 0x3a, 0xb1, 0x10, 0xf1, 0x86, 0xe2, 0xea, 0x2d, 0xc8, 0x57, 0x58, - 0xb1, 0x84, 0x4a, 0x45, 0x92, 0xb4, 0x16, 0xd8, 0xa1, 0x90, 0x89, 0x90, 0x38, 0x20, 0x92, 0xe2, - 0xed, 0x24, 0xa0, 0x8a, 0x4c, 0x70, 0x28, 0x18, 0xd7, 0x73, 0xf7, 0x0f, 0x80, 0xbd, 0x05, 0xc9, - 0x48, 0x22, 0xcd, 0x0f, 0xb0, 0x47, 0x42, 0xc5, 0xb6, 0xd4, 0x02, 0x23, 0x30, 0x7e, 0xe2, 0xbd, - 0xbc, 0x14, 0xce, 0xb3, 0x1d, 0x49, 0x36, 0x5f, 0x5c, 0xdd, 0x77, 0xfd, 0x5a, 0x60, 0x7e, 0x83, - 0x8f, 0x53, 0x9a, 0x31, 0x11, 0x49, 0xab, 0x33, 0xea, 0x8e, 0x07, 0xd3, 0xb7, 0xe8, 0x1e, 0xcf, - 0x68, 0x51, 0x69, 0xbc, 0x37, 0x87, 0xc2, 0x31, 0x2e, 0x85, 0xf3, 0x5c, 0xc3, 0xea, 0x4d, 0xd7, - 0x6f, 0x18, 0xee, 0x75, 0x69, 0xa2, 0xaa, 0xcd, 0xaf, 0xf0, 0x91, 0x54, 0x24, 0x53, 0x95, 0x87, - 0xc1, 0x74, 0x88, 0x74, 0x40, 0xd4, 0x04, 0x44, 0xdf, 0x9b, 0x80, 0x9e, 0x55, 0x63, 0x9f, 0x6a, - 0x6c, 0xb5, 0xe6, 0xee, 0xff, 0x3b, 0xc0, 0xd7, 0x08, 0x73, 0x06, 0xbb, 0x94, 0x47, 0x56, 0xe7, - 0x41, 0x52, 0x63, 0x10, 0x6a, 0x12, 0xe5, 0x91, 0xe6, 0x94, 0xeb, 0xe6, 0x4f, 0xd8, 0x67, 0x7c, - 0xb5, 0x21, 0x8a, 0x09, 0x6e, 0x0d, 0x46, 0x60, 0xdc, 0xf7, 0xbc, 0x52, 0xff, 0xaf, 0x70, 0xde, - 0xc7, 0x4c, 0xad, 0xf3, 0x00, 0x85, 0x22, 0xc1, 0xf5, 0x77, 0xd6, 0x8f, 0x4f, 0x32, 0xfa, 0x85, - 0xd5, 0x2e, 0xa5, 0x12, 0xcd, 0x68, 0x78, 0x29, 0x9c, 0x17, 0x9a, 0x7c, 0x0b, 0x72, 0xfd, 0x3b, - 0xa8, 0x37, 0x3f, 0x9c, 0x6c, 0x70, 0x3c, 0xd9, 0xe0, 0xea, 0x64, 0x83, 0xfd, 0xd9, 0x36, 0x8e, - 0x67, 0xdb, 0xf8, 0x7b, 0xb6, 0x8d, 0x1f, 0x1f, 0x5b, 0x07, 0x96, 0x7c, 0xc9, 0xd9, 0x9c, 0xe1, - 0x70, 0x4d, 0x18, 0xc7, 0xbf, 0xdb, 0xff, 0x8d, 0x3e, 0x15, 0xf4, 0xaa, 0x68, 0x9f, 0x6f, 0x02, - 0x00, 0x00, 0xff, 0xff, 0xa9, 0x04, 0xe5, 0xa8, 0x5f, 0x02, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Periods) > 0 { - for iNdEx := len(m.Periods) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Periods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintUnunifidist(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Active { - i-- - if m.Active { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Period) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Period) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Period) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Inflation.Size() - i -= size - if _, err := m.Inflation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintUnunifidist(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.End, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.End):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintUnunifidist(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x12 - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Start):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintUnunifidist(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintUnunifidist(dAtA []byte, offset int, v uint64) int { - offset -= sovUnunifidist(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Active { - n += 2 - } - if len(m.Periods) > 0 { - for _, e := range m.Periods { - l = e.Size() - n += 1 + l + sovUnunifidist(uint64(l)) - } - } - return n -} - -func (m *Period) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Start) - n += 1 + l + sovUnunifidist(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.End) - n += 1 + l + sovUnunifidist(uint64(l)) - l = m.Inflation.Size() - n += 1 + l + sovUnunifidist(uint64(l)) - return n -} - -func sovUnunifidist(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozUnunifidist(x uint64) (n int) { - return sovUnunifidist(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Active = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Periods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthUnunifidist - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthUnunifidist - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Periods = append(m.Periods, Period{}) - if err := m.Periods[len(m.Periods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipUnunifidist(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthUnunifidist - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Period) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Period: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Period: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthUnunifidist - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthUnunifidist - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Start, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthUnunifidist - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthUnunifidist - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.End, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inflation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthUnunifidist - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthUnunifidist - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Inflation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipUnunifidist(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthUnunifidist - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipUnunifidist(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowUnunifidist - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthUnunifidist - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupUnunifidist - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthUnunifidist - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthUnunifidist = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowUnunifidist = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupUnunifidist = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/client/cli/flags.go b/deprecated/x/yieldaggregatorv1/client/cli/flags.go deleted file mode 100644 index 788734cba..000000000 --- a/deprecated/x/yieldaggregatorv1/client/cli/flags.go +++ /dev/null @@ -1,103 +0,0 @@ -package cli - -import ( - flag "github.com/spf13/pflag" -) - -const ( - FlagTitle = "title" - FlagDescription = "description" - FlagDeposit = "deposit" - FlagAssetManagementAccountId = "assetmanagement-account-id" - FlagAssetManagementAccountName = "assetmanagement-account-name" - FlagEnabled = "enabled" - FlagAssetManagementAccountAddress = "assetmanagement-account-address" - FlagAssetManagementTargetId = "assetmanagement-target-id" - FlagUnbondingSeconds = "unbonding-seconds" - FlagAssetConditions = "asset-conditions" - FlagIntegrateType = "integration-type" - FlagModName = "module-name" - FlagExecuteOrders = "execute-orders" - FlagFarmingOrderId = "farming-order-id" - FlagStrategyType = "strategy-type" - FlagWhitelistedTargetIds = "whitelisted-target-ids" - FlagBlacklistedTargetIds = "blacklisted-target-ids" - FlagMaxUnbondingSeconds = "max-unbonding-seconds" - FlagOverallRatio = "overall-ratio" - FlagMin = "min" - FlagMax = "max" - FlagDate = "date" - FlagActive = "active" -) - -func FlagProposalTx() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagTitle, "", "title of the proposal") - fs.String(FlagDescription, "", "description of the proposal") - fs.String(FlagDeposit, "", "initial deposit on the proposal") - return fs -} - -func FlagAddAssetManagementAccount() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagAssetManagementAccountId, "", "id of the asset management account") - fs.String(FlagAssetManagementAccountName, "", "name of the asset management account") - fs.Bool(FlagEnabled, true, "flag if account is enabled or not") - return fs -} - -func FlagStopAssetManagementAccount() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagAssetManagementAccountId, "", "id of the asset management account") - return fs -} - -func FlagAddAssetManagementTarget() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagAssetManagementAccountId, "", "id of the asset management account") - fs.String(FlagAssetManagementAccountAddress, "", "address of the asset management target") - fs.String(FlagAssetManagementTargetId, "", "id of the asset management target") - fs.Uint64(FlagUnbondingSeconds, 0, "unbonding seconds") - fs.String(FlagAssetConditions, "", "asset conditions string") - fs.String(FlagIntegrateType, "", "integration type, GOLANG_MOD | COSMWASM") - fs.String(FlagModName, "", "module name to invest on, stakeibc | yieldfarm") - return fs -} - -func FlagStopAssetManagementTarget() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagAssetManagementAccountId, "", "id of the asset management account") - fs.String(FlagAssetManagementTargetId, "", "id of the asset management target") - - return fs -} - -func FlagDepositCmd() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.Bool(FlagExecuteOrders, false, "required flag when execute orders as part of deposit") - - return fs -} - -func FlagFarmingOrder() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagFarmingOrderId, "", "order id") - fs.String(FlagStrategyType, "", "strategy type") - fs.String(FlagWhitelistedTargetIds, "", "whitelisted target ids") - fs.String(FlagBlacklistedTargetIds, "", "blacklisted target ids") - fs.Uint64(FlagMaxUnbondingSeconds, 0, "maximum unbonding seconds on the order") - fs.Uint32(FlagOverallRatio, 0, "ratio on fund split") - fs.String(FlagMin, "", "minimum deposit amount") - fs.String(FlagMax, "", "maximum deposit amount") - fs.Uint64(FlagDate, 0, "order start timestamp") - fs.Bool(FlagActive, false, "shows if order is active or not") - - return fs -} diff --git a/deprecated/x/yieldaggregatorv1/client/cli/query.go b/deprecated/x/yieldaggregatorv1/client/cli/query.go deleted file mode 100644 index 636cd5ce6..000000000 --- a/deprecated/x/yieldaggregatorv1/client/cli/query.go +++ /dev/null @@ -1,159 +0,0 @@ -package cli - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group yieldaggregator queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - CmdQueryParams(), - CmdQueryAssetManagementAccount(), - CmdQueryAllAssetManagementAccounts(), - CmdQueryUserInfo(), - CmdQueryAllFarmingUnits(), - CmdQueryDailyRewardPercents(), - ) - - return cmd -} - -func CmdQueryAssetManagementAccount() *cobra.Command { - cmd := &cobra.Command{ - Use: "asset-management-account [id]", - Short: "queries asset management account details by id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AssetManagementAccount(context.Background(), &types.QueryAssetManagementAccountRequest{ - Id: args[0], - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryAllAssetManagementAccounts() *cobra.Command { - cmd := &cobra.Command{ - Use: "all-asset-management-accounts", - Short: "queries asset management account details by id", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AllAssetManagementAccounts(context.Background(), &types.QueryAllAssetManagementAccountsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryUserInfo() *cobra.Command { - cmd := &cobra.Command{ - Use: "user-info [user]", - Short: "query user information by address", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.UserInfo(context.Background(), &types.QueryUserInfoRequest{ - Address: args[0], - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryAllFarmingUnits() *cobra.Command { - cmd := &cobra.Command{ - Use: "all-farming-units", - Short: "query all farming units", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AllFarmingUnits(context.Background(), &types.QueryAllFarmingUnitsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdQueryDailyRewardPercents() *cobra.Command { - cmd := &cobra.Command{ - Use: "daily-reward-percents", - Short: "query all daily reward percents", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.DailyRewardPercents(context.Background(), &types.QueryDailyRewardPercentsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/yieldaggregatorv1/client/cli/query_params.go b/deprecated/x/yieldaggregatorv1/client/cli/query_params.go deleted file mode 100644 index a28276a6a..000000000 --- a/deprecated/x/yieldaggregatorv1/client/cli/query_params.go +++ /dev/null @@ -1,35 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/yieldaggregatorv1/client/cli/tx.go b/deprecated/x/yieldaggregatorv1/client/cli/tx.go deleted file mode 100644 index 3db7d90b0..000000000 --- a/deprecated/x/yieldaggregatorv1/client/cli/tx.go +++ /dev/null @@ -1,978 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - "strings" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - NewDepositTxCmd(), - NewWithdrawTxCmd(), - NewAddFarmingOrderTxCmd(), - NewDeleteFarmingOrderTxCmd(), - NewActivateFarmingOrderTxCmd(), - NewInactivateFarmingOrderTxCmd(), - NewExecuteFarmingOrdersTxCmd(), - NewSetDailyRewardPercentTxCmd(), - NewBeginWithdrawAllTxCmd(), - NewSubmitProposalAddYieldFarmTxCmd(), - NewSubmitProposalUpdateYieldFarmTxCmd(), - NewSubmitProposalStopYieldFarmTxCmd(), - NewSubmitProposalRemoveYieldFarmTxCmd(), - NewSubmitProposalAddYieldFarmTargetTxCmd(), - NewSubmitProposalUpdateYieldFarmTargetTxCmd(), - NewSubmitProposalStopYieldFarmTargetTxCmd(), - NewSubmitProposalRemoveYieldFarmTargetTxCmd(), - ) - - return cmd -} - -func NewDepositTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "deposit [amounts]", - Short: "Deposit tokens into yield aggregator", - Long: strings.TrimSpace( - fmt.Sprintf(`Deposit tokens into yield aggregator. -Example: -$ %s tx %s deposit 10000guu --execute-orders=true --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - executeOrders, err := cmd.Flags().GetBool(FlagExecuteOrders) - if err != nil { - return err - } - - amounts, err := sdk.ParseCoinsNormalized(args[0]) - if err != nil { - return err - } - msg := types.NewMsgDeposit(clientCtx.GetFromAddress(), amounts, executeOrders) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - cmd.Flags().AddFlagSet(FlagDepositCmd()) - - return cmd -} - -func NewWithdrawTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "withdraw [amounts]", - Short: "Withdraw tokens from yield aggregator", - Long: strings.TrimSpace( - fmt.Sprintf(`Withdraw tokens from yield aggregator. -Example: -$ %s tx %s withdraw 10000guu --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - amounts, err := sdk.ParseCoinsNormalized(args[0]) - if err != nil { - return err - } - msg := types.NewMsgWithdraw(clientCtx.GetFromAddress(), amounts) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewAddFarmingOrderTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "add-farming-order [flags]", - Short: "Add farming order for an account", - Long: strings.TrimSpace( - fmt.Sprintf(`Add farming order for an account. -Example: -$ %s tx %s add-farming-order [flags] --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - farmingOrderId, err := cmd.Flags().GetString(FlagFarmingOrderId) - if err != nil { - return err - } - - strategyType, err := cmd.Flags().GetString(FlagStrategyType) - if err != nil { - return err - } - - whitelistedTargetIdsStr, err := cmd.Flags().GetString(FlagWhitelistedTargetIds) - if err != nil { - return err - } - - blacklistedTargetIdsStr, err := cmd.Flags().GetString(FlagBlacklistedTargetIds) - if err != nil { - return err - } - - maxUnbondingSeconds, err := cmd.Flags().GetUint64(FlagMaxUnbondingSeconds) - if err != nil { - return err - } - - overallRatio, err := cmd.Flags().GetUint32(FlagOverallRatio) - if err != nil { - return err - } - - min, err := cmd.Flags().GetString(FlagMin) - if err != nil { - return err - } - - max, err := cmd.Flags().GetString(FlagMax) - if err != nil { - return err - } - - timestamp, err := cmd.Flags().GetUint64(FlagDate) - if err != nil { - return err - } - - active, err := cmd.Flags().GetBool(FlagActive) - if err != nil { - return err - } - - msg := types.NewMsgAddFarmingOrder(clientCtx.GetFromAddress(), types.FarmingOrder{ - Id: farmingOrderId, - FromAddress: clientCtx.GetFromAddress().String(), - Strategy: types.Strategy{ - StrategyType: strategyType, - WhitelistedTargetIds: strings.Split(whitelistedTargetIdsStr, ","), - BlacklistedTargetIds: strings.Split(blacklistedTargetIdsStr, ","), - }, - MaxUnbondingTime: time.Duration(maxUnbondingSeconds) * time.Second, - OverallRatio: overallRatio, - Min: min, - Max: max, - Date: time.Unix(int64(timestamp), 0), - Active: active, - }) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - cmd.Flags().AddFlagSet(FlagFarmingOrder()) - - return cmd -} - -func NewDeleteFarmingOrderTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "delete-farming-order [order-id]", - Short: "Delete farming order from an account", - Long: strings.TrimSpace( - fmt.Sprintf(`Delete farming order from an account. -Example: -$ %s tx %s delete-farming-order order1 --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgDeleteFarmingOrder(clientCtx.GetFromAddress(), args[0]) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewActivateFarmingOrderTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "activate-farming-order [order-id]", - Short: "Activate farming order from an account", - Long: strings.TrimSpace( - fmt.Sprintf(`Activate farming order from an account. -Example: -$ %s tx %s activate-farming-order order1 --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgActivateFarmingOrder(clientCtx.GetFromAddress(), args[0]) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewInactivateFarmingOrderTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "inactivate-farming-order [order-id]", - Short: "Inactivate farming order from an account", - Long: strings.TrimSpace( - fmt.Sprintf(`Inactivate farming order from an account. -Example: -$ %s tx %s inactivate-farming-order order1 --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgInactivateFarmingOrder(clientCtx.GetFromAddress(), args[0]) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewExecuteFarmingOrdersTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "execute-farming-orders [order-ids]", - Short: "Execute farming orders on an account", - Long: strings.TrimSpace( - fmt.Sprintf(`Execute farming orders on an account. -Example: -$ %s tx %s execute-farming-orders order1,order2 --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - orderIds := strings.Split(args[0], ",") - - msg := types.NewMsgExecuteFarmingOrders(clientCtx.GetFromAddress(), orderIds) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewSetDailyRewardPercentTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "set-daily-reward-percent [acc_id] [tar_id] [rate] [timestamp]", - Short: "Set daily reward percent by feeder", - Long: strings.TrimSpace( - fmt.Sprintf(`Set daily reward percent by feeder. -Example: -$ %s tx %s set-daily-reward-percent OsmosisFarm OsmosisGUUFarm 0.1 1662429412 --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - rate, err := sdk.NewDecFromStr(args[2]) - if err != nil { - return err - } - - timestamp, err := strconv.Atoi(args[3]) - if err != nil { - return err - } - - msg := types.NewMsgSetDailyRewardPercent(clientCtx.GetFromAddress(), args[0], args[1], rate, timestamp) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func NewBeginWithdrawAllTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "begin-withdraw-all", - Short: "Begin withdraw all for a user", - Long: strings.TrimSpace( - fmt.Sprintf(`Begin withdraw all for a user. -Example: -$ %s tx %s begin-withdraw-all --from=myKeyName --chain-id=ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgBeginWithdrawAll(clientCtx.GetFromAddress()) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// NewSubmitProposalAddYieldFarmTxCmd returns a CLI command handler for creating -// a proposal to add new yield farm -func NewSubmitProposalAddYieldFarmTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-add-yieldfarm", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to add yield farm", - Long: fmt.Sprintf(`Submit a proposal to add yield farm.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return err - } - - assetManagementAccName, err := cmd.Flags().GetString(FlagAssetManagementAccountName) - if err != nil { - return err - } - - enabled, err := cmd.Flags().GetBool(FlagEnabled) - if err != nil { - return err - } - - content := types.NewProposalAddYieldFarm(title, description, &types.AssetManagementAccount{ - Id: assetManagementAccId, - Name: assetManagementAccName, - Enabled: enabled, - }) - - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagAddAssetManagementAccount()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// ProposalUpdateYieldFarm returns a CLI command handler for creating -// a proposal to update a yield farm -func NewSubmitProposalUpdateYieldFarmTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-update-yieldfarm", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to update a yield farm", - Long: fmt.Sprintf(`Submit a proposal to update a yield farm.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return err - } - - assetManagementAccName, err := cmd.Flags().GetString(FlagAssetManagementAccountName) - if err != nil { - return err - } - - enabled, err := cmd.Flags().GetBool(FlagEnabled) - if err != nil { - return err - } - - content := types.NewProposalUpdateYieldFarm(title, description, &types.AssetManagementAccount{ - Id: assetManagementAccId, - Name: assetManagementAccName, - Enabled: enabled, - }) - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagAddAssetManagementAccount()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// ProposalStopYieldFarm returns a CLI command handler for creating -// a proposal to stop a yield farm -func NewSubmitProposalStopYieldFarmTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-stop-yieldfarm", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to stop a yield farm", - Long: fmt.Sprintf(`Submit a proposal to stop a yield farm.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return err - } - - content := types.NewProposalStopYieldFarm(title, description, assetManagementAccId) - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagStopAssetManagementAccount()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// ProposalRemoveYieldFarm returns a CLI command handler for creating -// a proposal to remove a yield farm -func NewSubmitProposalRemoveYieldFarmTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-remove-yieldfarm", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to remove a yield farm", - Long: fmt.Sprintf(`Submit a proposal to remove a yield farm.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return err - } - - content := types.NewProposalRemoveYieldFarm(title, description, assetManagementAccId) - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagStopAssetManagementAccount()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// ProposalAddYieldFarmTarget returns a CLI command handler for creating -// a proposal to add a yield farm target -func NewSubmitProposalAddYieldFarmTargetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-add-yieldfarmtarget", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to add a yield farm target", - Long: fmt.Sprintf(`Submit a proposal to add a yield farm target.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - target, err := getAssetManagementTargetFromFlags(cmd) - if err != nil { - return err - } - - content := types.NewProposalAddYieldFarmTarget(title, description, target) - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagAddAssetManagementTarget()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// ProposalUpdateYieldFarmTarget returns a CLI command handler for creating -// a proposal to update a yield farm target -func NewSubmitProposalUpdateYieldFarmTargetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-update-yieldfarmtarget", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to update a yield farm target", - Long: fmt.Sprintf(`Submit a proposal to update a yield farm target.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - target, err := getAssetManagementTargetFromFlags(cmd) - if err != nil { - return err - } - - content := types.NewProposalUpdateYieldFarmTarget(title, description, target) - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagAddAssetManagementTarget()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func getAssetManagementTargetFromFlags(cmd *cobra.Command) (*types.AssetManagementTarget, error) { - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return nil, err - } - - assetManagementAccAddress, err := cmd.Flags().GetString(FlagAssetManagementAccountAddress) - if err != nil { - return nil, err - } - - assetManagementTargetId, err := cmd.Flags().GetString(FlagAssetManagementTargetId) - if err != nil { - return nil, err - } - - unbondingSeconds, err := cmd.Flags().GetUint64(FlagUnbondingSeconds) - if err != nil { - return nil, err - } - - assetConditionsStr, err := cmd.Flags().GetString(FlagAssetConditions) - if err != nil { - return nil, err - } - - assetConditions := []types.AssetCondition{} - assetConditionStrArr := strings.Split(assetConditionsStr, ",") - for _, assetConditionStr := range assetConditionStrArr { - split := strings.Split(assetConditionStr, ":") - if len(split) != 3 { - return nil, fmt.Errorf("invalid asset condition expression") - } - ratio, err := strconv.Atoi(split[2]) - if err != nil { - return nil, err - } - assetConditions = append(assetConditions, types.AssetCondition{ - Denom: split[0], - Min: split[1], - Ratio: uint32(ratio), - }) - } - - integrateType, err := cmd.Flags().GetString(FlagIntegrateType) - if err != nil { - return nil, err - } - - modName, err := cmd.Flags().GetString(FlagModName) - if err != nil { - return nil, err - } - - return &types.AssetManagementTarget{ - Id: assetManagementTargetId, - AssetManagementAccountId: assetManagementAccId, - AccountAddress: assetManagementAccAddress, - AssetConditions: assetConditions, - UnbondingTime: time.Second * time.Duration(unbondingSeconds), - IntegrateInfo: types.IntegrateInfo{ - Type: types.IntegrateType(types.IntegrateType_value[integrateType]), - ContractIbcPortId: "", - ModName: modName, - }, - }, nil -} - -// ProposalStopYieldFarmTarget returns a CLI command handler for creating -// a proposal to stop a yield farm target -func NewSubmitProposalStopYieldFarmTargetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-stop-yieldfarmtarget", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to stop a yield farm target", - Long: fmt.Sprintf(`Submit a proposal to stop a yield farm target.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return err - } - - assetManagementTargetId, err := cmd.Flags().GetString(FlagAssetManagementTargetId) - if err != nil { - return err - } - - content := types.NewProposalStopYieldFarmTarget(title, description, assetManagementAccId, assetManagementTargetId) - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagStopAssetManagementTarget()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// ProposalRemoveYieldFarmTarget returns a CLI command handler for creating -// a proposal to remove a yield farm target -func NewSubmitProposalRemoveYieldFarmTargetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-remove-yieldfarmtarget", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to remove a yield farm target", - Long: fmt.Sprintf(`Submit a proposal to remove a yield farm target.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - assetManagementAccId, err := cmd.Flags().GetString(FlagAssetManagementAccountId) - if err != nil { - return err - } - - assetManagementTargetId, err := cmd.Flags().GetString(FlagAssetManagementTargetId) - if err != nil { - return err - } - - content := types.NewProposalRemoveYieldFarmTarget(title, description, assetManagementAccId, assetManagementTargetId) - depositStr, err := cmd.Flags().GetString(FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalTx()) - cmd.Flags().AddFlagSet(FlagStopAssetManagementTarget()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/deprecated/x/yieldaggregatorv1/client/proposal_handler.go b/deprecated/x/yieldaggregatorv1/client/proposal_handler.go deleted file mode 100644 index 9b86e5e7f..000000000 --- a/deprecated/x/yieldaggregatorv1/client/proposal_handler.go +++ /dev/null @@ -1,16 +0,0 @@ -package client - -import ( - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/client/cli" -) - -var ProposalAddYieldFarmHandler = govclient.NewProposalHandler(cli.NewSubmitProposalAddYieldFarmTxCmd) -var ProposalUpdateYieldFarm = govclient.NewProposalHandler(cli.NewSubmitProposalUpdateYieldFarmTxCmd) -var ProposalStopYieldFarm = govclient.NewProposalHandler(cli.NewSubmitProposalStopYieldFarmTxCmd) -var ProposalRemoveYieldFarm = govclient.NewProposalHandler(cli.NewSubmitProposalRemoveYieldFarmTxCmd) -var ProposalAddYieldFarmTarget = govclient.NewProposalHandler(cli.NewSubmitProposalAddYieldFarmTargetTxCmd) -var ProposalUpdateYieldFarmTarget = govclient.NewProposalHandler(cli.NewSubmitProposalUpdateYieldFarmTargetTxCmd) -var ProposalStopYieldFarmTarget = govclient.NewProposalHandler(cli.NewSubmitProposalStopYieldFarmTargetTxCmd) -var ProposalRemoveYieldFarmTarget = govclient.NewProposalHandler(cli.NewSubmitProposalRemoveYieldFarmTargetTxCmd) diff --git a/deprecated/x/yieldaggregatorv1/keeper/asset_management_accounts.go b/deprecated/x/yieldaggregatorv1/keeper/asset_management_accounts.go deleted file mode 100644 index 133e79f96..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/asset_management_accounts.go +++ /dev/null @@ -1,68 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// asset management keeper functions -func (k Keeper) AddAssetManagementAccount(ctx sdk.Context, id string, name string) error { - acc := k.GetAssetManagementAccount(ctx, id) - if acc.Id != "" { - return types.ErrAssetManagementAccountAlreadyExists - } - k.SetAssetManagementAccount(ctx, types.AssetManagementAccount{ - Id: id, - Name: name, - Enabled: true, - }) - return nil -} - -func (k Keeper) UpdateAssetManagementAccount(ctx sdk.Context, obj types.AssetManagementAccount) error { - acc := k.GetAssetManagementAccount(ctx, obj.Id) - if acc.Id == "" { - return types.ErrAssetManagementAccountDoesNotExists - } - k.SetAssetManagementAccount(ctx, obj) - return nil -} - -func (k Keeper) DeleteAssetManagementAccount(ctx sdk.Context, id string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.AssetManagementAccountKey(id)) -} - -func (k Keeper) SetAssetManagementAccount(ctx sdk.Context, obj types.AssetManagementAccount) { - bz := k.cdc.MustMarshal(&obj) - store := ctx.KVStore(k.storeKey) - store.Set(types.AssetManagementAccountKey(obj.Id), bz) -} - -func (k Keeper) GetAssetManagementAccount(ctx sdk.Context, id string) types.AssetManagementAccount { - acc := types.AssetManagementAccount{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.AssetManagementAccountKey(id)) - if bz == nil { - return acc - } - k.cdc.MustUnmarshal(bz, &acc) - return acc -} - -func (k Keeper) GetAllAssetManagementAccounts(ctx sdk.Context) []types.AssetManagementAccount { - store := ctx.KVStore(k.storeKey) - - accs := []types.AssetManagementAccount{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyAssetManagementAccount)) - defer it.Close() - - for ; it.Valid(); it.Next() { - acc := types.AssetManagementAccount{} - k.cdc.MustUnmarshal(it.Value(), &acc) - - accs = append(accs, acc) - } - return accs -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/asset_management_accounts_test.go b/deprecated/x/yieldaggregatorv1/keeper/asset_management_accounts_test.go deleted file mode 100644 index 8c06f4eab..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/asset_management_accounts_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package keeper_test - -// import ( -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestAssetManagementAccountGetSet() { -// // get not available account -// assetManagementAccount := suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "OsmoFarm") -// suite.Require().Equal(assetManagementAccount, types.AssetManagementAccount{}) - -// // set asset management account -// osmoManagementAccount := types.AssetManagementAccount{ -// Id: "OsmoFarm", -// Name: "Osmosis Farm", -// Enabled: true, -// } -// evmosManagementAccount := types.AssetManagementAccount{ -// Id: "EvmosFarm", -// Name: "Evmos Farm", -// Enabled: false, -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, osmoManagementAccount) -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, evmosManagementAccount) - -// // check asset management accounts -// assetManagementAccount = suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "OsmoFarm") -// suite.Require().Equal(assetManagementAccount, osmoManagementAccount) -// assetManagementAccount = suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "EvmosFarm") -// suite.Require().Equal(assetManagementAccount, evmosManagementAccount) -// assetManagementAccounts := suite.app.YieldaggregatorKeeper.GetAllAssetManagementAccounts(suite.ctx) -// suite.Require().Len(assetManagementAccounts, 2) - -// // delete user deposit and check -// suite.app.YieldaggregatorKeeper.DeleteAssetManagementAccount(suite.ctx, "EvmosFarm") -// assetManagementAccount = suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "EvmosFarm") -// suite.Require().Equal(assetManagementAccount, types.AssetManagementAccount{}) -// } - -// func (suite *KeeperTestSuite) TestAddAssetManagementAccount() { -// // get not available account -// assetManagementAccount := suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "OsmoFarm") -// suite.Require().Equal(assetManagementAccount, types.AssetManagementAccount{}) - -// // set asset management account -// err := suite.app.YieldaggregatorKeeper.AddAssetManagementAccount(suite.ctx, "OsmoFarm", "Osmosis Farm") -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.AddAssetManagementAccount(suite.ctx, "EvmosFarm", "Evmos Farm") -// suite.Require().NoError(err) - -// // check asset management accounts -// osmoManagementAccount := types.AssetManagementAccount{ -// Id: "OsmoFarm", -// Name: "Osmosis Farm", -// Enabled: true, -// } -// evmosManagementAccount := types.AssetManagementAccount{ -// Id: "EvmosFarm", -// Name: "Evmos Farm", -// Enabled: true, -// } -// assetManagementAccount = suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "OsmoFarm") -// suite.Require().Equal(assetManagementAccount, osmoManagementAccount) -// assetManagementAccount = suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "EvmosFarm") -// suite.Require().Equal(assetManagementAccount, evmosManagementAccount) -// assetManagementAccounts := suite.app.YieldaggregatorKeeper.GetAllAssetManagementAccounts(suite.ctx) -// suite.Require().Len(assetManagementAccounts, 2) - -// // try adding same account -// err = suite.app.YieldaggregatorKeeper.AddAssetManagementAccount(suite.ctx, "OsmoFarm", "Osmosis Farm") -// suite.Require().Error(err) -// } - -// func (suite *KeeperTestSuite) TestUpdateAssetManagementAccount() { -// // try updating when not available -// osmoManagementAccount := types.AssetManagementAccount{ -// Id: "OsmoFarm", -// Name: "Osmosis Farm", -// Enabled: true, -// } -// err := suite.app.YieldaggregatorKeeper.UpdateAssetManagementAccount(suite.ctx, osmoManagementAccount) -// suite.Require().Error(err) - -// // check asset management accounts -// err = suite.app.YieldaggregatorKeeper.AddAssetManagementAccount(suite.ctx, "OsmoFarm", "") -// suite.Require().NoError(err) -// assetManagementAccount := suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "OsmoFarm") -// suite.Require().Equal(assetManagementAccount.Name, "") - -// // update after addition -// err = suite.app.YieldaggregatorKeeper.UpdateAssetManagementAccount(suite.ctx, osmoManagementAccount) -// suite.Require().NoError(err) -// assetManagementAccount = suite.app.YieldaggregatorKeeper.GetAssetManagementAccount(suite.ctx, "OsmoFarm") -// suite.Require().Equal(assetManagementAccount, osmoManagementAccount) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/asset_management_targets.go b/deprecated/x/yieldaggregatorv1/keeper/asset_management_targets.go deleted file mode 100644 index 100e6553e..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/asset_management_targets.go +++ /dev/null @@ -1,92 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func (k Keeper) GetAssetManagementTargetsOfAccount(ctx sdk.Context, accountId string) []types.AssetManagementTarget { - store := ctx.KVStore(k.storeKey) - - targets := []types.AssetManagementTarget{} - it := sdk.KVStorePrefixIterator(store, append([]byte(types.PrefixKeyAssetManagementTarget), accountId...)) - defer it.Close() - - for ; it.Valid(); it.Next() { - target := types.AssetManagementTarget{} - k.cdc.MustUnmarshal(it.Value(), &target) - - targets = append(targets, target) - } - return targets -} - -func (k Keeper) GetAssetManagementTargetsOfDenom(ctx sdk.Context, accountId string, denom string) []types.AssetManagementTarget { - targets := k.GetAssetManagementTargetsOfAccount(ctx, accountId) - denomTargets := []types.AssetManagementTarget{} - for _, target := range targets { - for _, cond := range target.AssetConditions { - if cond.Denom == denom { - denomTargets = append(denomTargets, target) - break - } - } - } - return denomTargets -} - -func (k Keeper) DeleteAssetManagementTargetsOfAccount(ctx sdk.Context, accountId string) { - targets := k.GetAssetManagementTargetsOfAccount(ctx, accountId) - for _, target := range targets { - k.DeleteAssetManagementTarget(ctx, target.AssetManagementAccountId, target.Id) - } -} - -func (k Keeper) UpdateAssetManagementTargetsOfAccount(ctx sdk.Context, accountId string, targets []types.AssetManagementTarget) { - k.DeleteAssetManagementTargetsOfAccount(ctx, accountId) - for _, target := range targets { - k.SetAssetManagementTarget(ctx, target) - } -} - -func (k Keeper) SetAssetManagementTarget(ctx sdk.Context, obj types.AssetManagementTarget) { - bz := k.cdc.MustMarshal(&obj) - store := ctx.KVStore(k.storeKey) - store.Set(types.AssetManagementTargetKey(obj.AssetManagementAccountId, obj.Id), bz) -} - -func (k Keeper) DeleteAssetManagementTarget(ctx sdk.Context, accountId, targetId string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.AssetManagementTargetKey(accountId, targetId)) -} - -func (k Keeper) GetAssetManagementTarget(ctx sdk.Context, accountId, targetId string) types.AssetManagementTarget { - acc := types.AssetManagementTarget{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.AssetManagementTargetKey(accountId, targetId)) - if bz == nil { - return acc - } - k.cdc.MustUnmarshal(bz, &acc) - return acc -} - -func (k Keeper) GetAllAssetManagementTargets(ctx sdk.Context) []types.AssetManagementTarget { - store := ctx.KVStore(k.storeKey) - - targets := []types.AssetManagementTarget{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyAssetManagementTarget)) - defer it.Close() - - for ; it.Valid(); it.Next() { - target := types.AssetManagementTarget{} - k.cdc.MustUnmarshal(it.Value(), &target) - - targets = append(targets, target) - } - return targets -} - -// // AssetManagementAccountBankKeeper -// PayBack(ctx sdk.Context, targetId string, farmingUnit FarmingUnit) diff --git a/deprecated/x/yieldaggregatorv1/keeper/asset_management_targets_test.go b/deprecated/x/yieldaggregatorv1/keeper/asset_management_targets_test.go deleted file mode 100644 index c2c7ec8c8..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/asset_management_targets_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package keeper_test - -// import "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" - -// func (suite *KeeperTestSuite) TestAssetManagementTargetGetSet() { -// // get not available target -// assetManagementTarget := suite.app.YieldaggregatorKeeper.GetAssetManagementTarget(suite.ctx, "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(assetManagementTarget, types.AssetManagementTarget{}) - -// // set asset management target -// osmoManagementTarget := types.AssetManagementTarget{ -// Id: "OsmoGUUFarm", -// AssetManagementAccountId: "OsmoFarm", -// Enabled: true, -// AssetConditions: []types.AssetCondition{ -// { -// Denom: "uguu", -// Ratio: 100, -// Min: "", -// }, -// }, -// } -// evmosManagementTarget := types.AssetManagementTarget{ -// Id: "EvmosGUUFarm", -// AssetManagementAccountId: "EvmosFarm", -// Enabled: false, -// AssetConditions: []types.AssetCondition{ -// { -// Denom: "uguu", -// Ratio: 100, -// Min: "", -// }, -// }, -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementTarget(suite.ctx, osmoManagementTarget) -// suite.app.YieldaggregatorKeeper.SetAssetManagementTarget(suite.ctx, evmosManagementTarget) - -// // check asset management targets -// assetManagementTarget = suite.app.YieldaggregatorKeeper.GetAssetManagementTarget(suite.ctx, "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(assetManagementTarget, osmoManagementTarget) -// assetManagementTarget = suite.app.YieldaggregatorKeeper.GetAssetManagementTarget(suite.ctx, "EvmosFarm", "EvmosGUUFarm") -// suite.Require().Equal(assetManagementTarget, evmosManagementTarget) -// assetManagementTargets := suite.app.YieldaggregatorKeeper.GetAllAssetManagementTargets(suite.ctx) -// suite.Require().Len(assetManagementTargets, 2) -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAssetManagementTargetsOfAccount(suite.ctx, "OsmoFarm") -// suite.Require().Len(assetManagementTargets, 1) -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAssetManagementTargetsOfDenom(suite.ctx, "OsmoFarm", "uguu") -// suite.Require().Len(assetManagementTargets, 1) -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAssetManagementTargetsOfDenom(suite.ctx, "OsmoFarm", "axxx") -// suite.Require().Len(assetManagementTargets, 0) - -// // delete asset management target and check -// suite.app.YieldaggregatorKeeper.DeleteAssetManagementTarget(suite.ctx, "EvmosFarm", "EvmosGUUFarm") -// assetManagementTarget = suite.app.YieldaggregatorKeeper.GetAssetManagementTarget(suite.ctx, "EvmosFarm", "EvmosGUUFarm") -// suite.Require().Equal(assetManagementTarget, types.AssetManagementTarget{}) -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAllAssetManagementTargets(suite.ctx) -// suite.Require().Len(assetManagementTargets, 1) - -// // update asset management account target and check -// osmoManagementTarget.AssetConditions[0].Denom = "aguu" -// suite.app.YieldaggregatorKeeper.UpdateAssetManagementTargetsOfAccount(suite.ctx, "OsmoFarm", []types.AssetManagementTarget{osmoManagementTarget}) -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAssetManagementTargetsOfDenom(suite.ctx, "OsmoFarm", "aguu") -// suite.Require().Len(assetManagementTargets, 1) -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAssetManagementTargetsOfDenom(suite.ctx, "OsmoFarm", "uguu") -// suite.Require().Len(assetManagementTargets, 0) - -// // delete asset management targets of an account and check -// suite.app.YieldaggregatorKeeper.DeleteAssetManagementTargetsOfAccount(suite.ctx, "OsmoFarm") -// assetManagementTargets = suite.app.YieldaggregatorKeeper.GetAssetManagementTargetsOfAccount(suite.ctx, "OsmoFarm") -// suite.Require().Len(assetManagementTargets, 0) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/connect_yieldfarm.go b/deprecated/x/yieldaggregatorv1/keeper/connect_yieldfarm.go deleted file mode 100644 index 1f9c257f9..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/connect_yieldfarm.go +++ /dev/null @@ -1,207 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func (k Keeper) InvestOnTarget(ctx sdk.Context, addr sdk.AccAddress, target types.AssetManagementTarget, amount sdk.Coins) error { - farmingUnit := k.GetFarmingUnit(ctx, addr.String(), target.AssetManagementAccountId, target.Id) - // set farming unit if does not exists - if farmingUnit.AccountId == "" { - farmingUnit = types.FarmingUnit{ - AccountId: target.AssetManagementAccountId, - TargetId: target.Id, - Amount: amount, - FarmingStartTime: ctx.BlockTime().String(), - UnbondingStarttime: time.Time{}, - Owner: addr.String(), - } - k.SetFarmingUnit(ctx, farmingUnit) - } else { - farmingUnit.Amount = sdk.Coins(farmingUnit.Amount).Add(amount...) - } - - // move tokens to farm target - switch target.IntegrateInfo.Type { - case types.IntegrateType_GOLANG_MOD: - address := farmingUnit.GetAddress() - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, address, amount) - if err != nil { - return err - } - switch target.IntegrateInfo.ModName { - case "stakeibc": - for _, token := range amount { - err := k.stakeibcKeeper.LiquidStake( - ctx, - address, - token, - ) - if err != nil { - return err - } - } - default: - err = k.yieldfarmKeeper.Deposit(ctx, address, amount) - if err != nil { - return err - } - } - case types.IntegrateType_COSMWASM: - wasmMsg := `{"deposit_native_token":{}}` - contractAddr := sdk.MustAccAddressFromBech32(target.AccountAddress) - _, err := k.wasmKeeper.Execute(ctx, contractAddr, farmingUnit.GetAddress(), []byte(wasmMsg), amount) - if err != nil { - return err - } - } - return nil -} - -func (k Keeper) BeginWithdrawFromTarget(ctx sdk.Context, addr sdk.AccAddress, target types.AssetManagementTarget, amount sdk.Coins) error { - farmingUnit := k.GetFarmingUnit(ctx, addr.String(), target.AssetManagementAccountId, target.Id) - if farmingUnit.AccountId == "" { - return types.ErrFarmingUnitDoesNotExist - } - farmingUnit.UnbondingStarttime = ctx.BlockTime() - k.SetFarmingUnit(ctx, farmingUnit) - - switch target.IntegrateInfo.Type { - case types.IntegrateType_GOLANG_MOD: - address := farmingUnit.GetAddress() - - // request full withdraw from the unit if amount is empty - if amount.String() == "" { - amount = farmingUnit.Amount - } - switch target.IntegrateInfo.ModName { - case "stakeibc": - fmt.Println("SUCCESS BeginWithdrawFromTarget.1", amount) - for _, coin := range amount { - fmt.Println("SUCCESS BeginWithdrawFromTarget-1", coin) - err := k.stakeibcKeeper.RedeemStake( - ctx, - address, - coin, - address.String(), - ) - if err != nil { - return err - } - } - default: - err := k.yieldfarmKeeper.Withdraw(ctx, address, amount) - if err != nil { - return err - } - } - case types.IntegrateType_COSMWASM: - wasmMsg := `{"start_unbond":{}}` - contractAddr := sdk.MustAccAddressFromBech32(target.AccountAddress) - _, err := k.wasmKeeper.Execute(ctx, contractAddr, farmingUnit.GetAddress(), []byte(wasmMsg), sdk.Coins{}) - if err != nil { - return err - } - } - return nil -} - -func (k Keeper) ClaimWithdrawFromTarget(ctx sdk.Context, addr sdk.AccAddress, target types.AssetManagementTarget) error { - farmingUnit := k.GetFarmingUnit(ctx, addr.String(), target.AssetManagementAccountId, target.Id) - if farmingUnit.AccountId == "" { - return types.ErrFarmingUnitDoesNotExist - } - - // check unbonding time passed - if farmingUnit.UnbondingStarttime.Add(target.UnbondingTime).After(ctx.BlockTime()) { - return types.ErrUnbondingTimeNotPassed - } - - // withdraw from farming unit and increase users' deposit balance - switch target.IntegrateInfo.Type { - case types.IntegrateType_GOLANG_MOD: - address := farmingUnit.GetAddress() - balances := k.bankKeeper.GetAllBalances(ctx, address) - if balances.IsAllPositive() { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, balances) - if err != nil { - return err - } - } - k.IncreaseUserDeposit(ctx, addr, balances) - case types.IntegrateType_COSMWASM: - wasmMsg := `{"claim_unbond":{}}` - contractAddr := sdk.MustAccAddressFromBech32(target.AccountAddress) - _, err := k.wasmKeeper.Execute(ctx, contractAddr, farmingUnit.GetAddress(), []byte(wasmMsg), sdk.Coins{}) - if err != nil { - return err - } - - } - return nil -} - -func (k Keeper) ClaimRewardsFromTarget(ctx sdk.Context, addr sdk.AccAddress, target types.AssetManagementTarget) error { - fmt.Println("DEBUG ClaimRewardsFromTarget", addr, target) - farmingUnit := k.GetFarmingUnit(ctx, addr.String(), target.AssetManagementAccountId, target.Id) - if farmingUnit.AccountId == "" { - return types.ErrFarmingUnitDoesNotExist - } - address := farmingUnit.GetAddress() - - // claim and assign rewards to farm units - switch target.IntegrateInfo.Type { - case types.IntegrateType_GOLANG_MOD: - switch target.IntegrateInfo.ModName { - case "stakeibc": - fmt.Println("STAKEIBC UPDATE amount") - updatedAmounts := sdk.Coins{} - for _, token := range farmingUnit.Amount { - updatedAmount := k.stakeibcKeeper.GetUpdatedBalance(ctx, address, token.Denom) - updatedAmounts = updatedAmounts.Add(sdk.NewCoin(token.Denom, updatedAmount)) - } - farmingUnit.Amount = updatedAmounts - k.SetFarmingUnit(ctx, farmingUnit) - default: - k.yieldfarmKeeper.ClaimRewards(ctx, address) - balances := k.bankKeeper.GetAllBalances(ctx, address) - if balances.IsAllPositive() { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, balances) - if err != nil { - return err - } - } - k.IncreaseUserDeposit(ctx, addr, balances) - } - - case types.IntegrateType_COSMWASM: - wasmMsg := `{"claim_all_rewards":{}}` - contractAddr := sdk.MustAccAddressFromBech32(target.AccountAddress) - _, err := k.wasmKeeper.Execute(ctx, contractAddr, farmingUnit.GetAddress(), []byte(wasmMsg), sdk.Coins{}) - if err != nil { - return err - } - } - return nil -} - -func (k Keeper) ClaimAllFarmUnitRewards(ctx sdk.Context) { - // iterate and run ClaimRewardsFromTarget - farmUnits := k.GetAllFarmingUnits(ctx) - for _, farmUnit := range farmUnits { - target := k.GetAssetManagementTarget(ctx, farmUnit.AccountId, farmUnit.TargetId) - addr, err := sdk.AccAddressFromBech32(farmUnit.Owner) - if err != nil { - continue - } - err = k.ClaimRewardsFromTarget(ctx, addr, target) - if err != nil { - continue - } - } -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/connect_yieldfarm_test.go b/deprecated/x/yieldaggregatorv1/keeper/connect_yieldfarm_test.go deleted file mode 100644 index 5aaae6ab4..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/connect_yieldfarm_test.go +++ /dev/null @@ -1,365 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// epochtypes "github.com/UnUniFi/chain/x/epochs/types" -// recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" -// stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" -// yieldfarmtypes "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -// ) - -// func (suite *KeeperTestSuite) TestInvestOnTarget() { -// // preparation before investment -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) - -// // execute investment -// err = suite.app.YieldaggregatorKeeper.InvestOnTarget(suite.ctx, addr1, types.AssetManagementTarget{ -// AssetManagementAccountId: "UnunifiFarm", -// Id: "GUUStaking", -// IntegrateInfo: types.IntegrateInfo{ -// Type: types.IntegrateType_GOLANG_MOD, -// }, -// }, coins) -// suite.Require().NoError(err) - -// // farming unit creation or update check -// unit := suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "UnunifiFarm", "GUUStaking") -// expectedFarmingUnit := types.FarmingUnit{ -// AccountId: "UnunifiFarm", -// TargetId: "GUUStaking", -// Amount: coins, -// FarmingStartTime: suite.ctx.BlockTime().String(), -// UnbondingStarttime: time.Time{}, -// Owner: addr1.String(), -// } -// suite.Require().Equal(unit, expectedFarmingUnit) - -// // check token transfer from yield aggregator module to yieldfarm module by amount -// moduleAddr := suite.app.AccountKeeper.GetModuleAddress(yieldfarmtypes.ModuleName) -// balance := suite.app.BankKeeper.GetBalance(suite.ctx, moduleAddr, "uguu") -// suite.Require().Equal(balance, coins[0]) -// moduleAddr = suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) -// balance = suite.app.BankKeeper.GetBalance(suite.ctx, moduleAddr, "uguu") -// suite.Require().Equal(balance, sdk.NewInt64Coin("uguu", 0)) - -// // check farming unit account deposit amount increase -// farmerInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, expectedFarmingUnit.GetAddress()) -// suite.Require().Equal(farmerInfo, yieldfarmtypes.FarmerInfo{ -// Account: expectedFarmingUnit.GetAddress().String(), -// Amount: coins, -// Rewards: sdk.Coins(nil), -// }) -// } - -// func (suite *KeeperTestSuite) TestBeginWithdrawFromTarget() { -// // try withdrawal when farming unit does not exist -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// assetTarget := types.AssetManagementTarget{ -// AssetManagementAccountId: "UnunifiFarm", -// Id: "GUUStaking", -// IntegrateInfo: types.IntegrateInfo{ -// Type: types.IntegrateType_GOLANG_MOD, -// }, -// } -// err := suite.app.YieldaggregatorKeeper.BeginWithdrawFromTarget(suite.ctx, addr1, assetTarget, coins) -// suite.Require().Error(err) - -// // preparation for withdrawal -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.InvestOnTarget(suite.ctx, addr1, assetTarget, coins) -// suite.Require().NoError(err) - -// // withdraw partial amount -// partialCoins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 100)) -// err = suite.app.YieldaggregatorKeeper.BeginWithdrawFromTarget(suite.ctx, addr1, assetTarget, partialCoins) -// suite.Require().NoError(err) - -// // check farmerInfo change -// unit := suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "UnunifiFarm", "GUUStaking") -// farmerInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, unit.GetAddress()) -// suite.Require().Equal(farmerInfo, yieldfarmtypes.FarmerInfo{ -// Account: unit.GetAddress().String(), -// Amount: coins.Sub(partialCoins), -// Rewards: sdk.Coins(nil), -// }) - -// // withdraw full amount -// err = suite.app.YieldaggregatorKeeper.BeginWithdrawFromTarget(suite.ctx, addr1, assetTarget, sdk.Coins{sdk.NewInt64Coin("uguu", 900)}) -// suite.Require().NoError(err) - -// // check farmerInfo change -// farmerInfo = suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, unit.GetAddress()) -// suite.Require().Equal(farmerInfo, yieldfarmtypes.FarmerInfo{ -// Account: unit.GetAddress().String(), -// Amount: sdk.Coins(nil), -// Rewards: sdk.Coins(nil), -// }) -// } - -// func (suite *KeeperTestSuite) TestClaimWithdrawFromTarget() { -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) -// // try claim withdraw when farming unit does not exist -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// assetTarget := types.AssetManagementTarget{ -// AssetManagementAccountId: "UnunifiFarm", -// Id: "GUUStaking", -// IntegrateInfo: types.IntegrateInfo{ -// Type: types.IntegrateType_GOLANG_MOD, -// }, -// UnbondingTime: time.Hour, -// } -// err := suite.app.YieldaggregatorKeeper.ClaimWithdrawFromTarget(suite.ctx, addr1, assetTarget) -// suite.Require().Error(err) - -// // try claim before unbonding time pass -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.InvestOnTarget(suite.ctx, addr1, assetTarget, coins) -// suite.Require().NoError(err) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.BeginWithdrawFromTarget(suite.ctx, addr1, assetTarget, sdk.Coins{}) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.ClaimWithdrawFromTarget(suite.ctx, addr1, assetTarget) -// suite.Require().Error(err) - -// // claim after unbonding time pass -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Hour)) -// err = suite.app.YieldaggregatorKeeper.ClaimWithdrawFromTarget(suite.ctx, addr1, assetTarget) -// suite.Require().NoError(err) - -// // check user deposit increase -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().True(deposit.IsAllGTE(coins)) - -// // check farmerInfo zero -// unit := suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "UnunifiFarm", "GUUStaking") -// farmerInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, unit.GetAddress()) -// suite.Require().Equal(farmerInfo, yieldfarmtypes.FarmerInfo{ -// Account: unit.GetAddress().String(), -// Amount: sdk.Coins(nil), -// Rewards: sdk.Coins(nil), -// }) -// } - -// func (suite *KeeperTestSuite) TestClaimRewardsFromTarget() { -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) -// // try claim withdraw when farming unit does not exist -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// assetTarget := types.AssetManagementTarget{ -// AssetManagementAccountId: "UnunifiFarm", -// Id: "GUUStaking", -// IntegrateInfo: types.IntegrateInfo{ -// Type: types.IntegrateType_GOLANG_MOD, -// }, -// UnbondingTime: time.Hour, -// } -// err := suite.app.YieldaggregatorKeeper.ClaimRewardsFromTarget(suite.ctx, addr1, assetTarget) -// suite.Require().Error(err) - -// // preparation -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.InvestOnTarget(suite.ctx, addr1, assetTarget, coins) -// suite.Require().NoError(err) -// suite.Require().NoError(err) - -// // claim after some time -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Hour)) -// err = suite.app.YieldaggregatorKeeper.ClaimRewardsFromTarget(suite.ctx, addr1, assetTarget) -// suite.Require().NoError(err) - -// // check user deposit increase -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().Equal(deposit, sdk.Coins{sdk.NewInt64Coin("uguu", 1000)}) - -// // check farmerInfo stays same -// unit := suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "UnunifiFarm", "GUUStaking") -// farmerInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, unit.GetAddress()) -// suite.Require().Equal(farmerInfo, yieldfarmtypes.FarmerInfo{ -// Account: unit.GetAddress().String(), -// Amount: coins, -// Rewards: sdk.Coins(nil), -// }) -// } - -// func (suite *KeeperTestSuite) TestClaimAllFarmUnitRewards() { -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// assetTarget := types.AssetManagementTarget{ -// AssetManagementAccountId: "UnunifiFarm", -// Id: "GUUStaking", -// IntegrateInfo: types.IntegrateInfo{ -// Type: types.IntegrateType_GOLANG_MOD, -// }, -// UnbondingTime: time.Hour, -// } - -// // preparation -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.InvestOnTarget(suite.ctx, addr1, assetTarget, coins) -// suite.Require().NoError(err) -// suite.Require().NoError(err) - -// // claim after some time -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Hour)) -// suite.app.YieldaggregatorKeeper.ClaimAllFarmUnitRewards(suite.ctx) - -// // check user deposit increase -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().Equal(deposit, sdk.Coins{sdk.NewInt64Coin("uguu", 1000)}) - -// // check farmerInfo stays same -// unit := suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "UnunifiFarm", "GUUStaking") -// farmerInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, unit.GetAddress()) -// suite.Require().Equal(farmerInfo, yieldfarmtypes.FarmerInfo{ -// Account: unit.GetAddress().String(), -// Amount: coins, -// Rewards: sdk.Coins(nil), -// }) -// } - -// func (suite *KeeperTestSuite) TestClaimAllFarmUnitRewardsIBCStake() { -// now := time.Now() - -// suite.SetupTest() -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // set epoch tracker for env -// suite.app.StakeibcKeeper.SetEpochTracker(suite.ctx, stakeibctypes.EpochTracker{ -// EpochIdentifier: epochtypes.BASE_EPOCH, -// EpochNumber: 1, -// NextEpochStartTime: uint64(now.Unix()), -// Duration: 43200, -// }) - -// atomHostDenom := "uatom" -// prefixedDenom := transfertypes.GetPrefixedDenom("transfer", "channel-0", atomHostDenom) -// atomIbcDenom := transfertypes.ParseDenomTrace(prefixedDenom).IBCDenom() - -// // set deposit record for env -// suite.app.RecordsKeeper.SetDepositRecord(suite.ctx, recordstypes.DepositRecord{ -// Id: 1, -// Amount: 100, -// Denom: atomIbcDenom, -// HostZoneId: "hub-1", -// Status: recordstypes.DepositRecord_STAKE, -// DepositEpochNumber: 1, -// Source: recordstypes.DepositRecord_STRIDE, -// }) -// // set host zone for env -// zone := stakeibctypes.HostZone{ -// ChainId: "hub-1", -// ConnectionId: "connection-0", -// Bech32Prefix: "cosmos", -// TransferChannelId: "channel-0", -// Validators: []*stakeibctypes.Validator{}, -// BlacklistedValidators: []*stakeibctypes.Validator{}, -// WithdrawalAccount: nil, -// FeeAccount: nil, -// DelegationAccount: nil, -// RedemptionAccount: nil, -// IBCDenom: atomIbcDenom, -// HostDenom: atomHostDenom, -// RedemptionRate: sdk.NewDec(1), -// Address: addr1.String(), -// } -// suite.app.StakeibcKeeper.SetHostZone(suite.ctx, zone) - -// // mint coins to be spent on liquid staking -// coins := sdk.Coins{sdk.NewInt64Coin(atomIbcDenom, 1000000)} -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.Require().NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.Require().NoError(err) - -// assetTarget := types.AssetManagementTarget{ -// AssetManagementAccountId: "AtomFarm", -// Id: "AtomLiquidStaking", -// IntegrateInfo: types.IntegrateInfo{ -// Type: types.IntegrateType_GOLANG_MOD, -// ModName: "stakeibc", -// }, -// UnbondingTime: time.Hour, -// } - -// // preparation -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) -// suite.app.YieldaggregatorKeeper.SetAssetManagementTarget(suite.ctx, assetTarget) -// err = suite.app.YieldaggregatorKeeper.InvestOnTarget(suite.ctx, addr1, assetTarget, coins) -// suite.Require().NoError(err) - -// farmUnits := suite.app.YieldaggregatorKeeper.GetFarmingUnitsOfAddress(suite.ctx, addr1) -// suite.Require().Equal(len(farmUnits), 1) -// suite.Require().Equal(sdk.Coins(farmUnits[0].Amount).String(), "1000000"+atomIbcDenom) - -// // claim after some time -// suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Hour)) -// zone.RedemptionRate = zone.RedemptionRate.Mul(sdk.NewDec(2)) // 2x redemption rate -// suite.app.StakeibcKeeper.SetHostZone(suite.ctx, zone) - -// suite.app.YieldaggregatorKeeper.ClaimAllFarmUnitRewards(suite.ctx) - -// // check after claim -// farmUnits = suite.app.YieldaggregatorKeeper.GetFarmingUnitsOfAddress(suite.ctx, addr1) -// suite.Require().Equal(len(farmUnits), 1) -// suite.Require().Equal(sdk.Coins(farmUnits[0].Amount).String(), "2000000"+atomIbcDenom) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/farming_orders.go b/deprecated/x/yieldaggregatorv1/keeper/farming_orders.go deleted file mode 100644 index d1fffb6d0..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/farming_orders.go +++ /dev/null @@ -1,194 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// AssetManagementKeeper -func (k Keeper) AddFarmingOrder(ctx sdk.Context, obj types.FarmingOrder) error { - addr, err := sdk.AccAddressFromBech32(obj.FromAddress) - if err != nil { - panic(err) - } - - order := k.GetFarmingOrder(ctx, addr, obj.Id) - if order.Id != "" { - return types.ErrFarmingOrderAlreadyExists - } - k.SetFarmingOrder(ctx, obj) - return nil -} - -func (k Keeper) GetFarmingOrdersOfAddress(ctx sdk.Context, addr sdk.AccAddress) []types.FarmingOrder { - store := ctx.KVStore(k.storeKey) - - orders := []types.FarmingOrder{} - it := sdk.KVStorePrefixIterator(store, append([]byte(types.PrefixKeyFarmingOrder), addr...)) - defer it.Close() - - for ; it.Valid(); it.Next() { - order := types.FarmingOrder{} - k.cdc.MustUnmarshal(it.Value(), &order) - - orders = append(orders, order) - } - return orders -} - -func (k Keeper) SetFarmingOrder(ctx sdk.Context, obj types.FarmingOrder) { - bz := k.cdc.MustMarshal(&obj) - store := ctx.KVStore(k.storeKey) - addr, err := sdk.AccAddressFromBech32(obj.FromAddress) - if err != nil { - panic(err) - } - store.Set(types.FarmingOrderKey(addr, obj.Id), bz) -} - -func (k Keeper) DeleteFarmingOrder(ctx sdk.Context, addr sdk.AccAddress, orderId string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.FarmingOrderKey(addr, orderId)) -} - -func (k Keeper) GetFarmingOrder(ctx sdk.Context, addr sdk.AccAddress, orderId string) types.FarmingOrder { - order := types.FarmingOrder{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.FarmingOrderKey(addr, orderId)) - if bz == nil { - return order - } - k.cdc.MustUnmarshal(bz, &order) - return order -} - -func (k Keeper) GetAllFarmingOrders(ctx sdk.Context) []types.FarmingOrder { - store := ctx.KVStore(k.storeKey) - - orders := []types.FarmingOrder{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyFarmingOrder)) - defer it.Close() - - for ; it.Valid(); it.Next() { - order := types.FarmingOrder{} - k.cdc.MustUnmarshal(it.Value(), &order) - - orders = append(orders, order) - } - return orders -} - -func (k Keeper) ActivateFarmingOrder(ctx sdk.Context, addr sdk.AccAddress, farmingOrderId string) error { - order := k.GetFarmingOrder(ctx, addr, farmingOrderId) - if order.Id == "" { - return types.ErrFarmingOrderDoesNotExist - } - - order.Active = true - k.SetFarmingOrder(ctx, order) - return nil -} - -func (k Keeper) InactivateFarmingOrder(ctx sdk.Context, addr sdk.AccAddress, farmingOrderId string) error { - order := k.GetFarmingOrder(ctx, addr, farmingOrderId) - if order.Id == "" { - return types.ErrFarmingOrderDoesNotExist - } - - order.Active = false - k.SetFarmingOrder(ctx, order) - return nil -} - -func (k Keeper) ExecuteFarmingOrders(ctx sdk.Context, addr sdk.AccAddress, orders []types.FarmingOrder) error { - overallRatio := uint32(0) - for _, order := range orders { - overallRatio = order.OverallRatio - } - - deposit := k.GetUserDeposit(ctx, addr) - for _, order := range orders { - orderAlloc := sdk.Coins{} - for _, coin := range deposit { - orderAlloc = orderAlloc.Add(sdk.NewCoin(coin.Denom, coin.Amount.Mul(sdk.NewInt(int64(order.OverallRatio))).Quo(sdk.NewInt(int64(overallRatio))))) - } - - // move tokens to asset management targets based on strategy - strategy := order.Strategy - switch strategy.StrategyType { - case "recent30DaysHighDPRStrategy": // Invest in the best DPR destination in the last 30 days on average - // TODO: implement individual strategy once historical info calcuator is ready - fallthrough - case "recent1DayHighDPRStrategy": // Invest in the best DPR destination in the last average day - // TODO: implement individual strategy once historical info calcuator is ready - fallthrough - case "notHaveDPRStrategy": // Invest in something that does not have a DPR - // TODO: implement individual strategy once historical info calcuator is ready - fallthrough - case "ManualStrategy": // Manual investment, whiteTargetIdlist required - targets := k.GetAllAssetManagementTargets(ctx) - if len(targets) == 0 { - return types.ErrNoAssetManagementTargetExists - } - target := targets[0] - - cacheCtx, write := ctx.CacheContext() - err := k.InvestOnTarget(cacheCtx, addr, target, orderAlloc) - if err != nil { - fmt.Println("ERROR on InvestOnTarget", err) - return err - } else { - write() - } - } - } - - // reduce user owned tokens since its allocated to farming units - k.DeleteUserDeposit(ctx, addr) - return nil -} - -func (k Keeper) StopFarmingUnit(ctx sdk.Context, obj types.FarmingUnit) error { - fmt.Println("DEBUG StopFarmingUnit", obj) - - target := k.GetAssetManagementTarget(ctx, obj.AccountId, obj.TargetId) - addr, err := sdk.AccAddressFromBech32(obj.Owner) - if err != nil { - return err - } - - cacheCtx, write := ctx.CacheContext() - err = k.BeginWithdrawFromTarget(cacheCtx, addr, target, obj.Amount) - if err != nil { - fmt.Println("ERROR stopping farming unit", err) - return err - } else { - fmt.Println("SUCCESS BeginWithdrawFromTarget", obj) - write() - } - - return nil -} - -func (k Keeper) WithdrawFarmingUnit(ctx sdk.Context, obj types.FarmingUnit) error { - addr := obj.GetAddress() - balances := k.bankKeeper.GetAllBalances(ctx, addr) - if balances.IsAllPositive() { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, balances) - if err != nil { - return err - } - - unitOwner, err := sdk.AccAddressFromBech32(obj.Owner) - if err != nil { - return err - } - k.IncreaseUserDeposit(ctx, unitOwner, balances) - } - - k.DeleteFarmingUnit(ctx, obj) - return nil -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/farming_orders_test.go b/deprecated/x/yieldaggregatorv1/keeper/farming_orders_test.go deleted file mode 100644 index dc633a6fd..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/farming_orders_test.go +++ /dev/null @@ -1,178 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// yieldfarmtypes "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -// ) - -// // TODO: -// // StopFarmingUnit -// // WithdrawFarmingUnit - -// func (suite *KeeperTestSuite) TestFarmingOrderGetSet() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// addr2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // get not available order -// farmingOrder := suite.app.YieldaggregatorKeeper.GetFarmingOrder(suite.ctx, addr1, "OsmoGUUFarm") -// suite.Require().Equal(farmingOrder, types.FarmingOrder{}) - -// // set farming orders -// order1 := types.FarmingOrder{ -// Id: "OsmoGUUFarmOrder", -// FromAddress: addr1.String(), -// Strategy: types.Strategy{ -// StrategyType: "Manual", -// WhitelistedTargetIds: []string{"OsmoGUUFarm"}, -// }, -// } -// order2 := types.FarmingOrder{ -// Id: "EvmosGUUFarmOrder", -// FromAddress: addr2.String(), -// Strategy: types.Strategy{ -// StrategyType: "Manual", -// WhitelistedTargetIds: []string{"EvmosGUUFarm"}, -// }, -// } -// suite.app.YieldaggregatorKeeper.SetFarmingOrder(suite.ctx, order1) -// suite.app.YieldaggregatorKeeper.SetFarmingOrder(suite.ctx, order2) - -// // check farming orders -// farmingOrder = suite.app.YieldaggregatorKeeper.GetFarmingOrder(suite.ctx, addr1, "OsmoGUUFarmOrder") -// suite.Require().Equal(farmingOrder, order1) -// farmingOrder = suite.app.YieldaggregatorKeeper.GetFarmingOrder(suite.ctx, addr2, "EvmosGUUFarmOrder") -// suite.Require().Equal(farmingOrder, order2) -// farmingOrders := suite.app.YieldaggregatorKeeper.GetAllFarmingOrders(suite.ctx) -// suite.Require().Len(farmingOrders, 2) -// farmingOrders = suite.app.YieldaggregatorKeeper.GetFarmingOrdersOfAddress(suite.ctx, addr1) -// suite.Require().Len(farmingOrders, 1) - -// // delete farming order and check -// suite.app.YieldaggregatorKeeper.DeleteFarmingOrder(suite.ctx, addr2, "EvmosGUUFarmOrder") -// farmingOrder = suite.app.YieldaggregatorKeeper.GetFarmingOrder(suite.ctx, addr2, "EvmosGUUFarmOrder") -// suite.Require().Equal(farmingOrder, types.FarmingOrder{}) -// farmingOrders = suite.app.YieldaggregatorKeeper.GetAllFarmingOrders(suite.ctx) -// suite.Require().Len(farmingOrders, 1) - -// // add farming order and check -// err := suite.app.YieldaggregatorKeeper.AddFarmingOrder(suite.ctx, order2) -// suite.Require().NoError(err) -// farmingOrders = suite.app.YieldaggregatorKeeper.GetAllFarmingOrders(suite.ctx) -// suite.Require().Len(farmingOrders, 2) - -// // try adding once more to check error -// err = suite.app.YieldaggregatorKeeper.AddFarmingOrder(suite.ctx, order2) -// suite.Require().Error(err) -// } - -// func (suite *KeeperTestSuite) TestFarmingOrderActivation() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // activate not available order -// err := suite.app.YieldaggregatorKeeper.ActivateFarmingOrder(suite.ctx, addr1, "OsmoGUUFarmOrder") -// suite.Require().Error(err) - -// // inactivate not available order -// err = suite.app.YieldaggregatorKeeper.ActivateFarmingOrder(suite.ctx, addr1, "OsmoGUUFarmOrder") -// suite.Require().Error(err) - -// // set farming order -// order1 := types.FarmingOrder{ -// Id: "OsmoGUUFarmOrder", -// FromAddress: addr1.String(), -// Strategy: types.Strategy{ -// StrategyType: "Manual", -// WhitelistedTargetIds: []string{"OsmoGUUFarm"}, -// }, -// } -// suite.app.YieldaggregatorKeeper.SetFarmingOrder(suite.ctx, order1) - -// // inactivate and check -// err = suite.app.YieldaggregatorKeeper.InactivateFarmingOrder(suite.ctx, addr1, order1.Id) -// suite.Require().NoError(err) -// order := suite.app.YieldaggregatorKeeper.GetFarmingOrder(suite.ctx, addr1, order1.Id) -// suite.Require().False(order.Active) - -// // activate and check -// err = suite.app.YieldaggregatorKeeper.ActivateFarmingOrder(suite.ctx, addr1, order1.Id) -// suite.Require().NoError(err) -// order = suite.app.YieldaggregatorKeeper.GetFarmingOrder(suite.ctx, addr1, order1.Id) -// suite.Require().True(order.Active) -// } - -// func (suite *KeeperTestSuite) TestExecuteFarmingOrders() { -// farmer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// // create asset management account -// amAcc := types.AssetManagementAccount{ -// Id: "OsmosisAssetManager", -// Name: "Osmosis Asset Management Account", -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, amAcc) - -// // create asset management target -// amTarget := types.AssetManagementTarget{ -// Id: "GUUStaking", -// AssetManagementAccountId: amAcc.Id, -// AccountAddress: "", -// AssetConditions: []types.AssetCondition{}, -// UnbondingTime: time.Second, -// IntegrateInfo: types.IntegrateInfo{}, -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementTarget(suite.ctx, amTarget) - -// // deposit "uguu" by farmer -// coins := sdk.Coins{sdk.NewInt64Coin("uguu", 1000000)} -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, farmer, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: farmer.Bytes(), -// Amount: coins, -// ExecuteOrders: false, -// }) -// suite.NoError(err) - -// // create farming order by farmer -// suite.app.YieldaggregatorKeeper.SetFarmingOrder(suite.ctx, types.FarmingOrder{ -// Id: "ExecuteGUUStaking", -// FromAddress: farmer.String(), -// Strategy: types.Strategy{ -// StrategyType: "ManualStrategy", -// WhitelistedTargetIds: []string{amTarget.Id}, -// }, -// MaxUnbondingTime: 0, -// OverallRatio: 1, -// Min: "", -// Max: "", -// Date: now, -// Active: true, -// }) - -// // execute farming order by farmer -// orders := suite.app.YieldaggregatorKeeper.GetFarmingOrdersOfAddress(suite.ctx, farmer) -// suite.app.YieldaggregatorKeeper.ExecuteFarmingOrders(suite.ctx, farmer, orders) - -// // check farm unit created -// farmUnits := suite.app.YieldaggregatorKeeper.GetFarmingUnitsOfAddress(suite.ctx, farmer) -// suite.Require().GreaterOrEqual(len(farmUnits), 1) - -// // check deposit result on yieldfarm module -// farmUnit := farmUnits[0] -// yFarmInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, farmUnit.GetAddress()) -// suite.Require().Equal(yFarmInfo, yieldfarmtypes.FarmerInfo{ -// Account: farmUnit.GetAddress().String(), -// Amount: coins, -// Rewards: sdk.Coins(nil), -// }) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/farming_units.go b/deprecated/x/yieldaggregatorv1/keeper/farming_units.go deleted file mode 100644 index 082fdf9ee..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/farming_units.go +++ /dev/null @@ -1,70 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func (k Keeper) AddFarmingUnit(ctx sdk.Context, obj types.FarmingUnit) error { - unit := k.GetFarmingUnit(ctx, obj.Owner, obj.AccountId, obj.TargetId) - if unit.AccountId != "" { - return types.ErrFarmingUnitAlreadyExists - } - k.SetFarmingUnit(ctx, obj) - return nil -} - -func (k Keeper) GetFarmingUnitsOfAddress(ctx sdk.Context, addr sdk.AccAddress) []types.FarmingUnit { - store := ctx.KVStore(k.storeKey) - - units := []types.FarmingUnit{} - it := sdk.KVStorePrefixIterator(store, append([]byte(types.PrefixKeyFarmingUnit), addr.String()...)) - defer it.Close() - - for ; it.Valid(); it.Next() { - unit := types.FarmingUnit{} - k.cdc.MustUnmarshal(it.Value(), &unit) - - units = append(units, unit) - } - return units -} - -func (k Keeper) SetFarmingUnit(ctx sdk.Context, obj types.FarmingUnit) { - bz := k.cdc.MustMarshal(&obj) - store := ctx.KVStore(k.storeKey) - store.Set(types.FarmingUnitKey(obj.Owner, obj.AccountId, obj.TargetId), bz) -} - -func (k Keeper) DeleteFarmingUnit(ctx sdk.Context, obj types.FarmingUnit) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.FarmingUnitKey(obj.Owner, obj.AccountId, obj.TargetId)) -} - -func (k Keeper) GetFarmingUnit(ctx sdk.Context, addr string, accId, targetId string) types.FarmingUnit { - unit := types.FarmingUnit{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.FarmingUnitKey(addr, accId, targetId)) - if bz == nil { - return unit - } - k.cdc.MustUnmarshal(bz, &unit) - return unit -} - -func (k Keeper) GetAllFarmingUnits(ctx sdk.Context) []types.FarmingUnit { - store := ctx.KVStore(k.storeKey) - - units := []types.FarmingUnit{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyFarmingUnit)) - defer it.Close() - - for ; it.Valid(); it.Next() { - unit := types.FarmingUnit{} - k.cdc.MustUnmarshal(it.Value(), &unit) - - units = append(units, unit) - } - return units -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/farming_units_test.go b/deprecated/x/yieldaggregatorv1/keeper/farming_units_test.go deleted file mode 100644 index d65c66ad1..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/farming_units_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package keeper_test - -// import ( -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestFarmingUnitGetSet() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// addr2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // get not available unit -// farmingUnit := suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(farmingUnit, types.FarmingUnit{}) - -// // set farming units -// unit1 := types.FarmingUnit{ -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Owner: addr1.String(), -// } -// unit2 := types.FarmingUnit{ -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Owner: addr2.String(), -// } -// suite.app.YieldaggregatorKeeper.SetFarmingUnit(suite.ctx, unit1) -// suite.app.YieldaggregatorKeeper.SetFarmingUnit(suite.ctx, unit2) - -// // check farming units -// farmingUnit = suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr1.String(), "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(farmingUnit, unit1) -// farmingUnit = suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr2.String(), "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(farmingUnit, unit2) -// farmingUnits := suite.app.YieldaggregatorKeeper.GetAllFarmingUnits(suite.ctx) -// suite.Require().Len(farmingUnits, 2) -// farmingUnits = suite.app.YieldaggregatorKeeper.GetFarmingUnitsOfAddress(suite.ctx, addr1) -// suite.Require().Len(farmingUnits, 1) - -// // delete farming unit and check -// suite.app.YieldaggregatorKeeper.DeleteFarmingUnit(suite.ctx, unit2) -// farmingUnit = suite.app.YieldaggregatorKeeper.GetFarmingUnit(suite.ctx, addr2.String(), "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(farmingUnit, types.FarmingUnit{}) -// farmingUnits = suite.app.YieldaggregatorKeeper.GetAllFarmingUnits(suite.ctx) -// suite.Require().Len(farmingUnits, 1) - -// // add farming unit and check -// err := suite.app.YieldaggregatorKeeper.AddFarmingUnit(suite.ctx, unit2) -// suite.Require().NoError(err) -// farmingUnits = suite.app.YieldaggregatorKeeper.GetAllFarmingUnits(suite.ctx) -// suite.Require().Len(farmingUnits, 2) - -// // try adding once more to check error -// err = suite.app.YieldaggregatorKeeper.AddFarmingUnit(suite.ctx, unit2) -// suite.Require().Error(err) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/flow_test.go b/deprecated/x/yieldaggregatorv1/keeper/flow_test.go deleted file mode 100644 index 4757f29ff..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/flow_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package keeper_test - -// import ( -// "time" - -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// "github.com/UnUniFi/chain/deprecated/x/yieldfarm" -// yieldfarmtypes "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -// ) - -// func (suite *KeeperTestSuite) TestInvestmentFlow() { -// farmer := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// now := time.Now().UTC() -// suite.ctx = suite.ctx.WithBlockTime(now) - -// // create asset management account -// amAcc := types.AssetManagementAccount{ -// Id: "OsmosisAssetManager", -// Name: "Osmosis Asset Management Account", -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, amAcc) - -// // create asset management target -// amTarget := types.AssetManagementTarget{ -// Id: "GUUStaking", -// AssetManagementAccountId: amAcc.Id, -// AccountAddress: "", -// AssetConditions: []types.AssetCondition{}, -// UnbondingTime: time.Second, -// IntegrateInfo: types.IntegrateInfo{}, -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementTarget(suite.ctx, amTarget) - -// // deposit "uguu" by farmer -// coins := sdk.Coins{sdk.NewInt64Coin("uguu", 1000000)} -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, farmer, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: farmer.Bytes(), -// Amount: coins, -// ExecuteOrders: false, -// }) -// suite.NoError(err) - -// // create farming order by farmer -// suite.app.YieldaggregatorKeeper.SetFarmingOrder(suite.ctx, types.FarmingOrder{ -// Id: "ExecuteGUUStaking", -// FromAddress: farmer.String(), -// Strategy: types.Strategy{ -// StrategyType: "ManualStrategy", -// WhitelistedTargetIds: []string{amTarget.Id}, -// }, -// MaxUnbondingTime: 0, -// OverallRatio: 1, -// Min: "", -// Max: "", -// Date: now, -// Active: true, -// }) - -// // execute farming order by farmer -// orders := suite.app.YieldaggregatorKeeper.GetFarmingOrdersOfAddress(suite.ctx, farmer) -// suite.app.YieldaggregatorKeeper.ExecuteFarmingOrders(suite.ctx, farmer, orders) - -// // check farm unit created -// farmUnits := suite.app.YieldaggregatorKeeper.GetFarmingUnitsOfAddress(suite.ctx, farmer) -// suite.Require().GreaterOrEqual(len(farmUnits), 1) - -// // check deposit result on yieldfarm module -// farmUnit := farmUnits[0] -// yFarmInfo := suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, farmUnit.GetAddress()) -// suite.Require().Equal(yFarmInfo, yieldfarmtypes.FarmerInfo{ -// Account: farmUnit.GetAddress().String(), -// Amount: coins, -// Rewards: sdk.Coins(nil), -// }) - -// // after a day -// future := now.Add(time.Hour * 24) -// suite.ctx = suite.ctx.WithBlockTime(future) - -// // allocate reward -// yieldfarm.EndBlocker(suite.ctx, suite.app.YieldfarmKeeper) - -// // check deposit result on yieldfarm module -// yFarmInfo = suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, farmUnit.GetAddress()) -// suite.Require().Equal(yFarmInfo.Rewards, []sdk.Coin{sdk.NewInt64Coin("uguu", 10000)}) // 1% yield - -// // claim rewards after a time for all units -// suite.app.YieldaggregatorKeeper.ClaimAllFarmUnitRewards(suite.ctx) - -// // check claim result on yieldfarm module -// yFarmInfo = suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, farmUnit.GetAddress()) -// suite.Require().Equal(yFarmInfo.Rewards, []sdk.Coin(nil)) // amount after claim - -// // withdraw from farm unit to user deposit -// err = suite.app.YieldaggregatorKeeper.ClaimWithdrawFromTarget(suite.ctx, farmer, amTarget) -// suite.Require().NoError(err) - -// // execute farming order once more -// suite.app.YieldaggregatorKeeper.ExecuteFarmingOrders(suite.ctx, farmer, orders) - -// // check update farm unit -// farmUnits = suite.app.YieldaggregatorKeeper.GetFarmingUnitsOfAddress(suite.ctx, farmer) -// suite.Require().GreaterOrEqual(len(farmUnits), 1) -// farmUnit = farmUnits[0] -// yFarmInfo = suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, farmUnit.GetAddress()) -// suite.Require().Equal(yFarmInfo.Amount, []sdk.Coin{sdk.NewInt64Coin("uguu", 1010000)}) - -// // stop farming and close farm unit -// err = suite.app.YieldaggregatorKeeper.StopFarmingUnit(suite.ctx, farmUnit) -// suite.Require().NoError(err) - -// // withdraw from farming unit -// err = suite.app.YieldaggregatorKeeper.WithdrawFarmingUnit(suite.ctx, farmUnit) -// suite.Require().NoError(err) - -// // check user deposit balance -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, farmer) -// suite.Require().Equal(deposit, sdk.Coins{sdk.NewInt64Coin("uguu", 1010000)}) - -// // check stop result on yieldfarm module -// yFarmInfo = suite.app.YieldfarmKeeper.GetFarmerInfo(suite.ctx, farmUnit.GetAddress()) -// suite.Require().Equal(yFarmInfo, yieldfarmtypes.FarmerInfo{ -// Account: farmUnit.GetAddress().String(), -// Amount: sdk.Coins(nil), -// Rewards: sdk.Coins(nil), -// }) - -// // withdraw whole "uguu" by farmer -// err = suite.app.YieldaggregatorKeeper.Withdraw(suite.ctx, &types.MsgWithdraw{ -// FromAddress: farmer.Bytes(), -// Amount: deposit, -// }) -// suite.Require().NoError(err) - -// // check user deposit balance -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, farmer) -// suite.Require().Equal(deposit, sdk.Coins(nil)) - -// balance := suite.app.BankKeeper.GetBalance(suite.ctx, farmer, "uguu") -// suite.Require().Equal(balance, sdk.NewInt64Coin("uguu", 1010000)) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/genesis.go b/deprecated/x/yieldaggregatorv1/keeper/genesis.go deleted file mode 100644 index 3fff940cb..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/genesis.go +++ /dev/null @@ -1,56 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) - - for _, acc := range genState.AssetManagementAccounts { - k.SetAssetManagementAccount(ctx, acc) - } - - for _, target := range genState.AssetManagementTargets { - k.SetAssetManagementTarget(ctx, target) - } - - for _, order := range genState.FarmingOrders { - k.SetFarmingOrder(ctx, order) - } - - for _, unit := range genState.FarmingUnits { - k.SetFarmingUnit(ctx, unit) - } - - for _, deposit := range genState.UserDeposits { - addr, err := sdk.AccAddressFromBech32(deposit.User) - if err != nil { - panic(err) - } - k.SetUserDeposit(ctx, addr, deposit.Amount) - } - - for _, reward := range genState.DailyPercents { - k.SetDailyRewardPercent(ctx, reward) - } -} - -// ExportGenesis returns the module's exported genesis. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - genesis := &types.GenesisState{ - Params: k.GetParams(ctx), - AssetManagementAccounts: k.GetAllAssetManagementAccounts(ctx), - AssetManagementTargets: k.GetAllAssetManagementTargets(ctx), - FarmingOrders: k.GetAllFarmingOrders(ctx), - FarmingUnits: k.GetAllFarmingUnits(ctx), - UserDeposits: k.GetAllUserDeposits(ctx), - DailyPercents: k.GetAllDailyRewardPercents(ctx), - } - - return genesis -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/genesis_test.go b/deprecated/x/yieldaggregatorv1/keeper/genesis_test.go deleted file mode 100644 index 26f300828..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/genesis_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package keeper_test - -// import ( -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestGenesis() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// genesisState := types.GenesisState{ -// Params: types.Params{ -// RewardRateFeeders: addr1.String(), -// }, -// AssetManagementAccounts: []types.AssetManagementAccount{ -// { -// Id: "OsmoFarm", -// Name: "Osmosis Farm", -// Enabled: true, -// }, -// }, -// AssetManagementTargets: []types.AssetManagementTarget{ -// { -// Id: "OsmoGUUFarm", -// AssetManagementAccountId: "OsmoFarm", -// Enabled: true, -// AssetConditions: []types.AssetCondition{ -// { -// Denom: "uguu", -// Ratio: 100, -// Min: "", -// }, -// }, -// }, -// }, -// FarmingOrders: []types.FarmingOrder{ -// { -// Id: "OsmoGUUFarmOrder", -// FromAddress: addr1.String(), -// Strategy: types.Strategy{ -// StrategyType: "Manual", -// WhitelistedTargetIds: []string{"OsmoGUUFarm"}, -// }, -// }, -// }, -// FarmingUnits: []types.FarmingUnit{ -// { -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Owner: addr1.String(), -// }, -// }, -// UserDeposits: []types.UserDeposit{ -// { -// User: addr1.String(), -// Amount: sdk.Coins{sdk.NewInt64Coin("uguu", 1)}, -// }, -// }, -// DailyPercents: []types.DailyPercent{ -// { -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Rate: sdk.NewDecWithPrec(1, 1), -// }, -// }, -// } - -// suite.app.YieldaggregatorKeeper.InitGenesis(suite.ctx, genesisState) - -// exportedGenesis := suite.app.YieldaggregatorKeeper.ExportGenesis(suite.ctx) -// suite.Require().Equal(genesisState, *exportedGenesis) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/grpc_query.go b/deprecated/x/yieldaggregatorv1/keeper/grpc_query.go deleted file mode 100644 index 09a7dfccb..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/grpc_query.go +++ /dev/null @@ -1,96 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -var _ types.QueryServer = Keeper{} - -func (k Keeper) AssetManagementAccount(c context.Context, req *types.QueryAssetManagementAccountRequest) (*types.QueryAssetManagementAccountResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - amAcc := k.GetAssetManagementAccount(ctx, req.Id) - targets := k.GetAssetManagementTargetsOfAccount(ctx, req.Id) - return &types.QueryAssetManagementAccountResponse{ - Account: types.AssetManagementAccountInfo{ - Id: amAcc.Id, - Name: amAcc.Name, - AssetManagementTargets: targets, - }, - }, nil -} - -func (k Keeper) AllAssetManagementAccounts(c context.Context, req *types.QueryAllAssetManagementAccountsRequest) (*types.QueryAllAssetManagementAccountsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - amAccs := k.GetAllAssetManagementAccounts(ctx) - amAccInfos := []types.AssetManagementAccountInfo{} - for _, amAcc := range amAccs { - targets := k.GetAssetManagementTargetsOfAccount(ctx, amAcc.Id) - amAccInfos = append(amAccInfos, types.AssetManagementAccountInfo{ - Id: amAcc.Id, - Name: amAcc.Name, - AssetManagementTargets: targets, - }) - } - return &types.QueryAllAssetManagementAccountsResponse{ - Accounts: amAccInfos, - }, nil -} - -func (k Keeper) UserInfo(c context.Context, req *types.QueryUserInfoRequest) (*types.QueryUserInfoResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - addr, err := sdk.AccAddressFromBech32(req.Address) - if err != nil { - return nil, err - } - - orders := k.GetFarmingOrdersOfAddress(ctx, addr) - - deposits := k.GetUserDeposit(ctx, addr) - return &types.QueryUserInfoResponse{ - UserInfo: types.QueryUserInfo{ - Amount: deposits, - FarmingOrders: orders, - FarmedCounter: 0, - }, - }, nil -} - -func (k Keeper) AllFarmingUnits(c context.Context, req *types.QueryAllFarmingUnitsRequest) (*types.QueryAllFarmingUnitsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryAllFarmingUnitsResponse{ - Units: k.GetAllFarmingUnits(ctx), - }, nil -} - -func (k Keeper) DailyRewardPercents(c context.Context, req *types.QueryDailyRewardPercentsRequest) (*types.QueryDailyRewardPercentsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryDailyRewardPercentsResponse{ - DailyPercents: k.GetAllDailyRewardPercents(ctx), - }, nil -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/grpc_query_params.go b/deprecated/x/yieldaggregatorv1/keeper/grpc_query_params.go deleted file mode 100644 index bd0f6cb4d..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/grpc_query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/grpc_query_params_test.go b/deprecated/x/yieldaggregatorv1/keeper/grpc_query_params_test.go deleted file mode 100644 index d290cd94b..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/grpc_query_params_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package keeper_test - -// import ( -// "testing" - -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/stretchr/testify/require" -// testkeeper "github.com/UnUniFi/chain/testutil/keeper" -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func TestParamsQuery(t *testing.T) { -// keeper, ctx := testkeeper.YieldaggregatorKeeper(t) -// wctx := sdk.WrapSDKContext(ctx) -// params := types.DefaultParams() -// keeper.SetParams(ctx, params) - -// response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) -// require.NoError(t, err) -// require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/grpc_query_test.go b/deprecated/x/yieldaggregatorv1/keeper/grpc_query_test.go deleted file mode 100644 index a56e9d114..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/grpc_query_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package keeper_test - -// import ( -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestGRPCQueryAssetManagementAccount() { -// // get not available account -// _, err := suite.app.YieldaggregatorKeeper.AssetManagementAccount(sdk.WrapSDKContext(suite.ctx), &types.QueryAssetManagementAccountRequest{Id: "OsmoFarm"}) -// suite.Require().NoError(err) - -// // set asset management account -// osmoManagementAccount := types.AssetManagementAccount{ -// Id: "OsmoFarm", -// Name: "Osmosis Farm", -// Enabled: true, -// } -// evmosManagementAccount := types.AssetManagementAccount{ -// Id: "EvmosFarm", -// Name: "Evmos Farm", -// Enabled: false, -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, osmoManagementAccount) -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, evmosManagementAccount) - -// // check asset management accounts -// resp, err := suite.app.YieldaggregatorKeeper.AssetManagementAccount(sdk.WrapSDKContext(suite.ctx), &types.QueryAssetManagementAccountRequest{Id: "OsmoFarm"}) -// suite.Require().NoError(err) -// suite.Require().Equal(resp.Account.Id, osmoManagementAccount.Id) -// suite.Require().Equal(resp.Account.Name, osmoManagementAccount.Name) -// resp, err = suite.app.YieldaggregatorKeeper.AssetManagementAccount(sdk.WrapSDKContext(suite.ctx), &types.QueryAssetManagementAccountRequest{Id: "EvmosFarm"}) -// suite.Require().NoError(err) -// suite.Require().Equal(resp.Account.Id, evmosManagementAccount.Id) -// suite.Require().Equal(resp.Account.Name, evmosManagementAccount.Name) -// } - -// func (suite *KeeperTestSuite) TestGRPCQueryAllAssetManagementAccounts() { -// // get all asset management accounts at initial -// resp, err := suite.app.YieldaggregatorKeeper.AllAssetManagementAccounts(sdk.WrapSDKContext(suite.ctx), &types.QueryAllAssetManagementAccountsRequest{}) -// suite.Require().NoError(err) -// suite.Require().Len(resp.Accounts, 0) - -// // set asset management account -// osmoManagementAccount := types.AssetManagementAccount{ -// Id: "OsmoFarm", -// Name: "Osmosis Farm", -// Enabled: true, -// } -// evmosManagementAccount := types.AssetManagementAccount{ -// Id: "EvmosFarm", -// Name: "Evmos Farm", -// Enabled: false, -// } -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, osmoManagementAccount) -// suite.app.YieldaggregatorKeeper.SetAssetManagementAccount(suite.ctx, evmosManagementAccount) - -// // check all asset management accounts -// resp, err = suite.app.YieldaggregatorKeeper.AllAssetManagementAccounts(sdk.WrapSDKContext(suite.ctx), &types.QueryAllAssetManagementAccountsRequest{}) -// suite.Require().NoError(err) -// suite.Require().Len(resp.Accounts, 2) -// } - -// func (suite *KeeperTestSuite) TestGRPCQueryUserInfo() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // get initial user deposit -// resp, err := suite.app.YieldaggregatorKeeper.UserInfo(sdk.WrapSDKContext(suite.ctx), &types.QueryUserInfoRequest{ -// Address: addr1.String(), -// }) -// suite.Require().NoError(err) -// suite.Require().Equal(resp.UserInfo.Amount, []sdk.Coin{}) -// suite.Require().Len(resp.UserInfo.FarmingOrders, 0) - -// // set user deposit -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 10000)) -// suite.app.YieldaggregatorKeeper.SetUserDeposit(suite.ctx, addr1, coins) - -// // check user deposit -// resp, err = suite.app.YieldaggregatorKeeper.UserInfo(sdk.WrapSDKContext(suite.ctx), &types.QueryUserInfoRequest{ -// Address: addr1.String(), -// }) -// suite.Require().NoError(err) -// suite.Require().Equal(resp.UserInfo.Amount, []sdk.Coin(coins)) -// suite.Require().Len(resp.UserInfo.FarmingOrders, 0) -// } - -// func (suite *KeeperTestSuite) TestGRPCQueryAllFarmingUnits() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// addr2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // get not available unit -// resp, err := suite.app.YieldaggregatorKeeper.AllFarmingUnits(sdk.WrapSDKContext(suite.ctx), &types.QueryAllFarmingUnitsRequest{}) -// suite.Require().NoError(err) -// suite.Require().Len(resp.Units, 0) - -// // set farming units -// unit1 := types.FarmingUnit{ -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Owner: addr1.String(), -// } -// unit2 := types.FarmingUnit{ -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Owner: addr2.String(), -// } -// suite.app.YieldaggregatorKeeper.SetFarmingUnit(suite.ctx, unit1) -// suite.app.YieldaggregatorKeeper.SetFarmingUnit(suite.ctx, unit2) - -// // check farming units -// resp, err = suite.app.YieldaggregatorKeeper.AllFarmingUnits(sdk.WrapSDKContext(suite.ctx), &types.QueryAllFarmingUnitsRequest{}) -// suite.Require().NoError(err) -// suite.Require().Len(resp.Units, 2) -// } - -// func (suite *KeeperTestSuite) TestGRPCDailyRewardPercents() { -// // get not available rate -// resp, err := suite.app.YieldaggregatorKeeper.DailyRewardPercents(sdk.WrapSDKContext(suite.ctx), &types.QueryDailyRewardPercentsRequest{}) -// suite.Require().NoError(err) -// suite.Require().Len(resp.DailyPercents, 0) - -// // set rates -// percent1 := types.DailyPercent{ -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Rate: sdk.NewDecWithPrec(1, 1), -// } -// percent2 := types.DailyPercent{ -// AccountId: "EvmosFarm", -// TargetId: "EvmosGUUFarm", -// Rate: sdk.NewDecWithPrec(1, 1), -// } -// suite.app.YieldaggregatorKeeper.SetDailyRewardPercent(suite.ctx, percent1) -// suite.app.YieldaggregatorKeeper.SetDailyRewardPercent(suite.ctx, percent2) - -// // check rates -// resp, err = suite.app.YieldaggregatorKeeper.DailyRewardPercents(sdk.WrapSDKContext(suite.ctx), &types.QueryDailyRewardPercentsRequest{}) -// suite.Require().NoError(err) -// suite.Require().Len(resp.DailyPercents, 2) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/hooks.go b/deprecated/x/yieldaggregatorv1/keeper/hooks.go deleted file mode 100644 index 60de975dd..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/hooks.go +++ /dev/null @@ -1,40 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - epochstypes "github.com/UnUniFi/chain/x/epochs/types" -) - -func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { - // every epoch - epochIdentifier := epochInfo.Identifier - - // process redemption records - if epochIdentifier == epochstypes.BASE_EPOCH { - k.ClaimAllFarmUnitRewards(ctx) - } -} - -func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { -} - -// Hooks wrapper struct for incentives keeper -type Hooks struct { - k Keeper -} - -var _ epochstypes.EpochHooks = Hooks{} - -func (k Keeper) Hooks() Hooks { - return Hooks{k} -} - -// epochs hooks -func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { - h.k.BeforeEpochStart(ctx, epochInfo) -} - -func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { - h.k.AfterEpochEnd(ctx, epochInfo) -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/keeper.go b/deprecated/x/yieldaggregatorv1/keeper/keeper.go deleted file mode 100644 index 3a36f5ac7..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/keeper.go +++ /dev/null @@ -1,55 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" - stakeibckeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" -) - -type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - paramstore paramtypes.Subspace - bankKeeper types.BankKeeper - yieldfarmKeeper types.YieldFarmKeeper - wasmKeeper wasmtypes.ContractOpsKeeper - stakeibcKeeper stakeibckeeper.Keeper -} - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey storetypes.StoreKey, - paramSpace paramtypes.Subspace, - bk types.BankKeeper, - yfk types.YieldFarmKeeper, - wasmKeeper wasmtypes.ContractOpsKeeper, - stakeibcKeeper stakeibckeeper.Keeper, -) Keeper { - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - cdc: cdc, - storeKey: storeKey, - paramstore: paramSpace, - bankKeeper: bk, - yieldfarmKeeper: yfk, - wasmKeeper: wasmKeeper, - stakeibcKeeper: stakeibcKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/keeper_test.go b/deprecated/x/yieldaggregatorv1/keeper/keeper_test.go deleted file mode 100644 index 5fface4cf..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/keeper_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package keeper_test - -// import ( -// "testing" - -// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/stretchr/testify/suite" - -// simapp "github.com/UnUniFi/chain/app" -// ) - -// type KeeperTestSuite struct { -// suite.Suite - -// ctx sdk.Context -// app *simapp.App -// } - -// func (suite *KeeperTestSuite) SetupTest() { -// isCheckTx := false -// app := simapp.Setup(isCheckTx) - -// suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) -// suite.app = app -// } - -// func TestKeeperSuite(t *testing.T) { -// suite.Run(t, new(KeeperTestSuite)) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/msg_server.go b/deprecated/x/yieldaggregatorv1/keeper/msg_server.go deleted file mode 100644 index 0e3b840cd..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/msg_server.go +++ /dev/null @@ -1,142 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} - -func (k msgServer) Deposit(c context.Context, msg *types.MsgDeposit) (*types.MsgDepositResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - err := k.Keeper.Deposit(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgDepositResponse{}, nil -} - -func (k msgServer) Withdraw(c context.Context, msg *types.MsgWithdraw) (*types.MsgWithdrawResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - units := k.Keeper.GetAllFarmingUnits(ctx) - for _, unit := range units { - target := k.GetAssetManagementTarget(ctx, unit.AccountId, unit.TargetId) - err := k.ClaimWithdrawFromTarget(ctx, msg.FromAddress.AccAddress(), target) - fmt.Println("DEBUG Withdraw error", err, target) - if err != nil { - return nil, err - } - } - - err := k.Keeper.Withdraw(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgWithdrawResponse{}, nil -} - -func (k msgServer) AddFarmingOrder(c context.Context, msg *types.MsgAddFarmingOrder) (*types.MsgAddFarmingOrderResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - err := k.Keeper.AddFarmingOrder(ctx, *msg.Order) - if err != nil { - return nil, err - } - return &types.MsgAddFarmingOrderResponse{}, nil -} - -func (k msgServer) DeleteFarmingOrder(c context.Context, msg *types.MsgDeleteFarmingOrder) (*types.MsgDeleteFarmingOrderResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - k.Keeper.DeleteFarmingOrder(ctx, msg.FromAddress.AccAddress(), msg.OrderId) - return &types.MsgDeleteFarmingOrderResponse{}, nil -} - -func (k msgServer) ActivateFarmingOrder(c context.Context, msg *types.MsgActivateFarmingOrder) (*types.MsgActivateFarmingOrderResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - k.Keeper.ActivateFarmingOrder(ctx, msg.FromAddress.AccAddress(), msg.OrderId) - return &types.MsgActivateFarmingOrderResponse{}, nil -} - -func (k msgServer) InactivateFarmingOrder(c context.Context, msg *types.MsgInactivateFarmingOrder) (*types.MsgInactivateFarmingOrderResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - k.Keeper.InactivateFarmingOrder(ctx, msg.FromAddress.AccAddress(), msg.OrderId) - return &types.MsgInactivateFarmingOrderResponse{}, nil -} - -func (k msgServer) ExecuteFarmingOrders(c context.Context, msg *types.MsgExecuteFarmingOrders) (*types.MsgExecuteFarmingOrdersResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - orders := []types.FarmingOrder{} - - for _, orderId := range msg.OrderIds { - order := k.Keeper.GetFarmingOrder(ctx, msg.FromAddress.AccAddress(), orderId) - if order.Id == "" { - return nil, types.ErrFarmingOrderDoesNotExist - } - orders = append(orders, order) - } - err := k.Keeper.ExecuteFarmingOrders(ctx, msg.FromAddress.AccAddress(), orders) - if err != nil { - return nil, err - } - return &types.MsgExecuteFarmingOrdersResponse{}, nil -} - -func (k msgServer) SetDailyRewardPercent(c context.Context, msg *types.MsgSetDailyRewardPercent) (*types.MsgSetDailyRewardPercentResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - params := k.GetParams(ctx) - isFeeder := false - feeders := strings.Split(params.RewardRateFeeders, ",") - for _, feeder := range feeders { - if feeder == msg.FromAddress.AccAddress().String() { - isFeeder = true - } - } - - if !isFeeder { - return nil, types.ErrNotDailyRewardPercentFeeder - } - - k.Keeper.SetDailyRewardPercent(ctx, types.DailyPercent{ - AccountId: msg.AccountId, - TargetId: msg.TargetId, - Rate: msg.Rate, - Date: msg.Date, - }) - return &types.MsgSetDailyRewardPercentResponse{}, nil -} - -func (k msgServer) BeginWithdrawAll(c context.Context, msg *types.MsgBeginWithdrawAll) (*types.MsgBeginWithdrawAllResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - units := k.Keeper.GetFarmingUnitsOfAddress(ctx, msg.FromAddress.AccAddress()) - fmt.Println("DEBUG BeginWithdrawAll", units) - for _, unit := range units { - err := k.Keeper.StopFarmingUnit(ctx, unit) - if err != nil { - return nil, err - } - } - - return &types.MsgBeginWithdrawAllResponse{}, nil -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/msg_server_test.go b/deprecated/x/yieldaggregatorv1/keeper/msg_server_test.go deleted file mode 100644 index 02e5cc8f5..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/msg_server_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package keeper_test - -// import ( -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/keeper" -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestMsgServerSetDailyRewardPercent() { -// addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // when set by not a feeder -// msgServer := keeper.NewMsgServerImpl(suite.app.YieldaggregatorKeeper) -// msg := types.NewMsgSetDailyRewardPercent(addr, "acc1", "tar1", sdk.NewDec(1), 1662433360) -// _, err := msgServer.SetDailyRewardPercent(sdk.WrapSDKContext(suite.ctx), &msg) -// suite.Require().Error(err) - -// // when set by a feeder -// params := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) -// params.RewardRateFeeders = addr.String() -// suite.app.YieldaggregatorKeeper.SetParams(suite.ctx, params) -// _, err = msgServer.SetDailyRewardPercent(sdk.WrapSDKContext(suite.ctx), &msg) -// suite.Require().NoError(err) - -// // check result -// percent := suite.app.YieldaggregatorKeeper.GetDailyRewardPercent(suite.ctx, "acc1", "tar1") -// suite.Require().Equal(percent.Rate, msg.Rate) -// suite.Require().Equal(percent.Date, msg.Date) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/params.go b/deprecated/x/yieldaggregatorv1/keeper/params.go deleted file mode 100644 index 015433b9d..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/params.go +++ /dev/null @@ -1,18 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/params_test.go b/deprecated/x/yieldaggregatorv1/keeper/params_test.go deleted file mode 100644 index 95018eec2..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/params_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper_test - -// import ( -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// ) - -// func (suite *KeeperTestSuite) TestParamsGetSet() { -// params := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) - -// addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// params.RewardRateFeeders = addr.String() - -// suite.app.YieldaggregatorKeeper.SetParams(suite.ctx, params) -// newParams := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) -// suite.Require().Equal(params, newParams) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/reward_rate.go b/deprecated/x/yieldaggregatorv1/keeper/reward_rate.go deleted file mode 100644 index 8f1eaf452..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/reward_rate.go +++ /dev/null @@ -1,45 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func (k Keeper) SetDailyRewardPercent(ctx sdk.Context, obj types.DailyPercent) { - bz := k.cdc.MustMarshal(&obj) - store := ctx.KVStore(k.storeKey) - store.Set(types.DailyRewardKey(obj.AccountId, obj.TargetId), bz) -} - -func (k Keeper) DeleteDailyRewardPercent(ctx sdk.Context, obj types.DailyPercent) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.DailyRewardKey(obj.AccountId, obj.TargetId)) -} - -func (k Keeper) GetDailyRewardPercent(ctx sdk.Context, accId, targetId string) types.DailyPercent { - percent := types.DailyPercent{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.DailyRewardKey(accId, targetId)) - if bz == nil { - return percent - } - k.cdc.MustUnmarshal(bz, &percent) - return percent -} - -func (k Keeper) GetAllDailyRewardPercents(ctx sdk.Context) []types.DailyPercent { - store := ctx.KVStore(k.storeKey) - - percents := []types.DailyPercent{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyDailyPercent)) - defer it.Close() - - for ; it.Valid(); it.Next() { - percent := types.DailyPercent{} - k.cdc.MustUnmarshal(it.Value(), &percent) - - percents = append(percents, percent) - } - return percents -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/reward_rate_test.go b/deprecated/x/yieldaggregatorv1/keeper/reward_rate_test.go deleted file mode 100644 index 3ca747637..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/reward_rate_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package keeper_test - -// import ( -// sdk "github.com/cosmos/cosmos-sdk/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestDailyRewardPercentGetSet() { -// // get not available rate -// percent := suite.app.YieldaggregatorKeeper.GetDailyRewardPercent(suite.ctx, "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(percent, types.DailyPercent{}) - -// // set rates -// percent1 := types.DailyPercent{ -// AccountId: "OsmoFarm", -// TargetId: "OsmoGUUFarm", -// Rate: sdk.NewDecWithPrec(1, 1), -// } -// percent2 := types.DailyPercent{ -// AccountId: "EvmosFarm", -// TargetId: "EvmosGUUFarm", -// Rate: sdk.NewDecWithPrec(1, 1), -// } -// suite.app.YieldaggregatorKeeper.SetDailyRewardPercent(suite.ctx, percent1) -// suite.app.YieldaggregatorKeeper.SetDailyRewardPercent(suite.ctx, percent2) - -// // check rates -// percent = suite.app.YieldaggregatorKeeper.GetDailyRewardPercent(suite.ctx, "OsmoFarm", "OsmoGUUFarm") -// suite.Require().Equal(percent, percent1) -// percent = suite.app.YieldaggregatorKeeper.GetDailyRewardPercent(suite.ctx, "EvmosFarm", "EvmosGUUFarm") -// suite.Require().Equal(percent, percent2) -// percents := suite.app.YieldaggregatorKeeper.GetAllDailyRewardPercents(suite.ctx) -// suite.Require().Len(percents, 2) - -// // delete rate and check -// suite.app.YieldaggregatorKeeper.DeleteDailyRewardPercent(suite.ctx, percent2) -// percent = suite.app.YieldaggregatorKeeper.GetDailyRewardPercent(suite.ctx, "EvmosFarm", "EvmosGUUFarm") -// suite.Require().Equal(percent, types.DailyPercent{}) -// percents = suite.app.YieldaggregatorKeeper.GetAllDailyRewardPercents(suite.ctx) -// suite.Require().Len(percents, 1) -// } diff --git a/deprecated/x/yieldaggregatorv1/keeper/user.go b/deprecated/x/yieldaggregatorv1/keeper/user.go deleted file mode 100644 index c47f7c704..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/user.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// deposit -func (k Keeper) Deposit(ctx sdk.Context, msg *types.MsgDeposit) error { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, msg.FromAddress.AccAddress(), types.ModuleName, msg.Amount) - if err != nil { - return err - } - - k.IncreaseUserDeposit(ctx, msg.FromAddress.AccAddress(), msg.Amount) - - return nil -} - -// withdraw -func (k Keeper) Withdraw(ctx sdk.Context, msg *types.MsgWithdraw) error { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, msg.FromAddress.AccAddress(), msg.Amount) - if err != nil { - return err - } - - k.DecreaseUserDeposit(ctx, msg.FromAddress.AccAddress(), msg.Amount) - return nil -} - -func (k Keeper) GetAllUserDeposits(ctx sdk.Context) []types.UserDeposit { - store := ctx.KVStore(k.storeKey) - - deposits := []types.UserDeposit{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyUserDeposit)) - defer it.Close() - - for ; it.Valid(); it.Next() { - deposit := types.UserDeposit{} - k.cdc.MustUnmarshal(it.Value(), &deposit) - - deposits = append(deposits, deposit) - } - return deposits -} - -func (k Keeper) SetUserDeposit(ctx sdk.Context, addr sdk.AccAddress, amount sdk.Coins) { - bz := k.cdc.MustMarshal(&types.UserDeposit{ - User: addr.String(), - Amount: amount, - }) - store := ctx.KVStore(k.storeKey) - store.Set(types.UserDepositKey(addr), bz) -} - -func (k Keeper) DeleteUserDeposit(ctx sdk.Context, addr sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.UserDepositKey(addr)) -} - -func (k Keeper) GetUserDeposit(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { - deposit := types.UserDeposit{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.UserDepositKey(addr)) - if bz == nil { - return sdk.Coins{} - } - k.cdc.MustUnmarshal(bz, &deposit) - return deposit.Amount -} - -func (k Keeper) IncreaseUserDeposit(ctx sdk.Context, addr sdk.AccAddress, amount sdk.Coins) { - deposit := k.GetUserDeposit(ctx, addr) - deposit = deposit.Add(amount...) - k.SetUserDeposit(ctx, addr, deposit) -} - -func (k Keeper) DecreaseUserDeposit(ctx sdk.Context, addr sdk.AccAddress, amount sdk.Coins) { - deposit := k.GetUserDeposit(ctx, addr) - deposit = deposit.Sub(amount...) - k.SetUserDeposit(ctx, addr, deposit) -} diff --git a/deprecated/x/yieldaggregatorv1/keeper/user_test.go b/deprecated/x/yieldaggregatorv1/keeper/user_test.go deleted file mode 100644 index eb5284688..000000000 --- a/deprecated/x/yieldaggregatorv1/keeper/user_test.go +++ /dev/null @@ -1,122 +0,0 @@ -package keeper_test - -// import ( -// "github.com/cometbft/cometbft/crypto/ed25519" -// sdk "github.com/cosmos/cosmos-sdk/types" -// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - -// "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -// ) - -// func (suite *KeeperTestSuite) TestUserDepositGetSet() { -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// addr2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // get initial user deposit -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().Equal(deposit, sdk.Coins{}) - -// // set user deposit -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 10000)) -// suite.app.YieldaggregatorKeeper.SetUserDeposit(suite.ctx, addr1, coins) -// suite.app.YieldaggregatorKeeper.SetUserDeposit(suite.ctx, addr2, coins) - -// // check user deposit -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().Equal(deposit, coins) -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr2) -// suite.Require().Equal(deposit, coins) -// deposits := suite.app.YieldaggregatorKeeper.GetAllUserDeposits(suite.ctx) -// suite.Require().Len(deposits, 2) - -// // delete user deposit and check -// suite.app.YieldaggregatorKeeper.DeleteUserDeposit(suite.ctx, addr2) -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr2) -// suite.Require().Equal(deposit, sdk.Coins{}) - -// // increase user deposit and check -// suite.app.YieldaggregatorKeeper.IncreaseUserDeposit(suite.ctx, addr2, coins) -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr2) -// suite.Require().Equal(deposit, coins) - -// // decrease user deposit and check -// suite.app.YieldaggregatorKeeper.DecreaseUserDeposit(suite.ctx, addr2, coins) -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr2) -// suite.Require().Equal(deposit, sdk.Coins(nil)) - -// // increase user deposit and check again -// suite.app.YieldaggregatorKeeper.IncreaseUserDeposit(suite.ctx, addr2, coins) -// deposit = suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr2) -// suite.Require().Equal(deposit, coins) -// } - -// func (suite *KeeperTestSuite) TestDeposit() { -// // try deposit when not enough balance -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// err := suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().Error(err) - -// // deposit success when enough balance exists -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) - -// // check balance changes for deposit user + module account -// balance := suite.app.BankKeeper.GetBalance(suite.ctx, addr1, "uguu") -// suite.Require().Equal(balance, sdk.NewInt64Coin("uguu", 0)) -// moduleAddr := suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) -// balance = suite.app.BankKeeper.GetBalance(suite.ctx, moduleAddr, "uguu") -// suite.Require().Equal(balance, coins[0]) - -// // check user deposit increase -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().Equal(deposit, coins) -// } - -// func (suite *KeeperTestSuite) TestWithdraw() { -// // try withdraw when not enough deposit exists -// addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// coins := sdk.NewCoins(sdk.NewInt64Coin("uguu", 1000)) -// err := suite.app.YieldaggregatorKeeper.Withdraw(suite.ctx, &types.MsgWithdraw{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().Error(err) - -// // withdraw when enough deposit exists -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr1, coins) -// suite.NoError(err) -// err = suite.app.YieldaggregatorKeeper.Deposit(suite.ctx, &types.MsgDeposit{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) -// err = suite.app.YieldaggregatorKeeper.Withdraw(suite.ctx, &types.MsgWithdraw{ -// FromAddress: addr1.Bytes(), -// Amount: coins, -// }) -// suite.Require().NoError(err) - -// // check balance changes for withdrawn user + module account -// balance := suite.app.BankKeeper.GetBalance(suite.ctx, addr1, "uguu") -// suite.Require().Equal(balance, coins[0]) -// moduleAddr := suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) -// balance = suite.app.BankKeeper.GetBalance(suite.ctx, moduleAddr, "uguu") -// suite.Require().Equal(balance, sdk.NewInt64Coin("uguu", 0)) - -// // check user deposit decrease -// deposit := suite.app.YieldaggregatorKeeper.GetUserDeposit(suite.ctx, addr1) -// suite.Require().Nil(deposit) -// } diff --git a/deprecated/x/yieldaggregatorv1/module.go b/deprecated/x/yieldaggregatorv1/module.go deleted file mode 100644 index e000bc4a2..000000000 --- a/deprecated/x/yieldaggregatorv1/module.go +++ /dev/null @@ -1,165 +0,0 @@ -package yieldaggregator - -import ( - "encoding/json" - "fmt" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/client/cli" - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/keeper" - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - am.keeper.InitGenesis(ctx, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/deprecated/x/yieldaggregatorv1/module_simulation.go b/deprecated/x/yieldaggregatorv1/module_simulation.go deleted file mode 100644 index c2b458f7d..000000000 --- a/deprecated/x/yieldaggregatorv1/module_simulation.go +++ /dev/null @@ -1,51 +0,0 @@ -package yieldaggregator - -import ( - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - - yieldaggregatorsimulation "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/simulation" - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// avoid unused import issue -var ( - _ = yieldaggregatorsimulation.FindAccount - _ = simtestutil.StakePerAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace -) - -const () - -// GenerateGenesisState creates a randomized GenState of the module -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - yieldaggregatorGenesis := types.GenesisState{ - Params: types.DefaultParams(), - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&yieldaggregatorGenesis) -} - -// ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RegisterStoreDecoder registers a decoder -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - return operations -} diff --git a/deprecated/x/yieldaggregatorv1/proposal_handler.go b/deprecated/x/yieldaggregatorv1/proposal_handler.go deleted file mode 100644 index f7c647b99..000000000 --- a/deprecated/x/yieldaggregatorv1/proposal_handler.go +++ /dev/null @@ -1,104 +0,0 @@ -package yieldaggregator - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/keeper" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -// NewYieldAggregatorProposalHandler creates a new governance Handler -func NewProposalHandler(k keeper.Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *types.ProposalAddYieldFarm: - return handleProposalAddYieldFarm(ctx, k, c) - case *types.ProposalUpdateYieldFarm: - return handleProposalUpdateYieldFarm(ctx, k, c) - case *types.ProposalStopYieldFarm: - return handleProposalStopYieldFarm(ctx, k, c) - case *types.ProposalRemoveYieldFarm: - return handleProposalRemoveYieldFarm(ctx, k, c) - case *types.ProposalAddYieldFarmTarget: - return handleProposalAddYieldFarmTarget(ctx, k, c) - case *types.ProposalUpdateYieldFarmTarget: - return handleProposalUpdateYieldFarmTarget(ctx, k, c) - case *types.ProposalStopYieldFarmTarget: - return handleProposalStopYieldFarmTarget(ctx, k, c) - case *types.ProposalRemoveYieldFarmTarget: - return handleProposalRemoveYieldFarmTarget(ctx, k, c) - - default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized param proposal content type: %T", c) - } - } -} - -func handleProposalAddYieldFarm(ctx sdk.Context, k keeper.Keeper, p *types.ProposalAddYieldFarm) error { - return k.AddAssetManagementAccount(ctx, p.Account.Id, p.Account.Name) -} - -func handleProposalUpdateYieldFarm(ctx sdk.Context, k keeper.Keeper, p *types.ProposalUpdateYieldFarm) error { - return k.UpdateAssetManagementAccount(ctx, *p.Account) -} - -func handleProposalStopYieldFarm(ctx sdk.Context, k keeper.Keeper, p *types.ProposalStopYieldFarm) error { - acc := k.GetAssetManagementAccount(ctx, p.Id) - if acc.Id == "" { - return types.ErrAssetManagementAccountDoesNotExists - } - acc.Enabled = false - k.SetAssetManagementAccount(ctx, acc) - return nil -} - -func handleProposalRemoveYieldFarm(ctx sdk.Context, k keeper.Keeper, p *types.ProposalRemoveYieldFarm) error { - acc := k.GetAssetManagementAccount(ctx, p.Id) - if acc.Id == "" { - return types.ErrAssetManagementAccountDoesNotExists - } - k.DeleteAssetManagementAccount(ctx, p.Id) - k.DeleteAssetManagementTargetsOfAccount(ctx, p.Id) - return nil -} - -func handleProposalAddYieldFarmTarget(ctx sdk.Context, k keeper.Keeper, p *types.ProposalAddYieldFarmTarget) error { - k.SetAssetManagementTarget(ctx, *p.Target) - return nil -} - -func handleProposalUpdateYieldFarmTarget(ctx sdk.Context, k keeper.Keeper, p *types.ProposalUpdateYieldFarmTarget) error { - // TODO: should automatically withdraw all the funds from the target - target := k.GetAssetManagementTarget(ctx, p.Target.AssetManagementAccountId, p.Target.Id) - if target.Id == "" { - return types.ErrNoAssetManagementTargetExists - } - k.SetAssetManagementTarget(ctx, *p.Target) - return nil -} - -func handleProposalStopYieldFarmTarget(ctx sdk.Context, k keeper.Keeper, p *types.ProposalStopYieldFarmTarget) error { - // TODO: should automatically withdraw all the funds from the target - - target := k.GetAssetManagementTarget(ctx, p.AssetManagementAccountId, p.Id) - if target.Id == "" { - return types.ErrNoAssetManagementTargetExists - } - target.Enabled = false - k.SetAssetManagementTarget(ctx, target) - return nil -} - -func handleProposalRemoveYieldFarmTarget(ctx sdk.Context, k keeper.Keeper, p *types.ProposalRemoveYieldFarmTarget) error { - // TODO: should ensure that all the tokens are unbonded via stop proposal - - target := k.GetAssetManagementTarget(ctx, p.AssetManagementAccountId, p.Id) - if target.Id == "" { - return types.ErrNoAssetManagementTargetExists - } - k.DeleteAssetManagementTarget(ctx, p.AssetManagementAccountId, p.Id) - return nil -} diff --git a/deprecated/x/yieldaggregatorv1/types/asset.pb.go b/deprecated/x/yieldaggregatorv1/types/asset.pb.go deleted file mode 100644 index 2936d0dcd..000000000 --- a/deprecated/x/yieldaggregatorv1/types/asset.pb.go +++ /dev/null @@ -1,3927 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldaggregatorv1/asset.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type IntegrateType int32 - -const ( - IntegrateType_GOLANG_MOD IntegrateType = 0 - IntegrateType_COSMWASM IntegrateType = 1 -) - -var IntegrateType_name = map[int32]string{ - 0: "GOLANG_MOD", - 1: "COSMWASM", -} - -var IntegrateType_value = map[string]int32{ - "GOLANG_MOD": 0, - "COSMWASM": 1, -} - -func (x IntegrateType) String() string { - return proto.EnumName(IntegrateType_name, int32(x)) -} - -func (IntegrateType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{0} -} - -type IntegrateInfo struct { - Type IntegrateType `protobuf:"varint,1,opt,name=type,proto3,enum=ununifi.chain.yieldaggregator.IntegrateType" json:"type,omitempty"` - // for cosmwasm contract - ContractIbcPortId string `protobuf:"bytes,2,opt,name=contract_ibc_port_id,json=contractIbcPortId,proto3" json:"contract_ibc_port_id,omitempty"` - // for golang module - ModName string `protobuf:"bytes,3,opt,name=mod_name,json=modName,proto3" json:"mod_name,omitempty"` -} - -func (m *IntegrateInfo) Reset() { *m = IntegrateInfo{} } -func (m *IntegrateInfo) String() string { return proto.CompactTextString(m) } -func (*IntegrateInfo) ProtoMessage() {} -func (*IntegrateInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{0} -} -func (m *IntegrateInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IntegrateInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IntegrateInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *IntegrateInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_IntegrateInfo.Merge(m, src) -} -func (m *IntegrateInfo) XXX_Size() int { - return m.Size() -} -func (m *IntegrateInfo) XXX_DiscardUnknown() { - xxx_messageInfo_IntegrateInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_IntegrateInfo proto.InternalMessageInfo - -func (m *IntegrateInfo) GetType() IntegrateType { - if m != nil { - return m.Type - } - return IntegrateType_GOLANG_MOD -} - -func (m *IntegrateInfo) GetContractIbcPortId() string { - if m != nil { - return m.ContractIbcPortId - } - return "" -} - -func (m *IntegrateInfo) GetModName() string { - if m != nil { - return m.ModName - } - return "" -} - -type AssetCondition struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Min string `protobuf:"bytes,2,opt,name=min,proto3" json:"min,omitempty"` - Ratio uint32 `protobuf:"varint,3,opt,name=ratio,proto3" json:"ratio,omitempty"` -} - -func (m *AssetCondition) Reset() { *m = AssetCondition{} } -func (m *AssetCondition) String() string { return proto.CompactTextString(m) } -func (*AssetCondition) ProtoMessage() {} -func (*AssetCondition) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{1} -} -func (m *AssetCondition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetCondition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetCondition.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AssetCondition) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetCondition.Merge(m, src) -} -func (m *AssetCondition) XXX_Size() int { - return m.Size() -} -func (m *AssetCondition) XXX_DiscardUnknown() { - xxx_messageInfo_AssetCondition.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetCondition proto.InternalMessageInfo - -func (m *AssetCondition) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *AssetCondition) GetMin() string { - if m != nil { - return m.Min - } - return "" -} - -func (m *AssetCondition) GetRatio() uint32 { - if m != nil { - return m.Ratio - } - return 0 -} - -type AssetManagementTarget struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - AssetManagementAccountId string `protobuf:"bytes,2,opt,name=asset_management_account_id,json=assetManagementAccountId,proto3" json:"asset_management_account_id,omitempty"` - AccountAddress string `protobuf:"bytes,4,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"` - AssetConditions []AssetCondition `protobuf:"bytes,5,rep,name=asset_conditions,json=assetConditions,proto3" json:"asset_conditions"` - UnbondingTime time.Duration `protobuf:"bytes,6,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time"` - IntegrateInfo IntegrateInfo `protobuf:"bytes,7,opt,name=integrate_info,json=integrateInfo,proto3" json:"integrate_info"` - Enabled bool `protobuf:"varint,8,opt,name=enabled,proto3" json:"enabled,omitempty"` -} - -func (m *AssetManagementTarget) Reset() { *m = AssetManagementTarget{} } -func (m *AssetManagementTarget) String() string { return proto.CompactTextString(m) } -func (*AssetManagementTarget) ProtoMessage() {} -func (*AssetManagementTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{2} -} -func (m *AssetManagementTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetManagementTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetManagementTarget.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AssetManagementTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetManagementTarget.Merge(m, src) -} -func (m *AssetManagementTarget) XXX_Size() int { - return m.Size() -} -func (m *AssetManagementTarget) XXX_DiscardUnknown() { - xxx_messageInfo_AssetManagementTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetManagementTarget proto.InternalMessageInfo - -func (m *AssetManagementTarget) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *AssetManagementTarget) GetAssetManagementAccountId() string { - if m != nil { - return m.AssetManagementAccountId - } - return "" -} - -func (m *AssetManagementTarget) GetAccountAddress() string { - if m != nil { - return m.AccountAddress - } - return "" -} - -func (m *AssetManagementTarget) GetAssetConditions() []AssetCondition { - if m != nil { - return m.AssetConditions - } - return nil -} - -func (m *AssetManagementTarget) GetUnbondingTime() time.Duration { - if m != nil { - return m.UnbondingTime - } - return 0 -} - -func (m *AssetManagementTarget) GetIntegrateInfo() IntegrateInfo { - if m != nil { - return m.IntegrateInfo - } - return IntegrateInfo{} -} - -func (m *AssetManagementTarget) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -type AssetManagementAccount struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` -} - -func (m *AssetManagementAccount) Reset() { *m = AssetManagementAccount{} } -func (m *AssetManagementAccount) String() string { return proto.CompactTextString(m) } -func (*AssetManagementAccount) ProtoMessage() {} -func (*AssetManagementAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{3} -} -func (m *AssetManagementAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetManagementAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetManagementAccount.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AssetManagementAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetManagementAccount.Merge(m, src) -} -func (m *AssetManagementAccount) XXX_Size() int { - return m.Size() -} -func (m *AssetManagementAccount) XXX_DiscardUnknown() { - xxx_messageInfo_AssetManagementAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetManagementAccount proto.InternalMessageInfo - -func (m *AssetManagementAccount) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *AssetManagementAccount) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *AssetManagementAccount) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -type FarmingOrder struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - FromAddress string `protobuf:"bytes,2,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Strategy Strategy `protobuf:"bytes,3,opt,name=strategy,proto3" json:"strategy"` - MaxUnbondingTime time.Duration `protobuf:"bytes,4,opt,name=max_unbonding_time,json=maxUnbondingTime,proto3,stdduration" json:"max_unbonding_time"` - OverallRatio uint32 `protobuf:"varint,5,opt,name=overall_ratio,json=overallRatio,proto3" json:"overall_ratio,omitempty"` - Min string `protobuf:"bytes,6,opt,name=min,proto3" json:"min,omitempty"` - Max string `protobuf:"bytes,7,opt,name=max,proto3" json:"max,omitempty"` - Date time.Time `protobuf:"bytes,8,opt,name=date,proto3,stdtime" json:"date"` - Active bool `protobuf:"varint,9,opt,name=active,proto3" json:"active,omitempty"` -} - -func (m *FarmingOrder) Reset() { *m = FarmingOrder{} } -func (m *FarmingOrder) String() string { return proto.CompactTextString(m) } -func (*FarmingOrder) ProtoMessage() {} -func (*FarmingOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{4} -} -func (m *FarmingOrder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FarmingOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FarmingOrder.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FarmingOrder) XXX_Merge(src proto.Message) { - xxx_messageInfo_FarmingOrder.Merge(m, src) -} -func (m *FarmingOrder) XXX_Size() int { - return m.Size() -} -func (m *FarmingOrder) XXX_DiscardUnknown() { - xxx_messageInfo_FarmingOrder.DiscardUnknown(m) -} - -var xxx_messageInfo_FarmingOrder proto.InternalMessageInfo - -func (m *FarmingOrder) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *FarmingOrder) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *FarmingOrder) GetStrategy() Strategy { - if m != nil { - return m.Strategy - } - return Strategy{} -} - -func (m *FarmingOrder) GetMaxUnbondingTime() time.Duration { - if m != nil { - return m.MaxUnbondingTime - } - return 0 -} - -func (m *FarmingOrder) GetOverallRatio() uint32 { - if m != nil { - return m.OverallRatio - } - return 0 -} - -func (m *FarmingOrder) GetMin() string { - if m != nil { - return m.Min - } - return "" -} - -func (m *FarmingOrder) GetMax() string { - if m != nil { - return m.Max - } - return "" -} - -func (m *FarmingOrder) GetDate() time.Time { - if m != nil { - return m.Date - } - return time.Time{} -} - -func (m *FarmingOrder) GetActive() bool { - if m != nil { - return m.Active - } - return false -} - -type UserInfo struct { - User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - Amount []types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount"` - FarmingOrders []*FarmingOrder `protobuf:"bytes,3,rep,name=farming_orders,json=farmingOrders,proto3" json:"farming_orders,omitempty"` - FarmedCounter uint64 `protobuf:"varint,4,opt,name=farmed_counter,json=farmedCounter,proto3" json:"farmed_counter,omitempty"` -} - -func (m *UserInfo) Reset() { *m = UserInfo{} } -func (m *UserInfo) String() string { return proto.CompactTextString(m) } -func (*UserInfo) ProtoMessage() {} -func (*UserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{5} -} -func (m *UserInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UserInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *UserInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserInfo.Merge(m, src) -} -func (m *UserInfo) XXX_Size() int { - return m.Size() -} -func (m *UserInfo) XXX_DiscardUnknown() { - xxx_messageInfo_UserInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_UserInfo proto.InternalMessageInfo - -func (m *UserInfo) GetUser() string { - if m != nil { - return m.User - } - return "" -} - -func (m *UserInfo) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -func (m *UserInfo) GetFarmingOrders() []*FarmingOrder { - if m != nil { - return m.FarmingOrders - } - return nil -} - -func (m *UserInfo) GetFarmedCounter() uint64 { - if m != nil { - return m.FarmedCounter - } - return 0 -} - -type UserDeposit struct { - User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - Amount []types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount"` -} - -func (m *UserDeposit) Reset() { *m = UserDeposit{} } -func (m *UserDeposit) String() string { return proto.CompactTextString(m) } -func (*UserDeposit) ProtoMessage() {} -func (*UserDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{6} -} -func (m *UserDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UserDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UserDeposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *UserDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserDeposit.Merge(m, src) -} -func (m *UserDeposit) XXX_Size() int { - return m.Size() -} -func (m *UserDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_UserDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_UserDeposit proto.InternalMessageInfo - -func (m *UserDeposit) GetUser() string { - if m != nil { - return m.User - } - return "" -} - -func (m *UserDeposit) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -// FarmingUnit is managing users' investment on a yield farm target -// Here, amount field is the amount withdrawable instantly, staked amount on yield farms are not calculated here -// since the value of staked amount could change after deposit - it's only determined at the time of withdrawal -// from the farm -type FarmingUnit struct { - AccountId string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` - TargetId string `protobuf:"bytes,2,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` - Amount []types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` - FarmingStartTime string `protobuf:"bytes,4,opt,name=farming_start_time,json=farmingStartTime,proto3" json:"farming_start_time,omitempty"` - UnbondingStarttime time.Time `protobuf:"bytes,5,opt,name=unbonding_starttime,json=unbondingStarttime,proto3,stdtime" json:"unbonding_starttime"` - Owner string `protobuf:"bytes,6,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *FarmingUnit) Reset() { *m = FarmingUnit{} } -func (m *FarmingUnit) String() string { return proto.CompactTextString(m) } -func (*FarmingUnit) ProtoMessage() {} -func (*FarmingUnit) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{7} -} -func (m *FarmingUnit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FarmingUnit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FarmingUnit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FarmingUnit) XXX_Merge(src proto.Message) { - xxx_messageInfo_FarmingUnit.Merge(m, src) -} -func (m *FarmingUnit) XXX_Size() int { - return m.Size() -} -func (m *FarmingUnit) XXX_DiscardUnknown() { - xxx_messageInfo_FarmingUnit.DiscardUnknown(m) -} - -var xxx_messageInfo_FarmingUnit proto.InternalMessageInfo - -func (m *FarmingUnit) GetAccountId() string { - if m != nil { - return m.AccountId - } - return "" -} - -func (m *FarmingUnit) GetTargetId() string { - if m != nil { - return m.TargetId - } - return "" -} - -func (m *FarmingUnit) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -func (m *FarmingUnit) GetFarmingStartTime() string { - if m != nil { - return m.FarmingStartTime - } - return "" -} - -func (m *FarmingUnit) GetUnbondingStarttime() time.Time { - if m != nil { - return m.UnbondingStarttime - } - return time.Time{} -} - -func (m *FarmingUnit) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -// Strategy types -// recent30DaysHighDPRStrategy - Invest in the best DPR destination in the last 30 days on average -// recent1DayHighDPRStrategy - Invest in the best DPR destination in the last average day -// notHaveDPRStrategy - Invest in something that does not have a DPR. -// ManualStrategy - Manual investment, whiteTargetIdlist required. -type Strategy struct { - StrategyType string `protobuf:"bytes,1,opt,name=strategy_type,json=strategyType,proto3" json:"strategy_type,omitempty"` - WhitelistedTargetIds []string `protobuf:"bytes,2,rep,name=whitelisted_target_ids,json=whitelistedTargetIds,proto3" json:"whitelisted_target_ids,omitempty"` - BlacklistedTargetIds []string `protobuf:"bytes,3,rep,name=blacklisted_target_ids,json=blacklistedTargetIds,proto3" json:"blacklisted_target_ids,omitempty"` -} - -func (m *Strategy) Reset() { *m = Strategy{} } -func (m *Strategy) String() string { return proto.CompactTextString(m) } -func (*Strategy) ProtoMessage() {} -func (*Strategy) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{8} -} -func (m *Strategy) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Strategy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Strategy.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Strategy) XXX_Merge(src proto.Message) { - xxx_messageInfo_Strategy.Merge(m, src) -} -func (m *Strategy) XXX_Size() int { - return m.Size() -} -func (m *Strategy) XXX_DiscardUnknown() { - xxx_messageInfo_Strategy.DiscardUnknown(m) -} - -var xxx_messageInfo_Strategy proto.InternalMessageInfo - -func (m *Strategy) GetStrategyType() string { - if m != nil { - return m.StrategyType - } - return "" -} - -func (m *Strategy) GetWhitelistedTargetIds() []string { - if m != nil { - return m.WhitelistedTargetIds - } - return nil -} - -func (m *Strategy) GetBlacklistedTargetIds() []string { - if m != nil { - return m.BlacklistedTargetIds - } - return nil -} - -type DailyPercent struct { - AccountId string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` - TargetId string `protobuf:"bytes,2,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` - Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` - Date time.Time `protobuf:"bytes,4,opt,name=date,proto3,stdtime" json:"date"` -} - -func (m *DailyPercent) Reset() { *m = DailyPercent{} } -func (m *DailyPercent) String() string { return proto.CompactTextString(m) } -func (*DailyPercent) ProtoMessage() {} -func (*DailyPercent) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{9} -} -func (m *DailyPercent) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DailyPercent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DailyPercent.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DailyPercent) XXX_Merge(src proto.Message) { - xxx_messageInfo_DailyPercent.Merge(m, src) -} -func (m *DailyPercent) XXX_Size() int { - return m.Size() -} -func (m *DailyPercent) XXX_DiscardUnknown() { - xxx_messageInfo_DailyPercent.DiscardUnknown(m) -} - -var xxx_messageInfo_DailyPercent proto.InternalMessageInfo - -func (m *DailyPercent) GetAccountId() string { - if m != nil { - return m.AccountId - } - return "" -} - -func (m *DailyPercent) GetTargetId() string { - if m != nil { - return m.TargetId - } - return "" -} - -func (m *DailyPercent) GetDate() time.Time { - if m != nil { - return m.Date - } - return time.Time{} -} - -type DepositAllocation struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *DepositAllocation) Reset() { *m = DepositAllocation{} } -func (m *DepositAllocation) String() string { return proto.CompactTextString(m) } -func (*DepositAllocation) ProtoMessage() {} -func (*DepositAllocation) Descriptor() ([]byte, []int) { - return fileDescriptor_f8cdac88bdae9808, []int{10} -} -func (m *DepositAllocation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DepositAllocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DepositAllocation.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DepositAllocation) XXX_Merge(src proto.Message) { - xxx_messageInfo_DepositAllocation.Merge(m, src) -} -func (m *DepositAllocation) XXX_Size() int { - return m.Size() -} -func (m *DepositAllocation) XXX_DiscardUnknown() { - xxx_messageInfo_DepositAllocation.DiscardUnknown(m) -} - -var xxx_messageInfo_DepositAllocation proto.InternalMessageInfo - -func (m *DepositAllocation) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *DepositAllocation) GetOrderId() string { - if m != nil { - return m.OrderId - } - return "" -} - -func (m *DepositAllocation) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func init() { - proto.RegisterEnum("ununifi.chain.yieldaggregator.IntegrateType", IntegrateType_name, IntegrateType_value) - proto.RegisterType((*IntegrateInfo)(nil), "ununifi.chain.yieldaggregator.IntegrateInfo") - proto.RegisterType((*AssetCondition)(nil), "ununifi.chain.yieldaggregator.AssetCondition") - proto.RegisterType((*AssetManagementTarget)(nil), "ununifi.chain.yieldaggregator.AssetManagementTarget") - proto.RegisterType((*AssetManagementAccount)(nil), "ununifi.chain.yieldaggregator.AssetManagementAccount") - proto.RegisterType((*FarmingOrder)(nil), "ununifi.chain.yieldaggregator.FarmingOrder") - proto.RegisterType((*UserInfo)(nil), "ununifi.chain.yieldaggregator.UserInfo") - proto.RegisterType((*UserDeposit)(nil), "ununifi.chain.yieldaggregator.UserDeposit") - proto.RegisterType((*FarmingUnit)(nil), "ununifi.chain.yieldaggregator.FarmingUnit") - proto.RegisterType((*Strategy)(nil), "ununifi.chain.yieldaggregator.Strategy") - proto.RegisterType((*DailyPercent)(nil), "ununifi.chain.yieldaggregator.DailyPercent") - proto.RegisterType((*DepositAllocation)(nil), "ununifi.chain.yieldaggregator.DepositAllocation") -} - -func init() { proto.RegisterFile("yieldaggregatorv1/asset.proto", fileDescriptor_f8cdac88bdae9808) } - -var fileDescriptor_f8cdac88bdae9808 = []byte{ - // 1112 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x5f, 0x6f, 0x1b, 0x45, - 0x10, 0xcf, 0xd9, 0x4e, 0x62, 0x8f, 0xff, 0xd4, 0x5d, 0x42, 0x75, 0x69, 0x55, 0x27, 0x18, 0x41, - 0x23, 0x68, 0xee, 0x14, 0x83, 0x04, 0x2f, 0x48, 0x38, 0x89, 0x5a, 0x19, 0x35, 0x49, 0xb9, 0xc4, - 0x20, 0xfa, 0xc0, 0x69, 0x7d, 0xb7, 0xbe, 0xac, 0xea, 0xdb, 0xb5, 0x6e, 0xd7, 0x49, 0xfc, 0x2d, - 0xfa, 0x88, 0x84, 0xfa, 0x1d, 0xf8, 0x18, 0x79, 0xac, 0x78, 0x42, 0x3c, 0x14, 0x94, 0x7c, 0x0b, - 0x9e, 0xd0, 0xee, 0xde, 0x39, 0x76, 0x8c, 0x48, 0x23, 0x78, 0xf2, 0xcd, 0xec, 0xcc, 0xdc, 0xec, - 0xef, 0xf7, 0x9b, 0x39, 0xc3, 0xc3, 0x31, 0x25, 0x83, 0x10, 0x47, 0x51, 0x42, 0x22, 0x2c, 0x79, - 0x72, 0xb2, 0xe5, 0x62, 0x21, 0x88, 0x74, 0x86, 0x09, 0x97, 0x1c, 0x3d, 0x1c, 0xb1, 0x11, 0xa3, - 0x7d, 0xea, 0x04, 0xc7, 0x98, 0x32, 0xe7, 0x5a, 0xf0, 0xfd, 0x95, 0x88, 0x47, 0x5c, 0x47, 0xba, - 0xea, 0xc9, 0x24, 0xdd, 0x5f, 0x8b, 0x38, 0x8f, 0x06, 0xc4, 0xd5, 0x56, 0x6f, 0xd4, 0x77, 0x25, - 0x8d, 0x89, 0x90, 0x38, 0x1e, 0xa6, 0x01, 0x8d, 0xeb, 0x01, 0xe1, 0x28, 0xc1, 0x92, 0x72, 0x96, - 0x9e, 0xaf, 0x5e, 0x3f, 0xc7, 0x6c, 0x9c, 0xa5, 0xce, 0xf7, 0x3b, 0xc4, 0x09, 0x8e, 0x45, 0x76, - 0x1e, 0x70, 0x11, 0x73, 0xe1, 0xf6, 0xb0, 0x20, 0xee, 0xc9, 0x56, 0x8f, 0x48, 0xbc, 0xe5, 0x06, - 0x9c, 0xa6, 0xa5, 0x9b, 0xaf, 0x2d, 0xa8, 0x76, 0x98, 0x24, 0x51, 0x82, 0x25, 0xe9, 0xb0, 0x3e, - 0x47, 0x5f, 0x43, 0x41, 0x8e, 0x87, 0xc4, 0xb6, 0xd6, 0xad, 0x8d, 0x5a, 0xeb, 0xb1, 0xf3, 0xaf, - 0x37, 0x76, 0x26, 0xb9, 0x47, 0xe3, 0x21, 0xf1, 0x74, 0x26, 0x72, 0x61, 0x25, 0xe0, 0x4c, 0x26, - 0x38, 0x90, 0x3e, 0xed, 0x05, 0xfe, 0x90, 0x27, 0xd2, 0xa7, 0xa1, 0x9d, 0x5b, 0xb7, 0x36, 0x4a, - 0xde, 0xdd, 0xec, 0xac, 0xd3, 0x0b, 0x9e, 0xf3, 0x44, 0x76, 0x42, 0xb4, 0x0a, 0xc5, 0x98, 0x87, - 0x3e, 0xc3, 0x31, 0xb1, 0xf3, 0x3a, 0x68, 0x39, 0xe6, 0xe1, 0x3e, 0x8e, 0x49, 0x73, 0x1f, 0x6a, - 0x6d, 0x85, 0xff, 0x0e, 0x67, 0x21, 0x55, 0x90, 0xa0, 0x15, 0x58, 0x0c, 0x09, 0xe3, 0xb1, 0x6e, - 0xb0, 0xe4, 0x19, 0x03, 0xd5, 0x21, 0x1f, 0x53, 0x96, 0xbe, 0x42, 0x3d, 0xaa, 0x38, 0x0d, 0xa2, - 0xae, 0x58, 0xf5, 0x8c, 0xd1, 0xfc, 0x25, 0x0f, 0xef, 0xeb, 0x82, 0x7b, 0x98, 0xe1, 0x88, 0xc4, - 0x84, 0xc9, 0x23, 0x9c, 0x44, 0x44, 0xa2, 0x1a, 0xe4, 0x68, 0x98, 0x16, 0xcd, 0xd1, 0x10, 0x7d, - 0x05, 0x0f, 0x34, 0xf3, 0x7e, 0x3c, 0x89, 0xf4, 0x71, 0x10, 0xf0, 0x11, 0x9b, 0xba, 0x8c, 0x8d, - 0x67, 0x6b, 0xb5, 0x4d, 0x40, 0x27, 0x44, 0x8f, 0xe0, 0x4e, 0x16, 0x8d, 0xc3, 0x30, 0x21, 0x42, - 0xd8, 0x05, 0x9d, 0x52, 0x4b, 0xdd, 0x6d, 0xe3, 0x45, 0x3f, 0x42, 0xdd, 0xbc, 0x27, 0xc8, 0xae, - 0x28, 0xec, 0xc5, 0xf5, 0xfc, 0x46, 0xb9, 0xb5, 0x79, 0x03, 0xf6, 0xb3, 0xc0, 0x6c, 0x17, 0xce, - 0xdf, 0xae, 0x2d, 0x78, 0x77, 0xf0, 0x8c, 0x57, 0xa0, 0x6f, 0xa0, 0x36, 0x62, 0x3d, 0x65, 0xb3, - 0xc8, 0x57, 0xca, 0xb3, 0x97, 0xd6, 0xad, 0x8d, 0x72, 0x6b, 0xd5, 0x31, 0xaa, 0x72, 0x32, 0x55, - 0x39, 0xbb, 0xa9, 0xea, 0xb6, 0x8b, 0xaa, 0xd2, 0x4f, 0x7f, 0xac, 0x59, 0x5e, 0x75, 0x92, 0x7a, - 0x44, 0x63, 0x82, 0x7e, 0x80, 0x1a, 0xcd, 0x08, 0xf7, 0x29, 0xeb, 0x73, 0x7b, 0x59, 0xd7, 0x7a, - 0x67, 0x95, 0x28, 0x85, 0xa5, 0x8d, 0x56, 0xe9, 0x8c, 0xec, 0x6c, 0x58, 0x26, 0x0c, 0xf7, 0x06, - 0x24, 0xb4, 0x8b, 0xeb, 0xd6, 0x46, 0xd1, 0xcb, 0xcc, 0xe6, 0x77, 0x70, 0xaf, 0xfd, 0x8f, 0x28, - 0xcf, 0x51, 0x86, 0xa0, 0xa0, 0x35, 0x64, 0xb8, 0xd1, 0xcf, 0xd3, 0x75, 0xf3, 0xb3, 0x75, 0xff, - 0xca, 0x41, 0xe5, 0x09, 0x4e, 0x62, 0xca, 0xa2, 0x83, 0x24, 0x24, 0xc9, 0x5c, 0xb9, 0x0f, 0xa0, - 0xd2, 0x4f, 0x78, 0x3c, 0xe1, 0xcf, 0x94, 0x2d, 0x2b, 0x5f, 0x46, 0x5e, 0x07, 0x8a, 0x42, 0xaa, - 0x3b, 0x44, 0x63, 0x5d, 0xbe, 0xdc, 0x7a, 0x74, 0x03, 0x14, 0x87, 0x69, 0x78, 0x8a, 0xc2, 0x24, - 0x1d, 0x7d, 0x0b, 0x28, 0xc6, 0x67, 0xfe, 0x35, 0xae, 0x0a, 0xef, 0xce, 0x55, 0x3d, 0xc6, 0x67, - 0xdd, 0x19, 0xba, 0x3e, 0x84, 0x2a, 0x3f, 0x21, 0x09, 0x1e, 0x0c, 0x7c, 0x33, 0x0a, 0x8b, 0x7a, - 0x14, 0x2a, 0xa9, 0xd3, 0x53, 0xbe, 0x6c, 0x72, 0x96, 0xae, 0x26, 0x47, 0x79, 0xf0, 0x99, 0xa6, - 0x56, 0x79, 0xf0, 0x19, 0xfa, 0x12, 0x0a, 0x21, 0x96, 0x44, 0x33, 0x53, 0x6e, 0xdd, 0x9f, 0xeb, - 0xe6, 0x28, 0x5b, 0x68, 0xa6, 0x9d, 0x57, 0xaa, 0x1d, 0x9d, 0x81, 0xee, 0xc1, 0x12, 0x0e, 0x24, - 0x3d, 0x21, 0x76, 0x49, 0xa3, 0x9f, 0x5a, 0xcd, 0x5f, 0x2d, 0x28, 0x76, 0x05, 0x49, 0x34, 0xf7, - 0x08, 0x0a, 0x23, 0x41, 0x92, 0x14, 0x7a, 0xfd, 0x8c, 0xbe, 0x80, 0x25, 0x1c, 0x2b, 0x96, 0xed, - 0x9c, 0x1e, 0x86, 0x55, 0xc7, 0x6c, 0x32, 0x47, 0x6d, 0x32, 0x27, 0xdd, 0x64, 0xce, 0x0e, 0xa7, - 0x99, 0xf0, 0xd3, 0x70, 0xe4, 0x41, 0xad, 0x6f, 0x58, 0xf5, 0xb9, 0xa2, 0x55, 0xd8, 0x79, 0x5d, - 0xe0, 0xd3, 0x1b, 0x88, 0x99, 0x96, 0x82, 0x57, 0xed, 0x4f, 0x59, 0x02, 0x7d, 0x64, 0x6a, 0x92, - 0xd0, 0xd7, 0xc2, 0x23, 0x89, 0xe6, 0xa5, 0x60, 0xc2, 0x48, 0xb8, 0x63, 0x9c, 0xcd, 0x17, 0x50, - 0x56, 0x77, 0xda, 0x25, 0x43, 0x2e, 0xa8, 0xfc, 0x5f, 0xaf, 0xd5, 0x7c, 0x9d, 0x83, 0x72, 0xda, - 0x62, 0x97, 0x51, 0x89, 0x1e, 0x02, 0x4c, 0x6d, 0x23, 0xf3, 0x8a, 0x12, 0x9e, 0xac, 0x9f, 0x07, - 0x50, 0x92, 0x7a, 0xaf, 0x5d, 0xed, 0xaa, 0xa2, 0x71, 0x74, 0xc2, 0xa9, 0x26, 0xf2, 0xb7, 0xc3, - 0xf6, 0x31, 0xa0, 0x0c, 0x5b, 0x21, 0x71, 0x22, 0xaf, 0x34, 0x5a, 0xf2, 0xea, 0xe9, 0xc9, 0xa1, - 0x3a, 0xd0, 0xf2, 0xeb, 0xc2, 0x7b, 0x57, 0x6a, 0xd6, 0xf1, 0x3a, 0x7c, 0xf1, 0x16, 0x22, 0x42, - 0x93, 0x02, 0x87, 0x59, 0xbe, 0x5a, 0xec, 0xfc, 0x94, 0x91, 0x24, 0x95, 0xac, 0x31, 0x9a, 0x3f, - 0x5b, 0x50, 0xcc, 0x66, 0x4b, 0x09, 0x3f, 0x9b, 0x2b, 0x7f, 0xf2, 0x31, 0x2b, 0x79, 0x95, 0xcc, - 0xa9, 0x3e, 0x56, 0xe8, 0x73, 0xb8, 0x77, 0x7a, 0x4c, 0x25, 0x19, 0x50, 0x21, 0x49, 0xe8, 0x4f, - 0xe0, 0x12, 0x9a, 0x9a, 0x92, 0xb7, 0x32, 0x75, 0x7a, 0x94, 0x42, 0x27, 0x54, 0x56, 0x6f, 0x80, - 0x83, 0x97, 0xf3, 0x59, 0x79, 0x93, 0x35, 0x75, 0x3a, 0xc9, 0x6a, 0x9e, 0x5b, 0x50, 0xd9, 0xc5, - 0x74, 0x30, 0x7e, 0x4e, 0x92, 0x80, 0xb0, 0xff, 0x46, 0xdf, 0x36, 0x14, 0xd4, 0x35, 0xcc, 0xa7, - 0x72, 0xdb, 0x51, 0x60, 0xfd, 0xfe, 0x76, 0xed, 0xe3, 0x88, 0xca, 0xe3, 0x51, 0xcf, 0x09, 0x78, - 0xec, 0xa6, 0x1f, 0x7d, 0xf3, 0xb3, 0x29, 0xc2, 0x97, 0xae, 0x42, 0x41, 0x38, 0xbb, 0x24, 0xf0, - 0x74, 0xee, 0x64, 0xa2, 0x0b, 0xb7, 0x9d, 0xe8, 0xe6, 0x29, 0xdc, 0x4d, 0x05, 0xde, 0x1e, 0x0c, - 0x78, 0xa0, 0xb7, 0xd0, 0xdc, 0xea, 0x5c, 0x85, 0xa2, 0x1e, 0xbe, 0xab, 0xf6, 0x97, 0xb5, 0x7d, - 0x4d, 0x7c, 0xd6, 0x2d, 0xc4, 0xf7, 0xc9, 0xe6, 0xd4, 0x3f, 0x15, 0x4d, 0x60, 0x0d, 0xe0, 0xe9, - 0xc1, 0xb3, 0xf6, 0xfe, 0x53, 0x7f, 0xef, 0x60, 0xb7, 0xbe, 0x80, 0x2a, 0x50, 0xdc, 0x39, 0x38, - 0xdc, 0xfb, 0xbe, 0x7d, 0xb8, 0x57, 0xb7, 0xb6, 0x9f, 0x9d, 0x5f, 0x34, 0xac, 0x37, 0x17, 0x0d, - 0xeb, 0xcf, 0x8b, 0x86, 0xf5, 0xea, 0xb2, 0xb1, 0xf0, 0xe6, 0xb2, 0xb1, 0xf0, 0xdb, 0x65, 0x63, - 0xe1, 0x45, 0x6b, 0x0a, 0xa9, 0x2e, 0xeb, 0x32, 0xfa, 0x84, 0xba, 0x7a, 0x27, 0xb8, 0x67, 0xee, - 0xfc, 0xdf, 0x29, 0x8d, 0x5c, 0x6f, 0x49, 0x23, 0xf3, 0xd9, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xdf, 0x0f, 0x9a, 0x63, 0x20, 0x0a, 0x00, 0x00, -} - -func (m *IntegrateInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IntegrateInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IntegrateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ModName) > 0 { - i -= len(m.ModName) - copy(dAtA[i:], m.ModName) - i = encodeVarintAsset(dAtA, i, uint64(len(m.ModName))) - i-- - dAtA[i] = 0x1a - } - if len(m.ContractIbcPortId) > 0 { - i -= len(m.ContractIbcPortId) - copy(dAtA[i:], m.ContractIbcPortId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.ContractIbcPortId))) - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintAsset(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AssetCondition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AssetCondition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AssetCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Ratio != 0 { - i = encodeVarintAsset(dAtA, i, uint64(m.Ratio)) - i-- - dAtA[i] = 0x18 - } - if len(m.Min) > 0 { - i -= len(m.Min) - copy(dAtA[i:], m.Min) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Min))) - i-- - dAtA[i] = 0x12 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AssetManagementTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AssetManagementTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AssetManagementTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - { - size, err := m.IntegrateInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintAsset(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x32 - if len(m.AssetConditions) > 0 { - for iNdEx := len(m.AssetConditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AssetConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.AccountAddress) > 0 { - i -= len(m.AccountAddress) - copy(dAtA[i:], m.AccountAddress) - i = encodeVarintAsset(dAtA, i, uint64(len(m.AccountAddress))) - i-- - dAtA[i] = 0x22 - } - if len(m.AssetManagementAccountId) > 0 { - i -= len(m.AssetManagementAccountId) - copy(dAtA[i:], m.AssetManagementAccountId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.AssetManagementAccountId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AssetManagementAccount) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AssetManagementAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AssetManagementAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FarmingOrder) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FarmingOrder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FarmingOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Active { - i-- - if m.Active { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Date, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Date):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintAsset(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x42 - if len(m.Max) > 0 { - i -= len(m.Max) - copy(dAtA[i:], m.Max) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Max))) - i-- - dAtA[i] = 0x3a - } - if len(m.Min) > 0 { - i -= len(m.Min) - copy(dAtA[i:], m.Min) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Min))) - i-- - dAtA[i] = 0x32 - } - if m.OverallRatio != 0 { - i = encodeVarintAsset(dAtA, i, uint64(m.OverallRatio)) - i-- - dAtA[i] = 0x28 - } - n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxUnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxUnbondingTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintAsset(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x22 - { - size, err := m.Strategy.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintAsset(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UserInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UserInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UserInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.FarmedCounter != 0 { - i = encodeVarintAsset(dAtA, i, uint64(m.FarmedCounter)) - i-- - dAtA[i] = 0x20 - } - if len(m.FarmingOrders) > 0 { - for iNdEx := len(m.FarmingOrders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FarmingOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.User) > 0 { - i -= len(m.User) - copy(dAtA[i:], m.User) - i = encodeVarintAsset(dAtA, i, uint64(len(m.User))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UserDeposit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UserDeposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UserDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.User) > 0 { - i -= len(m.User) - copy(dAtA[i:], m.User) - i = encodeVarintAsset(dAtA, i, uint64(len(m.User))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FarmingUnit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FarmingUnit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FarmingUnit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x32 - } - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingStarttime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingStarttime):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintAsset(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x2a - if len(m.FarmingStartTime) > 0 { - i -= len(m.FarmingStartTime) - copy(dAtA[i:], m.FarmingStartTime) - i = encodeVarintAsset(dAtA, i, uint64(len(m.FarmingStartTime))) - i-- - dAtA[i] = 0x22 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.TargetId) > 0 { - i -= len(m.TargetId) - copy(dAtA[i:], m.TargetId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.TargetId))) - i-- - dAtA[i] = 0x12 - } - if len(m.AccountId) > 0 { - i -= len(m.AccountId) - copy(dAtA[i:], m.AccountId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.AccountId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Strategy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Strategy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Strategy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BlacklistedTargetIds) > 0 { - for iNdEx := len(m.BlacklistedTargetIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BlacklistedTargetIds[iNdEx]) - copy(dAtA[i:], m.BlacklistedTargetIds[iNdEx]) - i = encodeVarintAsset(dAtA, i, uint64(len(m.BlacklistedTargetIds[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.WhitelistedTargetIds) > 0 { - for iNdEx := len(m.WhitelistedTargetIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.WhitelistedTargetIds[iNdEx]) - copy(dAtA[i:], m.WhitelistedTargetIds[iNdEx]) - i = encodeVarintAsset(dAtA, i, uint64(len(m.WhitelistedTargetIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.StrategyType) > 0 { - i -= len(m.StrategyType) - copy(dAtA[i:], m.StrategyType) - i = encodeVarintAsset(dAtA, i, uint64(len(m.StrategyType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DailyPercent) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DailyPercent) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DailyPercent) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Date, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Date):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintAsset(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x22 - { - size := m.Rate.Size() - i -= size - if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.TargetId) > 0 { - i -= len(m.TargetId) - copy(dAtA[i:], m.TargetId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.TargetId))) - i-- - dAtA[i] = 0x12 - } - if len(m.AccountId) > 0 { - i -= len(m.AccountId) - copy(dAtA[i:], m.AccountId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.AccountId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DepositAllocation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DepositAllocation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DepositAllocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAsset(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.OrderId) > 0 { - i -= len(m.OrderId) - copy(dAtA[i:], m.OrderId) - i = encodeVarintAsset(dAtA, i, uint64(len(m.OrderId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintAsset(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintAsset(dAtA []byte, offset int, v uint64) int { - offset -= sovAsset(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *IntegrateInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovAsset(uint64(m.Type)) - } - l = len(m.ContractIbcPortId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.ModName) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - return n -} - -func (m *AssetCondition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.Min) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if m.Ratio != 0 { - n += 1 + sovAsset(uint64(m.Ratio)) - } - return n -} - -func (m *AssetManagementTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.AssetManagementAccountId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.AccountAddress) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if len(m.AssetConditions) > 0 { - for _, e := range m.AssetConditions { - l = e.Size() - n += 1 + l + sovAsset(uint64(l)) - } - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) - n += 1 + l + sovAsset(uint64(l)) - l = m.IntegrateInfo.Size() - n += 1 + l + sovAsset(uint64(l)) - if m.Enabled { - n += 2 - } - return n -} - -func (m *AssetManagementAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if m.Enabled { - n += 2 - } - return n -} - -func (m *FarmingOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = m.Strategy.Size() - n += 1 + l + sovAsset(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxUnbondingTime) - n += 1 + l + sovAsset(uint64(l)) - if m.OverallRatio != 0 { - n += 1 + sovAsset(uint64(m.OverallRatio)) - } - l = len(m.Min) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.Max) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Date) - n += 1 + l + sovAsset(uint64(l)) - if m.Active { - n += 2 - } - return n -} - -func (m *UserInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovAsset(uint64(l)) - } - } - if len(m.FarmingOrders) > 0 { - for _, e := range m.FarmingOrders { - l = e.Size() - n += 1 + l + sovAsset(uint64(l)) - } - } - if m.FarmedCounter != 0 { - n += 1 + sovAsset(uint64(m.FarmedCounter)) - } - return n -} - -func (m *UserDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovAsset(uint64(l)) - } - } - return n -} - -func (m *FarmingUnit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AccountId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.TargetId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovAsset(uint64(l)) - } - } - l = len(m.FarmingStartTime) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingStarttime) - n += 1 + l + sovAsset(uint64(l)) - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - return n -} - -func (m *Strategy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.StrategyType) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - if len(m.WhitelistedTargetIds) > 0 { - for _, s := range m.WhitelistedTargetIds { - l = len(s) - n += 1 + l + sovAsset(uint64(l)) - } - } - if len(m.BlacklistedTargetIds) > 0 { - for _, s := range m.BlacklistedTargetIds { - l = len(s) - n += 1 + l + sovAsset(uint64(l)) - } - } - return n -} - -func (m *DailyPercent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AccountId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.TargetId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = m.Rate.Size() - n += 1 + l + sovAsset(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Date) - n += 1 + l + sovAsset(uint64(l)) - return n -} - -func (m *DepositAllocation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = len(m.OrderId) - if l > 0 { - n += 1 + l + sovAsset(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovAsset(uint64(l)) - return n -} - -func sovAsset(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAsset(x uint64) (n int) { - return sovAsset(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *IntegrateInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IntegrateInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IntegrateInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= IntegrateType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractIbcPortId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractIbcPortId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AssetCondition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AssetCondition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AssetCondition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Min", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Min = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ratio", wireType) - } - m.Ratio = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Ratio |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AssetManagementTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AssetManagementTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AssetManagementTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetManagementAccountId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetManagementAccountId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AccountAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetConditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetConditions = append(m.AssetConditions, AssetCondition{}) - if err := m.AssetConditions[len(m.AssetConditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IntegrateInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IntegrateInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AssetManagementAccount) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AssetManagementAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AssetManagementAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FarmingOrder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FarmingOrder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FarmingOrder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Strategy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Strategy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxUnbondingTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxUnbondingTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OverallRatio", wireType) - } - m.OverallRatio = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OverallRatio |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Min", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Min = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Max = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Date", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Date, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Active = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UserInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UserInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UserInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.User = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmingOrders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FarmingOrders = append(m.FarmingOrders, &FarmingOrder{}) - if err := m.FarmingOrders[len(m.FarmingOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmedCounter", wireType) - } - m.FarmedCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FarmedCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UserDeposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UserDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UserDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.User = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FarmingUnit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FarmingUnit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FarmingUnit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AccountId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmingStartTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FarmingStartTime = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingStarttime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondingStarttime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Strategy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Strategy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Strategy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StrategyType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StrategyType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WhitelistedTargetIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WhitelistedTargetIds = append(m.WhitelistedTargetIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlacklistedTargetIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlacklistedTargetIds = append(m.BlacklistedTargetIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DailyPercent) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DailyPercent: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DailyPercent: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AccountId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Date", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Date, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DepositAllocation) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DepositAllocation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DepositAllocation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAsset - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAsset - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAsset - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAsset(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAsset - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAsset(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAsset - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAsset - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAsset - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAsset - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAsset - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAsset - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAsset = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAsset = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAsset = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/types/codec.go b/deprecated/x/yieldaggregatorv1/types/codec.go deleted file mode 100644 index 482c4ebb6..000000000 --- a/deprecated/x/yieldaggregatorv1/types/codec.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgDeposit{}, - &MsgWithdraw{}, - &MsgAddFarmingOrder{}, - &MsgDeleteFarmingOrder{}, - &MsgActivateFarmingOrder{}, - &MsgInactivateFarmingOrder{}, - &MsgExecuteFarmingOrders{}, - &MsgSetDailyRewardPercent{}, - ) - - registry.RegisterImplementations( - (*govtypes.Content)(nil), - &ProposalAddYieldFarm{}, - &ProposalUpdateYieldFarm{}, - &ProposalStopYieldFarm{}, - &ProposalRemoveYieldFarm{}, - &ProposalAddYieldFarmTarget{}, - &ProposalUpdateYieldFarmTarget{}, - &ProposalStopYieldFarmTarget{}, - &ProposalRemoveYieldFarmTarget{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/deprecated/x/yieldaggregatorv1/types/errors.go b/deprecated/x/yieldaggregatorv1/types/errors.go deleted file mode 100644 index c3ed46288..000000000 --- a/deprecated/x/yieldaggregatorv1/types/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/yieldaggregator module sentinel errors -var ( - ErrAssetManagementAccountAlreadyExists = sdkerrors.Register(ModuleName, 2, "asset management account already exists") - ErrAssetManagementAccountDoesNotExists = sdkerrors.Register(ModuleName, 3, "asset management account does not exist") - ErrFarmingOrderAlreadyExists = sdkerrors.Register(ModuleName, 4, "farming order already exists") - ErrFarmingOrderDoesNotExist = sdkerrors.Register(ModuleName, 5, "farming order does not exist") - ErrFarmingUnitAlreadyExists = sdkerrors.Register(ModuleName, 6, "farming unit already exists") - ErrFarmingUnitDoesNotExist = sdkerrors.Register(ModuleName, 7, "farming unit does not exist") - ErrNoAssetManagementTargetExists = sdkerrors.Register(ModuleName, 8, "no asset management target exists") - ErrUnbondingTimeNotPassed = sdkerrors.Register(ModuleName, 9, "unbonding time not passed") - ErrNotDailyRewardPercentFeeder = sdkerrors.Register(ModuleName, 10, "not a daily reward percent feeder") -) diff --git a/deprecated/x/yieldaggregatorv1/types/expected_keepers.go b/deprecated/x/yieldaggregatorv1/types/expected_keepers.go deleted file mode 100644 index eba3a2e69..000000000 --- a/deprecated/x/yieldaggregatorv1/types/expected_keepers.go +++ /dev/null @@ -1,34 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - yieldfarmtypes "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error -} - -type YieldFarmKeeper interface { - SetFarmerInfo(ctx sdk.Context, obj yieldfarmtypes.FarmerInfo) - DeleteFarmerInfo(ctx sdk.Context, addr sdk.AccAddress) - GetFarmerInfo(ctx sdk.Context, addr sdk.AccAddress) yieldfarmtypes.FarmerInfo - GetAllFarmerInfos(ctx sdk.Context) []yieldfarmtypes.FarmerInfo - Deposit(ctx sdk.Context, user sdk.AccAddress, coins sdk.Coins) error - Withdraw(ctx sdk.Context, user sdk.AccAddress, coins sdk.Coins) error - ClaimRewards(ctx sdk.Context, user sdk.AccAddress) sdk.Coins -} diff --git a/deprecated/x/yieldaggregatorv1/types/farm_unit.go b/deprecated/x/yieldaggregatorv1/types/farm_unit.go deleted file mode 100644 index 5c6937e86..000000000 --- a/deprecated/x/yieldaggregatorv1/types/farm_unit.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -import ( - fmt "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -func (f FarmingUnit) GetAddress() sdk.AccAddress { - return authtypes.NewModuleAddress(fmt.Sprintf("farming_unit_%s___%s___%s", f.Owner, f.AccountId, f.TargetId)) -} diff --git a/deprecated/x/yieldaggregatorv1/types/genesis.go b/deprecated/x/yieldaggregatorv1/types/genesis.go deleted file mode 100644 index 9873f3f01..000000000 --- a/deprecated/x/yieldaggregatorv1/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - AssetManagementAccounts: []AssetManagementAccount{}, - AssetManagementTargets: []AssetManagementTarget{}, - FarmingOrders: []FarmingOrder{}, - FarmingUnits: []FarmingUnit{}, - UserDeposits: []UserDeposit{}, - DailyPercents: []DailyPercent{}, - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - - return gs.Params.Validate() -} diff --git a/deprecated/x/yieldaggregatorv1/types/genesis.pb.go b/deprecated/x/yieldaggregatorv1/types/genesis.pb.go deleted file mode 100644 index 5597f6265..000000000 --- a/deprecated/x/yieldaggregatorv1/types/genesis.pb.go +++ /dev/null @@ -1,706 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldaggregatorv1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the yieldaggregator module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - AssetManagementAccounts []AssetManagementAccount `protobuf:"bytes,2,rep,name=asset_management_accounts,json=assetManagementAccounts,proto3" json:"asset_management_accounts"` - AssetManagementTargets []AssetManagementTarget `protobuf:"bytes,3,rep,name=asset_management_targets,json=assetManagementTargets,proto3" json:"asset_management_targets"` - FarmingOrders []FarmingOrder `protobuf:"bytes,4,rep,name=farming_orders,json=farmingOrders,proto3" json:"farming_orders"` - FarmingUnits []FarmingUnit `protobuf:"bytes,5,rep,name=farming_units,json=farmingUnits,proto3" json:"farming_units"` - UserDeposits []UserDeposit `protobuf:"bytes,6,rep,name=user_deposits,json=userDeposits,proto3" json:"user_deposits"` - DailyPercents []DailyPercent `protobuf:"bytes,7,rep,name=daily_percents,json=dailyPercents,proto3" json:"daily_percents"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_1d206e049b2aab70, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetAssetManagementAccounts() []AssetManagementAccount { - if m != nil { - return m.AssetManagementAccounts - } - return nil -} - -func (m *GenesisState) GetAssetManagementTargets() []AssetManagementTarget { - if m != nil { - return m.AssetManagementTargets - } - return nil -} - -func (m *GenesisState) GetFarmingOrders() []FarmingOrder { - if m != nil { - return m.FarmingOrders - } - return nil -} - -func (m *GenesisState) GetFarmingUnits() []FarmingUnit { - if m != nil { - return m.FarmingUnits - } - return nil -} - -func (m *GenesisState) GetUserDeposits() []UserDeposit { - if m != nil { - return m.UserDeposits - } - return nil -} - -func (m *GenesisState) GetDailyPercents() []DailyPercent { - if m != nil { - return m.DailyPercents - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.chain.yieldaggregator.GenesisState") -} - -func init() { proto.RegisterFile("yieldaggregatorv1/genesis.proto", fileDescriptor_1d206e049b2aab70) } - -var fileDescriptor_1d206e049b2aab70 = []byte{ - // 415 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xd1, 0x8a, 0xd3, 0x40, - 0x14, 0x86, 0x13, 0x77, 0xb7, 0x42, 0x76, 0xf5, 0x22, 0x88, 0xc6, 0xc2, 0x66, 0x17, 0x41, 0x28, - 0x0a, 0x09, 0x56, 0x7d, 0x80, 0xd6, 0x52, 0x6f, 0x14, 0x8b, 0x1a, 0x10, 0x6f, 0xc2, 0x34, 0x39, - 0x99, 0x0e, 0x34, 0x33, 0x61, 0xce, 0x44, 0xed, 0x5b, 0xf8, 0x10, 0x3e, 0x4c, 0x2f, 0x7b, 0xe9, - 0x95, 0x48, 0xfb, 0x22, 0x92, 0x99, 0xc4, 0x16, 0x53, 0x6c, 0xf7, 0x2e, 0x9c, 0x73, 0xbe, 0xff, - 0x3b, 0x9c, 0x8c, 0x73, 0xb5, 0x60, 0x30, 0x4f, 0x09, 0xa5, 0x12, 0x28, 0x51, 0x42, 0x7e, 0x79, - 0x16, 0x52, 0xe0, 0x80, 0x0c, 0x83, 0x42, 0x0a, 0x25, 0xdc, 0xcb, 0x92, 0x97, 0x9c, 0x65, 0x2c, - 0x48, 0x66, 0x84, 0xf1, 0xe0, 0x9f, 0xf1, 0xee, 0x3d, 0x2a, 0xa8, 0xd0, 0x93, 0x61, 0xf5, 0x65, - 0xa0, 0xae, 0xdf, 0x4e, 0x2d, 0x88, 0x24, 0x79, 0x1d, 0xda, 0xbd, 0x6c, 0xf7, 0x09, 0x22, 0x28, - 0xd3, 0x7e, 0xf4, 0xe3, 0xcc, 0xb9, 0x78, 0x6d, 0xb6, 0xf8, 0xa0, 0x88, 0x02, 0xf7, 0x95, 0xd3, - 0x31, 0xbc, 0x67, 0x5f, 0xdb, 0xbd, 0xf3, 0xfe, 0xe3, 0xe0, 0xbf, 0x5b, 0x05, 0x13, 0x3d, 0x3c, - 0x3c, 0x5d, 0xfe, 0xba, 0xb2, 0xde, 0xd7, 0xa8, 0xfb, 0xd5, 0x79, 0xa8, 0x25, 0x71, 0x4e, 0x38, - 0xa1, 0x90, 0x03, 0x57, 0x31, 0x49, 0x12, 0x51, 0x72, 0x85, 0xde, 0xad, 0xeb, 0x93, 0xde, 0x79, - 0xff, 0xe5, 0x81, 0xdc, 0x41, 0xc5, 0xbf, 0xfd, 0x8b, 0x0f, 0x0c, 0x5d, 0x7b, 0x1e, 0x90, 0xbd, - 0x5d, 0x74, 0x95, 0xe3, 0xb5, 0xc4, 0x8a, 0x48, 0x0a, 0x0a, 0xbd, 0x13, 0xed, 0x7d, 0x71, 0x33, - 0xef, 0x47, 0x0d, 0xd7, 0xda, 0xfb, 0x64, 0x5f, 0x13, 0xdd, 0x4f, 0xce, 0xdd, 0x8c, 0xc8, 0x9c, - 0x71, 0x1a, 0x0b, 0x99, 0x82, 0x44, 0xef, 0x54, 0xbb, 0x9e, 0x1e, 0x70, 0x8d, 0x0d, 0xf4, 0xae, - 0x62, 0x6a, 0xc5, 0x9d, 0x6c, 0xa7, 0x86, 0x6e, 0xe4, 0x34, 0x85, 0xb8, 0xe4, 0x4c, 0xa1, 0x77, - 0xa6, 0x83, 0x9f, 0x1c, 0x17, 0x1c, 0x71, 0xd6, 0xac, 0x7e, 0x91, 0x6d, 0x4b, 0x3a, 0xb6, 0x44, - 0x90, 0x71, 0x0a, 0x85, 0xc0, 0x2a, 0xb6, 0x73, 0x54, 0x6c, 0x84, 0x20, 0x47, 0x06, 0x69, 0x62, - 0xcb, 0x6d, 0x49, 0xdf, 0x21, 0x25, 0x6c, 0xbe, 0x88, 0x0b, 0x90, 0x09, 0x54, 0xff, 0xfa, 0xf6, - 0x51, 0x77, 0x18, 0x55, 0xd0, 0xc4, 0x30, 0xcd, 0x1d, 0xd2, 0x9d, 0x1a, 0x0e, 0xdf, 0x2c, 0xd7, - 0xbe, 0xbd, 0x5a, 0xfb, 0xf6, 0xef, 0xb5, 0x6f, 0x7f, 0xdf, 0xf8, 0xd6, 0x6a, 0xe3, 0x5b, 0x3f, - 0x37, 0xbe, 0xf5, 0xb9, 0x4f, 0x99, 0x9a, 0x95, 0xd3, 0x20, 0x11, 0x79, 0x18, 0xf1, 0x88, 0xb3, - 0x31, 0x0b, 0xb5, 0x25, 0xfc, 0x16, 0xb6, 0x9f, 0xbe, 0x5a, 0x14, 0x80, 0xd3, 0x8e, 0x7e, 0xfb, - 0xcf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xe6, 0xf3, 0x0c, 0x92, 0x03, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DailyPercents) > 0 { - for iNdEx := len(m.DailyPercents) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DailyPercents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.UserDeposits) > 0 { - for iNdEx := len(m.UserDeposits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UserDeposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.FarmingUnits) > 0 { - for iNdEx := len(m.FarmingUnits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FarmingUnits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.FarmingOrders) > 0 { - for iNdEx := len(m.FarmingOrders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FarmingOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.AssetManagementTargets) > 0 { - for iNdEx := len(m.AssetManagementTargets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AssetManagementTargets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.AssetManagementAccounts) > 0 { - for iNdEx := len(m.AssetManagementAccounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AssetManagementAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.AssetManagementAccounts) > 0 { - for _, e := range m.AssetManagementAccounts { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.AssetManagementTargets) > 0 { - for _, e := range m.AssetManagementTargets { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.FarmingOrders) > 0 { - for _, e := range m.FarmingOrders { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.FarmingUnits) > 0 { - for _, e := range m.FarmingUnits { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.UserDeposits) > 0 { - for _, e := range m.UserDeposits { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.DailyPercents) > 0 { - for _, e := range m.DailyPercents { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetManagementAccounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetManagementAccounts = append(m.AssetManagementAccounts, AssetManagementAccount{}) - if err := m.AssetManagementAccounts[len(m.AssetManagementAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetManagementTargets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetManagementTargets = append(m.AssetManagementTargets, AssetManagementTarget{}) - if err := m.AssetManagementTargets[len(m.AssetManagementTargets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmingOrders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FarmingOrders = append(m.FarmingOrders, FarmingOrder{}) - if err := m.FarmingOrders[len(m.FarmingOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmingUnits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FarmingUnits = append(m.FarmingUnits, FarmingUnit{}) - if err := m.FarmingUnits[len(m.FarmingUnits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDeposits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UserDeposits = append(m.UserDeposits, UserDeposit{}) - if err := m.UserDeposits[len(m.UserDeposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DailyPercents", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DailyPercents = append(m.DailyPercents, DailyPercent{}) - if err := m.DailyPercents[len(m.DailyPercents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/types/genesis_test.go b/deprecated/x/yieldaggregatorv1/types/genesis_test.go deleted file mode 100644 index 058936dd7..000000000 --- a/deprecated/x/yieldaggregatorv1/types/genesis_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" -) - -func TestGenesisState_Validate(t *testing.T) { - for _, tc := range []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{}, - valid: true, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/deprecated/x/yieldaggregatorv1/types/keys.go b/deprecated/x/yieldaggregatorv1/types/keys.go deleted file mode 100644 index 1df0e60c7..000000000 --- a/deprecated/x/yieldaggregatorv1/types/keys.go +++ /dev/null @@ -1,55 +0,0 @@ -package types - -import sdk "github.com/cosmos/cosmos-sdk/types" - -const ( - // ModuleName defines the module name - ModuleName = "yieldaggregatorv1" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} - -const ( - PrefixKeyAssetManagementAccount = "asset_management_account_" - PrefixKeyAssetManagementTarget = "asset_management_target_" - PrefixKeyFarmingOrder = "farming_order_" - PrefixKeyFarmingUnit = "farming_unit_" - PrefixKeyUserDeposit = "user_deposit_" - KeyLastFarmingUnit = "last_farming_unit_" - PrefixKeyDailyPercent = "daily_percent_" -) - -func AssetManagementAccountKey(id string) []byte { - return append([]byte(PrefixKeyAssetManagementAccount), id...) -} - -func AssetManagementTargetKey(accountId, targetId string) []byte { - return append(append([]byte(PrefixKeyAssetManagementTarget), accountId...), targetId...) -} - -func FarmingOrderKey(sender sdk.AccAddress, orderId string) []byte { - return append(append([]byte(PrefixKeyFarmingOrder), sender...), orderId...) -} - -func FarmingUnitKey(owner string, accId, targetId string) []byte { - return append(append(append([]byte(PrefixKeyFarmingUnit), owner...), accId...), targetId...) -} - -func DailyRewardKey(accId, targetId string) []byte { - return append(append([]byte(PrefixKeyDailyPercent), accId...), targetId...) -} - -func UserDepositKey(user sdk.AccAddress) []byte { - return append([]byte(PrefixKeyUserDeposit), user...) -} diff --git a/deprecated/x/yieldaggregatorv1/types/msgs.go b/deprecated/x/yieldaggregatorv1/types/msgs.go deleted file mode 100644 index 996aea67d..000000000 --- a/deprecated/x/yieldaggregatorv1/types/msgs.go +++ /dev/null @@ -1,190 +0,0 @@ -package types - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgDeposit{} - -func NewMsgDeposit(sender sdk.AccAddress, amounts sdk.Coins, executeOrders bool) MsgDeposit { - return MsgDeposit{ - FromAddress: sender.Bytes(), - Amount: amounts, - ExecuteOrders: executeOrders, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgDeposit) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgDeposit) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgWithdraw{} - -func NewMsgWithdraw(sender sdk.AccAddress, amounts sdk.Coins) MsgWithdraw { - return MsgWithdraw{ - FromAddress: sender.Bytes(), - Amount: amounts, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgWithdraw) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgWithdraw) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgAddFarmingOrder{} - -func NewMsgAddFarmingOrder(sender sdk.AccAddress, order FarmingOrder) MsgAddFarmingOrder { - return MsgAddFarmingOrder{ - FromAddress: sender.Bytes(), - Order: &order, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgAddFarmingOrder) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgAddFarmingOrder) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgDeleteFarmingOrder{} - -func NewMsgDeleteFarmingOrder(sender sdk.AccAddress, orderId string) MsgDeleteFarmingOrder { - return MsgDeleteFarmingOrder{ - FromAddress: sender.Bytes(), - OrderId: orderId, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgDeleteFarmingOrder) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgDeleteFarmingOrder) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgActivateFarmingOrder{} - -func NewMsgActivateFarmingOrder(sender sdk.AccAddress, orderId string) MsgActivateFarmingOrder { - return MsgActivateFarmingOrder{ - FromAddress: sender.Bytes(), - OrderId: orderId, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgActivateFarmingOrder) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgActivateFarmingOrder) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgInactivateFarmingOrder{} - -func NewMsgInactivateFarmingOrder(sender sdk.AccAddress, orderId string) MsgInactivateFarmingOrder { - return MsgInactivateFarmingOrder{ - FromAddress: sender.Bytes(), - OrderId: orderId, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgInactivateFarmingOrder) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgInactivateFarmingOrder) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgSetDailyRewardPercent{} - -func NewMsgSetDailyRewardPercent(sender sdk.AccAddress, accId, tarId string, rate sdk.Dec, timestamp int) MsgSetDailyRewardPercent { - return MsgSetDailyRewardPercent{ - FromAddress: sender.Bytes(), - AccountId: accId, - TargetId: tarId, - Rate: rate, - Date: time.Unix(int64(timestamp), 0).UTC(), - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgSetDailyRewardPercent) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgSetDailyRewardPercent) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgExecuteFarmingOrders{} - -func NewMsgExecuteFarmingOrders(sender sdk.AccAddress, orderIds []string) MsgExecuteFarmingOrders { - return MsgExecuteFarmingOrders{ - FromAddress: sender.Bytes(), - OrderIds: orderIds, - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgExecuteFarmingOrders) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgExecuteFarmingOrders) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} - -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgBeginWithdrawAll{} - -func NewMsgBeginWithdrawAll(sender sdk.AccAddress) MsgBeginWithdrawAll { - return MsgBeginWithdrawAll{ - FromAddress: sender.Bytes(), - } -} - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgBeginWithdrawAll) ValidateBasic() error { - return nil -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgBeginWithdrawAll) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.FromAddress.AccAddress()} -} diff --git a/deprecated/x/yieldaggregatorv1/types/params.go b/deprecated/x/yieldaggregatorv1/types/params.go deleted file mode 100644 index 0176dcabf..000000000 --- a/deprecated/x/yieldaggregatorv1/types/params.go +++ /dev/null @@ -1,71 +0,0 @@ -package types - -import ( - fmt "fmt" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramstype "github.com/cosmos/cosmos-sdk/x/params/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// Parameter keys -var ( - KeyRewardRateFeeders = []byte("RewardRateFeeders") -) - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { - return paramstype.ParamSetPairs{ - paramstype.NewParamSetPair(KeyRewardRateFeeders, &p.RewardRateFeeders, validateRewardRateFeeders), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - - if err := validateRewardRateFeeders(p.RewardRateFeeders); err != nil { - return err - } - - return nil -} - -func validateRewardRateFeeders(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v == "" { - return nil - } - - addrs := strings.Split(v, ",") - - for _, addr := range addrs { - _, err := sdk.AccAddressFromBech32(addr) - if err != nil { - return err - } - } - - return nil -} diff --git a/deprecated/x/yieldaggregatorv1/types/params.pb.go b/deprecated/x/yieldaggregatorv1/types/params.pb.go deleted file mode 100644 index 0bb101cab..000000000 --- a/deprecated/x/yieldaggregatorv1/types/params.pb.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldaggregatorv1/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { - RewardRateFeeders string `protobuf:"bytes,1,opt,name=reward_rate_feeders,json=rewardRateFeeders,proto3" json:"reward_rate_feeders,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_3cd79a8949d31337, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetRewardRateFeeders() string { - if m != nil { - return m.RewardRateFeeders - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "ununifi.chain.yieldaggregator.Params") -} - -func init() { proto.RegisterFile("yieldaggregatorv1/params.proto", fileDescriptor_3cd79a8949d31337) } - -var fileDescriptor_3cd79a8949d31337 = []byte{ - // 200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xab, 0xcc, 0x4c, 0xcd, - 0x49, 0x49, 0x4c, 0x4f, 0x2f, 0x4a, 0x4d, 0x4f, 0x2c, 0xc9, 0x2f, 0x2a, 0x33, 0xd4, 0x2f, 0x48, - 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x2d, 0xcd, 0x2b, 0xcd, - 0xcb, 0x4c, 0xcb, 0xd4, 0x4b, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x43, 0x53, 0x2d, 0x25, 0x92, 0x9e, - 0x9f, 0x9e, 0x0f, 0x56, 0xa9, 0x0f, 0x62, 0x41, 0x34, 0x29, 0x59, 0x70, 0xb1, 0x05, 0x80, 0x0d, - 0x11, 0xd2, 0xe3, 0x12, 0x2e, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0x89, 0x2f, 0x4a, 0x2c, 0x49, 0x8d, - 0x4f, 0x4b, 0x4d, 0x4d, 0x49, 0x2d, 0x2a, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x12, 0x84, - 0x48, 0x05, 0x25, 0x96, 0xa4, 0xba, 0x41, 0x24, 0x9c, 0x7c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, - 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, - 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x28, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, - 0x3f, 0x34, 0x2f, 0x34, 0x2f, 0xd3, 0x2d, 0x53, 0x1f, 0xec, 0x26, 0xfd, 0x0a, 0x7d, 0x4c, 0x3f, - 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x9d, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, - 0x59, 0xc7, 0xc6, 0xd3, 0xe5, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RewardRateFeeders) > 0 { - i -= len(m.RewardRateFeeders) - copy(dAtA[i:], m.RewardRateFeeders) - i = encodeVarintParams(dAtA, i, uint64(len(m.RewardRateFeeders))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RewardRateFeeders) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardRateFeeders", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RewardRateFeeders = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/types/proposal.go b/deprecated/x/yieldaggregatorv1/types/proposal.go deleted file mode 100644 index 2f2680bca..000000000 --- a/deprecated/x/yieldaggregatorv1/types/proposal.go +++ /dev/null @@ -1,245 +0,0 @@ -package types - -import ( - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -const ( - // ProposalTypeAddYieldFarm defines the type for a ProposalAddYieldFarm - ProposalTypeAddYieldFarm = "AddYieldFarm" - ProposalTypeUpdateYieldFarm = "UpdateYieldFarm" - ProposalTypeStopYieldFarm = "StopYieldFarm" - ProposalTypeRemoveYieldFarm = "RemoveYieldFarm" - ProposalTypeAddYieldFarmTarget = "AddYieldFarmTarget" - ProposalTypeUpdateYieldFarmTarget = "UpdateYieldFarmTarget" - ProposalTypeStopYieldFarmTarget = "StopYieldFarmTarget" - ProposalTypeRemoveYieldFarmTarget = "RemoveYieldFarmTarget" -) - -func init() { - govtypes.RegisterProposalType(ProposalTypeAddYieldFarm) - govtypes.RegisterProposalType(ProposalTypeUpdateYieldFarm) - govtypes.RegisterProposalType(ProposalTypeStopYieldFarm) - govtypes.RegisterProposalType(ProposalTypeRemoveYieldFarm) - govtypes.RegisterProposalType(ProposalTypeAddYieldFarmTarget) - govtypes.RegisterProposalType(ProposalTypeUpdateYieldFarmTarget) - govtypes.RegisterProposalType(ProposalTypeStopYieldFarmTarget) - govtypes.RegisterProposalType(ProposalTypeRemoveYieldFarmTarget) -} - -// Assert ProposalAddYieldFarm implements govtypes.Content at compile-time -var _ govtypes.Content = &ProposalAddYieldFarm{} - -func NewProposalAddYieldFarm(title, description string, assetManagementAccount *AssetManagementAccount) *ProposalAddYieldFarm { - return &ProposalAddYieldFarm{ - Title: title, - Description: description, - Account: assetManagementAccount, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalAddYieldFarm) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalAddYieldFarm) ProposalType() string { return ProposalTypeAddYieldFarm } - -// ValidateBasic validates the parameter change proposal -func (p *ProposalAddYieldFarm) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalUpdateYieldFarm{} - -func NewProposalUpdateYieldFarm(title, description string, assetManagementAccount *AssetManagementAccount) *ProposalUpdateYieldFarm { - return &ProposalUpdateYieldFarm{ - Title: title, - Description: description, - Account: assetManagementAccount, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalUpdateYieldFarm) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalUpdateYieldFarm) ProposalType() string { return ProposalTypeUpdateYieldFarm } - -// ValidateBasic validates the parameter change proposal -func (p *ProposalUpdateYieldFarm) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalStopYieldFarm{} - -func NewProposalStopYieldFarm(title, description, assetManagementAccountId string) *ProposalStopYieldFarm { - return &ProposalStopYieldFarm{ - Title: title, - Description: description, - Id: assetManagementAccountId, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalStopYieldFarm) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalStopYieldFarm) ProposalType() string { return ProposalTypeStopYieldFarm } - -// ValidateBasic validates the parameter change proposal -func (p *ProposalStopYieldFarm) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalRemoveYieldFarm{} - -func NewProposalRemoveYieldFarm(title, description, assetManagementAccountId string) *ProposalRemoveYieldFarm { - return &ProposalRemoveYieldFarm{ - Title: title, - Description: description, - Id: assetManagementAccountId, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalRemoveYieldFarm) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalRemoveYieldFarm) ProposalType() string { return ProposalTypeRemoveYieldFarm } - -// ValidateBasic validates the parameter change proposal -func (p *ProposalRemoveYieldFarm) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalAddYieldFarmTarget{} - -func NewProposalAddYieldFarmTarget(title, description string, target *AssetManagementTarget) *ProposalAddYieldFarmTarget { - return &ProposalAddYieldFarmTarget{ - Title: title, - Description: description, - Target: target, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalAddYieldFarmTarget) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalAddYieldFarmTarget) ProposalType() string { return ProposalTypeAddYieldFarmTarget } - -// ValidateBasic validates the parameter change proposal -func (p *ProposalAddYieldFarmTarget) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalUpdateYieldFarmTarget{} - -func NewProposalUpdateYieldFarmTarget(title, description string, target *AssetManagementTarget) *ProposalUpdateYieldFarmTarget { - return &ProposalUpdateYieldFarmTarget{ - Title: title, - Description: description, - Target: target, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalUpdateYieldFarmTarget) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalUpdateYieldFarmTarget) ProposalType() string { - return ProposalTypeUpdateYieldFarmTarget -} - -// ValidateBasic validates the parameter change proposal -func (p *ProposalUpdateYieldFarmTarget) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalStopYieldFarmTarget{} - -func NewProposalStopYieldFarmTarget(title, description, assetManagementAccountId, assetManagementTargetId string) *ProposalStopYieldFarmTarget { - return &ProposalStopYieldFarmTarget{ - Title: title, - Description: description, - AssetManagementAccountId: assetManagementAccountId, - Id: assetManagementTargetId, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalStopYieldFarmTarget) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalStopYieldFarmTarget) ProposalType() string { - return ProposalTypeStopYieldFarmTarget -} - -// ValidateBasic validates the parameter change proposal -func (p *ProposalStopYieldFarmTarget) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} - -var _ govtypes.Content = &ProposalRemoveYieldFarmTarget{} - -func NewProposalRemoveYieldFarmTarget(title, description, assetManagementAccountId, assetManagementTargetId string) *ProposalRemoveYieldFarmTarget { - return &ProposalRemoveYieldFarmTarget{ - Title: title, - Description: description, - AssetManagementAccountId: assetManagementAccountId, - Id: assetManagementTargetId, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalRemoveYieldFarmTarget) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalRemoveYieldFarmTarget) ProposalType() string { - return ProposalTypeRemoveYieldFarmTarget -} - -// ValidateBasic validates the parameter change proposal -func (p *ProposalRemoveYieldFarmTarget) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} diff --git a/deprecated/x/yieldaggregatorv1/types/proposal.pb.go b/deprecated/x/yieldaggregatorv1/types/proposal.pb.go deleted file mode 100644 index bd532e03c..000000000 --- a/deprecated/x/yieldaggregatorv1/types/proposal.pb.go +++ /dev/null @@ -1,2484 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldaggregatorv1/proposal.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// proposal to add new yield farm. -type ProposalAddYieldFarm struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Account *AssetManagementAccount `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` -} - -func (m *ProposalAddYieldFarm) Reset() { *m = ProposalAddYieldFarm{} } -func (m *ProposalAddYieldFarm) String() string { return proto.CompactTextString(m) } -func (*ProposalAddYieldFarm) ProtoMessage() {} -func (*ProposalAddYieldFarm) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{0} -} -func (m *ProposalAddYieldFarm) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalAddYieldFarm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalAddYieldFarm.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalAddYieldFarm) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalAddYieldFarm.Merge(m, src) -} -func (m *ProposalAddYieldFarm) XXX_Size() int { - return m.Size() -} -func (m *ProposalAddYieldFarm) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalAddYieldFarm.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalAddYieldFarm proto.InternalMessageInfo - -func (m *ProposalAddYieldFarm) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalAddYieldFarm) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalAddYieldFarm) GetAccount() *AssetManagementAccount { - if m != nil { - return m.Account - } - return nil -} - -// proposal to update yield farm info -type ProposalUpdateYieldFarm struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Account *AssetManagementAccount `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` -} - -func (m *ProposalUpdateYieldFarm) Reset() { *m = ProposalUpdateYieldFarm{} } -func (m *ProposalUpdateYieldFarm) String() string { return proto.CompactTextString(m) } -func (*ProposalUpdateYieldFarm) ProtoMessage() {} -func (*ProposalUpdateYieldFarm) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{1} -} -func (m *ProposalUpdateYieldFarm) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalUpdateYieldFarm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalUpdateYieldFarm.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalUpdateYieldFarm) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalUpdateYieldFarm.Merge(m, src) -} -func (m *ProposalUpdateYieldFarm) XXX_Size() int { - return m.Size() -} -func (m *ProposalUpdateYieldFarm) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalUpdateYieldFarm.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalUpdateYieldFarm proto.InternalMessageInfo - -func (m *ProposalUpdateYieldFarm) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalUpdateYieldFarm) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalUpdateYieldFarm) GetAccount() *AssetManagementAccount { - if m != nil { - return m.Account - } - return nil -} - -// proposal to remove yield farm -type ProposalStopYieldFarm struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *ProposalStopYieldFarm) Reset() { *m = ProposalStopYieldFarm{} } -func (m *ProposalStopYieldFarm) String() string { return proto.CompactTextString(m) } -func (*ProposalStopYieldFarm) ProtoMessage() {} -func (*ProposalStopYieldFarm) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{2} -} -func (m *ProposalStopYieldFarm) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalStopYieldFarm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalStopYieldFarm.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalStopYieldFarm) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalStopYieldFarm.Merge(m, src) -} -func (m *ProposalStopYieldFarm) XXX_Size() int { - return m.Size() -} -func (m *ProposalStopYieldFarm) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalStopYieldFarm.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalStopYieldFarm proto.InternalMessageInfo - -func (m *ProposalStopYieldFarm) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalStopYieldFarm) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalStopYieldFarm) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -// proposal to remove yield farm -type ProposalRemoveYieldFarm struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *ProposalRemoveYieldFarm) Reset() { *m = ProposalRemoveYieldFarm{} } -func (m *ProposalRemoveYieldFarm) String() string { return proto.CompactTextString(m) } -func (*ProposalRemoveYieldFarm) ProtoMessage() {} -func (*ProposalRemoveYieldFarm) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{3} -} -func (m *ProposalRemoveYieldFarm) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalRemoveYieldFarm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalRemoveYieldFarm.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalRemoveYieldFarm) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalRemoveYieldFarm.Merge(m, src) -} -func (m *ProposalRemoveYieldFarm) XXX_Size() int { - return m.Size() -} -func (m *ProposalRemoveYieldFarm) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalRemoveYieldFarm.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalRemoveYieldFarm proto.InternalMessageInfo - -func (m *ProposalRemoveYieldFarm) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalRemoveYieldFarm) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalRemoveYieldFarm) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -// proposal to add new yield farm target -type ProposalAddYieldFarmTarget struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Target *AssetManagementTarget `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` -} - -func (m *ProposalAddYieldFarmTarget) Reset() { *m = ProposalAddYieldFarmTarget{} } -func (m *ProposalAddYieldFarmTarget) String() string { return proto.CompactTextString(m) } -func (*ProposalAddYieldFarmTarget) ProtoMessage() {} -func (*ProposalAddYieldFarmTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{4} -} -func (m *ProposalAddYieldFarmTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalAddYieldFarmTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalAddYieldFarmTarget.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalAddYieldFarmTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalAddYieldFarmTarget.Merge(m, src) -} -func (m *ProposalAddYieldFarmTarget) XXX_Size() int { - return m.Size() -} -func (m *ProposalAddYieldFarmTarget) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalAddYieldFarmTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalAddYieldFarmTarget proto.InternalMessageInfo - -func (m *ProposalAddYieldFarmTarget) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalAddYieldFarmTarget) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalAddYieldFarmTarget) GetTarget() *AssetManagementTarget { - if m != nil { - return m.Target - } - return nil -} - -// proposal to update yield farm target -type ProposalUpdateYieldFarmTarget struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Target *AssetManagementTarget `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` -} - -func (m *ProposalUpdateYieldFarmTarget) Reset() { *m = ProposalUpdateYieldFarmTarget{} } -func (m *ProposalUpdateYieldFarmTarget) String() string { return proto.CompactTextString(m) } -func (*ProposalUpdateYieldFarmTarget) ProtoMessage() {} -func (*ProposalUpdateYieldFarmTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{5} -} -func (m *ProposalUpdateYieldFarmTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalUpdateYieldFarmTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalUpdateYieldFarmTarget.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalUpdateYieldFarmTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalUpdateYieldFarmTarget.Merge(m, src) -} -func (m *ProposalUpdateYieldFarmTarget) XXX_Size() int { - return m.Size() -} -func (m *ProposalUpdateYieldFarmTarget) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalUpdateYieldFarmTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalUpdateYieldFarmTarget proto.InternalMessageInfo - -func (m *ProposalUpdateYieldFarmTarget) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalUpdateYieldFarmTarget) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalUpdateYieldFarmTarget) GetTarget() *AssetManagementTarget { - if m != nil { - return m.Target - } - return nil -} - -// proposal to stop yield farm target -type ProposalStopYieldFarmTarget struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` - AssetManagementAccountId string `protobuf:"bytes,4,opt,name=asset_management_account_id,json=assetManagementAccountId,proto3" json:"asset_management_account_id,omitempty"` -} - -func (m *ProposalStopYieldFarmTarget) Reset() { *m = ProposalStopYieldFarmTarget{} } -func (m *ProposalStopYieldFarmTarget) String() string { return proto.CompactTextString(m) } -func (*ProposalStopYieldFarmTarget) ProtoMessage() {} -func (*ProposalStopYieldFarmTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{6} -} -func (m *ProposalStopYieldFarmTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalStopYieldFarmTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalStopYieldFarmTarget.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalStopYieldFarmTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalStopYieldFarmTarget.Merge(m, src) -} -func (m *ProposalStopYieldFarmTarget) XXX_Size() int { - return m.Size() -} -func (m *ProposalStopYieldFarmTarget) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalStopYieldFarmTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalStopYieldFarmTarget proto.InternalMessageInfo - -func (m *ProposalStopYieldFarmTarget) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalStopYieldFarmTarget) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalStopYieldFarmTarget) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *ProposalStopYieldFarmTarget) GetAssetManagementAccountId() string { - if m != nil { - return m.AssetManagementAccountId - } - return "" -} - -// proposal to delete yield farm target -type ProposalRemoveYieldFarmTarget struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` - AssetManagementAccountId string `protobuf:"bytes,4,opt,name=asset_management_account_id,json=assetManagementAccountId,proto3" json:"asset_management_account_id,omitempty"` -} - -func (m *ProposalRemoveYieldFarmTarget) Reset() { *m = ProposalRemoveYieldFarmTarget{} } -func (m *ProposalRemoveYieldFarmTarget) String() string { return proto.CompactTextString(m) } -func (*ProposalRemoveYieldFarmTarget) ProtoMessage() {} -func (*ProposalRemoveYieldFarmTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_f97b6a5309322393, []int{7} -} -func (m *ProposalRemoveYieldFarmTarget) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalRemoveYieldFarmTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalRemoveYieldFarmTarget.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalRemoveYieldFarmTarget) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalRemoveYieldFarmTarget.Merge(m, src) -} -func (m *ProposalRemoveYieldFarmTarget) XXX_Size() int { - return m.Size() -} -func (m *ProposalRemoveYieldFarmTarget) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalRemoveYieldFarmTarget.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalRemoveYieldFarmTarget proto.InternalMessageInfo - -func (m *ProposalRemoveYieldFarmTarget) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalRemoveYieldFarmTarget) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalRemoveYieldFarmTarget) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *ProposalRemoveYieldFarmTarget) GetAssetManagementAccountId() string { - if m != nil { - return m.AssetManagementAccountId - } - return "" -} - -func init() { - proto.RegisterType((*ProposalAddYieldFarm)(nil), "ununifi.chain.yieldaggregator.ProposalAddYieldFarm") - proto.RegisterType((*ProposalUpdateYieldFarm)(nil), "ununifi.chain.yieldaggregator.ProposalUpdateYieldFarm") - proto.RegisterType((*ProposalStopYieldFarm)(nil), "ununifi.chain.yieldaggregator.ProposalStopYieldFarm") - proto.RegisterType((*ProposalRemoveYieldFarm)(nil), "ununifi.chain.yieldaggregator.ProposalRemoveYieldFarm") - proto.RegisterType((*ProposalAddYieldFarmTarget)(nil), "ununifi.chain.yieldaggregator.ProposalAddYieldFarmTarget") - proto.RegisterType((*ProposalUpdateYieldFarmTarget)(nil), "ununifi.chain.yieldaggregator.ProposalUpdateYieldFarmTarget") - proto.RegisterType((*ProposalStopYieldFarmTarget)(nil), "ununifi.chain.yieldaggregator.ProposalStopYieldFarmTarget") - proto.RegisterType((*ProposalRemoveYieldFarmTarget)(nil), "ununifi.chain.yieldaggregator.ProposalRemoveYieldFarmTarget") -} - -func init() { proto.RegisterFile("yieldaggregatorv1/proposal.proto", fileDescriptor_f97b6a5309322393) } - -var fileDescriptor_f97b6a5309322393 = []byte{ - // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xc1, 0x6e, 0xda, 0x30, - 0x18, 0xc7, 0x31, 0xdb, 0x98, 0x30, 0xd2, 0x0e, 0x11, 0xd3, 0x22, 0x10, 0x51, 0x94, 0x13, 0xa7, - 0x44, 0x63, 0xdb, 0x71, 0x07, 0x76, 0x40, 0x9a, 0xc4, 0xb4, 0x29, 0x2b, 0x87, 0xf6, 0x12, 0x99, - 0xd8, 0x35, 0x96, 0x88, 0x1d, 0x39, 0x0e, 0x2a, 0x6f, 0xd1, 0x37, 0xa8, 0x84, 0xda, 0x3e, 0x4b, - 0x8f, 0x1c, 0x7b, 0xac, 0xe0, 0x45, 0x2a, 0x9c, 0xd0, 0x22, 0x48, 0x2b, 0xb5, 0xf4, 0xc0, 0x2d, - 0xc9, 0xf7, 0xf9, 0xff, 0xfd, 0xf2, 0xf7, 0xdf, 0x86, 0xf6, 0x94, 0x91, 0x31, 0x46, 0x94, 0x4a, - 0x42, 0x91, 0x12, 0x72, 0xf2, 0xd5, 0x8b, 0xa5, 0x88, 0x45, 0x82, 0xc6, 0x6e, 0x2c, 0x85, 0x12, - 0x46, 0x2b, 0xe5, 0x29, 0x67, 0xa7, 0xcc, 0x0d, 0x47, 0x88, 0x71, 0x77, 0xab, 0xbf, 0x51, 0xa7, - 0x82, 0x0a, 0xdd, 0xe9, 0xad, 0x9e, 0xb2, 0x45, 0x0d, 0xab, 0x40, 0x16, 0x49, 0x14, 0x25, 0x79, - 0xbd, 0xb5, 0x5b, 0x47, 0x49, 0x42, 0x54, 0x56, 0x76, 0x2e, 0x00, 0xac, 0xff, 0xcb, 0x31, 0xba, - 0x18, 0x1f, 0xaf, 0x9a, 0x7b, 0x48, 0x46, 0x46, 0x1d, 0x7e, 0x50, 0x4c, 0x8d, 0x89, 0x09, 0x6c, - 0xd0, 0xae, 0xfa, 0xd9, 0x8b, 0x61, 0xc3, 0x1a, 0x26, 0x49, 0x28, 0x59, 0xac, 0x98, 0xe0, 0x66, - 0x59, 0xd7, 0x36, 0x3f, 0x19, 0x7f, 0xe1, 0x47, 0x14, 0x86, 0x22, 0xe5, 0xca, 0x7c, 0x67, 0x83, - 0x76, 0xad, 0xf3, 0xc3, 0x7d, 0xf6, 0xb7, 0xdc, 0xee, 0x8a, 0xe6, 0x0f, 0xe2, 0x88, 0x92, 0x88, - 0x70, 0xd5, 0xcd, 0x16, 0xfb, 0x6b, 0x15, 0x67, 0x06, 0xe0, 0x97, 0x35, 0xe1, 0x20, 0xc6, 0x48, - 0x91, 0x03, 0x84, 0x0c, 0xe0, 0xe7, 0x35, 0xe3, 0x7f, 0x25, 0xe2, 0xfd, 0x09, 0x3f, 0xc1, 0x32, - 0xc3, 0x1a, 0xae, 0xea, 0x97, 0x19, 0x76, 0xd0, 0xa3, 0x09, 0x3e, 0x89, 0xc4, 0x84, 0xbc, 0xfd, - 0x88, 0x19, 0x80, 0x8d, 0xa2, 0x28, 0x1c, 0x21, 0x49, 0x89, 0x7a, 0xf5, 0x98, 0x3e, 0xac, 0x28, - 0xad, 0x90, 0x5b, 0xfd, 0xfd, 0x65, 0x56, 0x67, 0xd3, 0xfd, 0x5c, 0xc3, 0xb9, 0x02, 0xb0, 0xf5, - 0x44, 0x1a, 0x0e, 0x8a, 0xf3, 0x12, 0xc0, 0x66, 0x61, 0x22, 0xf6, 0xa4, 0xdc, 0xda, 0x34, 0xe3, - 0x27, 0x6c, 0xea, 0xe3, 0x1c, 0x44, 0x0f, 0x24, 0x41, 0x1e, 0xca, 0x80, 0x61, 0xf3, 0xbd, 0x6e, - 0x34, 0x51, 0x61, 0x7c, 0x7f, 0x63, 0xe7, 0x7a, 0xc3, 0xce, 0xad, 0x5c, 0x1d, 0x14, 0xe8, 0xaf, - 0xfe, 0xcd, 0xc2, 0x02, 0xf3, 0x85, 0x05, 0xee, 0x16, 0x16, 0x38, 0x5f, 0x5a, 0xa5, 0xf9, 0xd2, - 0x2a, 0xdd, 0x2e, 0xad, 0xd2, 0x49, 0x87, 0x32, 0x35, 0x4a, 0x87, 0x6e, 0x28, 0x22, 0x6f, 0xc0, - 0x07, 0x9c, 0xf5, 0x98, 0xa7, 0x77, 0xcc, 0x3b, 0xf3, 0x76, 0xef, 0x3e, 0x35, 0x8d, 0x49, 0x32, - 0xac, 0xe8, 0xcb, 0xef, 0xdb, 0x7d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xc3, 0xf8, 0xeb, 0x94, - 0x05, 0x00, 0x00, -} - -func (m *ProposalAddYieldFarm) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalAddYieldFarm) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalAddYieldFarm) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Account != nil { - { - size, err := m.Account.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalUpdateYieldFarm) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalUpdateYieldFarm) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalUpdateYieldFarm) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Account != nil { - { - size, err := m.Account.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalStopYieldFarm) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalStopYieldFarm) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalStopYieldFarm) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalRemoveYieldFarm) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalRemoveYieldFarm) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalRemoveYieldFarm) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalAddYieldFarmTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalAddYieldFarmTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalAddYieldFarmTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Target != nil { - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalUpdateYieldFarmTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalUpdateYieldFarmTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalUpdateYieldFarmTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Target != nil { - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalStopYieldFarmTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalStopYieldFarmTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalStopYieldFarmTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AssetManagementAccountId) > 0 { - i -= len(m.AssetManagementAccountId) - copy(dAtA[i:], m.AssetManagementAccountId) - i = encodeVarintProposal(dAtA, i, uint64(len(m.AssetManagementAccountId))) - i-- - dAtA[i] = 0x22 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProposalRemoveYieldFarmTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalRemoveYieldFarmTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalRemoveYieldFarmTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AssetManagementAccountId) > 0 { - i -= len(m.AssetManagementAccountId) - copy(dAtA[i:], m.AssetManagementAccountId) - i = encodeVarintProposal(dAtA, i, uint64(len(m.AssetManagementAccountId))) - i-- - dAtA[i] = 0x22 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { - offset -= sovProposal(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ProposalAddYieldFarm) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Account != nil { - l = m.Account.Size() - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalUpdateYieldFarm) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Account != nil { - l = m.Account.Size() - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalStopYieldFarm) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalRemoveYieldFarm) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalAddYieldFarmTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Target != nil { - l = m.Target.Size() - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalUpdateYieldFarmTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Target != nil { - l = m.Target.Size() - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalStopYieldFarmTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.AssetManagementAccountId) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func (m *ProposalRemoveYieldFarmTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.AssetManagementAccountId) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func sovProposal(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProposal(x uint64) (n int) { - return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ProposalAddYieldFarm) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalAddYieldFarm: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalAddYieldFarm: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Account == nil { - m.Account = &AssetManagementAccount{} - } - if err := m.Account.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalUpdateYieldFarm) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalUpdateYieldFarm: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalUpdateYieldFarm: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Account == nil { - m.Account = &AssetManagementAccount{} - } - if err := m.Account.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalStopYieldFarm) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalStopYieldFarm: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalStopYieldFarm: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalRemoveYieldFarm) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalRemoveYieldFarm: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalRemoveYieldFarm: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalAddYieldFarmTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalAddYieldFarmTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalAddYieldFarmTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Target == nil { - m.Target = &AssetManagementTarget{} - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalUpdateYieldFarmTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalUpdateYieldFarmTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalUpdateYieldFarmTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Target == nil { - m.Target = &AssetManagementTarget{} - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalStopYieldFarmTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalStopYieldFarmTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalStopYieldFarmTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetManagementAccountId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetManagementAccountId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProposalRemoveYieldFarmTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalRemoveYieldFarmTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalRemoveYieldFarmTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetManagementAccountId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetManagementAccountId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProposal(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthProposal - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProposal - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProposal - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProposal = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/types/query.pb.go b/deprecated/x/yieldaggregatorv1/types/query.pb.go deleted file mode 100644 index 5e3c119f0..000000000 --- a/deprecated/x/yieldaggregatorv1/types/query.pb.go +++ /dev/null @@ -1,2905 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldaggregatorv1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -type AssetManagementAccountInfo struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - AssetManagementTargets []AssetManagementTarget `protobuf:"bytes,3,rep,name=asset_management_targets,json=assetManagementTargets,proto3" json:"asset_management_targets"` -} - -func (m *AssetManagementAccountInfo) Reset() { *m = AssetManagementAccountInfo{} } -func (m *AssetManagementAccountInfo) String() string { return proto.CompactTextString(m) } -func (*AssetManagementAccountInfo) ProtoMessage() {} -func (*AssetManagementAccountInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{2} -} -func (m *AssetManagementAccountInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetManagementAccountInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetManagementAccountInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AssetManagementAccountInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetManagementAccountInfo.Merge(m, src) -} -func (m *AssetManagementAccountInfo) XXX_Size() int { - return m.Size() -} -func (m *AssetManagementAccountInfo) XXX_DiscardUnknown() { - xxx_messageInfo_AssetManagementAccountInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetManagementAccountInfo proto.InternalMessageInfo - -func (m *AssetManagementAccountInfo) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *AssetManagementAccountInfo) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *AssetManagementAccountInfo) GetAssetManagementTargets() []AssetManagementTarget { - if m != nil { - return m.AssetManagementTargets - } - return nil -} - -type QueryAssetManagementAccountRequest struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *QueryAssetManagementAccountRequest) Reset() { *m = QueryAssetManagementAccountRequest{} } -func (m *QueryAssetManagementAccountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAssetManagementAccountRequest) ProtoMessage() {} -func (*QueryAssetManagementAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{3} -} -func (m *QueryAssetManagementAccountRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAssetManagementAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAssetManagementAccountRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAssetManagementAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAssetManagementAccountRequest.Merge(m, src) -} -func (m *QueryAssetManagementAccountRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAssetManagementAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAssetManagementAccountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAssetManagementAccountRequest proto.InternalMessageInfo - -func (m *QueryAssetManagementAccountRequest) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -type QueryAssetManagementAccountResponse struct { - Account AssetManagementAccountInfo `protobuf:"bytes,1,opt,name=account,proto3" json:"account"` -} - -func (m *QueryAssetManagementAccountResponse) Reset() { *m = QueryAssetManagementAccountResponse{} } -func (m *QueryAssetManagementAccountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAssetManagementAccountResponse) ProtoMessage() {} -func (*QueryAssetManagementAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{4} -} -func (m *QueryAssetManagementAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAssetManagementAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAssetManagementAccountResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAssetManagementAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAssetManagementAccountResponse.Merge(m, src) -} -func (m *QueryAssetManagementAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAssetManagementAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAssetManagementAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAssetManagementAccountResponse proto.InternalMessageInfo - -func (m *QueryAssetManagementAccountResponse) GetAccount() AssetManagementAccountInfo { - if m != nil { - return m.Account - } - return AssetManagementAccountInfo{} -} - -type QueryAllAssetManagementAccountsRequest struct { -} - -func (m *QueryAllAssetManagementAccountsRequest) Reset() { - *m = QueryAllAssetManagementAccountsRequest{} -} -func (m *QueryAllAssetManagementAccountsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllAssetManagementAccountsRequest) ProtoMessage() {} -func (*QueryAllAssetManagementAccountsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{5} -} -func (m *QueryAllAssetManagementAccountsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAssetManagementAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAssetManagementAccountsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllAssetManagementAccountsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAssetManagementAccountsRequest.Merge(m, src) -} -func (m *QueryAllAssetManagementAccountsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAssetManagementAccountsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAssetManagementAccountsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAssetManagementAccountsRequest proto.InternalMessageInfo - -type QueryAllAssetManagementAccountsResponse struct { - Accounts []AssetManagementAccountInfo `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` -} - -func (m *QueryAllAssetManagementAccountsResponse) Reset() { - *m = QueryAllAssetManagementAccountsResponse{} -} -func (m *QueryAllAssetManagementAccountsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllAssetManagementAccountsResponse) ProtoMessage() {} -func (*QueryAllAssetManagementAccountsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{6} -} -func (m *QueryAllAssetManagementAccountsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllAssetManagementAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllAssetManagementAccountsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllAssetManagementAccountsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllAssetManagementAccountsResponse.Merge(m, src) -} -func (m *QueryAllAssetManagementAccountsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllAssetManagementAccountsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllAssetManagementAccountsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllAssetManagementAccountsResponse proto.InternalMessageInfo - -func (m *QueryAllAssetManagementAccountsResponse) GetAccounts() []AssetManagementAccountInfo { - if m != nil { - return m.Accounts - } - return nil -} - -type QueryUserInfo struct { - Amount []types.Coin `protobuf:"bytes,1,rep,name=amount,proto3" json:"amount"` - FarmingOrders []FarmingOrder `protobuf:"bytes,2,rep,name=farming_orders,json=farmingOrders,proto3" json:"farming_orders"` - FarmedCounter uint64 `protobuf:"varint,3,opt,name=farmed_counter,json=farmedCounter,proto3" json:"farmed_counter,omitempty"` -} - -func (m *QueryUserInfo) Reset() { *m = QueryUserInfo{} } -func (m *QueryUserInfo) String() string { return proto.CompactTextString(m) } -func (*QueryUserInfo) ProtoMessage() {} -func (*QueryUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{7} -} -func (m *QueryUserInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryUserInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserInfo.Merge(m, src) -} -func (m *QueryUserInfo) XXX_Size() int { - return m.Size() -} -func (m *QueryUserInfo) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserInfo proto.InternalMessageInfo - -func (m *QueryUserInfo) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -func (m *QueryUserInfo) GetFarmingOrders() []FarmingOrder { - if m != nil { - return m.FarmingOrders - } - return nil -} - -func (m *QueryUserInfo) GetFarmedCounter() uint64 { - if m != nil { - return m.FarmedCounter - } - return 0 -} - -type QueryUserInfoRequest struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *QueryUserInfoRequest) Reset() { *m = QueryUserInfoRequest{} } -func (m *QueryUserInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryUserInfoRequest) ProtoMessage() {} -func (*QueryUserInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{8} -} -func (m *QueryUserInfoRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserInfoRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryUserInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserInfoRequest.Merge(m, src) -} -func (m *QueryUserInfoRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryUserInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserInfoRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserInfoRequest proto.InternalMessageInfo - -func (m *QueryUserInfoRequest) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -type QueryUserInfoResponse struct { - UserInfo QueryUserInfo `protobuf:"bytes,1,opt,name=user_info,json=userInfo,proto3" json:"user_info"` -} - -func (m *QueryUserInfoResponse) Reset() { *m = QueryUserInfoResponse{} } -func (m *QueryUserInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryUserInfoResponse) ProtoMessage() {} -func (*QueryUserInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{9} -} -func (m *QueryUserInfoResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserInfoResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryUserInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserInfoResponse.Merge(m, src) -} -func (m *QueryUserInfoResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryUserInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserInfoResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserInfoResponse proto.InternalMessageInfo - -func (m *QueryUserInfoResponse) GetUserInfo() QueryUserInfo { - if m != nil { - return m.UserInfo - } - return QueryUserInfo{} -} - -type QueryAllFarmingUnitsRequest struct { -} - -func (m *QueryAllFarmingUnitsRequest) Reset() { *m = QueryAllFarmingUnitsRequest{} } -func (m *QueryAllFarmingUnitsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllFarmingUnitsRequest) ProtoMessage() {} -func (*QueryAllFarmingUnitsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{10} -} -func (m *QueryAllFarmingUnitsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllFarmingUnitsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllFarmingUnitsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllFarmingUnitsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllFarmingUnitsRequest.Merge(m, src) -} -func (m *QueryAllFarmingUnitsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllFarmingUnitsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllFarmingUnitsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllFarmingUnitsRequest proto.InternalMessageInfo - -type QueryAllFarmingUnitsResponse struct { - Units []FarmingUnit `protobuf:"bytes,1,rep,name=units,proto3" json:"units"` -} - -func (m *QueryAllFarmingUnitsResponse) Reset() { *m = QueryAllFarmingUnitsResponse{} } -func (m *QueryAllFarmingUnitsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllFarmingUnitsResponse) ProtoMessage() {} -func (*QueryAllFarmingUnitsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{11} -} -func (m *QueryAllFarmingUnitsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllFarmingUnitsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllFarmingUnitsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryAllFarmingUnitsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllFarmingUnitsResponse.Merge(m, src) -} -func (m *QueryAllFarmingUnitsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllFarmingUnitsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllFarmingUnitsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllFarmingUnitsResponse proto.InternalMessageInfo - -func (m *QueryAllFarmingUnitsResponse) GetUnits() []FarmingUnit { - if m != nil { - return m.Units - } - return nil -} - -type QueryDailyRewardPercentsRequest struct { -} - -func (m *QueryDailyRewardPercentsRequest) Reset() { *m = QueryDailyRewardPercentsRequest{} } -func (m *QueryDailyRewardPercentsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDailyRewardPercentsRequest) ProtoMessage() {} -func (*QueryDailyRewardPercentsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{12} -} -func (m *QueryDailyRewardPercentsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDailyRewardPercentsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDailyRewardPercentsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryDailyRewardPercentsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDailyRewardPercentsRequest.Merge(m, src) -} -func (m *QueryDailyRewardPercentsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDailyRewardPercentsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDailyRewardPercentsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDailyRewardPercentsRequest proto.InternalMessageInfo - -type QueryDailyRewardPercentsResponse struct { - DailyPercents []DailyPercent `protobuf:"bytes,1,rep,name=daily_percents,json=dailyPercents,proto3" json:"daily_percents"` -} - -func (m *QueryDailyRewardPercentsResponse) Reset() { *m = QueryDailyRewardPercentsResponse{} } -func (m *QueryDailyRewardPercentsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDailyRewardPercentsResponse) ProtoMessage() {} -func (*QueryDailyRewardPercentsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_558874aa520757b9, []int{13} -} -func (m *QueryDailyRewardPercentsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDailyRewardPercentsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDailyRewardPercentsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryDailyRewardPercentsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDailyRewardPercentsResponse.Merge(m, src) -} -func (m *QueryDailyRewardPercentsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDailyRewardPercentsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDailyRewardPercentsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDailyRewardPercentsResponse proto.InternalMessageInfo - -func (m *QueryDailyRewardPercentsResponse) GetDailyPercents() []DailyPercent { - if m != nil { - return m.DailyPercents - } - return nil -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.chain.yieldaggregator.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.chain.yieldaggregator.QueryParamsResponse") - proto.RegisterType((*AssetManagementAccountInfo)(nil), "ununifi.chain.yieldaggregator.AssetManagementAccountInfo") - proto.RegisterType((*QueryAssetManagementAccountRequest)(nil), "ununifi.chain.yieldaggregator.QueryAssetManagementAccountRequest") - proto.RegisterType((*QueryAssetManagementAccountResponse)(nil), "ununifi.chain.yieldaggregator.QueryAssetManagementAccountResponse") - proto.RegisterType((*QueryAllAssetManagementAccountsRequest)(nil), "ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsRequest") - proto.RegisterType((*QueryAllAssetManagementAccountsResponse)(nil), "ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsResponse") - proto.RegisterType((*QueryUserInfo)(nil), "ununifi.chain.yieldaggregator.QueryUserInfo") - proto.RegisterType((*QueryUserInfoRequest)(nil), "ununifi.chain.yieldaggregator.QueryUserInfoRequest") - proto.RegisterType((*QueryUserInfoResponse)(nil), "ununifi.chain.yieldaggregator.QueryUserInfoResponse") - proto.RegisterType((*QueryAllFarmingUnitsRequest)(nil), "ununifi.chain.yieldaggregator.QueryAllFarmingUnitsRequest") - proto.RegisterType((*QueryAllFarmingUnitsResponse)(nil), "ununifi.chain.yieldaggregator.QueryAllFarmingUnitsResponse") - proto.RegisterType((*QueryDailyRewardPercentsRequest)(nil), "ununifi.chain.yieldaggregator.QueryDailyRewardPercentsRequest") - proto.RegisterType((*QueryDailyRewardPercentsResponse)(nil), "ununifi.chain.yieldaggregator.QueryDailyRewardPercentsResponse") -} - -func init() { proto.RegisterFile("yieldaggregatorv1/query.proto", fileDescriptor_558874aa520757b9) } - -var fileDescriptor_558874aa520757b9 = []byte{ - // 905 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x18, 0xcd, 0x3a, 0xa9, 0xdb, 0x7c, 0x55, 0x83, 0x34, 0x0d, 0x95, 0x59, 0x1a, 0xd7, 0x2c, 0x2a, - 0x35, 0x05, 0xed, 0x62, 0xd7, 0x6a, 0xf9, 0x53, 0x20, 0x09, 0x58, 0x42, 0x02, 0xb5, 0x58, 0x58, - 0x2a, 0xe5, 0xc2, 0x1a, 0x7b, 0xc7, 0x9b, 0x91, 0xbc, 0x33, 0xee, 0xcc, 0x6e, 0xc1, 0x2a, 0x95, - 0x10, 0x17, 0x5c, 0x23, 0xf1, 0x02, 0xbc, 0x03, 0x12, 0x2f, 0xc0, 0x4d, 0xb9, 0xab, 0x84, 0x84, - 0xb8, 0x02, 0x94, 0x20, 0xf1, 0x00, 0xbc, 0x00, 0xda, 0x99, 0xd9, 0xc5, 0x76, 0xd7, 0x59, 0xbb, - 0xe5, 0xce, 0x3b, 0xdf, 0x9c, 0x33, 0xe7, 0x7c, 0xf3, 0xcd, 0x49, 0x60, 0x67, 0x42, 0xc9, 0xc8, - 0xc7, 0x41, 0x20, 0x48, 0x80, 0x23, 0x2e, 0xee, 0x35, 0xbc, 0xbb, 0x31, 0x11, 0x13, 0x77, 0x2c, - 0x78, 0xc4, 0xd1, 0x4e, 0xcc, 0x62, 0x46, 0x87, 0xd4, 0x1d, 0x1c, 0x62, 0xca, 0xdc, 0xb9, 0xcd, - 0xf6, 0x76, 0xc0, 0x03, 0xae, 0x76, 0x7a, 0xc9, 0x2f, 0x0d, 0xb2, 0x2f, 0x06, 0x9c, 0x07, 0x23, - 0xe2, 0xe1, 0x31, 0xf5, 0x30, 0x63, 0x3c, 0xc2, 0x11, 0xe5, 0x4c, 0x9a, 0x6a, 0x75, 0xc0, 0x65, - 0xc8, 0xa5, 0xd7, 0xc7, 0x92, 0x78, 0xf7, 0x1a, 0x7d, 0x12, 0xe1, 0x86, 0x37, 0xe0, 0x94, 0x99, - 0xfa, 0xd5, 0xe9, 0xba, 0xd2, 0x92, 0xed, 0x1a, 0xe3, 0x80, 0x32, 0x45, 0x96, 0x72, 0x3d, 0xae, - 0x7e, 0x8c, 0x05, 0x0e, 0xd3, 0xb3, 0x72, 0xdc, 0x61, 0x29, 0x49, 0xa4, 0xcb, 0xce, 0x36, 0xa0, - 0x8f, 0x93, 0x03, 0x6e, 0x29, 0x4c, 0x87, 0xdc, 0x8d, 0x89, 0x8c, 0x9c, 0x3b, 0x70, 0x7e, 0x66, - 0x55, 0x8e, 0x39, 0x93, 0x04, 0x1d, 0x40, 0x59, 0x73, 0x57, 0xac, 0x9a, 0x55, 0x3f, 0xdb, 0xbc, - 0xec, 0x9e, 0xd8, 0x1b, 0x57, 0xc3, 0xf7, 0x37, 0x1e, 0xfe, 0x7e, 0x69, 0xad, 0x63, 0xa0, 0xce, - 0x8f, 0x16, 0xd8, 0x7b, 0x89, 0x82, 0x8f, 0x30, 0xc3, 0x01, 0x09, 0x09, 0x8b, 0xf6, 0x06, 0x03, - 0x1e, 0xb3, 0xe8, 0x03, 0x36, 0xe4, 0x68, 0x0b, 0x4a, 0xd4, 0x57, 0xfc, 0x9b, 0x9d, 0x12, 0xf5, - 0x11, 0x82, 0x0d, 0x86, 0x43, 0x52, 0x29, 0xa9, 0x15, 0xf5, 0x1b, 0x45, 0x50, 0x51, 0x1e, 0x7a, - 0x61, 0x46, 0xd1, 0x8b, 0xb0, 0x08, 0x48, 0x24, 0x2b, 0xeb, 0xb5, 0xf5, 0xfa, 0xd9, 0x66, 0xab, - 0x40, 0xd9, 0x9c, 0x80, 0x4f, 0x14, 0xd8, 0x08, 0xbd, 0x80, 0xf3, 0x8a, 0xd2, 0x69, 0x81, 0xa3, - 0x9a, 0x92, 0x2f, 0xde, 0xb4, 0x6e, 0x5e, 0xbf, 0xf3, 0x95, 0x05, 0x2f, 0x9e, 0x08, 0x33, 0xbd, - 0xfd, 0x14, 0x4e, 0x63, 0xbd, 0x64, 0x9a, 0xfb, 0xc6, 0x6a, 0x16, 0xa6, 0x7a, 0x68, 0x7c, 0xa4, - 0x7c, 0x4e, 0x1d, 0x5e, 0xd2, 0x0a, 0x46, 0xa3, 0x7c, 0x50, 0x76, 0xef, 0xdf, 0x58, 0x70, 0xa5, - 0x70, 0xab, 0x11, 0xfc, 0x19, 0x9c, 0x31, 0x07, 0x24, 0xe3, 0xb0, 0xfe, 0x7f, 0x28, 0xce, 0x08, - 0x9d, 0x9f, 0x2d, 0x38, 0xa7, 0x84, 0x74, 0x25, 0x11, 0x6a, 0x2e, 0x6e, 0x40, 0x19, 0x87, 0xa6, - 0x3d, 0xc9, 0x61, 0xcf, 0xb9, 0xfa, 0x91, 0xb8, 0xc9, 0x23, 0x71, 0xcd, 0xf3, 0x70, 0x0f, 0x38, - 0x65, 0xe9, 0xbc, 0xe9, 0xed, 0xe8, 0x36, 0x6c, 0x0d, 0xb1, 0x08, 0x29, 0x0b, 0x7a, 0x5c, 0xf8, - 0x44, 0xc8, 0x4a, 0x49, 0x11, 0xbc, 0x52, 0xa0, 0xb6, 0xad, 0x41, 0x37, 0x13, 0x8c, 0xa1, 0x3c, - 0x37, 0x9c, 0x5a, 0x93, 0xe8, 0xb2, 0x66, 0x26, 0x7e, 0x4f, 0xa9, 0x26, 0xa2, 0xb2, 0x5e, 0xb3, - 0xea, 0x1b, 0x7a, 0x1b, 0xf1, 0x0f, 0xf4, 0xa2, 0xf3, 0x1a, 0x6c, 0xcf, 0x58, 0x49, 0x27, 0xa5, - 0x02, 0xa7, 0xb1, 0xef, 0x0b, 0x22, 0xa5, 0x19, 0x97, 0xf4, 0xd3, 0x39, 0x84, 0x67, 0xe7, 0x10, - 0xa6, 0xe7, 0x37, 0x61, 0x33, 0x96, 0x44, 0xf4, 0x28, 0x1b, 0x72, 0x33, 0x26, 0xaf, 0x16, 0xd8, - 0x98, 0x21, 0x4a, 0xfb, 0x1c, 0x9b, 0x6f, 0x67, 0x07, 0x9e, 0x4f, 0xef, 0xdb, 0xf8, 0xed, 0x32, - 0xfa, 0xdf, 0x3c, 0x0c, 0xe1, 0x62, 0x7e, 0xd9, 0xe8, 0x69, 0xc3, 0xa9, 0x38, 0x59, 0x30, 0x77, - 0x72, 0x75, 0xb9, 0x96, 0x26, 0x1c, 0x46, 0x89, 0x86, 0x3b, 0x2f, 0xc0, 0x25, 0x75, 0xce, 0x7b, - 0x98, 0x8e, 0x26, 0x1d, 0xf2, 0x39, 0x16, 0xfe, 0x2d, 0x22, 0x06, 0x64, 0x6a, 0x34, 0xbf, 0x84, - 0xda, 0xe2, 0x2d, 0x46, 0xce, 0x6d, 0xd8, 0xf2, 0x93, 0x72, 0x6f, 0x6c, 0x2a, 0x46, 0x57, 0xd1, - 0x55, 0x2b, 0x4e, 0xc3, 0x96, 0x5e, 0xb5, 0x3f, 0xb5, 0x26, 0x9b, 0x7f, 0x6c, 0xc2, 0x29, 0x75, - 0x3c, 0xfa, 0xde, 0x82, 0xb2, 0xce, 0x35, 0xd4, 0x58, 0xa6, 0xf5, 0x33, 0xc1, 0x6a, 0x37, 0x57, - 0x81, 0x68, 0x57, 0x8e, 0xf7, 0xf5, 0x2f, 0x7f, 0x7d, 0x57, 0x7a, 0x19, 0x5d, 0xf1, 0xba, 0xac, - 0xcb, 0x68, 0x9b, 0x7a, 0x0a, 0xeb, 0x2d, 0x0a, 0x7e, 0xf4, 0xb7, 0x05, 0x17, 0xf2, 0xdf, 0x1a, - 0xda, 0x5b, 0xe6, 0xfc, 0x13, 0x03, 0xce, 0xde, 0x7f, 0x1a, 0x0a, 0x63, 0xa9, 0xad, 0x2c, 0xbd, - 0x8b, 0x76, 0x0b, 0x2d, 0x3d, 0x96, 0xf3, 0x26, 0x22, 0xbc, 0xfb, 0xd4, 0x7f, 0x80, 0xfe, 0x49, - 0xfe, 0x96, 0x2c, 0x8c, 0x2a, 0xf4, 0xfe, 0x52, 0x52, 0x8b, 0x52, 0xd1, 0x6e, 0x3f, 0x2d, 0xcd, - 0xea, 0xae, 0x47, 0xa3, 0xde, 0x22, 0xe7, 0x12, 0xfd, 0x60, 0xc1, 0x99, 0x2c, 0x17, 0xaf, 0xad, - 0xf2, 0xfe, 0x53, 0x47, 0xad, 0xd5, 0x40, 0x46, 0xff, 0xdb, 0x4a, 0xff, 0x75, 0xd4, 0x2a, 0xd4, - 0x9f, 0x85, 0x94, 0x77, 0xdf, 0x64, 0xda, 0x03, 0xf4, 0x93, 0x05, 0xcf, 0xcc, 0xe5, 0x08, 0x7a, - 0x73, 0xc9, 0xce, 0xe6, 0x64, 0x93, 0xfd, 0xd6, 0x13, 0x61, 0x8d, 0x95, 0x1b, 0xca, 0x4a, 0x03, - 0x79, 0x4b, 0x5d, 0x45, 0x66, 0x47, 0xa2, 0x5f, 0x2d, 0x38, 0x9f, 0x13, 0x41, 0x68, 0x77, 0x19, - 0x35, 0x8b, 0xe3, 0xcd, 0x7e, 0xe7, 0x89, 0xf1, 0xc6, 0xd1, 0xae, 0x72, 0xf4, 0x3a, 0xba, 0x5e, - 0xe8, 0x48, 0x47, 0xa4, 0x50, 0x34, 0x59, 0x52, 0xee, 0x7f, 0xf8, 0xf0, 0xa8, 0x6a, 0x3d, 0x3a, - 0xaa, 0x5a, 0x7f, 0x1e, 0x55, 0xad, 0x6f, 0x8f, 0xab, 0x6b, 0x8f, 0x8e, 0xab, 0x6b, 0xbf, 0x1d, - 0x57, 0xd7, 0xee, 0x34, 0x03, 0x1a, 0x1d, 0xc6, 0x7d, 0x77, 0xc0, 0xc3, 0x39, 0xee, 0x2f, 0x72, - 0xd8, 0xa3, 0xc9, 0x98, 0xc8, 0x7e, 0x59, 0xfd, 0x77, 0x79, 0xed, 0xdf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xa9, 0x2f, 0x4b, 0x70, 0x5c, 0x0b, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - AssetManagementAccount(ctx context.Context, in *QueryAssetManagementAccountRequest, opts ...grpc.CallOption) (*QueryAssetManagementAccountResponse, error) - AllAssetManagementAccounts(ctx context.Context, in *QueryAllAssetManagementAccountsRequest, opts ...grpc.CallOption) (*QueryAllAssetManagementAccountsResponse, error) - UserInfo(ctx context.Context, in *QueryUserInfoRequest, opts ...grpc.CallOption) (*QueryUserInfoResponse, error) - AllFarmingUnits(ctx context.Context, in *QueryAllFarmingUnitsRequest, opts ...grpc.CallOption) (*QueryAllFarmingUnitsResponse, error) - DailyRewardPercents(ctx context.Context, in *QueryDailyRewardPercentsRequest, opts ...grpc.CallOption) (*QueryDailyRewardPercentsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AssetManagementAccount(ctx context.Context, in *QueryAssetManagementAccountRequest, opts ...grpc.CallOption) (*QueryAssetManagementAccountResponse, error) { - out := new(QueryAssetManagementAccountResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Query/AssetManagementAccount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AllAssetManagementAccounts(ctx context.Context, in *QueryAllAssetManagementAccountsRequest, opts ...grpc.CallOption) (*QueryAllAssetManagementAccountsResponse, error) { - out := new(QueryAllAssetManagementAccountsResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Query/AllAssetManagementAccounts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) UserInfo(ctx context.Context, in *QueryUserInfoRequest, opts ...grpc.CallOption) (*QueryUserInfoResponse, error) { - out := new(QueryUserInfoResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Query/UserInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AllFarmingUnits(ctx context.Context, in *QueryAllFarmingUnitsRequest, opts ...grpc.CallOption) (*QueryAllFarmingUnitsResponse, error) { - out := new(QueryAllFarmingUnitsResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Query/AllFarmingUnits", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DailyRewardPercents(ctx context.Context, in *QueryDailyRewardPercentsRequest, opts ...grpc.CallOption) (*QueryDailyRewardPercentsResponse, error) { - out := new(QueryDailyRewardPercentsResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Query/DailyRewardPercents", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - AssetManagementAccount(context.Context, *QueryAssetManagementAccountRequest) (*QueryAssetManagementAccountResponse, error) - AllAssetManagementAccounts(context.Context, *QueryAllAssetManagementAccountsRequest) (*QueryAllAssetManagementAccountsResponse, error) - UserInfo(context.Context, *QueryUserInfoRequest) (*QueryUserInfoResponse, error) - AllFarmingUnits(context.Context, *QueryAllFarmingUnitsRequest) (*QueryAllFarmingUnitsResponse, error) - DailyRewardPercents(context.Context, *QueryDailyRewardPercentsRequest) (*QueryDailyRewardPercentsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) AssetManagementAccount(ctx context.Context, req *QueryAssetManagementAccountRequest) (*QueryAssetManagementAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AssetManagementAccount not implemented") -} -func (*UnimplementedQueryServer) AllAssetManagementAccounts(ctx context.Context, req *QueryAllAssetManagementAccountsRequest) (*QueryAllAssetManagementAccountsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllAssetManagementAccounts not implemented") -} -func (*UnimplementedQueryServer) UserInfo(ctx context.Context, req *QueryUserInfoRequest) (*QueryUserInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserInfo not implemented") -} -func (*UnimplementedQueryServer) AllFarmingUnits(ctx context.Context, req *QueryAllFarmingUnitsRequest) (*QueryAllFarmingUnitsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllFarmingUnits not implemented") -} -func (*UnimplementedQueryServer) DailyRewardPercents(ctx context.Context, req *QueryDailyRewardPercentsRequest) (*QueryDailyRewardPercentsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DailyRewardPercents not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AssetManagementAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAssetManagementAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AssetManagementAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Query/AssetManagementAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AssetManagementAccount(ctx, req.(*QueryAssetManagementAccountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AllAssetManagementAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllAssetManagementAccountsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AllAssetManagementAccounts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Query/AllAssetManagementAccounts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllAssetManagementAccounts(ctx, req.(*QueryAllAssetManagementAccountsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_UserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUserInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).UserInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Query/UserInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UserInfo(ctx, req.(*QueryUserInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AllFarmingUnits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllFarmingUnitsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AllFarmingUnits(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Query/AllFarmingUnits", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllFarmingUnits(ctx, req.(*QueryAllFarmingUnitsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DailyRewardPercents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDailyRewardPercentsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DailyRewardPercents(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Query/DailyRewardPercents", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DailyRewardPercents(ctx, req.(*QueryDailyRewardPercentsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.chain.yieldaggregator.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "AssetManagementAccount", - Handler: _Query_AssetManagementAccount_Handler, - }, - { - MethodName: "AllAssetManagementAccounts", - Handler: _Query_AllAssetManagementAccounts_Handler, - }, - { - MethodName: "UserInfo", - Handler: _Query_UserInfo_Handler, - }, - { - MethodName: "AllFarmingUnits", - Handler: _Query_AllFarmingUnits_Handler, - }, - { - MethodName: "DailyRewardPercents", - Handler: _Query_DailyRewardPercents_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "yieldaggregatorv1/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *AssetManagementAccountInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AssetManagementAccountInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AssetManagementAccountInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AssetManagementTargets) > 0 { - for iNdEx := len(m.AssetManagementTargets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AssetManagementTargets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAssetManagementAccountRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAssetManagementAccountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAssetManagementAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAssetManagementAccountResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAssetManagementAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAssetManagementAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Account.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryAllAssetManagementAccountsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllAssetManagementAccountsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAssetManagementAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllAssetManagementAccountsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllAssetManagementAccountsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllAssetManagementAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Accounts) > 0 { - for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryUserInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryUserInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.FarmedCounter != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.FarmedCounter)) - i-- - dAtA[i] = 0x18 - } - if len(m.FarmingOrders) > 0 { - for iNdEx := len(m.FarmingOrders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FarmingOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryUserInfoRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryUserInfoRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUserInfoResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryUserInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryAllFarmingUnitsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllFarmingUnitsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllFarmingUnitsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllFarmingUnitsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllFarmingUnitsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllFarmingUnitsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Units) > 0 { - for iNdEx := len(m.Units) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Units[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryDailyRewardPercentsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryDailyRewardPercentsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDailyRewardPercentsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryDailyRewardPercentsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryDailyRewardPercentsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDailyRewardPercentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DailyPercents) > 0 { - for iNdEx := len(m.DailyPercents) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DailyPercents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *AssetManagementAccountInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.AssetManagementTargets) > 0 { - for _, e := range m.AssetManagementTargets { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryAssetManagementAccountRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAssetManagementAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Account.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAllAssetManagementAccountsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllAssetManagementAccountsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Accounts) > 0 { - for _, e := range m.Accounts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryUserInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.FarmingOrders) > 0 { - for _, e := range m.FarmingOrders { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.FarmedCounter != 0 { - n += 1 + sovQuery(uint64(m.FarmedCounter)) - } - return n -} - -func (m *QueryUserInfoRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryUserInfoResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.UserInfo.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAllFarmingUnitsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllFarmingUnitsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Units) > 0 { - for _, e := range m.Units { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryDailyRewardPercentsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryDailyRewardPercentsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.DailyPercents) > 0 { - for _, e := range m.DailyPercents { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AssetManagementAccountInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AssetManagementAccountInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AssetManagementAccountInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetManagementTargets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetManagementTargets = append(m.AssetManagementTargets, AssetManagementTarget{}) - if err := m.AssetManagementTargets[len(m.AssetManagementTargets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAssetManagementAccountRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAssetManagementAccountRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAssetManagementAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAssetManagementAccountResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAssetManagementAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAssetManagementAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Account.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAssetManagementAccountsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllAssetManagementAccountsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAssetManagementAccountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllAssetManagementAccountsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllAssetManagementAccountsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllAssetManagementAccountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Accounts = append(m.Accounts, AssetManagementAccountInfo{}) - if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryUserInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryUserInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmingOrders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FarmingOrders = append(m.FarmingOrders, FarmingOrder{}) - if err := m.FarmingOrders[len(m.FarmingOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmedCounter", wireType) - } - m.FarmedCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FarmedCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryUserInfoRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryUserInfoRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryUserInfoResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryUserInfoResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllFarmingUnitsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllFarmingUnitsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllFarmingUnitsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllFarmingUnitsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllFarmingUnitsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllFarmingUnitsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Units", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Units = append(m.Units, FarmingUnit{}) - if err := m.Units[len(m.Units)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDailyRewardPercentsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryDailyRewardPercentsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDailyRewardPercentsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDailyRewardPercentsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryDailyRewardPercentsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDailyRewardPercentsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DailyPercents", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DailyPercents = append(m.DailyPercents, DailyPercent{}) - if err := m.DailyPercents[len(m.DailyPercents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/types/query.pb.gw.go b/deprecated/x/yieldaggregatorv1/types/query.pb.gw.go deleted file mode 100644 index 9b38b41a1..000000000 --- a/deprecated/x/yieldaggregatorv1/types/query.pb.gw.go +++ /dev/null @@ -1,530 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: yieldaggregatorv1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AssetManagementAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAssetManagementAccountRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := client.AssetManagementAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AssetManagementAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAssetManagementAccountRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := server.AssetManagementAccount(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AllAssetManagementAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAssetManagementAccountsRequest - var metadata runtime.ServerMetadata - - msg, err := client.AllAssetManagementAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AllAssetManagementAccounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllAssetManagementAccountsRequest - var metadata runtime.ServerMetadata - - msg, err := server.AllAssetManagementAccounts(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_UserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUserInfoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := client.UserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_UserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUserInfoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := server.UserInfo(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AllFarmingUnits_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllFarmingUnitsRequest - var metadata runtime.ServerMetadata - - msg, err := client.AllFarmingUnits(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AllFarmingUnits_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllFarmingUnitsRequest - var metadata runtime.ServerMetadata - - msg, err := server.AllFarmingUnits(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_DailyRewardPercents_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDailyRewardPercentsRequest - var metadata runtime.ServerMetadata - - msg, err := client.DailyRewardPercents(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DailyRewardPercents_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDailyRewardPercentsRequest - var metadata runtime.ServerMetadata - - msg, err := server.DailyRewardPercents(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AssetManagementAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AssetManagementAccount_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AssetManagementAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AllAssetManagementAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AllAssetManagementAccounts_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AllAssetManagementAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_UserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_UserInfo_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_UserInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AllFarmingUnits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_AllFarmingUnits_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AllFarmingUnits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DailyRewardPercents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_DailyRewardPercents_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DailyRewardPercents_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AssetManagementAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AssetManagementAccount_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AssetManagementAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AllAssetManagementAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AllAssetManagementAccounts_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AllAssetManagementAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_UserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_UserInfo_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_UserInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AllFarmingUnits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_AllFarmingUnits_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_AllFarmingUnits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DailyRewardPercents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_DailyRewardPercents_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DailyRewardPercents_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"UnUniFi", "chain", "yieldaggregatorv1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_AssetManagementAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"UnUniFi", "chain", "yieldaggregatorv1", "asset_management_account", "id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_AllAssetManagementAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"UnUniFi", "chain", "yieldaggregatorv1", "all_asset_management_accounts"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_UserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"UnUniFi", "chain", "yieldaggregatorv1", "user_info", "address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_AllFarmingUnits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"UnUniFi", "chain", "yieldaggregatorv1", "all_user_infos"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_DailyRewardPercents_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"UnUniFi", "chain", "yieldaggregatorv1", "daily_reward_percents"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_AssetManagementAccount_0 = runtime.ForwardResponseMessage - - forward_Query_AllAssetManagementAccounts_0 = runtime.ForwardResponseMessage - - forward_Query_UserInfo_0 = runtime.ForwardResponseMessage - - forward_Query_AllFarmingUnits_0 = runtime.ForwardResponseMessage - - forward_Query_DailyRewardPercents_0 = runtime.ForwardResponseMessage -) diff --git a/deprecated/x/yieldaggregatorv1/types/tx.pb.go b/deprecated/x/yieldaggregatorv1/types/tx.pb.go deleted file mode 100644 index 1a3518f62..000000000 --- a/deprecated/x/yieldaggregatorv1/types/tx.pb.go +++ /dev/null @@ -1,3767 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldaggregatorv1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - github_com_UnUniFi_chain_types "github.com/UnUniFi/chain/deprecated/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type MsgDeposit struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - Amount []types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount"` - ExecuteOrders bool `protobuf:"varint,3,opt,name=execute_orders,json=executeOrders,proto3" json:"execute_orders,omitempty"` -} - -func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } -func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } -func (*MsgDeposit) ProtoMessage() {} -func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{0} -} -func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeposit.Merge(m, src) -} -func (m *MsgDeposit) XXX_Size() int { - return m.Size() -} -func (m *MsgDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo - -func (m *MsgDeposit) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -func (m *MsgDeposit) GetExecuteOrders() bool { - if m != nil { - return m.ExecuteOrders - } - return false -} - -type MsgDepositResponse struct { -} - -func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } -func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDepositResponse) ProtoMessage() {} -func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{1} -} -func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDepositResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositResponse.Merge(m, src) -} -func (m *MsgDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo - -type MsgWithdraw struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - Amount []types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount"` -} - -func (m *MsgWithdraw) Reset() { *m = MsgWithdraw{} } -func (m *MsgWithdraw) String() string { return proto.CompactTextString(m) } -func (*MsgWithdraw) ProtoMessage() {} -func (*MsgWithdraw) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{2} -} -func (m *MsgWithdraw) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdraw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdraw.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdraw) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdraw.Merge(m, src) -} -func (m *MsgWithdraw) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdraw) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdraw.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdraw proto.InternalMessageInfo - -func (m *MsgWithdraw) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -type MsgWithdrawResponse struct { -} - -func (m *MsgWithdrawResponse) Reset() { *m = MsgWithdrawResponse{} } -func (m *MsgWithdrawResponse) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawResponse) ProtoMessage() {} -func (*MsgWithdrawResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{3} -} -func (m *MsgWithdrawResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdrawResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawResponse.Merge(m, src) -} -func (m *MsgWithdrawResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawResponse proto.InternalMessageInfo - -type MsgAddFarmingOrder struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - Order *FarmingOrder `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"` -} - -func (m *MsgAddFarmingOrder) Reset() { *m = MsgAddFarmingOrder{} } -func (m *MsgAddFarmingOrder) String() string { return proto.CompactTextString(m) } -func (*MsgAddFarmingOrder) ProtoMessage() {} -func (*MsgAddFarmingOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{4} -} -func (m *MsgAddFarmingOrder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddFarmingOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddFarmingOrder.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgAddFarmingOrder) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddFarmingOrder.Merge(m, src) -} -func (m *MsgAddFarmingOrder) XXX_Size() int { - return m.Size() -} -func (m *MsgAddFarmingOrder) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddFarmingOrder.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddFarmingOrder proto.InternalMessageInfo - -func (m *MsgAddFarmingOrder) GetOrder() *FarmingOrder { - if m != nil { - return m.Order - } - return nil -} - -type MsgAddFarmingOrderResponse struct { -} - -func (m *MsgAddFarmingOrderResponse) Reset() { *m = MsgAddFarmingOrderResponse{} } -func (m *MsgAddFarmingOrderResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddFarmingOrderResponse) ProtoMessage() {} -func (*MsgAddFarmingOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{5} -} -func (m *MsgAddFarmingOrderResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddFarmingOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddFarmingOrderResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgAddFarmingOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddFarmingOrderResponse.Merge(m, src) -} -func (m *MsgAddFarmingOrderResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddFarmingOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddFarmingOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddFarmingOrderResponse proto.InternalMessageInfo - -type MsgDeleteFarmingOrder struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` -} - -func (m *MsgDeleteFarmingOrder) Reset() { *m = MsgDeleteFarmingOrder{} } -func (m *MsgDeleteFarmingOrder) String() string { return proto.CompactTextString(m) } -func (*MsgDeleteFarmingOrder) ProtoMessage() {} -func (*MsgDeleteFarmingOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{6} -} -func (m *MsgDeleteFarmingOrder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeleteFarmingOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeleteFarmingOrder.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDeleteFarmingOrder) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeleteFarmingOrder.Merge(m, src) -} -func (m *MsgDeleteFarmingOrder) XXX_Size() int { - return m.Size() -} -func (m *MsgDeleteFarmingOrder) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeleteFarmingOrder.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeleteFarmingOrder proto.InternalMessageInfo - -func (m *MsgDeleteFarmingOrder) GetOrderId() string { - if m != nil { - return m.OrderId - } - return "" -} - -type MsgDeleteFarmingOrderResponse struct { -} - -func (m *MsgDeleteFarmingOrderResponse) Reset() { *m = MsgDeleteFarmingOrderResponse{} } -func (m *MsgDeleteFarmingOrderResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDeleteFarmingOrderResponse) ProtoMessage() {} -func (*MsgDeleteFarmingOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{7} -} -func (m *MsgDeleteFarmingOrderResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeleteFarmingOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeleteFarmingOrderResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDeleteFarmingOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeleteFarmingOrderResponse.Merge(m, src) -} -func (m *MsgDeleteFarmingOrderResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDeleteFarmingOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeleteFarmingOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeleteFarmingOrderResponse proto.InternalMessageInfo - -type MsgActivateFarmingOrder struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` -} - -func (m *MsgActivateFarmingOrder) Reset() { *m = MsgActivateFarmingOrder{} } -func (m *MsgActivateFarmingOrder) String() string { return proto.CompactTextString(m) } -func (*MsgActivateFarmingOrder) ProtoMessage() {} -func (*MsgActivateFarmingOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{8} -} -func (m *MsgActivateFarmingOrder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgActivateFarmingOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgActivateFarmingOrder.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgActivateFarmingOrder) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgActivateFarmingOrder.Merge(m, src) -} -func (m *MsgActivateFarmingOrder) XXX_Size() int { - return m.Size() -} -func (m *MsgActivateFarmingOrder) XXX_DiscardUnknown() { - xxx_messageInfo_MsgActivateFarmingOrder.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgActivateFarmingOrder proto.InternalMessageInfo - -func (m *MsgActivateFarmingOrder) GetOrderId() string { - if m != nil { - return m.OrderId - } - return "" -} - -type MsgActivateFarmingOrderResponse struct { -} - -func (m *MsgActivateFarmingOrderResponse) Reset() { *m = MsgActivateFarmingOrderResponse{} } -func (m *MsgActivateFarmingOrderResponse) String() string { return proto.CompactTextString(m) } -func (*MsgActivateFarmingOrderResponse) ProtoMessage() {} -func (*MsgActivateFarmingOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{9} -} -func (m *MsgActivateFarmingOrderResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgActivateFarmingOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgActivateFarmingOrderResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgActivateFarmingOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgActivateFarmingOrderResponse.Merge(m, src) -} -func (m *MsgActivateFarmingOrderResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgActivateFarmingOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgActivateFarmingOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgActivateFarmingOrderResponse proto.InternalMessageInfo - -type MsgInactivateFarmingOrder struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` -} - -func (m *MsgInactivateFarmingOrder) Reset() { *m = MsgInactivateFarmingOrder{} } -func (m *MsgInactivateFarmingOrder) String() string { return proto.CompactTextString(m) } -func (*MsgInactivateFarmingOrder) ProtoMessage() {} -func (*MsgInactivateFarmingOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{10} -} -func (m *MsgInactivateFarmingOrder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgInactivateFarmingOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgInactivateFarmingOrder.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgInactivateFarmingOrder) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgInactivateFarmingOrder.Merge(m, src) -} -func (m *MsgInactivateFarmingOrder) XXX_Size() int { - return m.Size() -} -func (m *MsgInactivateFarmingOrder) XXX_DiscardUnknown() { - xxx_messageInfo_MsgInactivateFarmingOrder.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgInactivateFarmingOrder proto.InternalMessageInfo - -func (m *MsgInactivateFarmingOrder) GetOrderId() string { - if m != nil { - return m.OrderId - } - return "" -} - -type MsgInactivateFarmingOrderResponse struct { -} - -func (m *MsgInactivateFarmingOrderResponse) Reset() { *m = MsgInactivateFarmingOrderResponse{} } -func (m *MsgInactivateFarmingOrderResponse) String() string { return proto.CompactTextString(m) } -func (*MsgInactivateFarmingOrderResponse) ProtoMessage() {} -func (*MsgInactivateFarmingOrderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{11} -} -func (m *MsgInactivateFarmingOrderResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgInactivateFarmingOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgInactivateFarmingOrderResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgInactivateFarmingOrderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgInactivateFarmingOrderResponse.Merge(m, src) -} -func (m *MsgInactivateFarmingOrderResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgInactivateFarmingOrderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgInactivateFarmingOrderResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgInactivateFarmingOrderResponse proto.InternalMessageInfo - -type MsgExecuteFarmingOrders struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - OrderIds []string `protobuf:"bytes,2,rep,name=order_ids,json=orderIds,proto3" json:"order_ids,omitempty"` -} - -func (m *MsgExecuteFarmingOrders) Reset() { *m = MsgExecuteFarmingOrders{} } -func (m *MsgExecuteFarmingOrders) String() string { return proto.CompactTextString(m) } -func (*MsgExecuteFarmingOrders) ProtoMessage() {} -func (*MsgExecuteFarmingOrders) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{12} -} -func (m *MsgExecuteFarmingOrders) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExecuteFarmingOrders) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExecuteFarmingOrders.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgExecuteFarmingOrders) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExecuteFarmingOrders.Merge(m, src) -} -func (m *MsgExecuteFarmingOrders) XXX_Size() int { - return m.Size() -} -func (m *MsgExecuteFarmingOrders) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExecuteFarmingOrders.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExecuteFarmingOrders proto.InternalMessageInfo - -func (m *MsgExecuteFarmingOrders) GetOrderIds() []string { - if m != nil { - return m.OrderIds - } - return nil -} - -type MsgExecuteFarmingOrdersResponse struct { -} - -func (m *MsgExecuteFarmingOrdersResponse) Reset() { *m = MsgExecuteFarmingOrdersResponse{} } -func (m *MsgExecuteFarmingOrdersResponse) String() string { return proto.CompactTextString(m) } -func (*MsgExecuteFarmingOrdersResponse) ProtoMessage() {} -func (*MsgExecuteFarmingOrdersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{13} -} -func (m *MsgExecuteFarmingOrdersResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExecuteFarmingOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExecuteFarmingOrdersResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgExecuteFarmingOrdersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExecuteFarmingOrdersResponse.Merge(m, src) -} -func (m *MsgExecuteFarmingOrdersResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgExecuteFarmingOrdersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExecuteFarmingOrdersResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExecuteFarmingOrdersResponse proto.InternalMessageInfo - -type MsgSetDailyRewardPercent struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` - AccountId string `protobuf:"bytes,2,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` - TargetId string `protobuf:"bytes,3,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` - Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` - Date time.Time `protobuf:"bytes,5,opt,name=date,proto3,stdtime" json:"date"` -} - -func (m *MsgSetDailyRewardPercent) Reset() { *m = MsgSetDailyRewardPercent{} } -func (m *MsgSetDailyRewardPercent) String() string { return proto.CompactTextString(m) } -func (*MsgSetDailyRewardPercent) ProtoMessage() {} -func (*MsgSetDailyRewardPercent) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{14} -} -func (m *MsgSetDailyRewardPercent) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetDailyRewardPercent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetDailyRewardPercent.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSetDailyRewardPercent) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetDailyRewardPercent.Merge(m, src) -} -func (m *MsgSetDailyRewardPercent) XXX_Size() int { - return m.Size() -} -func (m *MsgSetDailyRewardPercent) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetDailyRewardPercent.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetDailyRewardPercent proto.InternalMessageInfo - -func (m *MsgSetDailyRewardPercent) GetAccountId() string { - if m != nil { - return m.AccountId - } - return "" -} - -func (m *MsgSetDailyRewardPercent) GetTargetId() string { - if m != nil { - return m.TargetId - } - return "" -} - -func (m *MsgSetDailyRewardPercent) GetDate() time.Time { - if m != nil { - return m.Date - } - return time.Time{} -} - -type MsgSetDailyRewardPercentResponse struct { -} - -func (m *MsgSetDailyRewardPercentResponse) Reset() { *m = MsgSetDailyRewardPercentResponse{} } -func (m *MsgSetDailyRewardPercentResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetDailyRewardPercentResponse) ProtoMessage() {} -func (*MsgSetDailyRewardPercentResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{15} -} -func (m *MsgSetDailyRewardPercentResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetDailyRewardPercentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetDailyRewardPercentResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSetDailyRewardPercentResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetDailyRewardPercentResponse.Merge(m, src) -} -func (m *MsgSetDailyRewardPercentResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSetDailyRewardPercentResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetDailyRewardPercentResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetDailyRewardPercentResponse proto.InternalMessageInfo - -type MsgBeginWithdrawAll struct { - FromAddress github_com_UnUniFi_chain_types.StringAccAddress `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3,customtype=github.com/UnUniFi/chain/types.StringAccAddress" json:"from_address"` -} - -func (m *MsgBeginWithdrawAll) Reset() { *m = MsgBeginWithdrawAll{} } -func (m *MsgBeginWithdrawAll) String() string { return proto.CompactTextString(m) } -func (*MsgBeginWithdrawAll) ProtoMessage() {} -func (*MsgBeginWithdrawAll) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{16} -} -func (m *MsgBeginWithdrawAll) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBeginWithdrawAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBeginWithdrawAll.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgBeginWithdrawAll) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBeginWithdrawAll.Merge(m, src) -} -func (m *MsgBeginWithdrawAll) XXX_Size() int { - return m.Size() -} -func (m *MsgBeginWithdrawAll) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBeginWithdrawAll.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBeginWithdrawAll proto.InternalMessageInfo - -type MsgBeginWithdrawAllResponse struct { -} - -func (m *MsgBeginWithdrawAllResponse) Reset() { *m = MsgBeginWithdrawAllResponse{} } -func (m *MsgBeginWithdrawAllResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBeginWithdrawAllResponse) ProtoMessage() {} -func (*MsgBeginWithdrawAllResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_954044072c4aa803, []int{17} -} -func (m *MsgBeginWithdrawAllResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBeginWithdrawAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBeginWithdrawAllResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgBeginWithdrawAllResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBeginWithdrawAllResponse.Merge(m, src) -} -func (m *MsgBeginWithdrawAllResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgBeginWithdrawAllResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBeginWithdrawAllResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBeginWithdrawAllResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgDeposit)(nil), "ununifi.chain.yieldaggregator.MsgDeposit") - proto.RegisterType((*MsgDepositResponse)(nil), "ununifi.chain.yieldaggregator.MsgDepositResponse") - proto.RegisterType((*MsgWithdraw)(nil), "ununifi.chain.yieldaggregator.MsgWithdraw") - proto.RegisterType((*MsgWithdrawResponse)(nil), "ununifi.chain.yieldaggregator.MsgWithdrawResponse") - proto.RegisterType((*MsgAddFarmingOrder)(nil), "ununifi.chain.yieldaggregator.MsgAddFarmingOrder") - proto.RegisterType((*MsgAddFarmingOrderResponse)(nil), "ununifi.chain.yieldaggregator.MsgAddFarmingOrderResponse") - proto.RegisterType((*MsgDeleteFarmingOrder)(nil), "ununifi.chain.yieldaggregator.MsgDeleteFarmingOrder") - proto.RegisterType((*MsgDeleteFarmingOrderResponse)(nil), "ununifi.chain.yieldaggregator.MsgDeleteFarmingOrderResponse") - proto.RegisterType((*MsgActivateFarmingOrder)(nil), "ununifi.chain.yieldaggregator.MsgActivateFarmingOrder") - proto.RegisterType((*MsgActivateFarmingOrderResponse)(nil), "ununifi.chain.yieldaggregator.MsgActivateFarmingOrderResponse") - proto.RegisterType((*MsgInactivateFarmingOrder)(nil), "ununifi.chain.yieldaggregator.MsgInactivateFarmingOrder") - proto.RegisterType((*MsgInactivateFarmingOrderResponse)(nil), "ununifi.chain.yieldaggregator.MsgInactivateFarmingOrderResponse") - proto.RegisterType((*MsgExecuteFarmingOrders)(nil), "ununifi.chain.yieldaggregator.MsgExecuteFarmingOrders") - proto.RegisterType((*MsgExecuteFarmingOrdersResponse)(nil), "ununifi.chain.yieldaggregator.MsgExecuteFarmingOrdersResponse") - proto.RegisterType((*MsgSetDailyRewardPercent)(nil), "ununifi.chain.yieldaggregator.MsgSetDailyRewardPercent") - proto.RegisterType((*MsgSetDailyRewardPercentResponse)(nil), "ununifi.chain.yieldaggregator.MsgSetDailyRewardPercentResponse") - proto.RegisterType((*MsgBeginWithdrawAll)(nil), "ununifi.chain.yieldaggregator.MsgBeginWithdrawAll") - proto.RegisterType((*MsgBeginWithdrawAllResponse)(nil), "ununifi.chain.yieldaggregator.MsgBeginWithdrawAllResponse") -} - -func init() { proto.RegisterFile("yieldaggregatorv1/tx.proto", fileDescriptor_954044072c4aa803) } - -var fileDescriptor_954044072c4aa803 = []byte{ - // 855 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x97, 0x4d, 0x6f, 0xe3, 0x44, - 0x18, 0xc7, 0x33, 0x4d, 0x76, 0x37, 0x79, 0xc2, 0x9b, 0x4c, 0x0b, 0xa9, 0x97, 0xbc, 0xac, 0x11, - 0x28, 0x80, 0xb0, 0x95, 0x80, 0xe8, 0x82, 0x10, 0x90, 0x50, 0x56, 0x8a, 0x44, 0x04, 0xf2, 0xb2, - 0x42, 0xda, 0x4b, 0x35, 0xb1, 0xa7, 0xd3, 0x81, 0xc4, 0x13, 0x3c, 0x93, 0x6e, 0x7b, 0x42, 0xe2, - 0xc4, 0x69, 0x55, 0x10, 0x9f, 0x80, 0x4f, 0x80, 0xc4, 0x85, 0x8f, 0xd0, 0x63, 0x8f, 0x88, 0x43, - 0x41, 0xed, 0x17, 0x41, 0x1e, 0xbf, 0x34, 0xa4, 0x4e, 0xe3, 0x46, 0x0a, 0xea, 0xa9, 0xf5, 0xcc, - 0xf3, 0x9f, 0xf9, 0xfd, 0x1f, 0xd7, 0xcf, 0x5f, 0x05, 0xfd, 0x90, 0x91, 0xa1, 0x8b, 0x29, 0xf5, - 0x09, 0xc5, 0x92, 0xfb, 0xfb, 0x2d, 0x4b, 0x1e, 0x98, 0x63, 0x9f, 0x4b, 0xae, 0x55, 0x27, 0xde, - 0xc4, 0x63, 0xbb, 0xcc, 0x74, 0xf6, 0x30, 0xf3, 0xcc, 0x99, 0x4a, 0x7d, 0x9d, 0x72, 0xca, 0x55, - 0xa5, 0x15, 0xfc, 0x16, 0x8a, 0xf4, 0x9a, 0xc3, 0xc5, 0x88, 0x0b, 0x6b, 0x80, 0x05, 0xb1, 0xf6, - 0x5b, 0x03, 0x22, 0x71, 0xcb, 0x72, 0x38, 0xf3, 0xa2, 0xfd, 0xea, 0xe5, 0x0b, 0xb1, 0x10, 0x44, - 0x46, 0xdb, 0x75, 0xca, 0x39, 0x1d, 0x12, 0x4b, 0x3d, 0x0d, 0x26, 0xbb, 0x96, 0x64, 0x23, 0x22, - 0x24, 0x1e, 0x8d, 0xc3, 0x02, 0xe3, 0x18, 0x01, 0xf4, 0x05, 0xdd, 0x26, 0x63, 0x2e, 0x98, 0xd4, - 0x1e, 0xc3, 0x33, 0xbb, 0x3e, 0x1f, 0xed, 0x60, 0xd7, 0xf5, 0x89, 0x10, 0x15, 0xd4, 0x40, 0xcd, - 0x52, 0x77, 0xeb, 0xf8, 0xb4, 0x9e, 0xfb, 0xeb, 0xb4, 0x6e, 0x51, 0x26, 0xf7, 0x26, 0x03, 0xd3, - 0xe1, 0x23, 0xeb, 0x91, 0xf7, 0xc8, 0x63, 0x0f, 0x98, 0xa5, 0xcc, 0x58, 0xf2, 0x70, 0x4c, 0x84, - 0xf9, 0x50, 0xfa, 0xcc, 0xa3, 0x1d, 0xc7, 0xe9, 0x84, 0x72, 0xbb, 0x1c, 0x1c, 0x16, 0x3d, 0x68, - 0x5b, 0x70, 0x1b, 0x8f, 0xf8, 0xc4, 0x93, 0x95, 0xb5, 0x46, 0xbe, 0x59, 0x6e, 0x6f, 0x9a, 0xa1, - 0x37, 0x33, 0xf0, 0x66, 0x46, 0xde, 0xcc, 0x4f, 0x39, 0xf3, 0xba, 0x85, 0xe0, 0x42, 0x3b, 0x2a, - 0xd7, 0x5e, 0x83, 0xe7, 0xc8, 0x01, 0x71, 0x26, 0x92, 0xec, 0x70, 0xdf, 0x25, 0xbe, 0xa8, 0xe4, - 0x1b, 0xa8, 0x59, 0xb4, 0x9f, 0x8d, 0x56, 0xbf, 0x50, 0x8b, 0xc6, 0x3a, 0x68, 0x17, 0x4e, 0x6c, - 0x22, 0xc6, 0xdc, 0x13, 0xc4, 0xf8, 0x15, 0x41, 0xb9, 0x2f, 0xe8, 0xd7, 0x4c, 0xee, 0xb9, 0x3e, - 0x7e, 0x72, 0x23, 0x1d, 0x1a, 0x1b, 0xf0, 0xe2, 0x14, 0x63, 0xc2, 0xfe, 0x3b, 0x52, 0x96, 0x3a, - 0xae, 0xfb, 0x00, 0xfb, 0x23, 0xe6, 0x51, 0xe5, 0x74, 0xa5, 0x16, 0x3a, 0x70, 0x4b, 0xf5, 0xb8, - 0xb2, 0xd6, 0x40, 0xcd, 0x72, 0xfb, 0x2d, 0xf3, 0xca, 0x3f, 0x5a, 0x73, 0x9a, 0xcb, 0x0e, 0x95, - 0xc6, 0x2b, 0xa0, 0x5f, 0x86, 0x4e, 0x3c, 0x3d, 0x45, 0xb0, 0xa1, 0x5e, 0xd3, 0x90, 0x48, 0xf2, - 0xbf, 0xd9, 0xda, 0x84, 0xa2, 0x82, 0xdb, 0x61, 0xae, 0x72, 0x56, 0xb2, 0xef, 0xa8, 0xe7, 0x9e, - 0x6b, 0xd4, 0xa1, 0x9a, 0xca, 0x93, 0x10, 0x1f, 0x21, 0x78, 0x39, 0x30, 0xe4, 0x48, 0xb6, 0x8f, - 0x6f, 0x06, 0xf3, 0x3d, 0xa8, 0xcf, 0x21, 0x4a, 0xa8, 0x7f, 0x46, 0xb0, 0xd9, 0x17, 0xb4, 0xe7, - 0xe1, 0x1b, 0xc4, 0xfd, 0x2a, 0xdc, 0x9b, 0xcb, 0x34, 0x4d, 0x1e, 0xf4, 0xfb, 0xb3, 0xf0, 0xe3, - 0x9e, 0x2e, 0x11, 0x2b, 0xe5, 0xbe, 0x0b, 0xa5, 0x98, 0x5b, 0xa8, 0x0f, 0xb8, 0x64, 0x17, 0x23, - 0x70, 0x11, 0x75, 0x3c, 0x8d, 0x29, 0xe1, 0xfe, 0x6d, 0x0d, 0x2a, 0x7d, 0x41, 0x1f, 0x12, 0xb9, - 0x8d, 0xd9, 0xf0, 0xd0, 0x26, 0x4f, 0xb0, 0xef, 0x7e, 0x49, 0x7c, 0x87, 0x78, 0xab, 0x1d, 0xac, - 0x55, 0x00, 0xec, 0x38, 0xc1, 0x20, 0xb9, 0x68, 0x79, 0x29, 0x5a, 0xe9, 0xb9, 0x81, 0x2f, 0x89, - 0x7d, 0x4a, 0xd4, 0x6e, 0x5e, 0xed, 0x16, 0xc3, 0x85, 0x9e, 0xab, 0x75, 0xa1, 0xe0, 0x63, 0x49, - 0x2a, 0x05, 0xc5, 0x63, 0x46, 0x3c, 0xaf, 0x4f, 0xf1, 0x44, 0x01, 0x14, 0xfe, 0x78, 0x5b, 0xb8, - 0xdf, 0x46, 0x4c, 0xdb, 0xc4, 0xb1, 0x95, 0x56, 0xbb, 0x0f, 0x05, 0x37, 0x38, 0xe3, 0x96, 0x1a, - 0x19, 0xba, 0x19, 0x66, 0x8e, 0x19, 0x67, 0x8e, 0xf9, 0x55, 0x9c, 0x39, 0xdd, 0x62, 0x70, 0xfe, - 0xd1, 0xdf, 0x75, 0x64, 0x2b, 0x85, 0x61, 0x40, 0x63, 0x5e, 0xc7, 0x92, 0xb6, 0x7e, 0xa7, 0x66, - 0x63, 0x97, 0x50, 0xe6, 0xc5, 0x03, 0xb2, 0x33, 0x1c, 0xae, 0xb2, 0xa1, 0x46, 0x15, 0xee, 0xa6, - 0x5c, 0x19, 0x13, 0xb5, 0xff, 0x28, 0x41, 0xbe, 0x2f, 0xa8, 0x46, 0xe1, 0x4e, 0x9c, 0x9b, 0x6f, - 0x2c, 0x98, 0x93, 0x17, 0xc1, 0xa4, 0xb7, 0x32, 0x97, 0xc6, 0x17, 0x6a, 0xdf, 0x40, 0x31, 0xc9, - 0xaf, 0x37, 0x17, 0xcb, 0xe3, 0x5a, 0xbd, 0x9d, 0xbd, 0x36, 0xb9, 0xeb, 0x07, 0x04, 0x2f, 0x5c, - 0x6a, 0x76, 0x86, 0x83, 0x66, 0x35, 0xfa, 0x07, 0xd7, 0xd7, 0x24, 0x10, 0xdf, 0xc3, 0xf3, 0xb3, - 0xa1, 0x97, 0xa1, 0x6d, 0x33, 0x12, 0xfd, 0xfd, 0x6b, 0x4b, 0x12, 0x80, 0x1f, 0x11, 0x68, 0x29, - 0x11, 0xf5, 0x6e, 0x96, 0x77, 0x37, 0xab, 0xd2, 0x3f, 0x5c, 0x46, 0x95, 0xa0, 0x3c, 0x45, 0xb0, - 0x9e, 0x9a, 0x3d, 0xef, 0x65, 0xb0, 0x97, 0xa2, 0xd3, 0x3f, 0x5a, 0x4e, 0x97, 0x00, 0xfd, 0x82, - 0xe0, 0xa5, 0x39, 0xb1, 0x72, 0x7f, 0xf1, 0xd1, 0xe9, 0x4a, 0xfd, 0x93, 0x65, 0x95, 0xff, 0xe9, - 0x53, 0x6a, 0x66, 0x64, 0xe8, 0x53, 0x9a, 0x2e, 0x4b, 0x9f, 0xae, 0xca, 0x03, 0xed, 0x27, 0x04, - 0x1b, 0xe9, 0x61, 0xb0, 0xb5, 0xf8, 0xe4, 0x54, 0xa1, 0xfe, 0xf1, 0x92, 0xc2, 0x98, 0xa9, 0xfb, - 0xf9, 0xf1, 0x59, 0x0d, 0x9d, 0x9c, 0xd5, 0xd0, 0x3f, 0x67, 0x35, 0x74, 0x74, 0x5e, 0xcb, 0x9d, - 0x9c, 0xd7, 0x72, 0x7f, 0x9e, 0xd7, 0x72, 0x8f, 0xdb, 0x73, 0x27, 0xe6, 0x81, 0x95, 0xf2, 0x4f, - 0x4d, 0x30, 0x45, 0x07, 0xb7, 0xd5, 0x88, 0x7f, 0xe7, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, - 0x0d, 0x26, 0x3e, 0xf6, 0x0c, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) - Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) - BeginWithdrawAll(ctx context.Context, in *MsgBeginWithdrawAll, opts ...grpc.CallOption) (*MsgBeginWithdrawAllResponse, error) - AddFarmingOrder(ctx context.Context, in *MsgAddFarmingOrder, opts ...grpc.CallOption) (*MsgAddFarmingOrderResponse, error) - DeleteFarmingOrder(ctx context.Context, in *MsgDeleteFarmingOrder, opts ...grpc.CallOption) (*MsgDeleteFarmingOrderResponse, error) - ActivateFarmingOrder(ctx context.Context, in *MsgActivateFarmingOrder, opts ...grpc.CallOption) (*MsgActivateFarmingOrderResponse, error) - InactivateFarmingOrder(ctx context.Context, in *MsgInactivateFarmingOrder, opts ...grpc.CallOption) (*MsgInactivateFarmingOrderResponse, error) - ExecuteFarmingOrders(ctx context.Context, in *MsgExecuteFarmingOrders, opts ...grpc.CallOption) (*MsgExecuteFarmingOrdersResponse, error) - SetDailyRewardPercent(ctx context.Context, in *MsgSetDailyRewardPercent, opts ...grpc.CallOption) (*MsgSetDailyRewardPercentResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { - out := new(MsgDepositResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) { - out := new(MsgWithdrawResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/Withdraw", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) BeginWithdrawAll(ctx context.Context, in *MsgBeginWithdrawAll, opts ...grpc.CallOption) (*MsgBeginWithdrawAllResponse, error) { - out := new(MsgBeginWithdrawAllResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/BeginWithdrawAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) AddFarmingOrder(ctx context.Context, in *MsgAddFarmingOrder, opts ...grpc.CallOption) (*MsgAddFarmingOrderResponse, error) { - out := new(MsgAddFarmingOrderResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/AddFarmingOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) DeleteFarmingOrder(ctx context.Context, in *MsgDeleteFarmingOrder, opts ...grpc.CallOption) (*MsgDeleteFarmingOrderResponse, error) { - out := new(MsgDeleteFarmingOrderResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/DeleteFarmingOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ActivateFarmingOrder(ctx context.Context, in *MsgActivateFarmingOrder, opts ...grpc.CallOption) (*MsgActivateFarmingOrderResponse, error) { - out := new(MsgActivateFarmingOrderResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/ActivateFarmingOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) InactivateFarmingOrder(ctx context.Context, in *MsgInactivateFarmingOrder, opts ...grpc.CallOption) (*MsgInactivateFarmingOrderResponse, error) { - out := new(MsgInactivateFarmingOrderResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/InactivateFarmingOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ExecuteFarmingOrders(ctx context.Context, in *MsgExecuteFarmingOrders, opts ...grpc.CallOption) (*MsgExecuteFarmingOrdersResponse, error) { - out := new(MsgExecuteFarmingOrdersResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/ExecuteFarmingOrders", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) SetDailyRewardPercent(ctx context.Context, in *MsgSetDailyRewardPercent, opts ...grpc.CallOption) (*MsgSetDailyRewardPercentResponse, error) { - out := new(MsgSetDailyRewardPercentResponse) - err := c.cc.Invoke(ctx, "/ununifi.chain.yieldaggregator.Msg/SetDailyRewardPercent", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) - Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) - BeginWithdrawAll(context.Context, *MsgBeginWithdrawAll) (*MsgBeginWithdrawAllResponse, error) - AddFarmingOrder(context.Context, *MsgAddFarmingOrder) (*MsgAddFarmingOrderResponse, error) - DeleteFarmingOrder(context.Context, *MsgDeleteFarmingOrder) (*MsgDeleteFarmingOrderResponse, error) - ActivateFarmingOrder(context.Context, *MsgActivateFarmingOrder) (*MsgActivateFarmingOrderResponse, error) - InactivateFarmingOrder(context.Context, *MsgInactivateFarmingOrder) (*MsgInactivateFarmingOrderResponse, error) - ExecuteFarmingOrders(context.Context, *MsgExecuteFarmingOrders) (*MsgExecuteFarmingOrdersResponse, error) - SetDailyRewardPercent(context.Context, *MsgSetDailyRewardPercent) (*MsgSetDailyRewardPercentResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") -} -func (*UnimplementedMsgServer) Withdraw(ctx context.Context, req *MsgWithdraw) (*MsgWithdrawResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") -} -func (*UnimplementedMsgServer) BeginWithdrawAll(ctx context.Context, req *MsgBeginWithdrawAll) (*MsgBeginWithdrawAllResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BeginWithdrawAll not implemented") -} -func (*UnimplementedMsgServer) AddFarmingOrder(ctx context.Context, req *MsgAddFarmingOrder) (*MsgAddFarmingOrderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddFarmingOrder not implemented") -} -func (*UnimplementedMsgServer) DeleteFarmingOrder(ctx context.Context, req *MsgDeleteFarmingOrder) (*MsgDeleteFarmingOrderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteFarmingOrder not implemented") -} -func (*UnimplementedMsgServer) ActivateFarmingOrder(ctx context.Context, req *MsgActivateFarmingOrder) (*MsgActivateFarmingOrderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ActivateFarmingOrder not implemented") -} -func (*UnimplementedMsgServer) InactivateFarmingOrder(ctx context.Context, req *MsgInactivateFarmingOrder) (*MsgInactivateFarmingOrderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InactivateFarmingOrder not implemented") -} -func (*UnimplementedMsgServer) ExecuteFarmingOrders(ctx context.Context, req *MsgExecuteFarmingOrders) (*MsgExecuteFarmingOrdersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ExecuteFarmingOrders not implemented") -} -func (*UnimplementedMsgServer) SetDailyRewardPercent(ctx context.Context, req *MsgSetDailyRewardPercent) (*MsgSetDailyRewardPercentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetDailyRewardPercent not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeposit) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdraw) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Withdraw(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/Withdraw", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Withdraw(ctx, req.(*MsgWithdraw)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_BeginWithdrawAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBeginWithdrawAll) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).BeginWithdrawAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/BeginWithdrawAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BeginWithdrawAll(ctx, req.(*MsgBeginWithdrawAll)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_AddFarmingOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddFarmingOrder) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddFarmingOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/AddFarmingOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddFarmingOrder(ctx, req.(*MsgAddFarmingOrder)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_DeleteFarmingOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeleteFarmingOrder) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DeleteFarmingOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/DeleteFarmingOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DeleteFarmingOrder(ctx, req.(*MsgDeleteFarmingOrder)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ActivateFarmingOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgActivateFarmingOrder) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ActivateFarmingOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/ActivateFarmingOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ActivateFarmingOrder(ctx, req.(*MsgActivateFarmingOrder)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_InactivateFarmingOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgInactivateFarmingOrder) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).InactivateFarmingOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/InactivateFarmingOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).InactivateFarmingOrder(ctx, req.(*MsgInactivateFarmingOrder)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ExecuteFarmingOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgExecuteFarmingOrders) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ExecuteFarmingOrders(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/ExecuteFarmingOrders", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ExecuteFarmingOrders(ctx, req.(*MsgExecuteFarmingOrders)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_SetDailyRewardPercent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSetDailyRewardPercent) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SetDailyRewardPercent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.chain.yieldaggregator.Msg/SetDailyRewardPercent", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SetDailyRewardPercent(ctx, req.(*MsgSetDailyRewardPercent)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ununifi.chain.yieldaggregator.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Deposit", - Handler: _Msg_Deposit_Handler, - }, - { - MethodName: "Withdraw", - Handler: _Msg_Withdraw_Handler, - }, - { - MethodName: "BeginWithdrawAll", - Handler: _Msg_BeginWithdrawAll_Handler, - }, - { - MethodName: "AddFarmingOrder", - Handler: _Msg_AddFarmingOrder_Handler, - }, - { - MethodName: "DeleteFarmingOrder", - Handler: _Msg_DeleteFarmingOrder_Handler, - }, - { - MethodName: "ActivateFarmingOrder", - Handler: _Msg_ActivateFarmingOrder_Handler, - }, - { - MethodName: "InactivateFarmingOrder", - Handler: _Msg_InactivateFarmingOrder_Handler, - }, - { - MethodName: "ExecuteFarmingOrders", - Handler: _Msg_ExecuteFarmingOrders_Handler, - }, - { - MethodName: "SetDailyRewardPercent", - Handler: _Msg_SetDailyRewardPercent_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "yieldaggregatorv1/tx.proto", -} - -func (m *MsgDeposit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExecuteOrders { - i-- - if m.ExecuteOrders { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgDepositResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgWithdraw) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdraw) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdraw) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdrawResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgAddFarmingOrder) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgAddFarmingOrder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddFarmingOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Order != nil { - { - size, err := m.Order.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgAddFarmingOrderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgAddFarmingOrderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddFarmingOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDeleteFarmingOrder) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDeleteFarmingOrder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeleteFarmingOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OrderId) > 0 { - i -= len(m.OrderId) - copy(dAtA[i:], m.OrderId) - i = encodeVarintTx(dAtA, i, uint64(len(m.OrderId))) - i-- - dAtA[i] = 0x12 - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgDeleteFarmingOrderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDeleteFarmingOrderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeleteFarmingOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgActivateFarmingOrder) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgActivateFarmingOrder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgActivateFarmingOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OrderId) > 0 { - i -= len(m.OrderId) - copy(dAtA[i:], m.OrderId) - i = encodeVarintTx(dAtA, i, uint64(len(m.OrderId))) - i-- - dAtA[i] = 0x12 - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgActivateFarmingOrderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgActivateFarmingOrderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgActivateFarmingOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgInactivateFarmingOrder) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgInactivateFarmingOrder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgInactivateFarmingOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OrderId) > 0 { - i -= len(m.OrderId) - copy(dAtA[i:], m.OrderId) - i = encodeVarintTx(dAtA, i, uint64(len(m.OrderId))) - i-- - dAtA[i] = 0x12 - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgInactivateFarmingOrderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgInactivateFarmingOrderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgInactivateFarmingOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgExecuteFarmingOrders) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgExecuteFarmingOrders) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExecuteFarmingOrders) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OrderIds) > 0 { - for iNdEx := len(m.OrderIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.OrderIds[iNdEx]) - copy(dAtA[i:], m.OrderIds[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.OrderIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgExecuteFarmingOrdersResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgExecuteFarmingOrdersResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExecuteFarmingOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgSetDailyRewardPercent) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSetDailyRewardPercent) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetDailyRewardPercent) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Date, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Date):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintTx(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x2a - { - size := m.Rate.Size() - i -= size - if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.TargetId) > 0 { - i -= len(m.TargetId) - copy(dAtA[i:], m.TargetId) - i = encodeVarintTx(dAtA, i, uint64(len(m.TargetId))) - i-- - dAtA[i] = 0x1a - } - if len(m.AccountId) > 0 { - i -= len(m.AccountId) - copy(dAtA[i:], m.AccountId) - i = encodeVarintTx(dAtA, i, uint64(len(m.AccountId))) - i-- - dAtA[i] = 0x12 - } - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgSetDailyRewardPercentResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSetDailyRewardPercentResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetDailyRewardPercentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgBeginWithdrawAll) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgBeginWithdrawAll) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBeginWithdrawAll) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.FromAddress.Size() - i -= size - if _, err := m.FromAddress.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgBeginWithdrawAllResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgBeginWithdrawAllResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBeginWithdrawAllResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.ExecuteOrders { - n += 2 - } - return n -} - -func (m *MsgDepositResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgWithdraw) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgWithdrawResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgAddFarmingOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - if m.Order != nil { - l = m.Order.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgAddFarmingOrderResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDeleteFarmingOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.OrderId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgDeleteFarmingOrderResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgActivateFarmingOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.OrderId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgActivateFarmingOrderResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgInactivateFarmingOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.OrderId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgInactivateFarmingOrderResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgExecuteFarmingOrders) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.OrderIds) > 0 { - for _, s := range m.OrderIds { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgExecuteFarmingOrdersResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgSetDailyRewardPercent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.AccountId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.TargetId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Rate.Size() - n += 1 + l + sovTx(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Date) - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgSetDailyRewardPercentResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBeginWithdrawAll) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.FromAddress.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgBeginWithdrawAllResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgDeposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecuteOrders", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ExecuteOrders = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgWithdraw) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgWithdraw: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdraw: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAddFarmingOrder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgAddFarmingOrder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddFarmingOrder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Order == nil { - m.Order = &FarmingOrder{} - } - if err := m.Order.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAddFarmingOrderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgAddFarmingOrderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddFarmingOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDeleteFarmingOrder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDeleteFarmingOrder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeleteFarmingOrder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDeleteFarmingOrderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDeleteFarmingOrderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeleteFarmingOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgActivateFarmingOrder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgActivateFarmingOrder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgActivateFarmingOrder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgActivateFarmingOrderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgActivateFarmingOrderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgActivateFarmingOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgInactivateFarmingOrder) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgInactivateFarmingOrder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInactivateFarmingOrder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgInactivateFarmingOrderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgInactivateFarmingOrderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInactivateFarmingOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExecuteFarmingOrders) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgExecuteFarmingOrders: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteFarmingOrders: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderIds = append(m.OrderIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExecuteFarmingOrdersResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgExecuteFarmingOrdersResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteFarmingOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSetDailyRewardPercent) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSetDailyRewardPercent: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetDailyRewardPercent: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AccountId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Date", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Date, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSetDailyRewardPercentResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSetDailyRewardPercentResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetDailyRewardPercentResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBeginWithdrawAll) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgBeginWithdrawAll: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBeginWithdrawAll: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FromAddress.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBeginWithdrawAllResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgBeginWithdrawAllResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBeginWithdrawAllResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldaggregatorv1/types/types.go b/deprecated/x/yieldaggregatorv1/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/deprecated/x/yieldaggregatorv1/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/deprecated/x/yieldfarm/abci.go b/deprecated/x/yieldfarm/abci.go deleted file mode 100644 index 0f515000f..000000000 --- a/deprecated/x/yieldfarm/abci.go +++ /dev/null @@ -1,23 +0,0 @@ -package yieldfarm - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/keeper" -) - -func EndBlocker(ctx sdk.Context, k keeper.Keeper) { - params := k.GetParams(ctx) - farmers := k.GetAllFarmerInfos(ctx) - for _, info := range farmers { - rewards := sdk.Coins{} - for _, coin := range info.Amount { - rewards = rewards.Add(sdk.NewCoin(coin.Denom, coin.Amount.Mul(sdk.NewInt(int64(params.DailyReward))).Quo(sdk.NewInt(100)))) - } - addr, err := sdk.AccAddressFromBech32(info.Account) - if err != nil { - continue - } - k.AllocateRewards(ctx, addr, rewards) - } -} diff --git a/deprecated/x/yieldfarm/genesis.go b/deprecated/x/yieldfarm/genesis.go deleted file mode 100644 index b01db80cc..000000000 --- a/deprecated/x/yieldfarm/genesis.go +++ /dev/null @@ -1,21 +0,0 @@ -package yieldfarm - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/keeper" - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - return genesis -} diff --git a/deprecated/x/yieldfarm/handler.go b/deprecated/x/yieldfarm/handler.go deleted file mode 100644 index b8e3ca9ed..000000000 --- a/deprecated/x/yieldfarm/handler.go +++ /dev/null @@ -1,26 +0,0 @@ -package yieldfarm - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/keeper" - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - // this line is used by starport scaffolding # handler/msgServer - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/deprecated/x/yieldfarm/keeper/farm.go b/deprecated/x/yieldfarm/keeper/farm.go deleted file mode 100644 index 14c9fed2d..000000000 --- a/deprecated/x/yieldfarm/keeper/farm.go +++ /dev/null @@ -1,105 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -func (k Keeper) SetFarmerInfo(ctx sdk.Context, obj types.FarmerInfo) { - bz := k.cdc.MustMarshal(&obj) - store := ctx.KVStore(k.storeKey) - addr, err := sdk.AccAddressFromBech32(obj.Account) - if err != nil { - panic(err) - } - store.Set(types.FarmerInfoKey(addr), bz) -} - -func (k Keeper) DeleteFarmerInfo(ctx sdk.Context, addr sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.FarmerInfoKey(addr)) -} - -func (k Keeper) GetFarmerInfo(ctx sdk.Context, addr sdk.AccAddress) types.FarmerInfo { - unit := types.FarmerInfo{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.FarmerInfoKey(addr)) - if bz == nil { - return unit - } - k.cdc.MustUnmarshal(bz, &unit) - return unit -} - -func (k Keeper) GetAllFarmerInfos(ctx sdk.Context) []types.FarmerInfo { - store := ctx.KVStore(k.storeKey) - - units := []types.FarmerInfo{} - it := sdk.KVStorePrefixIterator(store, []byte(types.PrefixKeyFarmerInfo)) - defer it.Close() - - for ; it.Valid(); it.Next() { - unit := types.FarmerInfo{} - k.cdc.MustUnmarshal(it.Value(), &unit) - - units = append(units, unit) - } - return units -} - -func (k Keeper) Deposit(ctx sdk.Context, user sdk.AccAddress, coins sdk.Coins) error { - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, user, types.ModuleName, coins) - if err != nil { - return err - } - - deposit := k.GetFarmerInfo(ctx, user) - deposit.Account = user.String() - deposit.Amount = sdk.Coins(deposit.Amount).Add(coins...) - k.SetFarmerInfo(ctx, deposit) - return nil -} - -func (k Keeper) Withdraw(ctx sdk.Context, user sdk.AccAddress, coins sdk.Coins) error { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, user, coins) - if err != nil { - return err - } - - deposit := k.GetFarmerInfo(ctx, user) - deposit.Amount = sdk.Coins(deposit.Amount).Sub(coins...) - k.SetFarmerInfo(ctx, deposit) - return nil -} - -func (k Keeper) ClaimRewards(ctx sdk.Context, user sdk.AccAddress) sdk.Coins { - deposit := k.GetFarmerInfo(ctx, user) - amount := deposit.Rewards - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, user, amount) - if err != nil { - panic(err) - } - - deposit.Rewards = sdk.Coins{} - k.SetFarmerInfo(ctx, deposit) - - return amount -} - -func (k Keeper) AllocateRewards(ctx sdk.Context, user sdk.AccAddress, amount sdk.Coins) { - deposit := k.GetFarmerInfo(ctx, user) - deposit.Rewards = sdk.Coins(deposit.Rewards).Add(amount...) - k.SetFarmerInfo(ctx, deposit) - - err := k.bankKeeper.MintCoins(ctx, minttypes.ModuleName, amount) - if err != nil { - panic(err) - } - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, amount) - if err != nil { - panic(err) - } -} diff --git a/deprecated/x/yieldfarm/keeper/keeper.go b/deprecated/x/yieldfarm/keeper/keeper.go deleted file mode 100644 index 9e4f7967c..000000000 --- a/deprecated/x/yieldfarm/keeper/keeper.go +++ /dev/null @@ -1,44 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cometbft/cometbft/libs/log" - - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - paramstore paramtypes.Subspace - bankKeeper types.BankKeeper -} - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey storetypes.StoreKey, - ps paramtypes.Subspace, - bk types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - paramstore: ps, - bankKeeper: bk, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/deprecated/x/yieldfarm/keeper/params.go b/deprecated/x/yieldfarm/keeper/params.go deleted file mode 100644 index 6ffeb595d..000000000 --- a/deprecated/x/yieldfarm/keeper/params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - params := types.Params{} - k.paramstore.GetParamSet(ctx, ¶ms) - return params -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/deprecated/x/yieldfarm/module.go b/deprecated/x/yieldfarm/module.go deleted file mode 100644 index 1237be243..000000000 --- a/deprecated/x/yieldfarm/module.go +++ /dev/null @@ -1,161 +0,0 @@ -package yieldfarm - -import ( - "encoding/json" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - abci "github.com/cometbft/cometbft/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/keeper" - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - return nil -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - // this line is used by starport scaffolding # 2 -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return nil -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return nil -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// RegisterServices registers a GRPC query service to respond to the -// module-specific GRPC queries. -func (am AppModule) RegisterServices(cfg module.Configurator) { -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { -} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - EndBlocker(ctx, am.keeper) - - return []abci.ValidatorUpdate{} -} diff --git a/deprecated/x/yieldfarm/module_simulation.go b/deprecated/x/yieldfarm/module_simulation.go deleted file mode 100644 index 69147e5df..000000000 --- a/deprecated/x/yieldfarm/module_simulation.go +++ /dev/null @@ -1,51 +0,0 @@ -package yieldfarm - -import ( - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/UnUniFi/chain/deprecated/x/yieldfarm/types" - - // yieldaggregatorsimulation "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/simulation" - // "github.com/UnUniFi/chain/deprecated/x/yieldaggregatorv1/types" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" -) - -// avoid unused import issue -var ( - // _ = yieldaggregatorsimulation.FindAccount - _ = simtestutil.StakePerAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace -) - -// GenerateGenesisState creates a randomized GenState of the module -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - yieldaggregatorGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&yieldaggregatorGenesis) -} - -// ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RegisterStoreDecoder registers a decoder -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - return operations -} diff --git a/deprecated/x/yieldfarm/types/expected_keepers.go b/deprecated/x/yieldfarm/types/expected_keepers.go deleted file mode 100644 index 37aea0cf7..000000000 --- a/deprecated/x/yieldfarm/types/expected_keepers.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error -} diff --git a/deprecated/x/yieldfarm/types/genesis.go b/deprecated/x/yieldfarm/types/genesis.go deleted file mode 100644 index 23311a406..000000000 --- a/deprecated/x/yieldfarm/types/genesis.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - } -} diff --git a/deprecated/x/yieldfarm/types/genesis.pb.go b/deprecated/x/yieldfarm/types/genesis.pb.go deleted file mode 100644 index 5b7611318..000000000 --- a/deprecated/x/yieldfarm/types/genesis.pb.go +++ /dev/null @@ -1,386 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldfarm/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the yieldfarm module's genesis state. -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - FarmerInfos []FarmerInfo `protobuf:"bytes,2,rep,name=farmer_infos,json=farmerInfos,proto3" json:"farmer_infos"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_acc6609999d396c5, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetFarmerInfos() []FarmerInfo { - if m != nil { - return m.FarmerInfos - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "ununifi.chain.yieldfarm.GenesisState") -} - -func init() { proto.RegisterFile("yieldfarm/genesis.proto", fileDescriptor_acc6609999d396c5) } - -var fileDescriptor_acc6609999d396c5 = []byte{ - // 247 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xaf, 0xcc, 0x4c, 0xcd, - 0x49, 0x49, 0x4b, 0x2c, 0xca, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x2f, 0xcd, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0xd4, 0x4b, 0xce, 0x48, - 0xcc, 0xcc, 0xd3, 0x83, 0x2b, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd1, 0x07, 0xb1, - 0x20, 0xca, 0xa5, 0xc4, 0x10, 0xe6, 0x14, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x8d, 0x91, 0x92, 0x44, - 0x88, 0xc3, 0x59, 0x10, 0x29, 0xa5, 0xd9, 0x8c, 0x5c, 0x3c, 0xee, 0x10, 0x3b, 0x83, 0x4b, 0x12, - 0x4b, 0x52, 0x85, 0x6c, 0xb9, 0xd8, 0x20, 0x7a, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xe4, - 0xf5, 0x70, 0xb8, 0x41, 0x2f, 0x00, 0xac, 0xcc, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, - 0x26, 0x21, 0x1f, 0x2e, 0x1e, 0x90, 0x64, 0x6a, 0x51, 0x7c, 0x66, 0x5e, 0x5a, 0x7e, 0xb1, 0x04, - 0x93, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x32, 0x4e, 0x43, 0xdc, 0xc0, 0x8a, 0x3d, 0xf3, 0xd2, 0xf2, - 0xa1, 0x06, 0x71, 0xa7, 0xc1, 0x45, 0x8a, 0x9d, 0x5c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, - 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, - 0x58, 0x8e, 0x21, 0x4a, 0x2b, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, - 0x34, 0x2f, 0x34, 0x2f, 0xd3, 0x2d, 0x53, 0x1f, 0x6c, 0xb6, 0x7e, 0x05, 0xc2, 0x8f, 0xfa, 0x25, - 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xaf, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3a, - 0xf7, 0xad, 0x5d, 0x67, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FarmerInfos) > 0 { - for iNdEx := len(m.FarmerInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FarmerInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.FarmerInfos) > 0 { - for _, e := range m.FarmerInfos { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FarmerInfos", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FarmerInfos = append(m.FarmerInfos, FarmerInfo{}) - if err := m.FarmerInfos[len(m.FarmerInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldfarm/types/keys.go b/deprecated/x/yieldfarm/types/keys.go deleted file mode 100644 index 2a25dd30b..000000000 --- a/deprecated/x/yieldfarm/types/keys.go +++ /dev/null @@ -1,25 +0,0 @@ -package types - -import sdk "github.com/cosmos/cosmos-sdk/types" - -const ( - // ModuleName defines the module name - ModuleName = "yieldfarm" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey is the message route for slashing - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName -) - -const ( - PrefixKeyFarmerInfo = "farmer_info_" -) - -func FarmerInfoKey(addr sdk.AccAddress) []byte { - return append([]byte(PrefixKeyFarmerInfo), addr...) -} diff --git a/deprecated/x/yieldfarm/types/params.go b/deprecated/x/yieldfarm/types/params.go deleted file mode 100644 index ec1bde721..000000000 --- a/deprecated/x/yieldfarm/types/params.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - fmt "fmt" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -// Parameter keys -var ( - KeyDailyReward = []byte("DailyReward") -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams(dailyReward uint64) Params { - return Params{ - DailyReward: dailyReward, - } -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams(1) -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyDailyReward, &p.DailyReward, validateDailyReward), - } -} - -// Validate checks that the parameters have valid values. -func (p Params) Validate() error { - - if err := validateDailyReward(p.DailyReward); err != nil { - return err - } - - return nil -} - -func validateDailyReward(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} diff --git a/deprecated/x/yieldfarm/types/params.pb.go b/deprecated/x/yieldfarm/types/params.pb.go deleted file mode 100644 index 9955ded86..000000000 --- a/deprecated/x/yieldfarm/types/params.pb.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldfarm/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { - DailyReward uint64 `protobuf:"varint,1,opt,name=daily_reward,json=dailyReward,proto3" json:"daily_reward,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e09913d7c0ecd545, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetDailyReward() uint64 { - if m != nil { - return m.DailyReward - } - return 0 -} - -func init() { - proto.RegisterType((*Params)(nil), "ununifi.chain.yieldfarm.Params") -} - -func init() { proto.RegisterFile("yieldfarm/params.proto", fileDescriptor_e09913d7c0ecd545) } - -var fileDescriptor_e09913d7c0ecd545 = []byte{ - // 181 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xab, 0xcc, 0x4c, 0xcd, - 0x49, 0x49, 0x4b, 0x2c, 0xca, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0x12, 0x2f, 0xcd, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0xd4, 0x4b, 0xce, 0x48, 0xcc, - 0xcc, 0xd3, 0x83, 0xab, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd1, 0x07, 0xb1, 0x20, - 0xca, 0x95, 0xb4, 0xb9, 0xd8, 0x02, 0xc0, 0xda, 0x85, 0x14, 0xb9, 0x78, 0x52, 0x12, 0x33, 0x73, - 0x2a, 0xe3, 0x8b, 0x52, 0xcb, 0x13, 0x8b, 0x52, 0x24, 0x18, 0x15, 0x18, 0x35, 0x58, 0x82, 0xb8, - 0xc1, 0x62, 0x41, 0x60, 0x21, 0x27, 0x97, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, - 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, - 0x88, 0xd2, 0x4a, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x0f, 0xcd, 0x0b, - 0xcd, 0xcb, 0x74, 0xcb, 0xd4, 0x07, 0x3b, 0x40, 0xbf, 0x42, 0x1f, 0xe1, 0xd0, 0x92, 0xca, 0x82, - 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xcd, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, 0xf9, 0x01, - 0x64, 0xc2, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.DailyReward != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.DailyReward)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DailyReward != 0 { - n += 1 + sovParams(uint64(m.DailyReward)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DailyReward", wireType) - } - m.DailyReward = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DailyReward |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/deprecated/x/yieldfarm/types/yieldfarm.pb.go b/deprecated/x/yieldfarm/types/yieldfarm.pb.go deleted file mode 100644 index dac014efa..000000000 --- a/deprecated/x/yieldfarm/types/yieldfarm.pb.go +++ /dev/null @@ -1,447 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: yieldfarm/yieldfarm.proto - -package types - -import ( - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type FarmerInfo struct { - Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` - Amount []types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount"` - Rewards []types.Coin `protobuf:"bytes,3,rep,name=rewards,proto3" json:"rewards"` -} - -func (m *FarmerInfo) Reset() { *m = FarmerInfo{} } -func (m *FarmerInfo) String() string { return proto.CompactTextString(m) } -func (*FarmerInfo) ProtoMessage() {} -func (*FarmerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_24371ddc269ed4ea, []int{0} -} -func (m *FarmerInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FarmerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FarmerInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *FarmerInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_FarmerInfo.Merge(m, src) -} -func (m *FarmerInfo) XXX_Size() int { - return m.Size() -} -func (m *FarmerInfo) XXX_DiscardUnknown() { - xxx_messageInfo_FarmerInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_FarmerInfo proto.InternalMessageInfo - -func (m *FarmerInfo) GetAccount() string { - if m != nil { - return m.Account - } - return "" -} - -func (m *FarmerInfo) GetAmount() []types.Coin { - if m != nil { - return m.Amount - } - return nil -} - -func (m *FarmerInfo) GetRewards() []types.Coin { - if m != nil { - return m.Rewards - } - return nil -} - -func init() { - proto.RegisterType((*FarmerInfo)(nil), "ununifi.chain.yieldfarm.FarmerInfo") -} - -func init() { proto.RegisterFile("yieldfarm/yieldfarm.proto", fileDescriptor_24371ddc269ed4ea) } - -var fileDescriptor_24371ddc269ed4ea = []byte{ - // 260 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xac, 0xcc, 0x4c, 0xcd, - 0x49, 0x49, 0x4b, 0x2c, 0xca, 0xd5, 0x87, 0xb3, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xc4, - 0x4b, 0xf3, 0x4a, 0xf3, 0x32, 0xd3, 0x32, 0xf5, 0x92, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe0, 0xd2, - 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x35, 0xfa, 0x20, 0x16, 0x44, 0xb9, 0x94, 0x5c, 0x72, - 0x7e, 0x71, 0x6e, 0x7e, 0xb1, 0x7e, 0x52, 0x62, 0x71, 0xaa, 0x7e, 0x99, 0x61, 0x52, 0x6a, 0x49, - 0xa2, 0xa1, 0x7e, 0x72, 0x7e, 0x66, 0x1e, 0x44, 0x5e, 0x69, 0x16, 0x23, 0x17, 0x97, 0x5b, 0x62, - 0x51, 0x6e, 0x6a, 0x91, 0x67, 0x5e, 0x5a, 0xbe, 0x90, 0x04, 0x17, 0x7b, 0x62, 0x72, 0x72, 0x7e, - 0x69, 0x5e, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0x2b, 0x64, 0xce, 0xc5, 0x96, - 0x98, 0x0b, 0x96, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, 0x92, 0xd4, 0x83, 0x98, 0xac, 0x07, 0x32, - 0x59, 0x0f, 0x6a, 0xb2, 0x9e, 0x73, 0x7e, 0x66, 0x9e, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, - 0x50, 0xe5, 0x42, 0x96, 0x5c, 0xec, 0x45, 0xa9, 0xe5, 0x89, 0x45, 0x29, 0xc5, 0x12, 0xcc, 0xc4, - 0xe9, 0x84, 0xa9, 0x77, 0x72, 0x39, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, - 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, - 0xad, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xd0, 0xbc, 0xd0, 0xbc, - 0x4c, 0xb7, 0x4c, 0x7d, 0x70, 0x80, 0xe8, 0x57, 0x20, 0x42, 0x4c, 0xbf, 0xa4, 0xb2, 0x20, 0xb5, - 0x38, 0x89, 0x0d, 0xec, 0x53, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0x4e, 0x6d, 0xe2, - 0x55, 0x01, 0x00, 0x00, -} - -func (m *FarmerInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FarmerInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FarmerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Rewards) > 0 { - for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintYieldfarm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintYieldfarm(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Account) > 0 { - i -= len(m.Account) - copy(dAtA[i:], m.Account) - i = encodeVarintYieldfarm(dAtA, i, uint64(len(m.Account))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintYieldfarm(dAtA []byte, offset int, v uint64) int { - offset -= sovYieldfarm(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *FarmerInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Account) - if l > 0 { - n += 1 + l + sovYieldfarm(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovYieldfarm(uint64(l)) - } - } - if len(m.Rewards) > 0 { - for _, e := range m.Rewards { - l = e.Size() - n += 1 + l + sovYieldfarm(uint64(l)) - } - } - return n -} - -func sovYieldfarm(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozYieldfarm(x uint64) (n int) { - return sovYieldfarm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *FarmerInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FarmerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FarmerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthYieldfarm - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthYieldfarm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Account = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthYieldfarm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthYieldfarm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthYieldfarm - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthYieldfarm - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Rewards = append(m.Rewards, types.Coin{}) - if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipYieldfarm(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthYieldfarm - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipYieldfarm(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowYieldfarm - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthYieldfarm - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupYieldfarm - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthYieldfarm - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthYieldfarm = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowYieldfarm = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupYieldfarm = fmt.Errorf("proto: unexpected end of group") -) diff --git a/docs/architecture/adr-ecosystem-incentive.md b/docs/architecture/adr-ecosystem-incentive.md index 4d666138e..ec84eb5a2 100644 --- a/docs/architecture/adr-ecosystem-incentive.md +++ b/docs/architecture/adr-ecosystem-incentive.md @@ -133,8 +133,8 @@ The interfaces: ```go type NftmarketHooks interface { - AfterNftListed(ctx sdk.Context, nft_id types.NftIdentifier, incentive_id string) - AfterNftPaid(ctx sdk.Context, nft_id types.NftIdentifier, fee_amount mathInt, fee_denom string) + AfterNftListed(ctx sdk.Context, nft_id types.NftId, incentive_id string) + AfterNftPaid(ctx sdk.Context, nft_id types.NftId, fee_amount mathInt, fee_denom string) } ``` diff --git a/docs/architecture/adr-nft-market/06_client.md b/docs/architecture/adr-nft-market/06_client.md index bd66e287a..bc067670a 100644 --- a/docs/architecture/adr-nft-market/06_client.md +++ b/docs/architecture/adr-nft-market/06_client.md @@ -13,51 +13,53 @@ A user can query and interact with the `nftmarket` module using the CLI. The `query` commands allow users to query `nftmarket` state. ```sh -ununifid query nftmarket --help +ununifid query nftbackedloan --help ``` + + #### classes The `classes` endpoint allows users to query all listing nft series. ```sh -ununifid query nftmarket classes [flags] +ununifid query nftbackedloan classes [flags] ``` Example: ```sh -ununifid query nftmarket classes +ununifid query nftbackedloan classes ``` Example Output: ```yml classes: -- id: a10 - name: crypotpunk - description: crypotpunk is awsome - symbol: cryp - uri: http... - uriHash: xxxxx - nft: - - id: ax10 + - id: a10 + name: crypotpunk + description: crypotpunk is awsome + symbol: cryp uri: http... uriHash: xxxxx - nftCount: 20 -- id: b10 - name: ape - description: ape is awsome - symbol: ape - uri: http... - uriHash: xxxxx - nft: - - id: bx10 + nft: + - id: ax10 + uri: http... + uriHash: xxxxx + nftCount: 20 + - id: b10 + name: ape + description: ape is awsome + symbol: ape uri: http... uriHash: xxxxx - nftCount: 5 + nft: + - id: bx10 + uri: http... + uriHash: xxxxx + nftCount: 5 pagination: - total: '2' + total: "2" ``` ### Transactions @@ -65,7 +67,7 @@ pagination: The `tx` commands allow users to interact with the `nftmarket` module. ```sh -ununifid tx nftmarket --help +ununifid tx nftbackedloan--help ``` #### listing @@ -73,16 +75,17 @@ ununifid tx nftmarket --help The `listing` command listing NFT. ```sh -ununifid tx nftmarket listing [class-id] [nft-id] [flags] +ununifid tx nftbackedloanlisting [class-id] [nft-id] [flags] ``` Example: ```sh -ununifid tx nftmarket listing a10 a10 --from myKeyName --chain-id ununifi-x +ununifid tx nftbackedloanlisting a10 a10 --from myKeyName --chain-id ununifi-x ``` + ## gRPC A user can query the `nftmarket` module using gRPC endpoints. @@ -110,36 +113,36 @@ Example Output: { "classes": [ { - "id":"a10", - "name":"crypotpunk", - "description":"crypotpunk is awsome", - "symbol":"cryp", - "uri":"http...", - "uriHash":"xxxxx", - "nft":[ + "id": "a10", + "name": "crypotpunk", + "description": "crypotpunk is awsome", + "symbol": "cryp", + "uri": "http...", + "uriHash": "xxxxx", + "nft": [ { - "id":"ax10", - "uri":"http...", - "uriHash":"xxxxx" + "id": "ax10", + "uri": "http...", + "uriHash": "xxxxx" } ], - "nftCount":20 + "nftCount": 20 }, { - "id":"b10", - "name":"ape", - "description":"ape is awsome", - "symbol":"ape", - "uri":"http...", - "uriHash":"xxxxx", - "nft":[ + "id": "b10", + "name": "ape", + "description": "ape is awsome", + "symbol": "ape", + "uri": "http...", + "uriHash": "xxxxx", + "nft": [ { - "id":"bx10", - "uri":"http...", - "uriHash":"xxxxx" + "id": "bx10", + "uri": "http...", + "uriHash": "xxxxx" } ], - "nftCount":5 + "nftCount": 5 } ], "pagination": { @@ -170,20 +173,20 @@ Example Output: ```json { "class": { - "id":"a10", - "name":"crypotpunk", - "description":"crypotpunk is awsome", - "symbol":"cryp", - "uri":"http...", - "uriHash":"xxxxx", - "nft":[ - { - "id":"ax10", - "uri":"http...", - "uriHash":"xxxxx", - } - ], - "nftCount":20, + "id": "a10", + "name": "crypotpunk", + "description": "crypotpunk is awsome", + "symbol": "cryp", + "uri": "http...", + "uriHash": "xxxxx", + "nft": [ + { + "id": "ax10", + "uri": "http...", + "uriHash": "xxxxx" + } + ], + "nftCount": 20 } } ``` @@ -209,30 +212,30 @@ Example Output: ```json { - "nft":{ - "classId":"a10", - "id":"ax10", - "uri":"http...", - "uriHash":"xxxxx", - "listingType":"DIRECT_ASSET_BORROW", - "bidToken":"uguu", - "state":"BIDDING", - "minBid":"1", - "bidActiverank":"2", - "bids":[ + "nft": { + "classId": "a10", + "id": "ax10", + "uri": "http...", + "uriHash": "xxxxx", + "listingType": "DIRECT_ASSET_BORROW", + "bidToken": "uguu", + "state": "BIDDING", + "minBid": "1", + "bidActiverank": "2", + "bids": [ { - "bidder":"ununifi1...", - "amount":"100uguu", + "bidder": "ununifi1...", + "amount": "100uguu" }, { - "bidder":"ununifi1...", - "amount":"99uguu", + "bidder": "ununifi1...", + "amount": "99uguu" }, { - "bidder":"ununifi1...", - "amount":"98uguu", + "bidder": "ununifi1...", + "amount": "98uguu" } - ], + ] } } ``` diff --git a/docs/client/swagger.yaml b/docs/client/swagger.yaml index 9ba3493e8..06d75efd1 100644 --- a/docs/client/swagger.yaml +++ b/docs/client/swagger.yaml @@ -954,6 +954,9 @@ paths: type: string target_weight: type: string + levy_period_required_seconds: + type: string + format: uint64 perpetual_futures: type: object properties: @@ -1191,51 +1194,43 @@ paths: } tags: - Query - /ununifi/derivatives/perpetual-futures: + /ununifi/derivatives/pending-payment-positions: get: - operationId: PerpetualFutures + operationId: AllPendingPaymentPositions responses: '200': description: A successful response. schema: type: object properties: - metrics_quote_ticker: - type: string - volume_24hours: - type: string - fees_24hours: - type: string - long_positions: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - short_positions: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + pending_payment_positions: + type: array + items: + type: object + properties: + id: + type: string + refundable_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method + NOTE: The amount field is an Int which implements the + custom method - signatures required by gogoproto. + signatures required by gogoproto. + created_at: + type: string + format: date-time + created_height: + type: string + format: uint64 default: description: An unexpected error response. schema: @@ -1429,27 +1424,41 @@ paths: } tags: - Query - /ununifi/derivatives/perpetual-futures/{base_denom}/{quote_denom}: + /ununifi/derivatives/pending-payment-positions/{position_id}: get: - operationId: PerpetualFuturesMarket + operationId: PendingPaymentPosition responses: '200': description: A successful response. schema: type: object properties: - price: - type: string - metrics_quote_ticker: - type: string - volume_24hours: - type: string - fees_24hours: - type: string - long_positions: - type: string - short_positions: - type: string + pending_payment_position: + type: object + properties: + id: + type: string + refundable_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + created_at: + type: string + format: date-time + created_height: + type: string + format: uint64 default: description: An unexpected error response. schema: @@ -1642,24 +1651,27 @@ paths: "value": "1.212s" } parameters: - - name: base_denom - in: path - required: true - type: string - - name: quote_denom + - name: position_id in: path required: true type: string tags: - Query - /ununifi/derivatives/perpetual-options: + /ununifi/derivatives/perpetual-futures: get: - operationId: PerpetualOptions + operationId: PerpetualFutures responses: '200': description: A successful response. schema: type: object + properties: + metrics_quote_ticker: + type: string + long_positions: + type: string + short_positions: + type: string default: description: An unexpected error response. schema: @@ -1853,14 +1865,23 @@ paths: } tags: - Query - /ununifi/derivatives/perpetual-options/{base_denom}/{quote_denom}: + /ununifi/derivatives/perpetual-futures/{base_denom}/{quote_denom}: get: - operationId: PerpetualOptionsMarket + operationId: PerpetualFuturesMarket responses: '200': description: A successful response. schema: type: object + properties: + price: + type: string + metrics_quote_ticker: + type: string + long_positions: + type: string + short_positions: + type: string default: description: An unexpected error response. schema: @@ -2063,42 +2084,14 @@ paths: type: string tags: - Query - /ununifi/derivatives/pool: + /ununifi/derivatives/perpetual-options: get: - summary: 'this line is used by starport scaffolding # 2' - operationId: Pool + operationId: PerpetualOptions responses: '200': description: A successful response. schema: type: object - properties: - metrics_quote_ticker: - type: string - pool_market_cap: - type: object - properties: - quote_ticker: - type: string - total: - type: string - asset_info: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - price: - type: string - reserved: - type: string - volume_24hours: - type: string - fees_24hours: - type: string default: description: An unexpected error response. schema: @@ -2292,30 +2285,14 @@ paths: } tags: - Query - /ununifi/derivatives/pools/available-asset/{denom}: + /ununifi/derivatives/perpetual-options/{base_denom}/{quote_denom}: get: - operationId: AvailableAssetInPoolByDenom + operationId: PerpetualOptionsMarket responses: '200': description: A successful response. schema: type: object - properties: - available_asset: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. default: description: An unexpected error response. schema: @@ -2508,38 +2485,48 @@ paths: "value": "1.212s" } parameters: - - name: denom + - name: base_denom + in: path + required: true + type: string + - name: quote_denom in: path required: true type: string tags: - Query - /ununifi/derivatives/pools/available-assets: + /ununifi/derivatives/pool: get: - operationId: AvailableAssetsInPool + summary: 'this line is used by starport scaffolding # 2' + operationId: Pool responses: '200': description: A successful response. schema: type: object properties: - available_assets: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. + metrics_quote_ticker: + type: string + pool_market_cap: + type: object + properties: + quote_ticker: + type: string + total: + type: string + asset_info: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + price: + type: string + reserved: + type: string default: description: An unexpected error response. schema: @@ -2733,34 +2720,30 @@ paths: } tags: - Query - /ununifi/derivatives/pools/dlp: + /ununifi/derivatives/pools/available-asset/{denom}: get: - operationId: DLPTokenRates + operationId: AvailableAssetInPoolByDenom responses: '200': description: A successful response. schema: type: object properties: - symbol: - type: string - rates: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + available_asset: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method + NOTE: The amount field is an Int which implements the custom + method - signatures required by gogoproto. + signatures required by gogoproto. default: description: An unexpected error response. schema: @@ -2952,267 +2935,39 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } + parameters: + - name: denom + in: path + required: true + type: string tags: - Query - /ununifi/derivatives/positions: + /ununifi/derivatives/pools/available-assets: get: - operationId: AllPositions + operationId: AvailableAssetsInPool responses: '200': description: A successful response. schema: type: object properties: - positions: + available_assets: type: array items: type: object properties: - id: - type: string - market: - type: object - properties: - base_denom: - type: string - quote_denom: - type: string - address: - type: string - opened_at: - type: string - format: date-time - opened_height: - type: string - format: uint64 - opened_base_rate: - type: string - opened_quote_rate: + denom: type: string - remaining_margin: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - last_levied_at: + amount: type: string - format: date-time - position_instance: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the - above specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - pagination: - type: object - properties: - next_key: - type: string - format: byte - title: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + description: >- + Coin defines a token with a denomination and an amount. - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - corresponding request message has used PageRequest. + NOTE: The amount field is an Int which implements the custom + method - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } + signatures required by gogoproto. default: description: An unexpected error response. schema: @@ -3404,79 +3159,36 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean tags: - Query - /ununifi/derivatives/positions/perpetual-futures/{position_type}/{address}: + /ununifi/derivatives/pools/dlp: get: - operationId: PerpetualFuturesPositionSize + operationId: DLPTokenRates responses: '200': description: A successful response. schema: type: object properties: - total_position_size_usd: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + symbol: + type: string + rates: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method + NOTE: The amount field is an Int which implements the custom + method - signatures required by gogoproto. + signatures required by gogoproto. default: description: An unexpected error response. schema: @@ -3668,281 +3380,284 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - parameters: - - name: position_type - in: path - required: true - type: string - enum: - - POSITION_UNKNOWN - - LONG - - SHORT - - name: address - in: path - required: true - type: string tags: - Query - /ununifi/derivatives/positions/{position_id}: + /ununifi/derivatives/positions: get: - operationId: Position + operationId: AllPositions responses: '200': description: A successful response. schema: type: object properties: - position: - type: object - properties: - id: - type: string - market: - type: object - properties: - base_denom: - type: string - quote_denom: - type: string - address: - type: string - opened_at: - type: string - format: date-time - opened_height: - type: string - format: uint64 - opened_base_rate: - type: string - opened_quote_rate: - type: string - remaining_margin: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + positions: + type: array + items: + type: object + properties: + id: + type: string + market: + type: object + properties: + base_denom: + type: string + quote_denom: + type: string + opener_address: + type: string + opened_at: + type: string + format: date-time + opened_height: + type: string + format: uint64 + opened_base_rate: + type: string + opened_quote_rate: + type: string + remaining_margin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the - custom method + NOTE: The amount field is an Int which implements the + custom method - signatures required by gogoproto. - last_levied_at: - type: string - format: date-time - position_instance: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized + signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - protocol buffer message. This string must contain at - least - one "/" character. The last segment of the URL's path - must represent + NOTE: The amount field is an Int which implements the + custom method - the fully qualified name of the type (as in + signatures required by gogoproto. + levied_amount_negative: + type: boolean + last_levied_at: + type: string + format: date-time + position_instance: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the + type of the serialized - `path/google.protobuf.Duration`). The name should be - in a canonical form + protocol buffer message. This string must contain at + least - (e.g., leading "." is not accepted). + one "/" character. The last segment of the URL's + path must represent + the fully qualified name of the type (as in - In practice, teams usually precompile into the binary - all types that they + `path/google.protobuf.Duration`). The name should be + in a canonical form - expect it to use in the context of Any. However, for - URLs which use the + (e.g., leading "." is not accepted). - scheme `http`, `https`, or no scheme, one can - optionally set up a type - server that maps type URLs to message definitions as - follows: + In practice, teams usually precompile into the + binary all types that they + expect it to use in the context of Any. However, for + URLs which use the - * If no scheme is provided, `https` is assumed. + scheme `http`, `https`, or no scheme, one can + optionally set up a type - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + server that maps type URLs to message definitions as + follows: - Note: this functionality is not currently available in - the official - protobuf release, and it is not used for type URLs - beginning with + * If no scheme is provided, `https` is assumed. - type.googleapis.com. + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + Note: this functionality is not currently available + in the official - Schemes other than `http`, `https` (or the empty - scheme) might be + protobuf release, and it is not used for type URLs + beginning with - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the - above specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + type.googleapis.com. - URL that describes the type of the serialized message. + Schemes other than `http`, `https` (or the empty + scheme) might be - Protobuf library provides support to pack/unpack Any - values in the form + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the + above specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a - of utility functions or additional generated methods of - the Any type. + URL that describes the type of the serialized message. - Example 1: Pack and unpack a message in C++. + Protobuf library provides support to pack/unpack Any + values in the form - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { + of utility functions or additional generated methods of + the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); ... - } + if (any.UnpackTo(&foo)) { + ... + } - Example 2: Pack and unpack a message in Java. + Example 2: Pack and unpack a message in Java. - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) + foo = Foo(...) + any = Any() + any.Pack(foo) ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } ... - } + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - The pack methods provided by protobuf library will by - default use + The pack methods provided by protobuf library will by + default use - 'type.googleapis.com/full.type.name' as the type URL and - the unpack + 'type.googleapis.com/full.type.name' as the type URL and + the unpack - methods only use the fully qualified type name after the - last '/' + methods only use the fully qualified type name after the + last '/' - in the type URL, for example "foo.bar.com/x/y.z" will - yield type + in the type URL, for example "foo.bar.com/x/y.z" will + yield type - name "y.z". + name "y.z". - JSON + JSON - The JSON representation of an `Any` value uses the regular + The JSON representation of an `Any` value uses the + regular - representation of the deserialized, embedded message, with - an + representation of the deserialized, embedded message, + with an - additional field `@type` which contains the type URL. - Example: + additional field `@type` which contains the type URL. + Example: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - If the embedded message type is well-known and has a - custom JSON + If the embedded message type is well-known and has a + custom JSON - representation, that representation will be embedded - adding a field + representation, that representation will be embedded + adding a field - `value` which holds the custom JSON in addition to the - `@type` + `value` which holds the custom JSON in addition to the + `@type` - field. Example (for message [google.protobuf.Duration][]): + field. Example (for message + [google.protobuf.Duration][]): - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - valuation_profit: + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + pagination: type: object properties: - denom: + next_key: type: string - amount: + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - signatures required by gogoproto. - margin_maintenance_rate: - type: string - effective_margin: - type: object - properties: - denom: - type: string - amount: - type: string + was set, its value is undefined otherwise description: >- - Coin defines a token with a denomination and an amount. - + PageResponse is to be embedded in gRPC response messages where + the - NOTE: The amount field is an Int which implements the custom - method + corresponding request message has used PageRequest. - signatures required by gogoproto. + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } default: description: An unexpected error response. schema: @@ -4135,39 +3850,786 @@ paths: "value": "1.212s" } parameters: - - name: position_id - in: path - required: true + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false type: string - tags: - - Query - /ununifi/derivatives/{address}/positions: - get: - operationId: AddressPositions - responses: - '200': - description: A successful response. - schema: - type: object - properties: - positions: - type: array - items: - type: object - properties: - position: - type: object - properties: - id: - type: string - market: - type: object - properties: - base_denom: + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + tags: + - Query + /ununifi/derivatives/positions/perpetual-futures/{position_type}/{address}: + get: + operationId: PerpetualFuturesPositionSize + responses: + '200': + description: A successful response. + schema: + type: object + properties: + total_position_size_usd: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: position_type + in: path + required: true + type: string + enum: + - POSITION_UNKNOWN + - LONG + - SHORT + - name: address + in: path + required: true + type: string + tags: + - Query + /ununifi/derivatives/positions/{position_id}: + get: + operationId: Position + responses: + '200': + description: A successful response. + schema: + type: object + properties: + position: + type: object + properties: + id: + type: string + market: + type: object + properties: + base_denom: + type: string + quote_denom: + type: string + opener_address: + type: string + opened_at: + type: string + format: date-time + opened_height: + type: string + format: uint64 + opened_base_rate: + type: string + opened_quote_rate: + type: string + remaining_margin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + levied_amount_negative: + type: boolean + last_levied_at: + type: string + format: date-time + position_instance: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type + of the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be + in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the + above specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any + values in the form + + of utility functions or additional generated methods of + the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and + the unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will + yield type + + name "y.z". + + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a + custom JSON + + representation, that representation will be embedded + adding a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + valuation_profit: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + margin_maintenance_rate: + type: string + effective_margin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: position_id + in: path + required: true + type: string + tags: + - Query + /ununifi/derivatives/{address}/positions: + get: + operationId: AddressPositions + responses: + '200': + description: A successful response. + schema: + type: object + properties: + positions: + type: array + items: + type: object + properties: + position: + type: object + properties: + id: + type: string + market: + type: object + properties: + base_denom: type: string quote_denom: type: string - address: + opener_address: type: string opened_at: type: string @@ -4195,6 +4657,24 @@ paths: the custom method signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + levied_amount_negative: + type: boolean last_levied_at: type: string format: date-time @@ -4684,11 +5164,18 @@ paths: - UNKNOWN - STAKERS - FRONTEND_DEVELOPERS + - COMMUNITY_POOL default: UNKNOWN description: >- - NFTMARKET_FRONTEND type reward will be + STAKERS type reward will be distributed for + the stakers of GUU token. + + FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. + + COMMUNITY_POOL type reward will be distributed + for the community pool. rate: type: string title: >- @@ -4703,7 +5190,7 @@ paths: to maintain the correctness of the fee rate in a module - e.g. if nftmarket module have "Frontend" and + e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, the combined those rates for the incentive cannot be @@ -4945,7 +5432,7 @@ paths: type: string tags: - Query - /ununifi/nftbackedloan/bidder_bids/{bidder}: + /ununifi/nftbackedloan/bidder-bids/{bidder}: get: operationId: BidderBids responses: @@ -4959,16 +5446,19 @@ paths: items: type: object properties: - nft_id: + id: type: object properties: - class_id: - type: string nft_id: + type: object + properties: + class_id: + type: string + nft_id: + type: string + bidder: type: string - bidder: - type: string - bid_amount: + price: type: object properties: denom: @@ -4983,7 +5473,7 @@ paths: custom method signatures required by gogoproto. - deposit_amount: + deposit: type: object properties: denom: @@ -5013,85 +5503,39 @@ paths: custom method signatures required by gogoproto. - bidding_period: + expiry: type: string format: date-time - deposit_lending_rate: + interest_rate: type: string automatic_payment: type: boolean - bid_time: + created_at: type: string format: date-time - interest_amount: + borrow: + title: borrow info type: object properties: - denom: - type: string amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - borrowings: - type: array - items: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements - the custom method - - signatures required by gogoproto. - paid_interest_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements - the custom method - - signatures required by gogoproto. - start_at: - type: string - format: date-time - title: lister borrowing bidder info - id: - title: todo remove nft_id,bidder then use it - type: object - properties: - nft_id: type: object properties: - class_id: + denom: type: string - nft_id: + amount: type: string - bidder: + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + last_repaid_at: type: string + format: date-time default: description: An unexpected error response. schema: @@ -5121,38 +5565,6 @@ paths: type: string tags: - Query - /ununifi/nftbackedloan/cdps_list: - get: - operationId: CDPsList - responses: - '200': - description: A successful response. - schema: - type: object - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - Query /ununifi/nftbackedloan/liquidation/{class_id}/{nft_id}: get: operationId: Liquidation @@ -5244,7 +5656,7 @@ paths: type: string tags: - Query - /ununifi/nftbackedloan/listed_class/{class_id}/{nft_limit}: + /ununifi/nftbackedloan/listed-class/{class_id}/{nft_limit}: get: operationId: ListedClass responses: @@ -5313,7 +5725,7 @@ paths: format: int32 tags: - Query - /ununifi/nftbackedloan/listed_classes: + /ununifi/nftbackedloan/listed-classes: get: operationId: ListedClasses responses: @@ -5383,7 +5795,7 @@ paths: format: int32 tags: - Query - /ununifi/nftbackedloan/listed_nfts: + /ununifi/nftbackedloan/listed-nfts: get: operationId: ListedNfts responses: @@ -5409,32 +5821,24 @@ paths: type: string owner: type: string - listing_type: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW state: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - bid_token: + default: UNKNOWN + bid_denom: type: string minimum_deposit_rate: type: string - automatic_refinancing: - type: boolean started_at: type: string format: date-time - end_at: + liquidated_at: type: string format: date-time full_payment_end_at: @@ -5443,9 +5847,6 @@ paths: successful_bid_end_at: type: string format: date-time - auto_relisted_count: - type: string - format: uint64 collected_amount: type: object properties: @@ -5462,6 +5863,8 @@ paths: the custom method signatures required by gogoproto. + collected_amount_negative: + type: boolean minimum_bidding_period: type: string nft_info: @@ -5502,66 +5905,6 @@ paths: type: string tags: - Query - /ununifi/nftbackedloan/loans: - get: - operationId: Loans - responses: - '200': - description: A successful response. - schema: - type: object - properties: - loans: - type: array - items: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - loan: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - Query /ununifi/nftbackedloan/loans/{class_id}/{nft_id}: get: operationId: Loan @@ -5571,33 +5914,58 @@ paths: schema: type: object properties: - loan: + nft_id: type: object properties: + class_id: + type: string nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - loan: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + type: string + borrowing_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + borrowing_limit: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + total_deposit: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the - custom method + NOTE: The amount field is an Int which implements the custom + method - signatures required by gogoproto. - borrowing_limit: - type: string + signatures required by gogoproto. default: description: An unexpected error response. schema: @@ -5631,7 +5999,7 @@ paths: type: string tags: - Query - /ununifi/nftbackedloan/nft_bids/{class_id}/{nft_id}: + /ununifi/nftbackedloan/nft-bids/{class_id}/{nft_id}: get: operationId: NftBids responses: @@ -5645,16 +6013,19 @@ paths: items: type: object properties: - nft_id: + id: type: object properties: - class_id: - type: string nft_id: + type: object + properties: + class_id: + type: string + nft_id: + type: string + bidder: type: string - bidder: - type: string - bid_amount: + price: type: object properties: denom: @@ -5669,7 +6040,7 @@ paths: custom method signatures required by gogoproto. - deposit_amount: + deposit: type: object properties: denom: @@ -5699,85 +6070,39 @@ paths: custom method signatures required by gogoproto. - bidding_period: + expiry: type: string format: date-time - deposit_lending_rate: + interest_rate: type: string automatic_payment: type: boolean - bid_time: + created_at: type: string format: date-time - interest_amount: + borrow: + title: borrow info type: object properties: - denom: - type: string amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - borrowings: - type: array - items: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements - the custom method - - signatures required by gogoproto. - paid_interest_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements - the custom method - - signatures required by gogoproto. - start_at: - type: string - format: date-time - title: lister borrowing bidder info - id: - title: todo remove nft_id,bidder then use it - type: object - properties: - nft_id: type: object properties: - class_id: + denom: type: string - nft_id: + amount: type: string - bidder: + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + last_repaid_at: type: string + format: date-time default: description: An unexpected error response. schema: @@ -5811,7 +6136,7 @@ paths: type: string tags: - Query - /ununifi/nftbackedloan/nft_listing/{class_id}/{nft_id}: + /ununifi/nftbackedloan/nft-listing/{class_id}/{nft_id}: get: operationId: NftListing responses: @@ -5832,32 +6157,24 @@ paths: type: string owner: type: string - listing_type: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW state: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - bid_token: + default: UNKNOWN + bid_denom: type: string minimum_deposit_rate: type: string - automatic_refinancing: - type: boolean started_at: type: string format: date-time - end_at: + liquidated_at: type: string format: date-time full_payment_end_at: @@ -5866,9 +6183,6 @@ paths: successful_bid_end_at: type: string format: date-time - auto_relisted_count: - type: string - format: uint64 collected_amount: type: object properties: @@ -5884,6 +6198,8 @@ paths: custom method signatures required by gogoproto. + collected_amount_negative: + type: boolean minimum_bidding_period: type: string default: @@ -5933,147 +6249,25 @@ paths: properties: min_staking_for_listing: type: string - default_bid_active_rank: - type: string - format: uint64 bid_tokens: type: array items: type: string - auto_relisting_count_if_no_bid: - type: string - format: uint64 - nft_listing_delay_seconds: - type: string - format: uint64 - nft_listing_period_initial: - type: string - format: uint64 nft_listing_cancel_required_seconds: type: string format: uint64 - nft_listing_cancel_fee_percentage: - type: string - format: uint64 - nft_listing_gap_time: - type: string - format: uint64 bid_cancel_required_seconds: type: string format: uint64 - bid_token_disburse_seconds_after_cancel: - type: string - format: uint64 nft_listing_full_payment_period: type: string format: uint64 nft_listing_nft_delivery_period: type: string format: uint64 - nft_creator_share_percentage: - type: string - format: uint64 - market_administrator: - type: string nft_listing_commission_fee: type: string format: uint64 - nft_listing_extend_seconds: - type: string - format: uint64 - nft_listing_period_extend_fee_per_hour: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - Query - /ununifi/nftbackedloan/payment_status/{class_id}/{nft_id}/{bidder}: - get: - operationId: PaymentStatus - responses: - '200': - description: A successful response. - schema: - type: object - properties: - paymentStatus: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - bidder: - type: string - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - automatic_payment: - type: boolean - paid_amount: - type: string - bid_time: - type: string - format: date-time - state: - type: string - enum: - - LISTING - - BIDDING - - SELLING_DECISION - - END_LISTING - - SUCCESSFUL_BID - default: LISTING - all_paid: - type: boolean default: description: An unexpected error response. schema: @@ -6096,19 +6290,6 @@ paths: value: type: string format: byte - parameters: - - name: class_id - in: path - required: true - type: string - - name: nft_id - in: path - required: true - type: string - - name: bidder - in: path - required: true - type: string tags: - Query /ununifi/nftbackedloan/rewards/{address}: @@ -8084,6 +8265,9 @@ definitions: type: string target_weight: type: string + levy_period_required_seconds: + type: string + format: uint64 perpetual_futures: type: object properties: @@ -8125,6 +8309,29 @@ definitions: type: string quote_denom: type: string + ununifi.derivatives.PendingPaymentPosition: + type: object + properties: + id: + type: string + refundable_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + created_at: + type: string + format: date-time + created_height: + type: string + format: uint64 ununifi.derivatives.PerpetualFuturesParams: type: object properties: @@ -8228,6 +8435,9 @@ definitions: type: string target_weight: type: string + levy_period_required_seconds: + type: string + format: uint64 ununifi.derivatives.Position: type: object properties: @@ -8240,7 +8450,7 @@ definitions: type: string quote_denom: type: string - address: + opener_address: type: string opened_at: type: string @@ -8264,6 +8474,20 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + levied_amount_negative: + type: boolean last_levied_at: type: string format: date-time @@ -8450,7 +8674,7 @@ definitions: type: string quote_denom: type: string - address: + opener_address: type: string opened_at: type: string @@ -8477,6 +8701,23 @@ definitions: method signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + levied_amount_negative: + type: boolean last_levied_at: type: string format: date-time @@ -8695,7 +8936,7 @@ definitions: type: string quote_denom: type: string - address: + opener_address: type: string opened_at: type: string @@ -8722,6 +8963,23 @@ definitions: method signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + levied_amount_negative: + type: boolean last_levied_at: type: string format: date-time @@ -8936,6 +9194,37 @@ definitions: signatures required by gogoproto. margin_maintenance_rate: type: string + ununifi.derivatives.QueryAllPendingPaymentPositionsResponse: + type: object + properties: + pending_payment_positions: + type: array + items: + type: object + properties: + id: + type: string + refundable_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + created_at: + type: string + format: date-time + created_height: + type: string + format: uint64 ununifi.derivatives.QueryAllPositionsResponse: type: object properties: @@ -8953,7 +9242,7 @@ definitions: type: string quote_denom: type: string - address: + opener_address: type: string opened_at: type: string @@ -8980,6 +9269,23 @@ definitions: method signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + levied_amount_negative: + type: boolean last_levied_at: type: string format: date-time @@ -9325,6 +9631,9 @@ definitions: type: string target_weight: type: string + levy_period_required_seconds: + type: string + format: uint64 perpetual_futures: type: object properties: @@ -9367,6 +9676,35 @@ definitions: quote_denom: type: string description: QueryParamsResponse is response type for the Query/Params RPC method. + ununifi.derivatives.QueryPendingPaymentPositionResponse: + type: object + properties: + pending_payment_position: + type: object + properties: + id: + type: string + refundable_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + created_at: + type: string + format: date-time + created_height: + type: string + format: uint64 ununifi.derivatives.QueryPerpetualFuturesMarketResponse: type: object properties: @@ -9374,10 +9712,6 @@ definitions: type: string metrics_quote_ticker: type: string - volume_24hours: - type: string - fees_24hours: - type: string long_positions: type: string short_positions: @@ -9402,34 +9736,10 @@ definitions: properties: metrics_quote_ticker: type: string - volume_24hours: - type: string - fees_24hours: - type: string long_positions: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. + type: string short_positions: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. + type: string ununifi.derivatives.QueryPerpetualOptionsMarketResponse: type: object ununifi.derivatives.QueryPerpetualOptionsResponse: @@ -9459,10 +9769,6 @@ definitions: type: string reserved: type: string - volume_24hours: - type: string - fees_24hours: - type: string ununifi.derivatives.QueryPositionResponse: type: object properties: @@ -9478,7 +9784,7 @@ definitions: type: string quote_denom: type: string - address: + opener_address: type: string opened_at: type: string @@ -9505,6 +9811,23 @@ definitions: method signatures required by gogoproto. + levied_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + levied_amount_negative: + type: boolean last_levied_at: type: string format: date-time @@ -9722,10 +10045,17 @@ definitions: - UNKNOWN - STAKERS - FRONTEND_DEVELOPERS + - COMMUNITY_POOL default: UNKNOWN description: >- - NFTMARKET_FRONTEND type reward will be disributed for the + STAKERS type reward will be distributed for the stakers of + GUU token. + + FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. + + COMMUNITY_POOL type reward will be distributed for the + community pool. rate: type: string title: >- @@ -9738,7 +10068,7 @@ definitions: to maintain the correctness of the fee rate in a module - e.g. if nftmarket module have "Frontend" and "Collection" + e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, the combined those rates for the incentive cannot be exceed 1 @@ -9800,10 +10130,17 @@ definitions: - UNKNOWN - STAKERS - FRONTEND_DEVELOPERS + - COMMUNITY_POOL default: UNKNOWN description: >- - NFTMARKET_FRONTEND type reward will be disributed for + STAKERS type reward will be distributed for the + stakers of GUU token. + + FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. + + COMMUNITY_POOL type reward will be distributed for the + community pool. rate: type: string title: >- @@ -9818,7 +10155,7 @@ definitions: to maintain the correctness of the fee rate in a module - e.g. if nftmarket module have "Frontend" and "Collection" + e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, the combined those rates for the incentive cannot be exceed 1 @@ -9889,10 +10226,17 @@ definitions: - UNKNOWN - STAKERS - FRONTEND_DEVELOPERS + - COMMUNITY_POOL default: UNKNOWN description: >- - NFTMARKET_FRONTEND type reward will be disributed for the + STAKERS type reward will be distributed for the stakers of GUU + token. + + FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. + + COMMUNITY_POOL type reward will be distributed for the community + pool. rate: type: string title: >- @@ -9903,7 +10247,7 @@ definitions: title: |- RewardParams defines which module have which rewards type and rate to maintain the correctness of the fee rate in a module - e.g. if nftmarket module have "Frontend" and "Collection" incentive, + e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, the combined those rates for the incentive cannot be exceed 1 ununifi.ecosystemincentive.RewardRate: type: object @@ -9914,10 +10258,15 @@ definitions: - UNKNOWN - STAKERS - FRONTEND_DEVELOPERS + - COMMUNITY_POOL default: UNKNOWN description: >- - NFTMARKET_FRONTEND type reward will be disributed for the creators of + STAKERS type reward will be distributed for the stakers of GUU token. + + FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. + + COMMUNITY_POOL type reward will be distributed for the community pool. rate: type: string title: |- @@ -9948,10 +10297,15 @@ definitions: - UNKNOWN - STAKERS - FRONTEND_DEVELOPERS + - COMMUNITY_POOL default: UNKNOWN description: >- - NFTMARKET_FRONTEND type reward will be disributed for the creators of + STAKERS type reward will be distributed for the stakers of GUU token. + + FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. + + COMMUNITY_POOL type reward will be distributed for the community pool. ununifi.ecosystemincentive.WeightedAddress: type: object properties: @@ -9971,6 +10325,24 @@ definitions: type: string bidder: type: string + ununifi.nftbackedloan.Borrowing: + type: object + properties: + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + last_repaid_at: + type: string + format: date-time ununifi.nftbackedloan.Liquidation: type: object properties: @@ -10039,163 +10411,96 @@ definitions: ununifi.nftbackedloan.ListingState: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - ununifi.nftbackedloan.ListingType: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW - ununifi.nftbackedloan.Loan: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - loan: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. + default: UNKNOWN ununifi.nftbackedloan.NftBid: type: object properties: - nft_id: + id: type: object properties: - class_id: - type: string nft_id: + type: object + properties: + class_id: + type: string + nft_id: + type: string + bidder: type: string - bidder: - type: string - bid_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - deposit_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - paid_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - bidding_period: - type: string - format: date-time - deposit_lending_rate: - type: string - automatic_payment: - type: boolean - bid_time: - type: string - format: date-time - interest_amount: + price: type: object properties: denom: type: string amount: type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - borrowings: - type: array - items: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - paid_interest_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + description: |- + Coin defines a token with a denomination and an amount. + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + deposit: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + paid_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - signatures required by gogoproto. - start_at: - type: string - format: date-time - title: lister borrowing bidder info - id: - title: todo remove nft_id,bidder then use it + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + expiry: + type: string + format: date-time + interest_rate: + type: string + automatic_payment: + type: boolean + created_at: + type: string + format: date-time + borrow: + title: borrow info type: object properties: - nft_id: + amount: type: object properties: - class_id: + denom: type: string - nft_id: + amount: type: string - bidder: + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + last_repaid_at: type: string + format: date-time ununifi.nftbackedloan.NftIdentifier: type: object properties: @@ -10224,32 +10529,24 @@ definitions: type: string owner: type: string - listing_type: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW state: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - bid_token: + default: UNKNOWN + bid_denom: type: string minimum_deposit_rate: type: string - automatic_refinancing: - type: boolean started_at: type: string format: date-time - end_at: + liquidated_at: type: string format: date-time full_payment_end_at: @@ -10258,9 +10555,6 @@ definitions: successful_bid_end_at: type: string format: date-time - auto_relisted_count: - type: string - format: uint64 collected_amount: type: object properties: @@ -10273,6 +10567,8 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. + collected_amount_negative: + type: boolean minimum_bidding_period: type: string ununifi.nftbackedloan.NftListingDetail: @@ -10290,32 +10586,24 @@ definitions: type: string owner: type: string - listing_type: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW state: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - bid_token: + default: UNKNOWN + bid_denom: type: string minimum_deposit_rate: type: string - automatic_refinancing: - type: boolean started_at: type: string format: date-time - end_at: + liquidated_at: type: string format: date-time full_payment_end_at: @@ -10324,9 +10612,6 @@ definitions: successful_bid_end_at: type: string format: date-time - auto_relisted_count: - type: string - format: uint64 collected_amount: type: object properties: @@ -10342,6 +10627,8 @@ definitions: method signatures required by gogoproto. + collected_amount_negative: + type: boolean minimum_bidding_period: type: string nft_info: @@ -10358,108 +10645,25 @@ definitions: properties: min_staking_for_listing: type: string - default_bid_active_rank: - type: string - format: uint64 bid_tokens: type: array items: type: string - auto_relisting_count_if_no_bid: - type: string - format: uint64 - nft_listing_delay_seconds: - type: string - format: uint64 - nft_listing_period_initial: - type: string - format: uint64 nft_listing_cancel_required_seconds: type: string format: uint64 - nft_listing_cancel_fee_percentage: - type: string - format: uint64 - nft_listing_gap_time: - type: string - format: uint64 bid_cancel_required_seconds: type: string format: uint64 - bid_token_disburse_seconds_after_cancel: - type: string - format: uint64 nft_listing_full_payment_period: type: string format: uint64 nft_listing_nft_delivery_period: type: string format: uint64 - nft_creator_share_percentage: - type: string - format: uint64 - market_administrator: - type: string nft_listing_commission_fee: type: string format: uint64 - nft_listing_extend_seconds: - type: string - format: uint64 - nft_listing_period_extend_fee_per_hour: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - ununifi.nftbackedloan.PaymentStatus: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - bidder: - type: string - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - automatic_payment: - type: boolean - paid_amount: - type: string - bid_time: - type: string - format: date-time - state: - type: string - enum: - - LISTING - - BIDDING - - SELLING_DECISION - - END_LISTING - - SUCCESSFUL_BID - default: LISTING - all_paid: - type: boolean ununifi.nftbackedloan.QueryBidderBidsResponse: type: object properties: @@ -10468,16 +10672,19 @@ definitions: items: type: object properties: - nft_id: + id: type: object properties: - class_id: - type: string nft_id: + type: object + properties: + class_id: + type: string + nft_id: + type: string + bidder: type: string - bidder: - type: string - bid_amount: + price: type: object properties: denom: @@ -10492,7 +10699,7 @@ definitions: method signatures required by gogoproto. - deposit_amount: + deposit: type: object properties: denom: @@ -10522,85 +10729,38 @@ definitions: method signatures required by gogoproto. - bidding_period: + expiry: type: string format: date-time - deposit_lending_rate: + interest_rate: type: string automatic_payment: type: boolean - bid_time: + created_at: type: string format: date-time - interest_amount: + borrow: + title: borrow info type: object properties: - denom: - type: string amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - borrowings: - type: array - items: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - paid_interest_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - start_at: - type: string - format: date-time - title: lister borrowing bidder info - id: - title: todo remove nft_id,bidder then use it - type: object - properties: - nft_id: type: object properties: - class_id: + denom: type: string - nft_id: + amount: type: string - bidder: + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + last_repaid_at: type: string - ununifi.nftbackedloan.QueryCDPsListResponse: - type: object + format: date-time ununifi.nftbackedloan.QueryLiquidationResponse: type: object properties: @@ -10734,32 +10894,24 @@ definitions: type: string owner: type: string - listing_type: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW state: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - bid_token: + default: UNKNOWN + bid_denom: type: string minimum_deposit_rate: type: string - automatic_refinancing: - type: boolean started_at: type: string format: date-time - end_at: + liquidated_at: type: string format: date-time full_payment_end_at: @@ -10768,9 +10920,6 @@ definitions: successful_bid_end_at: type: string format: date-time - auto_relisted_count: - type: string - format: uint64 collected_amount: type: object properties: @@ -10779,84 +10928,72 @@ definitions: amount: type: string description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - minimum_bidding_period: - type: string - nft_info: - type: object - properties: - id: - type: string - uri: - type: string - uri_hash: - type: string - ununifi.nftbackedloan.QueryLoanResponse: - type: object - properties: - loan: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - loan: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method + NOTE: The amount field is an Int which implements the custom + method - signatures required by gogoproto. - borrowing_limit: - type: string - ununifi.nftbackedloan.QueryLoansResponse: - type: object - properties: - loans: - type: array - items: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: + signatures required by gogoproto. + collected_amount_negative: + type: boolean + minimum_bidding_period: type: string - loan: + nft_info: type: object properties: - denom: + id: type: string - amount: + uri: type: string - description: >- - Coin defines a token with a denomination and an amount. + uri_hash: + type: string + ununifi.nftbackedloan.QueryLoanResponse: + type: object + properties: + nft_id: + type: object + properties: + class_id: + type: string + nft_id: + type: string + borrowing_amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + borrowing_limit: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - NOTE: The amount field is an Int which implements the custom - method + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + total_deposit: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - signatures required by gogoproto. + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. ununifi.nftbackedloan.QueryNftBidsResponse: type: object properties: @@ -10865,16 +11002,19 @@ definitions: items: type: object properties: - nft_id: + id: type: object properties: - class_id: - type: string nft_id: + type: object + properties: + class_id: + type: string + nft_id: + type: string + bidder: type: string - bidder: - type: string - bid_amount: + price: type: object properties: denom: @@ -10889,7 +11029,7 @@ definitions: method signatures required by gogoproto. - deposit_amount: + deposit: type: object properties: denom: @@ -10919,83 +11059,38 @@ definitions: method signatures required by gogoproto. - bidding_period: + expiry: type: string format: date-time - deposit_lending_rate: + interest_rate: type: string automatic_payment: type: boolean - bid_time: + created_at: type: string format: date-time - interest_amount: + borrow: + title: borrow info type: object properties: - denom: - type: string amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - borrowings: - type: array - items: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - paid_interest_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - start_at: - type: string - format: date-time - title: lister borrowing bidder info - id: - title: todo remove nft_id,bidder then use it - type: object - properties: - nft_id: type: object properties: - class_id: + denom: type: string - nft_id: + amount: type: string - bidder: + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + last_repaid_at: type: string + format: date-time ununifi.nftbackedloan.QueryNftListingResponse: type: object properties: @@ -11011,32 +11106,24 @@ definitions: type: string owner: type: string - listing_type: - type: string - enum: - - DIRECT_ASSET_BORROW - - SYNTHETIC_ASSET_CREATION - - LATE_SHIPPING - default: DIRECT_ASSET_BORROW state: type: string enum: + - UNKNOWN - LISTING - BIDDING - SELLING_DECISION - - END_LISTING + - LIQUIDATION - SUCCESSFUL_BID - default: LISTING - bid_token: + default: UNKNOWN + bid_denom: type: string minimum_deposit_rate: type: string - automatic_refinancing: - type: boolean started_at: type: string format: date-time - end_at: + liquidated_at: type: string format: date-time full_payment_end_at: @@ -11045,9 +11132,6 @@ definitions: successful_bid_end_at: type: string format: date-time - auto_relisted_count: - type: string - format: uint64 collected_amount: type: object properties: @@ -11063,6 +11147,8 @@ definitions: method signatures required by gogoproto. + collected_amount_negative: + type: boolean minimum_bidding_period: type: string ununifi.nftbackedloan.QueryParamsResponse: @@ -11073,117 +11159,25 @@ definitions: properties: min_staking_for_listing: type: string - default_bid_active_rank: - type: string - format: uint64 bid_tokens: type: array items: type: string - auto_relisting_count_if_no_bid: - type: string - format: uint64 - nft_listing_delay_seconds: - type: string - format: uint64 - nft_listing_period_initial: - type: string - format: uint64 nft_listing_cancel_required_seconds: type: string format: uint64 - nft_listing_cancel_fee_percentage: - type: string - format: uint64 - nft_listing_gap_time: - type: string - format: uint64 bid_cancel_required_seconds: type: string format: uint64 - bid_token_disburse_seconds_after_cancel: - type: string - format: uint64 nft_listing_full_payment_period: type: string format: uint64 nft_listing_nft_delivery_period: type: string format: uint64 - nft_creator_share_percentage: - type: string - format: uint64 - market_administrator: - type: string nft_listing_commission_fee: type: string format: uint64 - nft_listing_extend_seconds: - type: string - format: uint64 - nft_listing_period_extend_fee_per_hour: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - ununifi.nftbackedloan.QueryPaymentStatusResponse: - type: object - properties: - paymentStatus: - type: object - properties: - nft_id: - type: object - properties: - class_id: - type: string - nft_id: - type: string - bidder: - type: string - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - automatic_payment: - type: boolean - paid_amount: - type: string - bid_time: - type: string - format: date-time - state: - type: string - enum: - - LISTING - - BIDDING - - SELLING_DECISION - - END_LISTING - - SUCCESSFUL_BID - default: LISTING - all_paid: - type: boolean ununifi.nftbackedloan.QueryRewardsResponse: type: object properties: @@ -11201,36 +11195,6 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. - ununifi.nftbackedloan.borrowing: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - paid_interest_amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - start_at: - type: string - format: date-time ununifi.nftfactory.ClassAttributes: type: object properties: diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 9e5b49cef..8bfc8df65 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -1,765 +1,721 @@ + # Protobuf Documentation + ## Table of Contents - [auction/auction.proto](#auction/auction.proto) - - [BaseAuction](#ununifi.auction.BaseAuction) - - [CollateralAuction](#ununifi.auction.CollateralAuction) - - [DebtAuction](#ununifi.auction.DebtAuction) - - [Params](#ununifi.auction.Params) - - [SurplusAuction](#ununifi.auction.SurplusAuction) - - [WeightedAddress](#ununifi.auction.WeightedAddress) - + - [BaseAuction](#ununifi.auction.BaseAuction) + - [CollateralAuction](#ununifi.auction.CollateralAuction) + - [DebtAuction](#ununifi.auction.DebtAuction) + - [Params](#ununifi.auction.Params) + - [SurplusAuction](#ununifi.auction.SurplusAuction) + - [WeightedAddress](#ununifi.auction.WeightedAddress) - [auction/genesis.proto](#auction/genesis.proto) - - [GenesisState](#ununifi.auction.GenesisState) - + - [GenesisState](#ununifi.auction.GenesisState) - [auction/query.proto](#auction/query.proto) - - [QueryAllAuctionRequest](#ununifi.auction.QueryAllAuctionRequest) - - [QueryAllAuctionResponse](#ununifi.auction.QueryAllAuctionResponse) - - [QueryGetAuctionRequest](#ununifi.auction.QueryGetAuctionRequest) - - [QueryGetAuctionResponse](#ununifi.auction.QueryGetAuctionResponse) - - [QueryParamsRequest](#ununifi.auction.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.auction.QueryParamsResponse) - - - [Query](#ununifi.auction.Query) - + + - [QueryAllAuctionRequest](#ununifi.auction.QueryAllAuctionRequest) + - [QueryAllAuctionResponse](#ununifi.auction.QueryAllAuctionResponse) + - [QueryGetAuctionRequest](#ununifi.auction.QueryGetAuctionRequest) + - [QueryGetAuctionResponse](#ununifi.auction.QueryGetAuctionResponse) + - [QueryParamsRequest](#ununifi.auction.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.auction.QueryParamsResponse) + + - [Query](#ununifi.auction.Query) + - [auction/tx.proto](#auction/tx.proto) - - [MsgPlaceBid](#ununifi.auction.MsgPlaceBid) - - [MsgPlaceBidResponse](#ununifi.auction.MsgPlaceBidResponse) - - - [Msg](#ununifi.auction.Msg) - + + - [MsgPlaceBid](#ununifi.auction.MsgPlaceBid) + - [MsgPlaceBidResponse](#ununifi.auction.MsgPlaceBidResponse) + + - [Msg](#ununifi.auction.Msg) + - [cdp/cdp.proto](#cdp/cdp.proto) - - [AugmentedCdp](#ununifi.cdp.AugmentedCdp) - - [Cdp](#ununifi.cdp.Cdp) - - [CollateralParam](#ununifi.cdp.CollateralParam) - - [DebtParam](#ununifi.cdp.DebtParam) - - [Deposit](#ununifi.cdp.Deposit) - - [Params](#ununifi.cdp.Params) - + - [AugmentedCdp](#ununifi.cdp.AugmentedCdp) + - [Cdp](#ununifi.cdp.Cdp) + - [CollateralParam](#ununifi.cdp.CollateralParam) + - [DebtParam](#ununifi.cdp.DebtParam) + - [Deposit](#ununifi.cdp.Deposit) + - [Params](#ununifi.cdp.Params) - [cdp/genesis.proto](#cdp/genesis.proto) - - [GenesisAccumulationTime](#ununifi.cdp.GenesisAccumulationTime) - - [GenesisState](#ununifi.cdp.GenesisState) - - [GenesisTotalPrincipal](#ununifi.cdp.GenesisTotalPrincipal) - + - [GenesisAccumulationTime](#ununifi.cdp.GenesisAccumulationTime) + - [GenesisState](#ununifi.cdp.GenesisState) + - [GenesisTotalPrincipal](#ununifi.cdp.GenesisTotalPrincipal) - [cdp/query.proto](#cdp/query.proto) - - [QueryAllAccountRequest](#ununifi.cdp.QueryAllAccountRequest) - - [QueryAllAccountResponse](#ununifi.cdp.QueryAllAccountResponse) - - [QueryAllCdpRequest](#ununifi.cdp.QueryAllCdpRequest) - - [QueryAllCdpResponse](#ununifi.cdp.QueryAllCdpResponse) - - [QueryAllDepositRequest](#ununifi.cdp.QueryAllDepositRequest) - - [QueryAllDepositResponse](#ununifi.cdp.QueryAllDepositResponse) - - [QueryGetCdpRequest](#ununifi.cdp.QueryGetCdpRequest) - - [QueryGetCdpResponse](#ununifi.cdp.QueryGetCdpResponse) - - [QueryParamsRequest](#ununifi.cdp.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.cdp.QueryParamsResponse) - - - [Query](#ununifi.cdp.Query) - + + - [QueryAllAccountRequest](#ununifi.cdp.QueryAllAccountRequest) + - [QueryAllAccountResponse](#ununifi.cdp.QueryAllAccountResponse) + - [QueryAllCdpRequest](#ununifi.cdp.QueryAllCdpRequest) + - [QueryAllCdpResponse](#ununifi.cdp.QueryAllCdpResponse) + - [QueryAllDepositRequest](#ununifi.cdp.QueryAllDepositRequest) + - [QueryAllDepositResponse](#ununifi.cdp.QueryAllDepositResponse) + - [QueryGetCdpRequest](#ununifi.cdp.QueryGetCdpRequest) + - [QueryGetCdpResponse](#ununifi.cdp.QueryGetCdpResponse) + - [QueryParamsRequest](#ununifi.cdp.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.cdp.QueryParamsResponse) + + - [Query](#ununifi.cdp.Query) + - [cdp/tx.proto](#cdp/tx.proto) - - [MsgCreateCdp](#ununifi.cdp.MsgCreateCdp) - - [MsgCreateCdpResponse](#ununifi.cdp.MsgCreateCdpResponse) - - [MsgDeposit](#ununifi.cdp.MsgDeposit) - - [MsgDepositResponse](#ununifi.cdp.MsgDepositResponse) - - [MsgDrawDebt](#ununifi.cdp.MsgDrawDebt) - - [MsgDrawDebtResponse](#ununifi.cdp.MsgDrawDebtResponse) - - [MsgLiquidate](#ununifi.cdp.MsgLiquidate) - - [MsgLiquidateResponse](#ununifi.cdp.MsgLiquidateResponse) - - [MsgRepayDebt](#ununifi.cdp.MsgRepayDebt) - - [MsgRepayDebtResponse](#ununifi.cdp.MsgRepayDebtResponse) - - [MsgWithdraw](#ununifi.cdp.MsgWithdraw) - - [MsgWithdrawResponse](#ununifi.cdp.MsgWithdrawResponse) - - - [Msg](#ununifi.cdp.Msg) - + + - [MsgCreateCdp](#ununifi.cdp.MsgCreateCdp) + - [MsgCreateCdpResponse](#ununifi.cdp.MsgCreateCdpResponse) + - [MsgDeposit](#ununifi.cdp.MsgDeposit) + - [MsgDepositResponse](#ununifi.cdp.MsgDepositResponse) + - [MsgDrawDebt](#ununifi.cdp.MsgDrawDebt) + - [MsgDrawDebtResponse](#ununifi.cdp.MsgDrawDebtResponse) + - [MsgLiquidate](#ununifi.cdp.MsgLiquidate) + - [MsgLiquidateResponse](#ununifi.cdp.MsgLiquidateResponse) + - [MsgRepayDebt](#ununifi.cdp.MsgRepayDebt) + - [MsgRepayDebtResponse](#ununifi.cdp.MsgRepayDebtResponse) + - [MsgWithdraw](#ununifi.cdp.MsgWithdraw) + - [MsgWithdrawResponse](#ununifi.cdp.MsgWithdrawResponse) + + - [Msg](#ununifi.cdp.Msg) + - [derivatives/derivatives.proto](#derivatives/derivatives.proto) - - [EventPriceIsNotFeeded](#ununifi.derivatives.EventPriceIsNotFeeded) - - [Market](#ununifi.derivatives.Market) - - [PoolAssetConf](#ununifi.derivatives.PoolAssetConf) - - [PoolMarketCap](#ununifi.derivatives.PoolMarketCap) - - [PoolMarketCap.AssetInfo](#ununifi.derivatives.PoolMarketCap.AssetInfo) - - [PoolParams](#ununifi.derivatives.PoolParams) - - [Position](#ununifi.derivatives.Position) - - [QueriedPosition](#ununifi.derivatives.QueriedPosition) - - - [PositionType](#ununifi.derivatives.PositionType) - + + - [EventPriceIsNotFed](#ununifi.derivatives.EventPriceIsNotFed) + - [Market](#ununifi.derivatives.Market) + - [PoolAssetConf](#ununifi.derivatives.PoolAssetConf) + - [PoolMarketCap](#ununifi.derivatives.PoolMarketCap) + - [PoolMarketCap.AssetInfo](#ununifi.derivatives.PoolMarketCap.AssetInfo) + - [PoolParams](#ununifi.derivatives.PoolParams) + - [Position](#ununifi.derivatives.Position) + - [QueriedPosition](#ununifi.derivatives.QueriedPosition) + + - [PositionType](#ununifi.derivatives.PositionType) + - [derivatives/perpetual_futures.proto](#derivatives/perpetual_futures.proto) - - [EventLossToLP](#ununifi.derivatives.EventLossToLP) - - [EventPerpetualFuturesPositionClosed](#ununifi.derivatives.EventPerpetualFuturesPositionClosed) - - [EventPerpetualFuturesPositionLevied](#ununifi.derivatives.EventPerpetualFuturesPositionLevied) - - [EventPerpetualFuturesPositionLiquidated](#ununifi.derivatives.EventPerpetualFuturesPositionLiquidated) - - [EventPerpetualFuturesPositionOpened](#ununifi.derivatives.EventPerpetualFuturesPositionOpened) - - [PerpetualFuturesGrossPositionOfMarket](#ununifi.derivatives.PerpetualFuturesGrossPositionOfMarket) - - [PerpetualFuturesParams](#ununifi.derivatives.PerpetualFuturesParams) - - [PerpetualFuturesPosition](#ununifi.derivatives.PerpetualFuturesPosition) - - [PerpetualFuturesPositionInstance](#ununifi.derivatives.PerpetualFuturesPositionInstance) - + - [EventLossToLP](#ununifi.derivatives.EventLossToLP) + - [EventPerpetualFuturesPositionClosed](#ununifi.derivatives.EventPerpetualFuturesPositionClosed) + - [EventPerpetualFuturesPositionLevied](#ununifi.derivatives.EventPerpetualFuturesPositionLevied) + - [EventPerpetualFuturesPositionLiquidated](#ununifi.derivatives.EventPerpetualFuturesPositionLiquidated) + - [EventPerpetualFuturesPositionOpened](#ununifi.derivatives.EventPerpetualFuturesPositionOpened) + - [PerpetualFuturesGrossPositionOfMarket](#ununifi.derivatives.PerpetualFuturesGrossPositionOfMarket) + - [PerpetualFuturesParams](#ununifi.derivatives.PerpetualFuturesParams) + - [PerpetualFuturesPosition](#ununifi.derivatives.PerpetualFuturesPosition) + - [PerpetualFuturesPositionInstance](#ununifi.derivatives.PerpetualFuturesPositionInstance) - [derivatives/perpetual_options.proto](#derivatives/perpetual_options.proto) - - [PerpetualOptionsParams](#ununifi.derivatives.PerpetualOptionsParams) - - [PerpetualOptionsPositionInstance](#ununifi.derivatives.PerpetualOptionsPositionInstance) - - - [OptionType](#ununifi.derivatives.OptionType) - + + - [PerpetualOptionsParams](#ununifi.derivatives.PerpetualOptionsParams) + - [PerpetualOptionsPositionInstance](#ununifi.derivatives.PerpetualOptionsPositionInstance) + + - [OptionType](#ununifi.derivatives.OptionType) + - [derivatives/params.proto](#derivatives/params.proto) - - [Params](#ununifi.derivatives.Params) - + - [Params](#ununifi.derivatives.Params) - [derivatives/genesis.proto](#derivatives/genesis.proto) - - [GenesisState](#ununifi.derivatives.GenesisState) - + - [GenesisState](#ununifi.derivatives.GenesisState) - [derivatives/query.proto](#derivatives/query.proto) - - [QueryAddressPositionsRequest](#ununifi.derivatives.QueryAddressPositionsRequest) - - [QueryAddressPositionsResponse](#ununifi.derivatives.QueryAddressPositionsResponse) - - [QueryAllPositionsRequest](#ununifi.derivatives.QueryAllPositionsRequest) - - [QueryAllPositionsResponse](#ununifi.derivatives.QueryAllPositionsResponse) - - [QueryAvailableAssetInPoolByDenomRequest](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomRequest) - - [QueryAvailableAssetInPoolByDenomResponse](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomResponse) - - [QueryAvailableAssetsInPoolRequest](#ununifi.derivatives.QueryAvailableAssetsInPoolRequest) - - [QueryAvailableAssetsInPoolResponse](#ununifi.derivatives.QueryAvailableAssetsInPoolResponse) - - [QueryDLPTokenRateRequest](#ununifi.derivatives.QueryDLPTokenRateRequest) - - [QueryDLPTokenRateResponse](#ununifi.derivatives.QueryDLPTokenRateResponse) - - [QueryEstimateDLPTokenAmountRequest](#ununifi.derivatives.QueryEstimateDLPTokenAmountRequest) - - [QueryEstimateDLPTokenAmountResponse](#ununifi.derivatives.QueryEstimateDLPTokenAmountResponse) - - [QueryEstimateRedeemAmountRequest](#ununifi.derivatives.QueryEstimateRedeemAmountRequest) - - [QueryEstimateRedeemAmountResponse](#ununifi.derivatives.QueryEstimateRedeemAmountResponse) - - [QueryLiquidityProviderTokenNominalAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYRequest) - - [QueryLiquidityProviderTokenNominalAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYResponse) - - [QueryLiquidityProviderTokenRealAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYRequest) - - [QueryLiquidityProviderTokenRealAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYResponse) - - [QueryParamsRequest](#ununifi.derivatives.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.derivatives.QueryParamsResponse) - - [QueryPerpetualFuturesMarketRequest](#ununifi.derivatives.QueryPerpetualFuturesMarketRequest) - - [QueryPerpetualFuturesMarketResponse](#ununifi.derivatives.QueryPerpetualFuturesMarketResponse) - - [QueryPerpetualFuturesPositionSizeRequest](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeRequest) - - [QueryPerpetualFuturesPositionSizeResponse](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeResponse) - - [QueryPerpetualFuturesRequest](#ununifi.derivatives.QueryPerpetualFuturesRequest) - - [QueryPerpetualFuturesResponse](#ununifi.derivatives.QueryPerpetualFuturesResponse) - - [QueryPerpetualOptionsMarketRequest](#ununifi.derivatives.QueryPerpetualOptionsMarketRequest) - - [QueryPerpetualOptionsMarketResponse](#ununifi.derivatives.QueryPerpetualOptionsMarketResponse) - - [QueryPerpetualOptionsRequest](#ununifi.derivatives.QueryPerpetualOptionsRequest) - - [QueryPerpetualOptionsResponse](#ununifi.derivatives.QueryPerpetualOptionsResponse) - - [QueryPoolRequest](#ununifi.derivatives.QueryPoolRequest) - - [QueryPoolResponse](#ununifi.derivatives.QueryPoolResponse) - - [QueryPositionRequest](#ununifi.derivatives.QueryPositionRequest) - - [QueryPositionResponse](#ununifi.derivatives.QueryPositionResponse) - - - [Query](#ununifi.derivatives.Query) - + + - [QueryAddressPositionsRequest](#ununifi.derivatives.QueryAddressPositionsRequest) + - [QueryAddressPositionsResponse](#ununifi.derivatives.QueryAddressPositionsResponse) + - [QueryAllPositionsRequest](#ununifi.derivatives.QueryAllPositionsRequest) + - [QueryAllPositionsResponse](#ununifi.derivatives.QueryAllPositionsResponse) + - [QueryAvailableAssetInPoolByDenomRequest](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomRequest) + - [QueryAvailableAssetInPoolByDenomResponse](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomResponse) + - [QueryAvailableAssetsInPoolRequest](#ununifi.derivatives.QueryAvailableAssetsInPoolRequest) + - [QueryAvailableAssetsInPoolResponse](#ununifi.derivatives.QueryAvailableAssetsInPoolResponse) + - [QueryDLPTokenRateRequest](#ununifi.derivatives.QueryDLPTokenRateRequest) + - [QueryDLPTokenRateResponse](#ununifi.derivatives.QueryDLPTokenRateResponse) + - [QueryEstimateDLPTokenAmountRequest](#ununifi.derivatives.QueryEstimateDLPTokenAmountRequest) + - [QueryEstimateDLPTokenAmountResponse](#ununifi.derivatives.QueryEstimateDLPTokenAmountResponse) + - [QueryEstimateRedeemAmountRequest](#ununifi.derivatives.QueryEstimateRedeemAmountRequest) + - [QueryEstimateRedeemAmountResponse](#ununifi.derivatives.QueryEstimateRedeemAmountResponse) + - [QueryLiquidityProviderTokenNominalAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYRequest) + - [QueryLiquidityProviderTokenNominalAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYResponse) + - [QueryLiquidityProviderTokenRealAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYRequest) + - [QueryLiquidityProviderTokenRealAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYResponse) + - [QueryParamsRequest](#ununifi.derivatives.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.derivatives.QueryParamsResponse) + - [QueryPerpetualFuturesMarketRequest](#ununifi.derivatives.QueryPerpetualFuturesMarketRequest) + - [QueryPerpetualFuturesMarketResponse](#ununifi.derivatives.QueryPerpetualFuturesMarketResponse) + - [QueryPerpetualFuturesPositionSizeRequest](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeRequest) + - [QueryPerpetualFuturesPositionSizeResponse](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeResponse) + - [QueryPerpetualFuturesRequest](#ununifi.derivatives.QueryPerpetualFuturesRequest) + - [QueryPerpetualFuturesResponse](#ununifi.derivatives.QueryPerpetualFuturesResponse) + - [QueryPerpetualOptionsMarketRequest](#ununifi.derivatives.QueryPerpetualOptionsMarketRequest) + - [QueryPerpetualOptionsMarketResponse](#ununifi.derivatives.QueryPerpetualOptionsMarketResponse) + - [QueryPerpetualOptionsRequest](#ununifi.derivatives.QueryPerpetualOptionsRequest) + - [QueryPerpetualOptionsResponse](#ununifi.derivatives.QueryPerpetualOptionsResponse) + - [QueryPoolRequest](#ununifi.derivatives.QueryPoolRequest) + - [QueryPoolResponse](#ununifi.derivatives.QueryPoolResponse) + - [QueryPositionRequest](#ununifi.derivatives.QueryPositionRequest) + - [QueryPositionResponse](#ununifi.derivatives.QueryPositionResponse) + + - [Query](#ununifi.derivatives.Query) + - [derivatives/tx.proto](#derivatives/tx.proto) - - [MsgClosePosition](#ununifi.derivatives.MsgClosePosition) - - [MsgClosePositionResponse](#ununifi.derivatives.MsgClosePositionResponse) - - [MsgDepositToPool](#ununifi.derivatives.MsgDepositToPool) - - [MsgDepositToPoolResponse](#ununifi.derivatives.MsgDepositToPoolResponse) - - [MsgOpenPosition](#ununifi.derivatives.MsgOpenPosition) - - [MsgOpenPositionResponse](#ununifi.derivatives.MsgOpenPositionResponse) - - [MsgReportLevyPeriod](#ununifi.derivatives.MsgReportLevyPeriod) - - [MsgReportLevyPeriodResponse](#ununifi.derivatives.MsgReportLevyPeriodResponse) - - [MsgReportLiquidation](#ununifi.derivatives.MsgReportLiquidation) - - [MsgReportLiquidationResponse](#ununifi.derivatives.MsgReportLiquidationResponse) - - [MsgWithdrawFromPool](#ununifi.derivatives.MsgWithdrawFromPool) - - [MsgWithdrawFromPoolResponse](#ununifi.derivatives.MsgWithdrawFromPoolResponse) - - - [Msg](#ununifi.derivatives.Msg) - + + - [MsgClosePosition](#ununifi.derivatives.MsgClosePosition) + - [MsgClosePositionResponse](#ununifi.derivatives.MsgClosePositionResponse) + - [MsgDepositToPool](#ununifi.derivatives.MsgDepositToPool) + - [MsgDepositToPoolResponse](#ununifi.derivatives.MsgDepositToPoolResponse) + - [MsgOpenPosition](#ununifi.derivatives.MsgOpenPosition) + - [MsgOpenPositionResponse](#ununifi.derivatives.MsgOpenPositionResponse) + - [MsgReportLevyPeriod](#ununifi.derivatives.MsgReportLevyPeriod) + - [MsgReportLevyPeriodResponse](#ununifi.derivatives.MsgReportLevyPeriodResponse) + - [MsgReportLiquidation](#ununifi.derivatives.MsgReportLiquidation) + - [MsgReportLiquidationResponse](#ununifi.derivatives.MsgReportLiquidationResponse) + - [MsgWithdrawFromPool](#ununifi.derivatives.MsgWithdrawFromPool) + - [MsgWithdrawFromPoolResponse](#ununifi.derivatives.MsgWithdrawFromPoolResponse) + + - [Msg](#ununifi.derivatives.Msg) + - [ecosystem-incentive/ecosystem_incentive.proto](#ecosystem-incentive/ecosystem_incentive.proto) - - [IncentiveUnit](#ununifi.ecosystemincentive.IncentiveUnit) - - [IncentiveUnitIdsByAddr](#ununifi.ecosystemincentive.IncentiveUnitIdsByAddr) - - [RewardStore](#ununifi.ecosystemincentive.RewardStore) - - [SubjectInfo](#ununifi.ecosystemincentive.SubjectInfo) - + - [IncentiveUnit](#ununifi.ecosystemincentive.IncentiveUnit) + - [IncentiveUnitIdsByAddr](#ununifi.ecosystemincentive.IncentiveUnitIdsByAddr) + - [RewardStore](#ununifi.ecosystemincentive.RewardStore) + - [SubjectInfo](#ununifi.ecosystemincentive.SubjectInfo) - [ecosystem-incentive/event.proto](#ecosystem-incentive/event.proto) - - [EventDeletedNftIdRecordedForFrontendReward](#ununifi.ecosystemincentive.EventDeletedNftIdRecordedForFrontendReward) - - [EventFailedParsingMemoInputs](#ununifi.ecosystemincentive.EventFailedParsingMemoInputs) - - [EventNotRecordedNftId](#ununifi.ecosystemincentive.EventNotRecordedNftId) - - [EventNotRegisteredIncentiveUnitId](#ununifi.ecosystemincentive.EventNotRegisteredIncentiveUnitId) - - [EventRecordedIncentiveUnitId](#ununifi.ecosystemincentive.EventRecordedIncentiveUnitId) - - [EventRegister](#ununifi.ecosystemincentive.EventRegister) - - [EventUpdatedReward](#ununifi.ecosystemincentive.EventUpdatedReward) - - [EventVersionUnmatched](#ununifi.ecosystemincentive.EventVersionUnmatched) - - [EventWithdrawAllRewards](#ununifi.ecosystemincentive.EventWithdrawAllRewards) - - [EventWithdrawReward](#ununifi.ecosystemincentive.EventWithdrawReward) - + - [EventDeletedNftIdRecordedForFrontendReward](#ununifi.ecosystemincentive.EventDeletedNftIdRecordedForFrontendReward) + - [EventFailedParsingMemoInputs](#ununifi.ecosystemincentive.EventFailedParsingMemoInputs) + - [EventNotRecordedNftId](#ununifi.ecosystemincentive.EventNotRecordedNftId) + - [EventNotRegisteredIncentiveUnitId](#ununifi.ecosystemincentive.EventNotRegisteredIncentiveUnitId) + - [EventRecordedIncentiveUnitId](#ununifi.ecosystemincentive.EventRecordedIncentiveUnitId) + - [EventRegister](#ununifi.ecosystemincentive.EventRegister) + - [EventUpdatedReward](#ununifi.ecosystemincentive.EventUpdatedReward) + - [EventVersionUnmatched](#ununifi.ecosystemincentive.EventVersionUnmatched) + - [EventWithdrawAllRewards](#ununifi.ecosystemincentive.EventWithdrawAllRewards) + - [EventWithdrawReward](#ununifi.ecosystemincentive.EventWithdrawReward) - [ecosystem-incentive/params.proto](#ecosystem-incentive/params.proto) - - [Params](#ununifi.ecosystemincentive.Params) - - [RewardParams](#ununifi.ecosystemincentive.RewardParams) - - [RewardRate](#ununifi.ecosystemincentive.RewardRate) - - - [RewardType](#ununifi.ecosystemincentive.RewardType) - + + - [Params](#ununifi.ecosystemincentive.Params) + - [RewardParams](#ununifi.ecosystemincentive.RewardParams) + - [RewardRate](#ununifi.ecosystemincentive.RewardRate) + + - [RewardType](#ununifi.ecosystemincentive.RewardType) + - [ecosystem-incentive/genesis.proto](#ecosystem-incentive/genesis.proto) - - [GenesisState](#ununifi.ecosystemincentive.GenesisState) - + - [GenesisState](#ununifi.ecosystemincentive.GenesisState) - [ecosystem-incentive/memo.proto](#ecosystem-incentive/memo.proto) - - [MemoInputs](#ununifi.ecosystemincentive.MemoInputs) - + - [MemoInputs](#ununifi.ecosystemincentive.MemoInputs) - [ecosystem-incentive/query.proto](#ecosystem-incentive/query.proto) - - [QueryAllRewardsRequest](#ununifi.ecosystemincentive.QueryAllRewardsRequest) - - [QueryAllRewardsResponse](#ununifi.ecosystemincentive.QueryAllRewardsResponse) - - [QueryIncentiveUnitIdsByAddrRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrRequest) - - [QueryIncentiveUnitIdsByAddrResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrResponse) - - [QueryIncentiveUnitRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitRequest) - - [QueryIncentiveUnitResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitResponse) - - [QueryParamsRequest](#ununifi.ecosystemincentive.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.ecosystemincentive.QueryParamsResponse) - - [QueryRecordedIncentiveUnitIdRequest](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdRequest) - - [QueryRecordedIncentiveUnitIdResponse](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdResponse) - - [QueryRewardRequest](#ununifi.ecosystemincentive.QueryRewardRequest) - - [QueryRewardResponse](#ununifi.ecosystemincentive.QueryRewardResponse) - - - [Query](#ununifi.ecosystemincentive.Query) - + + - [QueryAllRewardsRequest](#ununifi.ecosystemincentive.QueryAllRewardsRequest) + - [QueryAllRewardsResponse](#ununifi.ecosystemincentive.QueryAllRewardsResponse) + - [QueryIncentiveUnitIdsByAddrRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrRequest) + - [QueryIncentiveUnitIdsByAddrResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrResponse) + - [QueryIncentiveUnitRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitRequest) + - [QueryIncentiveUnitResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitResponse) + - [QueryParamsRequest](#ununifi.ecosystemincentive.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.ecosystemincentive.QueryParamsResponse) + - [QueryRecordedIncentiveUnitIdRequest](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdRequest) + - [QueryRecordedIncentiveUnitIdResponse](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdResponse) + - [QueryRewardRequest](#ununifi.ecosystemincentive.QueryRewardRequest) + - [QueryRewardResponse](#ununifi.ecosystemincentive.QueryRewardResponse) + + - [Query](#ununifi.ecosystemincentive.Query) + - [ecosystem-incentive/tx.proto](#ecosystem-incentive/tx.proto) - - [MsgRegister](#ununifi.ecosystemincentive.MsgRegister) - - [MsgRegisterResponse](#ununifi.ecosystemincentive.MsgRegisterResponse) - - [MsgWithdrawAllRewards](#ununifi.ecosystemincentive.MsgWithdrawAllRewards) - - [MsgWithdrawAllRewardsResponse](#ununifi.ecosystemincentive.MsgWithdrawAllRewardsResponse) - - [MsgWithdrawReward](#ununifi.ecosystemincentive.MsgWithdrawReward) - - [MsgWithdrawRewardResponse](#ununifi.ecosystemincentive.MsgWithdrawRewardResponse) - - - [Msg](#ununifi.ecosystemincentive.Msg) - + + - [MsgRegister](#ununifi.ecosystemincentive.MsgRegister) + - [MsgRegisterResponse](#ununifi.ecosystemincentive.MsgRegisterResponse) + - [MsgWithdrawAllRewards](#ununifi.ecosystemincentive.MsgWithdrawAllRewards) + - [MsgWithdrawAllRewardsResponse](#ununifi.ecosystemincentive.MsgWithdrawAllRewardsResponse) + - [MsgWithdrawReward](#ununifi.ecosystemincentive.MsgWithdrawReward) + - [MsgWithdrawRewardResponse](#ununifi.ecosystemincentive.MsgWithdrawRewardResponse) + + - [Msg](#ununifi.ecosystemincentive.Msg) + - [ethereum/signdoc.proto](#ethereum/signdoc.proto) - - [SignDocForMetamask](#ununifi.ethereum.SignDocForMetamask) - + - [SignDocForMetamask](#ununifi.ethereum.SignDocForMetamask) - [incentive/incentive.proto](#incentive/incentive.proto) - - [BaseClaim](#ununifi.incentive.BaseClaim) - - [BaseMultiClaim](#ununifi.incentive.BaseMultiClaim) - - [CdpMintingClaim](#ununifi.incentive.CdpMintingClaim) - - [Multiplier](#ununifi.incentive.Multiplier) - - [Params](#ununifi.incentive.Params) - - [RewardIndex](#ununifi.incentive.RewardIndex) - - [RewardPeriod](#ununifi.incentive.RewardPeriod) - + - [BaseClaim](#ununifi.incentive.BaseClaim) + - [BaseMultiClaim](#ununifi.incentive.BaseMultiClaim) + - [CdpMintingClaim](#ununifi.incentive.CdpMintingClaim) + - [Multiplier](#ununifi.incentive.Multiplier) + - [Params](#ununifi.incentive.Params) + - [RewardIndex](#ununifi.incentive.RewardIndex) + - [RewardPeriod](#ununifi.incentive.RewardPeriod) - [incentive/genesis.proto](#incentive/genesis.proto) - - [GenesisAccumulationTime](#ununifi.incentive.GenesisAccumulationTime) - - [GenesisDenoms](#ununifi.incentive.GenesisDenoms) - - [GenesisState](#ununifi.incentive.GenesisState) - + - [GenesisAccumulationTime](#ununifi.incentive.GenesisAccumulationTime) + - [GenesisDenoms](#ununifi.incentive.GenesisDenoms) + - [GenesisState](#ununifi.incentive.GenesisState) - [incentive/query.proto](#incentive/query.proto) - - [QueryParamsRequest](#ununifi.incentive.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.incentive.QueryParamsResponse) - - - [Query](#ununifi.incentive.Query) - + + - [QueryParamsRequest](#ununifi.incentive.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.incentive.QueryParamsResponse) + + - [Query](#ununifi.incentive.Query) + - [incentive/tx.proto](#incentive/tx.proto) - - [MsgClaimCdpMintingReward](#ununifi.incentive.MsgClaimCdpMintingReward) - - [MsgClaimCdpMintingRewardResponse](#ununifi.incentive.MsgClaimCdpMintingRewardResponse) - - - [Msg](#ununifi.incentive.Msg) - + + - [MsgClaimCdpMintingReward](#ununifi.incentive.MsgClaimCdpMintingReward) + - [MsgClaimCdpMintingRewardResponse](#ununifi.incentive.MsgClaimCdpMintingRewardResponse) + + - [Msg](#ununifi.incentive.Msg) + - [nftmarket/nftmarket.proto](#nftmarket/nftmarket.proto) - - [BidId](#ununifi.nftmarket.BidId) - - [EventBorrow](#ununifi.nftmarket.EventBorrow) - - [EventCancelBid](#ununifi.nftmarket.EventCancelBid) - - [EventCancelListNfting](#ununifi.nftmarket.EventCancelListNfting) - - [EventEndListNfting](#ununifi.nftmarket.EventEndListNfting) - - [EventExpandListingPeriod](#ununifi.nftmarket.EventExpandListingPeriod) - - [EventLiquidate](#ununifi.nftmarket.EventLiquidate) - - [EventListNft](#ununifi.nftmarket.EventListNft) - - [EventPayFullBid](#ununifi.nftmarket.EventPayFullBid) - - [EventPlaceBid](#ununifi.nftmarket.EventPlaceBid) - - [EventRepay](#ununifi.nftmarket.EventRepay) - - [EventSellingDecision](#ununifi.nftmarket.EventSellingDecision) - - [Liquidation](#ununifi.nftmarket.Liquidation) - - [Liquidations](#ununifi.nftmarket.Liquidations) - - [ListedClass](#ununifi.nftmarket.ListedClass) - - [Loan](#ununifi.nftmarket.Loan) - - [NftBid](#ununifi.nftmarket.NftBid) - - [NftIdentifier](#ununifi.nftmarket.NftIdentifier) - - [NftInfo](#ununifi.nftmarket.NftInfo) - - [NftListing](#ununifi.nftmarket.NftListing) - - [Params](#ununifi.nftmarket.Params) - - [PaymentStatus](#ununifi.nftmarket.PaymentStatus) - - [borrowing](#ununifi.nftmarket.borrowing) - - - [ListingState](#ununifi.nftmarket.ListingState) - - [ListingType](#ununifi.nftmarket.ListingType) - + + - [BidId](#ununifi.nftmarket.BidId) + - [EventBorrow](#ununifi.nftmarket.EventBorrow) + - [EventCancelBid](#ununifi.nftmarket.EventCancelBid) + - [EventCancelListNfting](#ununifi.nftmarket.EventCancelListNfting) + - [EventEndListNfting](#ununifi.nftmarket.EventEndListNfting) + - [EventExpandListingPeriod](#ununifi.nftmarket.EventExpandListingPeriod) + - [EventLiquidate](#ununifi.nftmarket.EventLiquidate) + - [EventListNft](#ununifi.nftmarket.EventListNft) + - [EventPayFullBid](#ununifi.nftmarket.EventPayFullBid) + - [EventPlaceBid](#ununifi.nftmarket.EventPlaceBid) + - [EventRepay](#ununifi.nftmarket.EventRepay) + - [EventSellingDecision](#ununifi.nftmarket.EventSellingDecision) + - [Liquidation](#ununifi.nftmarket.Liquidation) + - [Liquidations](#ununifi.nftmarket.Liquidations) + - [ListedClass](#ununifi.nftmarket.ListedClass) + - [Loan](#ununifi.nftmarket.Loan) + - [NftBid](#ununifi.nftmarket.NftBid) + - [NftIdentifier](#ununifi.nftmarket.NftIdentifier) + - [NftInfo](#ununifi.nftmarket.NftInfo) + - [NftListing](#ununifi.nftmarket.NftListing) + - [Params](#ununifi.nftmarket.Params) + - [PaymentStatus](#ununifi.nftmarket.PaymentStatus) + - [borrowing](#ununifi.nftmarket.borrowing) + + - [ListingState](#ununifi.nftmarket.ListingState) + - [ListingType](#ununifi.nftmarket.ListingType) + - [nftmarket/genesis.proto](#nftmarket/genesis.proto) - - [GenesisState](#ununifi.nftmarket.GenesisState) - + - [GenesisState](#ununifi.nftmarket.GenesisState) - [nftmarket/query.proto](#nftmarket/query.proto) - - [NftListingDetail](#ununifi.nftmarket.NftListingDetail) - - [QueryBidderBidsRequest](#ununifi.nftmarket.QueryBidderBidsRequest) - - [QueryBidderBidsResponse](#ununifi.nftmarket.QueryBidderBidsResponse) - - [QueryCDPsListRequest](#ununifi.nftmarket.QueryCDPsListRequest) - - [QueryCDPsListResponse](#ununifi.nftmarket.QueryCDPsListResponse) - - [QueryLiquidationRequest](#ununifi.nftmarket.QueryLiquidationRequest) - - [QueryLiquidationResponse](#ununifi.nftmarket.QueryLiquidationResponse) - - [QueryListedClassRequest](#ununifi.nftmarket.QueryListedClassRequest) - - [QueryListedClassResponse](#ununifi.nftmarket.QueryListedClassResponse) - - [QueryListedClassesRequest](#ununifi.nftmarket.QueryListedClassesRequest) - - [QueryListedClassesResponse](#ununifi.nftmarket.QueryListedClassesResponse) - - [QueryListedNftsRequest](#ununifi.nftmarket.QueryListedNftsRequest) - - [QueryListedNftsResponse](#ununifi.nftmarket.QueryListedNftsResponse) - - [QueryLoanRequest](#ununifi.nftmarket.QueryLoanRequest) - - [QueryLoanResponse](#ununifi.nftmarket.QueryLoanResponse) - - [QueryLoansRequest](#ununifi.nftmarket.QueryLoansRequest) - - [QueryLoansResponse](#ununifi.nftmarket.QueryLoansResponse) - - [QueryNftBidsRequest](#ununifi.nftmarket.QueryNftBidsRequest) - - [QueryNftBidsResponse](#ununifi.nftmarket.QueryNftBidsResponse) - - [QueryNftListingRequest](#ununifi.nftmarket.QueryNftListingRequest) - - [QueryNftListingResponse](#ununifi.nftmarket.QueryNftListingResponse) - - [QueryParamsRequest](#ununifi.nftmarket.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.nftmarket.QueryParamsResponse) - - [QueryPaymentStatusRequest](#ununifi.nftmarket.QueryPaymentStatusRequest) - - [QueryPaymentStatusResponse](#ununifi.nftmarket.QueryPaymentStatusResponse) - - [QueryRewardsRequest](#ununifi.nftmarket.QueryRewardsRequest) - - [QueryRewardsResponse](#ununifi.nftmarket.QueryRewardsResponse) - - - [Query](#ununifi.nftmarket.Query) - + + - [NftListingDetail](#ununifi.nftmarket.NftListingDetail) + - [QueryBidderBidsRequest](#ununifi.nftmarket.QueryBidderBidsRequest) + - [QueryBidderBidsResponse](#ununifi.nftmarket.QueryBidderBidsResponse) + - [QueryCDPsListRequest](#ununifi.nftmarket.QueryCDPsListRequest) + - [QueryCDPsListResponse](#ununifi.nftmarket.QueryCDPsListResponse) + - [QueryLiquidationRequest](#ununifi.nftmarket.QueryLiquidationRequest) + - [QueryLiquidationResponse](#ununifi.nftmarket.QueryLiquidationResponse) + - [QueryListedClassRequest](#ununifi.nftmarket.QueryListedClassRequest) + - [QueryListedClassResponse](#ununifi.nftmarket.QueryListedClassResponse) + - [QueryListedClassesRequest](#ununifi.nftmarket.QueryListedClassesRequest) + - [QueryListedClassesResponse](#ununifi.nftmarket.QueryListedClassesResponse) + - [QueryListedNftsRequest](#ununifi.nftmarket.QueryListedNftsRequest) + - [QueryListedNftsResponse](#ununifi.nftmarket.QueryListedNftsResponse) + - [QueryLoanRequest](#ununifi.nftmarket.QueryLoanRequest) + - [QueryLoanResponse](#ununifi.nftmarket.QueryLoanResponse) + - [QueryLoansRequest](#ununifi.nftmarket.QueryLoansRequest) + - [QueryLoansResponse](#ununifi.nftmarket.QueryLoansResponse) + - [QueryNftBidsRequest](#ununifi.nftmarket.QueryNftBidsRequest) + - [QueryNftBidsResponse](#ununifi.nftmarket.QueryNftBidsResponse) + - [QueryNftListingRequest](#ununifi.nftmarket.QueryNftListingRequest) + - [QueryNftListingResponse](#ununifi.nftmarket.QueryNftListingResponse) + - [QueryParamsRequest](#ununifi.nftmarket.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.nftmarket.QueryParamsResponse) + - [QueryPaymentStatusRequest](#ununifi.nftmarket.QueryPaymentStatusRequest) + - [QueryPaymentStatusResponse](#ununifi.nftmarket.QueryPaymentStatusResponse) + - [QueryRewardsRequest](#ununifi.nftmarket.QueryRewardsRequest) + - [QueryRewardsResponse](#ununifi.nftmarket.QueryRewardsResponse) + + - [Query](#ununifi.nftmarket.Query) + - [nftmarket/tx.proto](#nftmarket/tx.proto) - - [MsgBorrow](#ununifi.nftmarket.MsgBorrow) - - [MsgBorrowResponse](#ununifi.nftmarket.MsgBorrowResponse) - - [MsgCancelBid](#ununifi.nftmarket.MsgCancelBid) - - [MsgCancelBidResponse](#ununifi.nftmarket.MsgCancelBidResponse) - - [MsgCancelNftListing](#ununifi.nftmarket.MsgCancelNftListing) - - [MsgCancelNftListingResponse](#ununifi.nftmarket.MsgCancelNftListingResponse) - - [MsgEndNftListing](#ununifi.nftmarket.MsgEndNftListing) - - [MsgEndNftListingResponse](#ununifi.nftmarket.MsgEndNftListingResponse) - - [MsgListNft](#ununifi.nftmarket.MsgListNft) - - [MsgListNftResponse](#ununifi.nftmarket.MsgListNftResponse) - - [MsgMintNft](#ununifi.nftmarket.MsgMintNft) - - [MsgMintNftResponse](#ununifi.nftmarket.MsgMintNftResponse) - - [MsgPayFullBid](#ununifi.nftmarket.MsgPayFullBid) - - [MsgPayFullBidResponse](#ununifi.nftmarket.MsgPayFullBidResponse) - - [MsgPlaceBid](#ununifi.nftmarket.MsgPlaceBid) - - [MsgPlaceBidResponse](#ununifi.nftmarket.MsgPlaceBidResponse) - - [MsgRepay](#ununifi.nftmarket.MsgRepay) - - [MsgRepayResponse](#ununifi.nftmarket.MsgRepayResponse) - - [MsgSellingDecision](#ununifi.nftmarket.MsgSellingDecision) - - [MsgSellingDecisionResponse](#ununifi.nftmarket.MsgSellingDecisionResponse) - - - [Msg](#ununifi.nftmarket.Msg) - + + - [MsgBorrow](#ununifi.nftmarket.MsgBorrow) + - [MsgBorrowResponse](#ununifi.nftmarket.MsgBorrowResponse) + - [MsgCancelBid](#ununifi.nftmarket.MsgCancelBid) + - [MsgCancelBidResponse](#ununifi.nftmarket.MsgCancelBidResponse) + - [MsgCancelNftListing](#ununifi.nftmarket.MsgCancelNftListing) + - [MsgCancelNftListingResponse](#ununifi.nftmarket.MsgCancelNftListingResponse) + - [MsgEndNftListing](#ununifi.nftmarket.MsgEndNftListing) + - [MsgEndNftListingResponse](#ununifi.nftmarket.MsgEndNftListingResponse) + - [MsgListNft](#ununifi.nftmarket.MsgListNft) + - [MsgListNftResponse](#ununifi.nftmarket.MsgListNftResponse) + - [MsgMintNft](#ununifi.nftmarket.MsgMintNft) + - [MsgMintNftResponse](#ununifi.nftmarket.MsgMintNftResponse) + - [MsgPayFullBid](#ununifi.nftmarket.MsgPayFullBid) + - [MsgPayFullBidResponse](#ununifi.nftmarket.MsgPayFullBidResponse) + - [MsgPlaceBid](#ununifi.nftmarket.MsgPlaceBid) + - [MsgPlaceBidResponse](#ununifi.nftmarket.MsgPlaceBidResponse) + - [MsgRepay](#ununifi.nftmarket.MsgRepay) + - [MsgRepayResponse](#ununifi.nftmarket.MsgRepayResponse) + - [MsgSellingDecision](#ununifi.nftmarket.MsgSellingDecision) + - [MsgSellingDecisionResponse](#ununifi.nftmarket.MsgSellingDecisionResponse) + + - [Msg](#ununifi.nftmarket.Msg) + - [nftmarketv1/nftmarket.proto](#nftmarketv1/nftmarket.proto) - - [EventBorrow](#ununifi.nftmarketv1.EventBorrow) - - [EventCancelBid](#ununifi.nftmarketv1.EventCancelBid) - - [EventCancelListNfting](#ununifi.nftmarketv1.EventCancelListNfting) - - [EventEndListNfting](#ununifi.nftmarketv1.EventEndListNfting) - - [EventExpandListingPeriod](#ununifi.nftmarketv1.EventExpandListingPeriod) - - [EventLiquidate](#ununifi.nftmarketv1.EventLiquidate) - - [EventListNft](#ununifi.nftmarketv1.EventListNft) - - [EventPayFullBid](#ununifi.nftmarketv1.EventPayFullBid) - - [EventPlaceBid](#ununifi.nftmarketv1.EventPlaceBid) - - [EventRepay](#ununifi.nftmarketv1.EventRepay) - - [EventSellingDecision](#ununifi.nftmarketv1.EventSellingDecision) - - [ListedClass](#ununifi.nftmarketv1.ListedClass) - - [ListedNft](#ununifi.nftmarketv1.ListedNft) - - [Loan](#ununifi.nftmarketv1.Loan) - - [NftBid](#ununifi.nftmarketv1.NftBid) - - [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) - - [NftListing](#ununifi.nftmarketv1.NftListing) - - [Params](#ununifi.nftmarketv1.Params) - - [PaymentStatus](#ununifi.nftmarketv1.PaymentStatus) - - - [ListingState](#ununifi.nftmarketv1.ListingState) - - [ListingType](#ununifi.nftmarketv1.ListingType) - + + - [EventBorrow](#ununifi.nftmarketv1.EventBorrow) + - [EventCancelBid](#ununifi.nftmarketv1.EventCancelBid) + - [EventCancelListNfting](#ununifi.nftmarketv1.EventCancelListNfting) + - [EventEndListNfting](#ununifi.nftmarketv1.EventEndListNfting) + - [EventExpandListingPeriod](#ununifi.nftmarketv1.EventExpandListingPeriod) + - [EventLiquidate](#ununifi.nftmarketv1.EventLiquidate) + - [EventListNft](#ununifi.nftmarketv1.EventListNft) + - [EventPayFullBid](#ununifi.nftmarketv1.EventPayFullBid) + - [EventPlaceBid](#ununifi.nftmarketv1.EventPlaceBid) + - [EventRepay](#ununifi.nftmarketv1.EventRepay) + - [EventSellingDecision](#ununifi.nftmarketv1.EventSellingDecision) + - [ListedClass](#ununifi.nftmarketv1.ListedClass) + - [ListedNft](#ununifi.nftmarketv1.ListedNft) + - [Loan](#ununifi.nftmarketv1.Loan) + - [NftBid](#ununifi.nftmarketv1.NftBid) + - [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) + - [NftListing](#ununifi.nftmarketv1.NftListing) + - [Params](#ununifi.nftmarketv1.Params) + - [PaymentStatus](#ununifi.nftmarketv1.PaymentStatus) + + - [ListingState](#ununifi.nftmarketv1.ListingState) + - [ListingType](#ununifi.nftmarketv1.ListingType) + - [nftmarketv1/genesis.proto](#nftmarketv1/genesis.proto) - - [GenesisState](#ununifi.nftmarketv1.GenesisState) - + - [GenesisState](#ununifi.nftmarketv1.GenesisState) - [nftmarketv1/query.proto](#nftmarketv1/query.proto) - - [QueryBidderBidsRequest](#ununifi.nftmarketv1.QueryBidderBidsRequest) - - [QueryBidderBidsResponse](#ununifi.nftmarketv1.QueryBidderBidsResponse) - - [QueryCDPsListRequest](#ununifi.nftmarketv1.QueryCDPsListRequest) - - [QueryCDPsListResponse](#ununifi.nftmarketv1.QueryCDPsListResponse) - - [QueryListedClassRequest](#ununifi.nftmarketv1.QueryListedClassRequest) - - [QueryListedClassResponse](#ununifi.nftmarketv1.QueryListedClassResponse) - - [QueryListedClassesRequest](#ununifi.nftmarketv1.QueryListedClassesRequest) - - [QueryListedClassesResponse](#ununifi.nftmarketv1.QueryListedClassesResponse) - - [QueryListedNftsRequest](#ununifi.nftmarketv1.QueryListedNftsRequest) - - [QueryListedNftsResponse](#ununifi.nftmarketv1.QueryListedNftsResponse) - - [QueryLoanRequest](#ununifi.nftmarketv1.QueryLoanRequest) - - [QueryLoanResponse](#ununifi.nftmarketv1.QueryLoanResponse) - - [QueryLoansRequest](#ununifi.nftmarketv1.QueryLoansRequest) - - [QueryLoansResponse](#ununifi.nftmarketv1.QueryLoansResponse) - - [QueryNftBidsRequest](#ununifi.nftmarketv1.QueryNftBidsRequest) - - [QueryNftBidsResponse](#ununifi.nftmarketv1.QueryNftBidsResponse) - - [QueryNftListingRequest](#ununifi.nftmarketv1.QueryNftListingRequest) - - [QueryNftListingResponse](#ununifi.nftmarketv1.QueryNftListingResponse) - - [QueryParamsRequest](#ununifi.nftmarketv1.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.nftmarketv1.QueryParamsResponse) - - [QueryPaymentStatusRequest](#ununifi.nftmarketv1.QueryPaymentStatusRequest) - - [QueryPaymentStatusResponse](#ununifi.nftmarketv1.QueryPaymentStatusResponse) - - [QueryRewardsRequest](#ununifi.nftmarketv1.QueryRewardsRequest) - - [QueryRewardsResponse](#ununifi.nftmarketv1.QueryRewardsResponse) - - - [Query](#ununifi.nftmarketv1.Query) - + + - [QueryBidderBidsRequest](#ununifi.nftmarketv1.QueryBidderBidsRequest) + - [QueryBidderBidsResponse](#ununifi.nftmarketv1.QueryBidderBidsResponse) + - [QueryCDPsListRequest](#ununifi.nftmarketv1.QueryCDPsListRequest) + - [QueryCDPsListResponse](#ununifi.nftmarketv1.QueryCDPsListResponse) + - [QueryListedClassRequest](#ununifi.nftmarketv1.QueryListedClassRequest) + - [QueryListedClassResponse](#ununifi.nftmarketv1.QueryListedClassResponse) + - [QueryListedClassesRequest](#ununifi.nftmarketv1.QueryListedClassesRequest) + - [QueryListedClassesResponse](#ununifi.nftmarketv1.QueryListedClassesResponse) + - [QueryListedNftsRequest](#ununifi.nftmarketv1.QueryListedNftsRequest) + - [QueryListedNftsResponse](#ununifi.nftmarketv1.QueryListedNftsResponse) + - [QueryLoanRequest](#ununifi.nftmarketv1.QueryLoanRequest) + - [QueryLoanResponse](#ununifi.nftmarketv1.QueryLoanResponse) + - [QueryLoansRequest](#ununifi.nftmarketv1.QueryLoansRequest) + - [QueryLoansResponse](#ununifi.nftmarketv1.QueryLoansResponse) + - [QueryNftBidsRequest](#ununifi.nftmarketv1.QueryNftBidsRequest) + - [QueryNftBidsResponse](#ununifi.nftmarketv1.QueryNftBidsResponse) + - [QueryNftListingRequest](#ununifi.nftmarketv1.QueryNftListingRequest) + - [QueryNftListingResponse](#ununifi.nftmarketv1.QueryNftListingResponse) + - [QueryParamsRequest](#ununifi.nftmarketv1.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.nftmarketv1.QueryParamsResponse) + - [QueryPaymentStatusRequest](#ununifi.nftmarketv1.QueryPaymentStatusRequest) + - [QueryPaymentStatusResponse](#ununifi.nftmarketv1.QueryPaymentStatusResponse) + - [QueryRewardsRequest](#ununifi.nftmarketv1.QueryRewardsRequest) + - [QueryRewardsResponse](#ununifi.nftmarketv1.QueryRewardsResponse) + + - [Query](#ununifi.nftmarketv1.Query) + - [nftmarketv1/tx.proto](#nftmarketv1/tx.proto) - - [MsgBorrow](#ununifi.nftmarketv1.MsgBorrow) - - [MsgBorrowResponse](#ununifi.nftmarketv1.MsgBorrowResponse) - - [MsgBurnStableCoin](#ununifi.nftmarketv1.MsgBurnStableCoin) - - [MsgBurnStableCoinResponse](#ununifi.nftmarketv1.MsgBurnStableCoinResponse) - - [MsgCancelBid](#ununifi.nftmarketv1.MsgCancelBid) - - [MsgCancelBidResponse](#ununifi.nftmarketv1.MsgCancelBidResponse) - - [MsgCancelNftListing](#ununifi.nftmarketv1.MsgCancelNftListing) - - [MsgCancelNftListingResponse](#ununifi.nftmarketv1.MsgCancelNftListingResponse) - - [MsgEndNftListing](#ununifi.nftmarketv1.MsgEndNftListing) - - [MsgEndNftListingResponse](#ununifi.nftmarketv1.MsgEndNftListingResponse) - - [MsgExpandListingPeriod](#ununifi.nftmarketv1.MsgExpandListingPeriod) - - [MsgExpandListingPeriodResponse](#ununifi.nftmarketv1.MsgExpandListingPeriodResponse) - - [MsgLiquidate](#ununifi.nftmarketv1.MsgLiquidate) - - [MsgLiquidateResponse](#ununifi.nftmarketv1.MsgLiquidateResponse) - - [MsgListNft](#ununifi.nftmarketv1.MsgListNft) - - [MsgListNftResponse](#ununifi.nftmarketv1.MsgListNftResponse) - - [MsgMintNft](#ununifi.nftmarketv1.MsgMintNft) - - [MsgMintNftResponse](#ununifi.nftmarketv1.MsgMintNftResponse) - - [MsgMintStableCoin](#ununifi.nftmarketv1.MsgMintStableCoin) - - [MsgMintStableCoinResponse](#ununifi.nftmarketv1.MsgMintStableCoinResponse) - - [MsgPayFullBid](#ununifi.nftmarketv1.MsgPayFullBid) - - [MsgPayFullBidResponse](#ununifi.nftmarketv1.MsgPayFullBidResponse) - - [MsgPlaceBid](#ununifi.nftmarketv1.MsgPlaceBid) - - [MsgPlaceBidResponse](#ununifi.nftmarketv1.MsgPlaceBidResponse) - - [MsgRepay](#ununifi.nftmarketv1.MsgRepay) - - [MsgRepayResponse](#ununifi.nftmarketv1.MsgRepayResponse) - - [MsgSellingDecision](#ununifi.nftmarketv1.MsgSellingDecision) - - [MsgSellingDecisionResponse](#ununifi.nftmarketv1.MsgSellingDecisionResponse) - - - [Msg](#ununifi.nftmarketv1.Msg) - + + - [MsgBorrow](#ununifi.nftmarketv1.MsgBorrow) + - [MsgBorrowResponse](#ununifi.nftmarketv1.MsgBorrowResponse) + - [MsgBurnStableCoin](#ununifi.nftmarketv1.MsgBurnStableCoin) + - [MsgBurnStableCoinResponse](#ununifi.nftmarketv1.MsgBurnStableCoinResponse) + - [MsgCancelBid](#ununifi.nftmarketv1.MsgCancelBid) + - [MsgCancelBidResponse](#ununifi.nftmarketv1.MsgCancelBidResponse) + - [MsgCancelNftListing](#ununifi.nftmarketv1.MsgCancelNftListing) + - [MsgCancelNftListingResponse](#ununifi.nftmarketv1.MsgCancelNftListingResponse) + - [MsgEndNftListing](#ununifi.nftmarketv1.MsgEndNftListing) + - [MsgEndNftListingResponse](#ununifi.nftmarketv1.MsgEndNftListingResponse) + - [MsgExpandListingPeriod](#ununifi.nftmarketv1.MsgExpandListingPeriod) + - [MsgExpandListingPeriodResponse](#ununifi.nftmarketv1.MsgExpandListingPeriodResponse) + - [MsgLiquidate](#ununifi.nftmarketv1.MsgLiquidate) + - [MsgLiquidateResponse](#ununifi.nftmarketv1.MsgLiquidateResponse) + - [MsgListNft](#ununifi.nftmarketv1.MsgListNft) + - [MsgListNftResponse](#ununifi.nftmarketv1.MsgListNftResponse) + - [MsgMintNft](#ununifi.nftmarketv1.MsgMintNft) + - [MsgMintNftResponse](#ununifi.nftmarketv1.MsgMintNftResponse) + - [MsgMintStableCoin](#ununifi.nftmarketv1.MsgMintStableCoin) + - [MsgMintStableCoinResponse](#ununifi.nftmarketv1.MsgMintStableCoinResponse) + - [MsgPayFullBid](#ununifi.nftmarketv1.MsgPayFullBid) + - [MsgPayFullBidResponse](#ununifi.nftmarketv1.MsgPayFullBidResponse) + - [MsgPlaceBid](#ununifi.nftmarketv1.MsgPlaceBid) + - [MsgPlaceBidResponse](#ununifi.nftmarketv1.MsgPlaceBidResponse) + - [MsgRepay](#ununifi.nftmarketv1.MsgRepay) + - [MsgRepayResponse](#ununifi.nftmarketv1.MsgRepayResponse) + - [MsgSellingDecision](#ununifi.nftmarketv1.MsgSellingDecision) + - [MsgSellingDecisionResponse](#ununifi.nftmarketv1.MsgSellingDecisionResponse) + + - [Msg](#ununifi.nftmarketv1.Msg) + - [nftmint/nftmint.proto](#nftmint/nftmint.proto) - - [ClassAttributes](#ununifi.nftmint.ClassAttributes) - - [ClassNameIdList](#ununifi.nftmint.ClassNameIdList) - - [OwningClassIdList](#ununifi.nftmint.OwningClassIdList) - - [Params](#ununifi.nftmint.Params) - - - [MintingPermission](#ununifi.nftmint.MintingPermission) - + + - [ClassAttributes](#ununifi.nftmint.ClassAttributes) + - [ClassNameIdList](#ununifi.nftmint.ClassNameIdList) + - [OwningClassIdList](#ununifi.nftmint.OwningClassIdList) + - [Params](#ununifi.nftmint.Params) + + - [MintingPermission](#ununifi.nftmint.MintingPermission) + - [nftmint/event.proto](#nftmint/event.proto) - - [EventBurnNFT](#ununifi.nftmint.EventBurnNFT) - - [EventCreateClass](#ununifi.nftmint.EventCreateClass) - - [EventMintNFT](#ununifi.nftmint.EventMintNFT) - - [EventSendClassOwnership](#ununifi.nftmint.EventSendClassOwnership) - - [EventUpdateBaseTokenUri](#ununifi.nftmint.EventUpdateBaseTokenUri) - - [EventUpdateTokenSupplyCap](#ununifi.nftmint.EventUpdateTokenSupplyCap) - + - [EventBurnNFT](#ununifi.nftmint.EventBurnNFT) + - [EventCreateClass](#ununifi.nftmint.EventCreateClass) + - [EventMintNFT](#ununifi.nftmint.EventMintNFT) + - [EventSendClassOwnership](#ununifi.nftmint.EventSendClassOwnership) + - [EventUpdateBaseTokenUri](#ununifi.nftmint.EventUpdateBaseTokenUri) + - [EventUpdateTokenSupplyCap](#ununifi.nftmint.EventUpdateTokenSupplyCap) - [nftmint/genesis.proto](#nftmint/genesis.proto) - - [GenesisState](#ununifi.nftmint.GenesisState) - + - [GenesisState](#ununifi.nftmint.GenesisState) - [nftmint/query.proto](#nftmint/query.proto) - - [QueryClassAttributesRequest](#ununifi.nftmint.QueryClassAttributesRequest) - - [QueryClassAttributesResponse](#ununifi.nftmint.QueryClassAttributesResponse) - - [QueryClassIdsByNameRequest](#ununifi.nftmint.QueryClassIdsByNameRequest) - - [QueryClassIdsByNameResponse](#ununifi.nftmint.QueryClassIdsByNameResponse) - - [QueryClassIdsByOwnerRequest](#ununifi.nftmint.QueryClassIdsByOwnerRequest) - - [QueryClassIdsByOwnerResponse](#ununifi.nftmint.QueryClassIdsByOwnerResponse) - - [QueryNFTMinterRequest](#ununifi.nftmint.QueryNFTMinterRequest) - - [QueryNFTMinterResponse](#ununifi.nftmint.QueryNFTMinterResponse) - - [QueryParamsRequest](#ununifi.nftmint.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.nftmint.QueryParamsResponse) - - - [Query](#ununifi.nftmint.Query) - + + - [QueryClassAttributesRequest](#ununifi.nftmint.QueryClassAttributesRequest) + - [QueryClassAttributesResponse](#ununifi.nftmint.QueryClassAttributesResponse) + - [QueryClassIdsByNameRequest](#ununifi.nftmint.QueryClassIdsByNameRequest) + - [QueryClassIdsByNameResponse](#ununifi.nftmint.QueryClassIdsByNameResponse) + - [QueryClassIdsByOwnerRequest](#ununifi.nftmint.QueryClassIdsByOwnerRequest) + - [QueryClassIdsByOwnerResponse](#ununifi.nftmint.QueryClassIdsByOwnerResponse) + - [QueryNFTMinterRequest](#ununifi.nftmint.QueryNFTMinterRequest) + - [QueryNFTMinterResponse](#ununifi.nftmint.QueryNFTMinterResponse) + - [QueryParamsRequest](#ununifi.nftmint.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.nftmint.QueryParamsResponse) + + - [Query](#ununifi.nftmint.Query) + - [nftmint/tx.proto](#nftmint/tx.proto) - - [MsgBurnNFT](#ununifi.nftmint.MsgBurnNFT) - - [MsgBurnNFTResponse](#ununifi.nftmint.MsgBurnNFTResponse) - - [MsgCreateClass](#ununifi.nftmint.MsgCreateClass) - - [MsgCreateClassResponse](#ununifi.nftmint.MsgCreateClassResponse) - - [MsgMintNFT](#ununifi.nftmint.MsgMintNFT) - - [MsgMintNFTResponse](#ununifi.nftmint.MsgMintNFTResponse) - - [MsgSendClassOwnership](#ununifi.nftmint.MsgSendClassOwnership) - - [MsgSendClassOwnershipResponse](#ununifi.nftmint.MsgSendClassOwnershipResponse) - - [MsgUpdateBaseTokenUri](#ununifi.nftmint.MsgUpdateBaseTokenUri) - - [MsgUpdateBaseTokenUriResponse](#ununifi.nftmint.MsgUpdateBaseTokenUriResponse) - - [MsgUpdateTokenSupplyCap](#ununifi.nftmint.MsgUpdateTokenSupplyCap) - - [MsgUpdateTokenSupplyCapResponse](#ununifi.nftmint.MsgUpdateTokenSupplyCapResponse) - - - [Msg](#ununifi.nftmint.Msg) - + + - [MsgBurnNFT](#ununifi.nftmint.MsgBurnNFT) + - [MsgBurnNFTResponse](#ununifi.nftmint.MsgBurnNFTResponse) + - [MsgCreateClass](#ununifi.nftmint.MsgCreateClass) + - [MsgCreateClassResponse](#ununifi.nftmint.MsgCreateClassResponse) + - [MsgMintNFT](#ununifi.nftmint.MsgMintNFT) + - [MsgMintNFTResponse](#ununifi.nftmint.MsgMintNFTResponse) + - [MsgSendClassOwnership](#ununifi.nftmint.MsgSendClassOwnership) + - [MsgSendClassOwnershipResponse](#ununifi.nftmint.MsgSendClassOwnershipResponse) + - [MsgUpdateBaseTokenUri](#ununifi.nftmint.MsgUpdateBaseTokenUri) + - [MsgUpdateBaseTokenUriResponse](#ununifi.nftmint.MsgUpdateBaseTokenUriResponse) + - [MsgUpdateTokenSupplyCap](#ununifi.nftmint.MsgUpdateTokenSupplyCap) + - [MsgUpdateTokenSupplyCapResponse](#ununifi.nftmint.MsgUpdateTokenSupplyCapResponse) + + - [Msg](#ununifi.nftmint.Msg) + - [pricefeed/pricefeed.proto](#pricefeed/pricefeed.proto) - - [CurrentPrice](#ununifi.pricefeed.CurrentPrice) - - [Market](#ununifi.pricefeed.Market) - - [Params](#ununifi.pricefeed.Params) - - [PostedPrice](#ununifi.pricefeed.PostedPrice) - + - [CurrentPrice](#ununifi.pricefeed.CurrentPrice) + - [Market](#ununifi.pricefeed.Market) + - [Params](#ununifi.pricefeed.Params) + - [PostedPrice](#ununifi.pricefeed.PostedPrice) - [pricefeed/genesis.proto](#pricefeed/genesis.proto) - - [GenesisState](#ununifi.pricefeed.GenesisState) - + - [GenesisState](#ununifi.pricefeed.GenesisState) - [pricefeed/query.proto](#pricefeed/query.proto) - - [QueryAllMarketRequest](#ununifi.pricefeed.QueryAllMarketRequest) - - [QueryAllMarketResponse](#ununifi.pricefeed.QueryAllMarketResponse) - - [QueryAllOracleRequest](#ununifi.pricefeed.QueryAllOracleRequest) - - [QueryAllOracleResponse](#ununifi.pricefeed.QueryAllOracleResponse) - - [QueryAllPriceRequest](#ununifi.pricefeed.QueryAllPriceRequest) - - [QueryAllPriceResponse](#ununifi.pricefeed.QueryAllPriceResponse) - - [QueryAllRawPriceRequest](#ununifi.pricefeed.QueryAllRawPriceRequest) - - [QueryAllRawPriceResponse](#ununifi.pricefeed.QueryAllRawPriceResponse) - - [QueryGetPriceRequest](#ununifi.pricefeed.QueryGetPriceRequest) - - [QueryGetPriceResponse](#ununifi.pricefeed.QueryGetPriceResponse) - - [QueryParamsRequest](#ununifi.pricefeed.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.pricefeed.QueryParamsResponse) - - - [Query](#ununifi.pricefeed.Query) - + + - [QueryAllMarketRequest](#ununifi.pricefeed.QueryAllMarketRequest) + - [QueryAllMarketResponse](#ununifi.pricefeed.QueryAllMarketResponse) + - [QueryAllOracleRequest](#ununifi.pricefeed.QueryAllOracleRequest) + - [QueryAllOracleResponse](#ununifi.pricefeed.QueryAllOracleResponse) + - [QueryAllPriceRequest](#ununifi.pricefeed.QueryAllPriceRequest) + - [QueryAllPriceResponse](#ununifi.pricefeed.QueryAllPriceResponse) + - [QueryAllRawPriceRequest](#ununifi.pricefeed.QueryAllRawPriceRequest) + - [QueryAllRawPriceResponse](#ununifi.pricefeed.QueryAllRawPriceResponse) + - [QueryGetPriceRequest](#ununifi.pricefeed.QueryGetPriceRequest) + - [QueryGetPriceResponse](#ununifi.pricefeed.QueryGetPriceResponse) + - [QueryParamsRequest](#ununifi.pricefeed.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.pricefeed.QueryParamsResponse) + + - [Query](#ununifi.pricefeed.Query) + - [pricefeed/tx.proto](#pricefeed/tx.proto) - - [MsgPostPrice](#ununifi.pricefeed.MsgPostPrice) - - [MsgPostPriceResponse](#ununifi.pricefeed.MsgPostPriceResponse) - - - [Msg](#ununifi.pricefeed.Msg) - + + - [MsgPostPrice](#ununifi.pricefeed.MsgPostPrice) + - [MsgPostPriceResponse](#ununifi.pricefeed.MsgPostPriceResponse) + + - [Msg](#ununifi.pricefeed.Msg) + - [ununifidist/ununifidist.proto](#ununifidist/ununifidist.proto) - - [Params](#ununifi.ununifidist.Params) - - [Period](#ununifi.ununifidist.Period) - + - [Params](#ununifi.ununifidist.Params) + - [Period](#ununifi.ununifidist.Period) - [ununifidist/genesis.proto](#ununifidist/genesis.proto) - - [GenesisState](#ununifi.ununifidist.GenesisState) - + - [GenesisState](#ununifi.ununifidist.GenesisState) - [ununifidist/query.proto](#ununifidist/query.proto) - - [QueryGetBalancesRequest](#ununifi.ununifidist.QueryGetBalancesRequest) - - [QueryGetBalancesResponse](#ununifi.ununifidist.QueryGetBalancesResponse) - - [QueryParamsRequest](#ununifi.ununifidist.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.ununifidist.QueryParamsResponse) - - - [Query](#ununifi.ununifidist.Query) - + + - [QueryGetBalancesRequest](#ununifi.ununifidist.QueryGetBalancesRequest) + - [QueryGetBalancesResponse](#ununifi.ununifidist.QueryGetBalancesResponse) + - [QueryParamsRequest](#ununifi.ununifidist.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.ununifidist.QueryParamsResponse) + + - [Query](#ununifi.ununifidist.Query) + - [yield-aggregator/params.proto](#yield-aggregator/params.proto) - - [Params](#ununifi.yieldaggregator.Params) - + - [Params](#ununifi.yieldaggregator.Params) - [yield-aggregator/yield-aggregator.proto](#yield-aggregator/yield-aggregator.proto) - - [Strategy](#ununifi.yieldaggregator.Strategy) - - [StrategyMetrics](#ununifi.yieldaggregator.StrategyMetrics) - - [StrategyWeight](#ununifi.yieldaggregator.StrategyWeight) - - [Vault](#ununifi.yieldaggregator.Vault) - - [VaultMetrics](#ununifi.yieldaggregator.VaultMetrics) - + - [Strategy](#ununifi.yieldaggregator.Strategy) + - [StrategyMetrics](#ununifi.yieldaggregator.StrategyMetrics) + - [StrategyWeight](#ununifi.yieldaggregator.StrategyWeight) + - [Vault](#ununifi.yieldaggregator.Vault) + - [VaultMetrics](#ununifi.yieldaggregator.VaultMetrics) - [yield-aggregator/genesis.proto](#yield-aggregator/genesis.proto) - - [GenesisState](#ununifi.yieldaggregator.GenesisState) - + - [GenesisState](#ununifi.yieldaggregator.GenesisState) - [yield-aggregator/proposal.proto](#yield-aggregator/proposal.proto) - - [ProposalAddStrategy](#ununifi.yieldaggregator.ProposalAddStrategy) - + - [ProposalAddStrategy](#ununifi.yieldaggregator.ProposalAddStrategy) - [yield-aggregator/query.proto](#yield-aggregator/query.proto) - - [QueryAllStrategyRequest](#ununifi.yieldaggregator.QueryAllStrategyRequest) - - [QueryAllStrategyResponse](#ununifi.yieldaggregator.QueryAllStrategyResponse) - - [QueryAllVaultRequest](#ununifi.yieldaggregator.QueryAllVaultRequest) - - [QueryAllVaultResponse](#ununifi.yieldaggregator.QueryAllVaultResponse) - - [QueryEstimateMintAmountRequest](#ununifi.yieldaggregator.QueryEstimateMintAmountRequest) - - [QueryEstimateMintAmountResponse](#ununifi.yieldaggregator.QueryEstimateMintAmountResponse) - - [QueryEstimateRedeemAmountRequest](#ununifi.yieldaggregator.QueryEstimateRedeemAmountRequest) - - [QueryEstimateRedeemAmountResponse](#ununifi.yieldaggregator.QueryEstimateRedeemAmountResponse) - - [QueryGetStrategyRequest](#ununifi.yieldaggregator.QueryGetStrategyRequest) - - [QueryGetStrategyResponse](#ununifi.yieldaggregator.QueryGetStrategyResponse) - - [QueryGetVaultRequest](#ununifi.yieldaggregator.QueryGetVaultRequest) - - [QueryGetVaultResponse](#ununifi.yieldaggregator.QueryGetVaultResponse) - - [QueryParamsRequest](#ununifi.yieldaggregator.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.yieldaggregator.QueryParamsResponse) - - - [Query](#ununifi.yieldaggregator.Query) - + + - [QueryAllStrategyRequest](#ununifi.yieldaggregator.QueryAllStrategyRequest) + - [QueryAllStrategyResponse](#ununifi.yieldaggregator.QueryAllStrategyResponse) + - [QueryAllVaultRequest](#ununifi.yieldaggregator.QueryAllVaultRequest) + - [QueryAllVaultResponse](#ununifi.yieldaggregator.QueryAllVaultResponse) + - [QueryEstimateMintAmountRequest](#ununifi.yieldaggregator.QueryEstimateMintAmountRequest) + - [QueryEstimateMintAmountResponse](#ununifi.yieldaggregator.QueryEstimateMintAmountResponse) + - [QueryEstimateRedeemAmountRequest](#ununifi.yieldaggregator.QueryEstimateRedeemAmountRequest) + - [QueryEstimateRedeemAmountResponse](#ununifi.yieldaggregator.QueryEstimateRedeemAmountResponse) + - [QueryGetStrategyRequest](#ununifi.yieldaggregator.QueryGetStrategyRequest) + - [QueryGetStrategyResponse](#ununifi.yieldaggregator.QueryGetStrategyResponse) + - [QueryGetVaultRequest](#ununifi.yieldaggregator.QueryGetVaultRequest) + - [QueryGetVaultResponse](#ununifi.yieldaggregator.QueryGetVaultResponse) + - [QueryParamsRequest](#ununifi.yieldaggregator.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.yieldaggregator.QueryParamsResponse) + + - [Query](#ununifi.yieldaggregator.Query) + - [yield-aggregator/tx.proto](#yield-aggregator/tx.proto) - - [MsgCreateVault](#ununifi.yieldaggregator.MsgCreateVault) - - [MsgCreateVaultResponse](#ununifi.yieldaggregator.MsgCreateVaultResponse) - - [MsgDeleteVault](#ununifi.yieldaggregator.MsgDeleteVault) - - [MsgDeleteVaultResponse](#ununifi.yieldaggregator.MsgDeleteVaultResponse) - - [MsgDepositToVault](#ununifi.yieldaggregator.MsgDepositToVault) - - [MsgDepositToVaultResponse](#ununifi.yieldaggregator.MsgDepositToVaultResponse) - - [MsgTransferVaultOwnership](#ununifi.yieldaggregator.MsgTransferVaultOwnership) - - [MsgTransferVaultOwnershipResponse](#ununifi.yieldaggregator.MsgTransferVaultOwnershipResponse) - - [MsgWithdrawFromVault](#ununifi.yieldaggregator.MsgWithdrawFromVault) - - [MsgWithdrawFromVaultResponse](#ununifi.yieldaggregator.MsgWithdrawFromVaultResponse) - - - [Msg](#ununifi.yieldaggregator.Msg) - + + - [MsgCreateVault](#ununifi.yieldaggregator.MsgCreateVault) + - [MsgCreateVaultResponse](#ununifi.yieldaggregator.MsgCreateVaultResponse) + - [MsgDeleteVault](#ununifi.yieldaggregator.MsgDeleteVault) + - [MsgDeleteVaultResponse](#ununifi.yieldaggregator.MsgDeleteVaultResponse) + - [MsgDepositToVault](#ununifi.yieldaggregator.MsgDepositToVault) + - [MsgDepositToVaultResponse](#ununifi.yieldaggregator.MsgDepositToVaultResponse) + - [MsgTransferVaultOwnership](#ununifi.yieldaggregator.MsgTransferVaultOwnership) + - [MsgTransferVaultOwnershipResponse](#ununifi.yieldaggregator.MsgTransferVaultOwnershipResponse) + - [MsgWithdrawFromVault](#ununifi.yieldaggregator.MsgWithdrawFromVault) + - [MsgWithdrawFromVaultResponse](#ununifi.yieldaggregator.MsgWithdrawFromVaultResponse) + + - [Msg](#ununifi.yieldaggregator.Msg) + - [yieldaggregatorv1/params.proto](#yieldaggregatorv1/params.proto) - - [Params](#ununifi.chain.yieldaggregator.Params) - + - [Params](#ununifi.chain.yieldaggregator.Params) - [yieldaggregatorv1/asset.proto](#yieldaggregatorv1/asset.proto) - - [AssetCondition](#ununifi.chain.yieldaggregator.AssetCondition) - - [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) - - [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) - - [DailyPercent](#ununifi.chain.yieldaggregator.DailyPercent) - - [DepositAllocation](#ununifi.chain.yieldaggregator.DepositAllocation) - - [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) - - [FarmingUnit](#ununifi.chain.yieldaggregator.FarmingUnit) - - [IntegrateInfo](#ununifi.chain.yieldaggregator.IntegrateInfo) - - [Strategy](#ununifi.chain.yieldaggregator.Strategy) - - [UserDeposit](#ununifi.chain.yieldaggregator.UserDeposit) - - [UserInfo](#ununifi.chain.yieldaggregator.UserInfo) - - - [IntegrateType](#ununifi.chain.yieldaggregator.IntegrateType) - + + - [AssetCondition](#ununifi.chain.yieldaggregator.AssetCondition) + - [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) + - [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) + - [DailyPercent](#ununifi.chain.yieldaggregator.DailyPercent) + - [DepositAllocation](#ununifi.chain.yieldaggregator.DepositAllocation) + - [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) + - [FarmingUnit](#ununifi.chain.yieldaggregator.FarmingUnit) + - [IntegrateInfo](#ununifi.chain.yieldaggregator.IntegrateInfo) + - [Strategy](#ununifi.chain.yieldaggregator.Strategy) + - [UserDeposit](#ununifi.chain.yieldaggregator.UserDeposit) + - [UserInfo](#ununifi.chain.yieldaggregator.UserInfo) + + - [IntegrateType](#ununifi.chain.yieldaggregator.IntegrateType) + - [yieldaggregatorv1/genesis.proto](#yieldaggregatorv1/genesis.proto) - - [GenesisState](#ununifi.chain.yieldaggregator.GenesisState) - + - [GenesisState](#ununifi.chain.yieldaggregator.GenesisState) - [yieldaggregatorv1/proposal.proto](#yieldaggregatorv1/proposal.proto) - - [ProposalAddYieldFarm](#ununifi.chain.yieldaggregator.ProposalAddYieldFarm) - - [ProposalAddYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalAddYieldFarmTarget) - - [ProposalRemoveYieldFarm](#ununifi.chain.yieldaggregator.ProposalRemoveYieldFarm) - - [ProposalRemoveYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalRemoveYieldFarmTarget) - - [ProposalStopYieldFarm](#ununifi.chain.yieldaggregator.ProposalStopYieldFarm) - - [ProposalStopYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalStopYieldFarmTarget) - - [ProposalUpdateYieldFarm](#ununifi.chain.yieldaggregator.ProposalUpdateYieldFarm) - - [ProposalUpdateYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalUpdateYieldFarmTarget) - + - [ProposalAddYieldFarm](#ununifi.chain.yieldaggregator.ProposalAddYieldFarm) + - [ProposalAddYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalAddYieldFarmTarget) + - [ProposalRemoveYieldFarm](#ununifi.chain.yieldaggregator.ProposalRemoveYieldFarm) + - [ProposalRemoveYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalRemoveYieldFarmTarget) + - [ProposalStopYieldFarm](#ununifi.chain.yieldaggregator.ProposalStopYieldFarm) + - [ProposalStopYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalStopYieldFarmTarget) + - [ProposalUpdateYieldFarm](#ununifi.chain.yieldaggregator.ProposalUpdateYieldFarm) + - [ProposalUpdateYieldFarmTarget](#ununifi.chain.yieldaggregator.ProposalUpdateYieldFarmTarget) - [yieldaggregatorv1/query.proto](#yieldaggregatorv1/query.proto) - - [AssetManagementAccountInfo](#ununifi.chain.yieldaggregator.AssetManagementAccountInfo) - - [QueryAllAssetManagementAccountsRequest](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsRequest) - - [QueryAllAssetManagementAccountsResponse](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsResponse) - - [QueryAllFarmingUnitsRequest](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsRequest) - - [QueryAllFarmingUnitsResponse](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsResponse) - - [QueryAssetManagementAccountRequest](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountRequest) - - [QueryAssetManagementAccountResponse](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountResponse) - - [QueryDailyRewardPercentsRequest](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsRequest) - - [QueryDailyRewardPercentsResponse](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsResponse) - - [QueryParamsRequest](#ununifi.chain.yieldaggregator.QueryParamsRequest) - - [QueryParamsResponse](#ununifi.chain.yieldaggregator.QueryParamsResponse) - - [QueryUserInfo](#ununifi.chain.yieldaggregator.QueryUserInfo) - - [QueryUserInfoRequest](#ununifi.chain.yieldaggregator.QueryUserInfoRequest) - - [QueryUserInfoResponse](#ununifi.chain.yieldaggregator.QueryUserInfoResponse) - - - [Query](#ununifi.chain.yieldaggregator.Query) - + + - [AssetManagementAccountInfo](#ununifi.chain.yieldaggregator.AssetManagementAccountInfo) + - [QueryAllAssetManagementAccountsRequest](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsRequest) + - [QueryAllAssetManagementAccountsResponse](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsResponse) + - [QueryAllFarmingUnitsRequest](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsRequest) + - [QueryAllFarmingUnitsResponse](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsResponse) + - [QueryAssetManagementAccountRequest](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountRequest) + - [QueryAssetManagementAccountResponse](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountResponse) + - [QueryDailyRewardPercentsRequest](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsRequest) + - [QueryDailyRewardPercentsResponse](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsResponse) + - [QueryParamsRequest](#ununifi.chain.yieldaggregator.QueryParamsRequest) + - [QueryParamsResponse](#ununifi.chain.yieldaggregator.QueryParamsResponse) + - [QueryUserInfo](#ununifi.chain.yieldaggregator.QueryUserInfo) + - [QueryUserInfoRequest](#ununifi.chain.yieldaggregator.QueryUserInfoRequest) + - [QueryUserInfoResponse](#ununifi.chain.yieldaggregator.QueryUserInfoResponse) + + - [Query](#ununifi.chain.yieldaggregator.Query) + - [yieldaggregatorv1/tx.proto](#yieldaggregatorv1/tx.proto) - - [MsgActivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrder) - - [MsgActivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrderResponse) - - [MsgAddFarmingOrder](#ununifi.chain.yieldaggregator.MsgAddFarmingOrder) - - [MsgAddFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgAddFarmingOrderResponse) - - [MsgBeginWithdrawAll](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAll) - - [MsgBeginWithdrawAllResponse](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAllResponse) - - [MsgDeleteFarmingOrder](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrder) - - [MsgDeleteFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrderResponse) - - [MsgDeposit](#ununifi.chain.yieldaggregator.MsgDeposit) - - [MsgDepositResponse](#ununifi.chain.yieldaggregator.MsgDepositResponse) - - [MsgExecuteFarmingOrders](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrders) - - [MsgExecuteFarmingOrdersResponse](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrdersResponse) - - [MsgInactivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrder) - - [MsgInactivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrderResponse) - - [MsgSetDailyRewardPercent](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercent) - - [MsgSetDailyRewardPercentResponse](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercentResponse) - - [MsgWithdraw](#ununifi.chain.yieldaggregator.MsgWithdraw) - - [MsgWithdrawResponse](#ununifi.chain.yieldaggregator.MsgWithdrawResponse) - - - [Msg](#ununifi.chain.yieldaggregator.Msg) - + + - [MsgActivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrder) + - [MsgActivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrderResponse) + - [MsgAddFarmingOrder](#ununifi.chain.yieldaggregator.MsgAddFarmingOrder) + - [MsgAddFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgAddFarmingOrderResponse) + - [MsgBeginWithdrawAll](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAll) + - [MsgBeginWithdrawAllResponse](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAllResponse) + - [MsgDeleteFarmingOrder](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrder) + - [MsgDeleteFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrderResponse) + - [MsgDeposit](#ununifi.chain.yieldaggregator.MsgDeposit) + - [MsgDepositResponse](#ununifi.chain.yieldaggregator.MsgDepositResponse) + - [MsgExecuteFarmingOrders](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrders) + - [MsgExecuteFarmingOrdersResponse](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrdersResponse) + - [MsgInactivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrder) + - [MsgInactivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrderResponse) + - [MsgSetDailyRewardPercent](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercent) + - [MsgSetDailyRewardPercentResponse](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercentResponse) + - [MsgWithdraw](#ununifi.chain.yieldaggregator.MsgWithdraw) + - [MsgWithdrawResponse](#ununifi.chain.yieldaggregator.MsgWithdrawResponse) + + - [Msg](#ununifi.chain.yieldaggregator.Msg) + - [yieldfarm/params.proto](#yieldfarm/params.proto) - - [Params](#ununifi.chain.yieldfarm.Params) - + - [Params](#ununifi.chain.yieldfarm.Params) - [yieldfarm/yieldfarm.proto](#yieldfarm/yieldfarm.proto) - - [FarmerInfo](#ununifi.chain.yieldfarm.FarmerInfo) - + - [FarmerInfo](#ununifi.chain.yieldfarm.FarmerInfo) - [yieldfarm/genesis.proto](#yieldfarm/genesis.proto) - - [GenesisState](#ununifi.chain.yieldfarm.GenesisState) - + - [GenesisState](#ununifi.chain.yieldfarm.GenesisState) - [Scalar Value Types](#scalar-value-types) - - +

Top

## auction/auction.proto - - ### BaseAuction - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | -| `initiator` | [string](#string) | | | -| `lot` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `bidder` | [string](#string) | | | -| `bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `has_received_bids` | [bool](#bool) | | | -| `end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `max_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - +| Field | Type | Label | Description | +| ------------------- | ------------------------------------------------------- | ----- | ----------- | +| `id` | [uint64](#uint64) | | | +| `initiator` | [string](#string) | | | +| `lot` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `bidder` | [string](#string) | | | +| `bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `has_received_bids` | [bool](#bool) | | | +| `end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `max_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | ### CollateralAuction - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_auction` | [BaseAuction](#ununifi.auction.BaseAuction) | | | -| `corresponding_debt` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `max_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `lot_returns` | [WeightedAddress](#ununifi.auction.WeightedAddress) | repeated | | - - - - - +| Field | Type | Label | Description | +| -------------------- | ----------------------------------------------------- | -------- | ----------- | +| `base_auction` | [BaseAuction](#ununifi.auction.BaseAuction) | | | +| `corresponding_debt` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `max_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `lot_returns` | [WeightedAddress](#ununifi.auction.WeightedAddress) | repeated | | ### DebtAuction - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_auction` | [BaseAuction](#ununifi.auction.BaseAuction) | | | -| `corresponding_debt` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - +| Field | Type | Label | Description | +| -------------------- | ----------------------------------------------------- | ----- | ----------- | +| `base_auction` | [BaseAuction](#ununifi.auction.BaseAuction) | | | +| `corresponding_debt` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | ### Params - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `max_auction_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | -| `bid_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | -| `increment_surplus` | [string](#string) | | | -| `increment_debt` | [string](#string) | | | -| `increment_collateral` | [string](#string) | | | - - - - - +| Field | Type | Label | Description | +| ---------------------- | ----------------------------------------------------- | ----- | ----------- | +| `max_auction_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `bid_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `increment_surplus` | [string](#string) | | | +| `increment_debt` | [string](#string) | | | +| `increment_collateral` | [string](#string) | | | ### SurplusAuction - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_auction` | [BaseAuction](#ununifi.auction.BaseAuction) | | | - - - - - +| Field | Type | Label | Description | +| -------------- | ------------------------------------------- | ----- | ----------- | +| `base_auction` | [BaseAuction](#ununifi.auction.BaseAuction) | | | ### WeightedAddress - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | | -| `weight` | [string](#string) | | | - - - - +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `address` | [string](#string) | | | +| `weight` | [string](#string) | | | @@ -769,30 +725,23 @@ - - +

Top

## auction/genesis.proto - - ### GenesisState -GenesisState defines the auction module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `next_auction_id` | [uint64](#uint64) | | | -| `params` | [Params](#ununifi.auction.Params) | | | -| `auctions` | [google.protobuf.Any](#google.protobuf.Any) | repeated | this line is used by starport scaffolding # genesis/proto/state | - - +GenesisState defines the auction module's genesis state. +| Field | Type | Label | Description | +| ----------------- | ------------------------------------------- | -------- | --------------------------------------------------------------- | +| `next_auction_id` | [uint64](#uint64) | | | +| `params` | [Params](#ununifi.auction.Params) | | | +| `auctions` | [google.protobuf.Any](#google.protobuf.Any) | repeated | this line is used by starport scaffolding # genesis/proto/state | @@ -802,99 +751,58 @@ GenesisState defines the auction module's genesis state. - - +

Top

## auction/query.proto - - ### QueryAllAuctionRequest - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | ### QueryAllAuctionResponse - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `auctions` | [google.protobuf.Any](#google.protobuf.Any) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `auctions` | [google.protobuf.Any](#google.protobuf.Any) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | ### QueryGetAuctionRequest -this line is used by starport scaffolding # 3 - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | - - - +this line is used by starport scaffolding # 3 +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| `id` | [uint64](#uint64) | | | ### QueryGetAuctionResponse - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `auction` | [google.protobuf.Any](#google.protobuf.Any) | | | - - - - - +| Field | Type | Label | Description | +| --------- | ------------------------------------------- | ----- | ----------- | +| `auction` | [google.protobuf.Any](#google.protobuf.Any) | | | ### QueryParamsRequest - - - - - - ### QueryParamsResponse - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.auction.Params) | | | - - - - +| Field | Type | Label | Description | +| -------- | --------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.auction.Params) | | | @@ -902,998 +810,1545 @@ this line is used by starport scaffolding # 3 - ### Query + Query defines the gRPC querier service. -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.auction.QueryParamsRequest) | [QueryParamsResponse](#ununifi.auction.QueryParamsResponse) | | GET|/ununifi/auction/params| -| `Auction` | [QueryGetAuctionRequest](#ununifi.auction.QueryGetAuctionRequest) | [QueryGetAuctionResponse](#ununifi.auction.QueryGetAuctionResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/auction/auctions/{id}| -| `AuctionAll` | [QueryAllAuctionRequest](#ununifi.auction.QueryAllAuctionRequest) | [QueryAllAuctionResponse](#ununifi.auction.QueryAllAuctionResponse) | | GET|/ununifi/auction/auctions| +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------ | ----------------------------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------- | --------- | ------------------------------ | +| `Params` | [QueryParamsRequest](#ununifi.auction.QueryParamsRequest) | [QueryParamsResponse](#ununifi.auction.QueryParamsResponse) | | GET | /ununifi/auction/params | +| `Auction` | [QueryGetAuctionRequest](#ununifi.auction.QueryGetAuctionRequest) | [QueryGetAuctionResponse](#ununifi.auction.QueryGetAuctionResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/auction/auctions/{id} | +| `AuctionAll` | [QueryAllAuctionRequest](#ununifi.auction.QueryAllAuctionRequest) | [QueryAllAuctionResponse](#ununifi.auction.QueryAllAuctionResponse) | | GET | /ununifi/auction/auctions | - - +

Top

## auction/tx.proto - - ### MsgPlaceBid - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `auction_id` | [uint64](#uint64) | | | -| `bidder` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - +| Field | Type | Label | Description | +| ------------ | ----------------------------------------------------- | ----- | ----------- | +| `auction_id` | [uint64](#uint64) | | | +| `bidder` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | ### MsgPlaceBidResponse - - - - - - ### Msg - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `PlaceBid` | [MsgPlaceBid](#ununifi.auction.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.auction.MsgPlaceBidResponse) | | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------------------------------------- | ----------------------------------------------------------- | ----------- | --------- | -------- | +| `PlaceBid` | [MsgPlaceBid](#ununifi.auction.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.auction.MsgPlaceBidResponse) | | | - - +

Top

## cdp/cdp.proto - - ### AugmentedCdp +| Field | Type | Label | Description | +| ------------------------- | ----------------------------------------------------- | ----- | ----------- | +| `cdp` | [Cdp](#ununifi.cdp.Cdp) | | | +| `collateral_value` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `collateralization_ratio` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `cdp` | [Cdp](#ununifi.cdp.Cdp) | | | -| `collateral_value` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `collateralization_ratio` | [string](#string) | | | +### Cdp +| Field | Type | Label | Description | +| ------------------ | ------------------------------------------------------- | ----- | ----------- | +| `id` | [uint64](#uint64) | | | +| `owner` | [string](#string) | | | +| `type` | [string](#string) | | | +| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `principal` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `accumulated_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `fees_updated` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `interest_factor` | [string](#string) | | | + +### CollateralParam +| Field | Type | Label | Description | +| ------------------------------------- | ----------------------------------------------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `type` | [string](#string) | | | +| `liquidation_ratio` | [string](#string) | | | +| `debt_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `stability_fee` | [string](#string) | | | +| `auction_size` | [string](#string) | | | +| `liquidation_penalty` | [string](#string) | | | +| `prefix` | [uint32](#uint32) | | | +| `spot_market_id` | [string](#string) | | | +| `liquidation_market_id` | [string](#string) | | | +| `keeper_reward_percentage` | [string](#string) | | | +| `check_collateralization_index_count` | [string](#string) | | | +| `conversion_factor` | [string](#string) | | | + - +### DebtParam -### Cdp +| Field | Type | Label | Description | +| --------------------------- | ----------------------------------------------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `reference_asset` | [string](#string) | | | +| `conversion_factor` | [string](#string) | | | +| `debt_floor` | [string](#string) | | | +| `global_debt_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `debt_denom` | [string](#string) | | | +| `surplus_auction_threshold` | [string](#string) | | | +| `surplus_auction_lot` | [string](#string) | | | +| `debt_auction_threshold` | [string](#string) | | | +| `debt_auction_lot` | [string](#string) | | | +| `circuit_breaker` | [bool](#bool) | | | + +### Deposit -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | -| `owner` | [string](#string) | | | -| `type` | [string](#string) | | | -| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `principal` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `accumulated_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `fees_updated` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `interest_factor` | [string](#string) | | | +| Field | Type | Label | Description | +| ----------- | ----------------------------------------------------- | ----- | ----------- | +| `cdp_id` | [uint64](#uint64) | | | +| `depositor` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### Params +| Field | Type | Label | Description | +| ------------------- | ----------------------------------------------- | -------- | ----------- | +| `collateral_params` | [CollateralParam](#ununifi.cdp.CollateralParam) | repeated | | +| `debt_params` | [DebtParam](#ununifi.cdp.DebtParam) | repeated | | + + - + -### CollateralParam + + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `type` | [string](#string) | | | -| `liquidation_ratio` | [string](#string) | | | -| `debt_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `stability_fee` | [string](#string) | | | -| `auction_size` | [string](#string) | | | -| `liquidation_penalty` | [string](#string) | | | -| `prefix` | [uint32](#uint32) | | | -| `spot_market_id` | [string](#string) | | | -| `liquidation_market_id` | [string](#string) | | | -| `keeper_reward_percentage` | [string](#string) | | | -| `check_collateralization_index_count` | [string](#string) | | | -| `conversion_factor` | [string](#string) | | | +## cdp/genesis.proto + +### GenesisAccumulationTime +| Field | Type | Label | Description | +| ---------------------------- | ------------------------------------------------------- | ----- | ----------- | +| `collateral_type` | [string](#string) | | | +| `previous_accumulation_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `interest_factor` | [string](#string) | | | + +### GenesisState - +GenesisState defines the cdp module's genesis state. -### DebtParam +| Field | Type | Label | Description | +| ----------------------------- | --------------------------------------------------------------- | -------- | --------------------------------------------------------------- | +| `params` | [Params](#ununifi.cdp.Params) | | | +| `cdps` | [Cdp](#ununifi.cdp.Cdp) | repeated | | +| `deposits` | [Deposit](#ununifi.cdp.Deposit) | repeated | | +| `starting_cdp_id` | [uint64](#uint64) | | | +| `gov_denom` | [string](#string) | | | +| `previous_accumulation_times` | [GenesisAccumulationTime](#ununifi.cdp.GenesisAccumulationTime) | repeated | | +| `total_principals` | [GenesisTotalPrincipal](#ununifi.cdp.GenesisTotalPrincipal) | repeated | this line is used by starport scaffolding # genesis/proto/state | + +### GenesisTotalPrincipal -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `reference_asset` | [string](#string) | | | -| `conversion_factor` | [string](#string) | | | -| `debt_floor` | [string](#string) | | | -| `global_debt_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `debt_denom` | [string](#string) | | | -| `surplus_auction_threshold` | [string](#string) | | | -| `surplus_auction_lot` | [string](#string) | | | -| `debt_auction_threshold` | [string](#string) | | | -| `debt_auction_lot` | [string](#string) | | | -| `circuit_breaker` | [bool](#bool) | | | +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `collateral_type` | [string](#string) | | | +| `total_principal` | [string](#string) | | | + + + + + - +

Top

-### Deposit +## cdp/query.proto + +### QueryAllAccountRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `cdp_id` | [uint64](#uint64) | | | -| `depositor` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryAllAccountResponse +| Field | Type | Label | Description | +| ---------- | ------------------------------------------- | -------- | ----------- | +| `accounts` | [google.protobuf.Any](#google.protobuf.Any) | repeated | | + +### QueryAllCdpRequest +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - + -### Params +### QueryAllCdpResponse +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `cdp` | [AugmentedCdp](#ununifi.cdp.AugmentedCdp) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `collateral_params` | [CollateralParam](#ununifi.cdp.CollateralParam) | repeated | | -| `debt_params` | [DebtParam](#ununifi.cdp.DebtParam) | repeated | | - - +### QueryAllDepositRequest +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `collateral_type` | [string](#string) | | | + - +### QueryAllDepositResponse - +| Field | Type | Label | Description | +| ---------- | ------------------------------- | -------- | ----------- | +| `deposits` | [Deposit](#ununifi.cdp.Deposit) | repeated | | - + - +### QueryGetCdpRequest +this line is used by starport scaffolding # 3 +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `collateral_type` | [string](#string) | | | - -

Top

+ -## cdp/genesis.proto +### QueryGetCdpResponse +| Field | Type | Label | Description | +| ----- | ----------------------------------------- | ----- | ----------- | +| `cdp` | [AugmentedCdp](#ununifi.cdp.AugmentedCdp) | | | + - +### QueryParamsRequest -### GenesisAccumulationTime + +### QueryParamsResponse +| Field | Type | Label | Description | +| -------- | ----------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.cdp.Params) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `collateral_type` | [string](#string) | | | -| `previous_accumulation_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `interest_factor` | [string](#string) | | | + + + + +### Query +Query defines the gRPC querier service. - +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------ | ------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------- | --------- | ----------------------------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.cdp.QueryParamsRequest) | [QueryParamsResponse](#ununifi.cdp.QueryParamsResponse) | | GET | /ununifi/cdp/params | +| `Cdp` | [QueryGetCdpRequest](#ununifi.cdp.QueryGetCdpRequest) | [QueryGetCdpResponse](#ununifi.cdp.QueryGetCdpResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/cdp/cdps/owners/{owner}/collateral-types/{collateral_type}/cdp | +| `CdpAll` | [QueryAllCdpRequest](#ununifi.cdp.QueryAllCdpRequest) | [QueryAllCdpResponse](#ununifi.cdp.QueryAllCdpResponse) | | GET | /ununifi/cdp/cdps | +| `AccountAll` | [QueryAllAccountRequest](#ununifi.cdp.QueryAllAccountRequest) | [QueryAllAccountResponse](#ununifi.cdp.QueryAllAccountResponse) | | GET | /ununifi/cdp/accounts | +| `DepositAll` | [QueryAllDepositRequest](#ununifi.cdp.QueryAllDepositRequest) | [QueryAllDepositResponse](#ununifi.cdp.QueryAllDepositResponse) | | GET | /ununifi/cdp/deposits/owners/{owner}/collateral-types/{collateral_type} | -### GenesisState -GenesisState defines the cdp module's genesis state. + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.cdp.Params) | | | -| `cdps` | [Cdp](#ununifi.cdp.Cdp) | repeated | | -| `deposits` | [Deposit](#ununifi.cdp.Deposit) | repeated | | -| `starting_cdp_id` | [uint64](#uint64) | | | -| `gov_denom` | [string](#string) | | | -| `previous_accumulation_times` | [GenesisAccumulationTime](#ununifi.cdp.GenesisAccumulationTime) | repeated | | -| `total_principals` | [GenesisTotalPrincipal](#ununifi.cdp.GenesisTotalPrincipal) | repeated | this line is used by starport scaffolding # genesis/proto/state | +

Top

+## cdp/tx.proto + +### MsgCreateCdp +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `principal` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `collateral_type` | [string](#string) | | | + - +### MsgCreateCdpResponse -### GenesisTotalPrincipal + +### MsgDeposit +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `depositor` | [string](#string) | | | +| `owner` | [string](#string) | | | +| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `collateral_type` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `collateral_type` | [string](#string) | | | -| `total_principal` | [string](#string) | | | + +### MsgDepositResponse + +### MsgDrawDebt +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `collateral_type` | [string](#string) | | | +| `principal` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - + - +### MsgDrawDebtResponse - + - +### MsgLiquidate +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `keeper` | [string](#string) | | | +| `borrower` | [string](#string) | | | +| `collateral_type` | [string](#string) | | | + - -

Top

+### MsgLiquidateResponse -## cdp/query.proto + +### MsgRepayDebt +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `collateral_type` | [string](#string) | | | +| `payment` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - + -### QueryAllAccountRequest +### MsgRepayDebtResponse + +### MsgWithdraw +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `depositor` | [string](#string) | | | +| `owner` | [string](#string) | | | +| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `collateral_type` | [string](#string) | | | + +### MsgWithdrawResponse + - + -### QueryAllAccountResponse + + +### Msg -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `accounts` | [google.protobuf.Any](#google.protobuf.Any) | repeated | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ----------------------------------------- | --------------------------------------------------------- | ----------- | --------- | -------- | +| `CreateCdp` | [MsgCreateCdp](#ununifi.cdp.MsgCreateCdp) | [MsgCreateCdpResponse](#ununifi.cdp.MsgCreateCdpResponse) | | | +| `Deposit` | [MsgDeposit](#ununifi.cdp.MsgDeposit) | [MsgDepositResponse](#ununifi.cdp.MsgDepositResponse) | | | +| `Withdraw` | [MsgWithdraw](#ununifi.cdp.MsgWithdraw) | [MsgWithdrawResponse](#ununifi.cdp.MsgWithdrawResponse) | | | +| `DrawDebt` | [MsgDrawDebt](#ununifi.cdp.MsgDrawDebt) | [MsgDrawDebtResponse](#ununifi.cdp.MsgDrawDebtResponse) | | | +| `RepayDebt` | [MsgRepayDebt](#ununifi.cdp.MsgRepayDebt) | [MsgRepayDebtResponse](#ununifi.cdp.MsgRepayDebtResponse) | | | +| `Liquidate` | [MsgLiquidate](#ununifi.cdp.MsgLiquidate) | [MsgLiquidateResponse](#ununifi.cdp.MsgLiquidateResponse) | | | + + +

Top

+## derivatives/derivatives.proto + - +### EventPriceIsNotFed -### QueryAllCdpRequest +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `asset` | [string](#string) | | | + +### Market -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `base_denom` | [string](#string) | | | +| `quote_denom` | [string](#string) | | | + +### PoolAssetConf +| Field | Type | Label | Description | +| --------------- | ----------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `target_weight` | [string](#string) | | | + +### PoolMarketCap - +| Field | Type | Label | Description | +| -------------- | ----------------------------------------------------------------------- | -------- | ----------- | +| `quote_ticker` | [string](#string) | | | +| `total` | [string](#string) | | | +| `asset_info` | [PoolMarketCap.AssetInfo](#ununifi.derivatives.PoolMarketCap.AssetInfo) | repeated | | -### QueryAllCdpResponse + +### PoolMarketCap.AssetInfo +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `amount` | [string](#string) | | | +| `price` | [string](#string) | | | +| `reserved` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `cdp` | [AugmentedCdp](#ununifi.cdp.AugmentedCdp) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### PoolParams +| Field | Type | Label | Description | +| -------------------------------- | --------------------------------------------------- | -------- | ----------- | +| `quote_ticker` | [string](#string) | | | +| `base_lpt_mint_fee` | [string](#string) | | | +| `base_lpt_redeem_fee` | [string](#string) | | | +| `borrowing_fee_rate_per_hour` | [string](#string) | | | +| `report_liquidation_reward_rate` | [string](#string) | | | +| `report_levy_period_reward_rate` | [string](#string) | | | +| `accepted_assets_conf` | [PoolAssetConf](#ununifi.derivatives.PoolAssetConf) | repeated | | + +### Position +| Field | Type | Label | Description | +| ------------------------ | ------------------------------------------------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `market` | [Market](#ununifi.derivatives.Market) | | | +| `address` | [string](#string) | | | +| `opened_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `opened_height` | [uint64](#uint64) | | | +| `opened_base_rate` | [string](#string) | | | +| `opened_quote_rate` | [string](#string) | | | +| `remaining_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `levied_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `levied_amount_negative` | [bool](#bool) | | | +| `last_levied_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `position_instance` | [google.protobuf.Any](#google.protobuf.Any) | | | - + -### QueryAllDepositRequest +### QueriedPosition +| Field | Type | Label | Description | +| ------------------------- | ----------------------------------------------------- | ----- | ----------- | +| `position` | [Position](#ununifi.derivatives.Position) | | | +| `valuation_profit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `remaining_margin_value` | [string](#string) | | | +| `effective_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `margin_maintenance_rate` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `collateral_type` | [string](#string) | | | + +### PositionType +| Name | Number | Description | +| ---------------- | ------ | ----------- | +| POSITION_UNKNOWN | 0 | | +| LONG | 1 | | +| SHORT | 2 | | + + + - + -### QueryAllDepositResponse +

Top

+## derivatives/perpetual_futures.proto + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `deposits` | [Deposit](#ununifi.cdp.Deposit) | repeated | | +### EventLossToLP +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `position_id` | [string](#string) | | | +| `loss_amount` | [string](#string) | | | + +### EventPerpetualFuturesPositionClosed +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `position_id` | [string](#string) | | | +| `position_size` | [string](#string) | | | +| `pnl_amount` | [string](#string) | | | +| `returning_amount` | [string](#string) | | | + - +### EventPerpetualFuturesPositionLevied -### QueryGetCdpRequest -this line is used by starport scaffolding # 3 +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `reward_recipient` | [string](#string) | | | +| `position_id` | [string](#string) | | | +| `remaining_margin` | [string](#string) | | | +| `reward_amount` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `collateral_type` | [string](#string) | | | +### EventPerpetualFuturesPositionLiquidated +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `reward_recipient` | [string](#string) | | | +| `position_id` | [string](#string) | | | +| `remaining_margin` | [string](#string) | | | +| `reward_amount` | [string](#string) | | | + +### EventPerpetualFuturesPositionOpened +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `position_id` | [string](#string) | | | + - +### PerpetualFuturesGrossPositionOfMarket -### QueryGetCdpResponse +| Field | Type | Label | Description | +| --------------------------------- | ------------------------------------------------- | ----- | ----------- | +| `market` | [Market](#ununifi.derivatives.Market) | | | +| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | +| `position_size_in_denom_exponent` | [string](#string) | | | + +### PerpetualFuturesParams -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `cdp` | [AugmentedCdp](#ununifi.cdp.AugmentedCdp) | | | +| Field | Type | Label | Description | +| ------------------------------------------------- | ------------------------------------- | -------- | ----------- | +| `commission_rate` | [string](#string) | | | +| `margin_maintenance_rate` | [string](#string) | | | +| `imaginary_funding_rate_proportional_coefficient` | [string](#string) | | | +| `markets` | [Market](#ununifi.derivatives.Market) | repeated | | +| `max_leverage` | [uint32](#uint32) | | | + +### PerpetualFuturesPosition +| Field | Type | Label | Description | +| ------------------------ | ----------------------------------------------------------------------------------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `market` | [Market](#ununifi.derivatives.Market) | | | +| `address` | [string](#string) | | | +| `opened_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `opened_height` | [uint64](#uint64) | | | +| `opened_base_rate` | [string](#string) | | | +| `opened_quote_rate` | [string](#string) | | | +| `remaining_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `levied_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `levied_amount_negative` | [bool](#bool) | | | +| `last_levied_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `position_instance` | [PerpetualFuturesPositionInstance](#ununifi.derivatives.PerpetualFuturesPositionInstance) | | | + +### PerpetualFuturesPositionInstance - +| Field | Type | Label | Description | +| --------------- | ------------------------------------------------- | ----- | ----------- | +| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | +| `size` | [string](#string) | | | +| `leverage` | [uint32](#uint32) | | | -### QueryParamsRequest + + + + + +

Top

+## derivatives/perpetual_options.proto - + -### QueryParamsResponse +### PerpetualOptionsParams +| Field | Type | Label | Description | +| ------------------------------------------------- | ------------------------------------- | -------- | ----------- | +| `premium_commission_rate` | [string](#string) | | | +| `strike_commission_rate` | [string](#string) | | | +| `margin_maintenance_rate` | [string](#string) | | | +| `imaginary_funding_rate_proportional_coefficient` | [string](#string) | | | +| `markets` | [Market](#ununifi.derivatives.Market) | repeated | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.cdp.Params) | | | +### PerpetualOptionsPositionInstance +| Field | Type | Label | Description | +| --------------- | ------------------------------------------------- | ----- | ----------- | +| `option_type` | [OptionType](#ununifi.derivatives.OptionType) | | | +| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | +| `strike_price` | [string](#string) | | | +| `premium` | [string](#string) | | | + + +### OptionType - +| Name | Number | Description | +| -------------- | ------ | ----------- | +| OPTION_UNKNOWN | 0 | | +| CALL | 1 | | +| PUT | 2 | | - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.cdp.QueryParamsRequest) | [QueryParamsResponse](#ununifi.cdp.QueryParamsResponse) | | GET|/ununifi/cdp/params| -| `Cdp` | [QueryGetCdpRequest](#ununifi.cdp.QueryGetCdpRequest) | [QueryGetCdpResponse](#ununifi.cdp.QueryGetCdpResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/cdp/cdps/owners/{owner}/collateral-types/{collateral_type}/cdp| -| `CdpAll` | [QueryAllCdpRequest](#ununifi.cdp.QueryAllCdpRequest) | [QueryAllCdpResponse](#ununifi.cdp.QueryAllCdpResponse) | | GET|/ununifi/cdp/cdps| -| `AccountAll` | [QueryAllAccountRequest](#ununifi.cdp.QueryAllAccountRequest) | [QueryAllAccountResponse](#ununifi.cdp.QueryAllAccountResponse) | | GET|/ununifi/cdp/accounts| -| `DepositAll` | [QueryAllDepositRequest](#ununifi.cdp.QueryAllDepositRequest) | [QueryAllDepositResponse](#ununifi.cdp.QueryAllDepositResponse) | | GET|/ununifi/cdp/deposits/owners/{owner}/collateral-types/{collateral_type}| - + - -

Top

-## cdp/tx.proto +## derivatives/params.proto + +### Params - +| Field | Type | Label | Description | +| ------------------- | --------------------------------------------------------------------- | ----- | ----------- | +| `pool_params` | [PoolParams](#ununifi.derivatives.PoolParams) | | | +| `perpetual_futures` | [PerpetualFuturesParams](#ununifi.derivatives.PerpetualFuturesParams) | | | +| `perpetual_options` | [PerpetualOptionsParams](#ununifi.derivatives.PerpetualOptionsParams) | | | -### MsgCreateCdp + + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `principal` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `collateral_type` | [string](#string) | | | + + +

Top

+## derivatives/genesis.proto + +### GenesisState - +GenesisState defines the derivatives module's genesis state. -### MsgCreateCdpResponse +| Field | Type | Label | Description | +| -------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.derivatives.Params) | | | +| `positions` | [Position](#ununifi.derivatives.Position) | repeated | | +| `pool_market_cap` | [PoolMarketCap](#ununifi.derivatives.PoolMarketCap) | | | +| `perpetual_futures_gross_position_of_market` | [PerpetualFuturesGrossPositionOfMarket](#ununifi.derivatives.PerpetualFuturesGrossPositionOfMarket) | repeated | | + + + + + +

Top

- +## derivatives/query.proto -### MsgDeposit + +### QueryAddressPositionsRequest +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `address` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `depositor` | [string](#string) | | | -| `owner` | [string](#string) | | | -| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `collateral_type` | [string](#string) | | | + +### QueryAddressPositionsResponse +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `positions` | [QueriedPosition](#ununifi.derivatives.QueriedPosition) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### QueryAllPositionsRequest +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - + -### MsgDepositResponse +### QueryAllPositionsResponse +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `positions` | [QueriedPosition](#ununifi.derivatives.QueriedPosition) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### QueryAvailableAssetInPoolByDenomRequest +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `denom` | [string](#string) | | | + +### QueryAvailableAssetInPoolByDenomResponse - +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `available_asset` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -### MsgDrawDebt + +### QueryAvailableAssetsInPoolRequest + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `collateral_type` | [string](#string) | | | -| `principal` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +### QueryAvailableAssetsInPoolResponse +| Field | Type | Label | Description | +| ------------------ | ----------------------------------------------------- | -------- | ----------- | +| `available_assets` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + +### QueryDLPTokenRateRequest + +### QueryDLPTokenRateResponse - +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | -------- | ----------- | +| `symbol` | [string](#string) | | | +| `rates` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -### MsgDrawDebtResponse + +### QueryEstimateDLPTokenAmountRequest +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `mint_denom` | [string](#string) | | | +| `amount` | [string](#string) | | | + +### QueryEstimateDLPTokenAmountResponse +| Field | Type | Label | Description | +| ---------------------- | ----------------------------------------------------- | ----- | ----------- | +| `estimated_dlp_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `deposit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + - +### QueryEstimateRedeemAmountRequest -### MsgLiquidate +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `redeem_denom` | [string](#string) | | | +| `lpt_amount` | [string](#string) | | | + +### QueryEstimateRedeemAmountResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `keeper` | [string](#string) | | | -| `borrower` | [string](#string) | | | -| `collateral_type` | [string](#string) | | | +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryLiquidityProviderTokenNominalAPYRequest +| Field | Type | Label | Description | +| --------------- | --------------- | ----- | ----------- | +| `before_height` | [int64](#int64) | | | +| `after_height` | [int64](#int64) | | | + +### QueryLiquidityProviderTokenNominalAPYResponse - +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| `apy` | [string](#string) | | | -### MsgLiquidateResponse + +### QueryLiquidityProviderTokenRealAPYRequest +| Field | Type | Label | Description | +| --------------- | --------------- | ----- | ----------- | +| `before_height` | [int64](#int64) | | | +| `after_height` | [int64](#int64) | | | + +### QueryLiquidityProviderTokenRealAPYResponse +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| `apy` | [string](#string) | | | + - +### QueryParamsRequest -### MsgRepayDebt +QueryParamsRequest is request type for the Query/Params RPC method. + +### QueryParamsResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `collateral_type` | [string](#string) | | | -| `payment` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +QueryParamsResponse is response type for the Query/Params RPC method. +| Field | Type | Label | Description | +| -------- | ------------------------------------- | ----- | ----------------------------------------------- | +| `params` | [Params](#ununifi.derivatives.Params) | | params holds all the parameters of this module. | + +### QueryPerpetualFuturesMarketRequest +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `base_denom` | [string](#string) | | | +| `quote_denom` | [string](#string) | | | + - +### QueryPerpetualFuturesMarketResponse -### MsgRepayDebtResponse +| Field | Type | Label | Description | +| ---------------------- | ----------------- | ----- | ----------- | +| `price` | [string](#string) | | | +| `metrics_quote_ticker` | [string](#string) | | | +| `volume_24hours` | [string](#string) | | | +| `fees_24hours` | [string](#string) | | | +| `long_positions` | [string](#string) | | | +| `short_positions` | [string](#string) | | | + +### QueryPerpetualFuturesPositionSizeRequest +| Field | Type | Label | Description | +| --------------- | ------------------------------------------------- | ----- | ----------- | +| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | +| `address` | [string](#string) | | | + +### QueryPerpetualFuturesPositionSizeResponse +| Field | Type | Label | Description | +| ------------------------- | ----------------------------------------------------- | ----- | ----------- | +| `total_position_size_usd` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - -### MsgWithdraw - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `depositor` | [string](#string) | | | -| `owner` | [string](#string) | | | -| `collateral` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `collateral_type` | [string](#string) | | | + +### QueryPerpetualFuturesRequest + +### QueryPerpetualFuturesResponse +| Field | Type | Label | Description | +| ---------------------- | ----------------------------------------------------- | ----- | ----------- | +| `metrics_quote_ticker` | [string](#string) | | | +| `volume_24hours` | [string](#string) | | | +| `fees_24hours` | [string](#string) | | | +| `long_positions` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `short_positions` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + - +### QueryPerpetualOptionsMarketRequest -### MsgWithdrawResponse +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `base_denom` | [string](#string) | | | +| `quote_denom` | [string](#string) | | | + +### QueryPerpetualOptionsMarketResponse + +### QueryPerpetualOptionsRequest + - +### QueryPerpetualOptionsResponse - + - +### QueryPoolRequest +this line is used by starport scaffolding # 3 - + -### Msg +### QueryPoolResponse +| Field | Type | Label | Description | +| ---------------------- | --------------------------------------------------- | ----- | ----------- | +| `metrics_quote_ticker` | [string](#string) | | | +| `pool_market_cap` | [PoolMarketCap](#ununifi.derivatives.PoolMarketCap) | | | +| `volume_24hours` | [string](#string) | | | +| `fees_24hours` | [string](#string) | | | -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `CreateCdp` | [MsgCreateCdp](#ununifi.cdp.MsgCreateCdp) | [MsgCreateCdpResponse](#ununifi.cdp.MsgCreateCdpResponse) | | | -| `Deposit` | [MsgDeposit](#ununifi.cdp.MsgDeposit) | [MsgDepositResponse](#ununifi.cdp.MsgDepositResponse) | | | -| `Withdraw` | [MsgWithdraw](#ununifi.cdp.MsgWithdraw) | [MsgWithdrawResponse](#ununifi.cdp.MsgWithdrawResponse) | | | -| `DrawDebt` | [MsgDrawDebt](#ununifi.cdp.MsgDrawDebt) | [MsgDrawDebtResponse](#ununifi.cdp.MsgDrawDebtResponse) | | | -| `RepayDebt` | [MsgRepayDebt](#ununifi.cdp.MsgRepayDebt) | [MsgRepayDebtResponse](#ununifi.cdp.MsgRepayDebtResponse) | | | -| `Liquidate` | [MsgLiquidate](#ununifi.cdp.MsgLiquidate) | [MsgLiquidateResponse](#ununifi.cdp.MsgLiquidateResponse) | | | + - +### QueryPositionRequest +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `position_id` | [string](#string) | | | + - -

Top

+### QueryPositionResponse -## derivatives/derivatives.proto +| Field | Type | Label | Description | +| ------------------------- | ----------------------------------------------------- | ----- | ----------- | +| `position` | [Position](#ununifi.derivatives.Position) | | | +| `valuation_profit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `margin_maintenance_rate` | [string](#string) | | | +| `effective_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + - + -### EventPriceIsNotFeeded + +### Query +Query defines the gRPC querier service. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `asset` | [string](#string) | | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | --------- | -------------------------------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.derivatives.QueryParamsRequest) | [QueryParamsResponse](#ununifi.derivatives.QueryParamsResponse) | Parameters queries the parameters of the module. | GET | /ununifi/derivatives/params | +| `Pool` | [QueryPoolRequest](#ununifi.derivatives.QueryPoolRequest) | [QueryPoolResponse](#ununifi.derivatives.QueryPoolResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/derivatives/pool | +| `LiquidityProviderTokenRealAPY` | [QueryLiquidityProviderTokenRealAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYRequest) | [QueryLiquidityProviderTokenRealAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYResponse) | | GET | /ununifi/derivatives/liquidity-providers/real-apy | +| `LiquidityProviderTokenNominalAPY` | [QueryLiquidityProviderTokenNominalAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYRequest) | [QueryLiquidityProviderTokenNominalAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYResponse) | | GET | /ununifi/derivatives/liquidity-providers/nominal-apy | +| `PerpetualFutures` | [QueryPerpetualFuturesRequest](#ununifi.derivatives.QueryPerpetualFuturesRequest) | [QueryPerpetualFuturesResponse](#ununifi.derivatives.QueryPerpetualFuturesResponse) | | GET | /ununifi/derivatives/perpetual-futures | +| `PerpetualFuturesMarket` | [QueryPerpetualFuturesMarketRequest](#ununifi.derivatives.QueryPerpetualFuturesMarketRequest) | [QueryPerpetualFuturesMarketResponse](#ununifi.derivatives.QueryPerpetualFuturesMarketResponse) | | GET | /ununifi/derivatives/perpetual-futures/{base_denom}/{quote_denom} | +| `PerpetualOptions` | [QueryPerpetualOptionsRequest](#ununifi.derivatives.QueryPerpetualOptionsRequest) | [QueryPerpetualOptionsResponse](#ununifi.derivatives.QueryPerpetualOptionsResponse) | | GET | /ununifi/derivatives/perpetual-options | +| `PerpetualOptionsMarket` | [QueryPerpetualOptionsMarketRequest](#ununifi.derivatives.QueryPerpetualOptionsMarketRequest) | [QueryPerpetualOptionsMarketResponse](#ununifi.derivatives.QueryPerpetualOptionsMarketResponse) | | GET | /ununifi/derivatives/perpetual-options/{base_denom}/{quote_denom} | +| `AllPositions` | [QueryAllPositionsRequest](#ununifi.derivatives.QueryAllPositionsRequest) | [QueryAllPositionsResponse](#ununifi.derivatives.QueryAllPositionsResponse) | | GET | /ununifi/derivatives/positions | +| `Position` | [QueryPositionRequest](#ununifi.derivatives.QueryPositionRequest) | [QueryPositionResponse](#ununifi.derivatives.QueryPositionResponse) | | GET | /ununifi/derivatives/positions/{position_id} | +| `PerpetualFuturesPositionSize` | [QueryPerpetualFuturesPositionSizeRequest](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeRequest) | [QueryPerpetualFuturesPositionSizeResponse](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeResponse) | | GET | /ununifi/derivatives/positions/perpetual-futures/{position_type}/{address} | +| `AddressPositions` | [QueryAddressPositionsRequest](#ununifi.derivatives.QueryAddressPositionsRequest) | [QueryAddressPositionsResponse](#ununifi.derivatives.QueryAddressPositionsResponse) | | GET | /ununifi/derivatives/{address}/positions | +| `DLPTokenRates` | [QueryDLPTokenRateRequest](#ununifi.derivatives.QueryDLPTokenRateRequest) | [QueryDLPTokenRateResponse](#ununifi.derivatives.QueryDLPTokenRateResponse) | | GET | /ununifi/derivatives/pools/dlp | +| `EstimateDLPTokenAmount` | [QueryEstimateDLPTokenAmountRequest](#ununifi.derivatives.QueryEstimateDLPTokenAmountRequest) | [QueryEstimateDLPTokenAmountResponse](#ununifi.derivatives.QueryEstimateDLPTokenAmountResponse) | | GET | /ununifi/derivatives/estimate-dlp-token-amount/{mint_denom}/{amount} | +| `EstimateRedeemAmount` | [QueryEstimateRedeemAmountRequest](#ununifi.derivatives.QueryEstimateRedeemAmountRequest) | [QueryEstimateRedeemAmountResponse](#ununifi.derivatives.QueryEstimateRedeemAmountResponse) | | GET | /ununifi/derivatives/estimate-redeem-amount/{redeem_denom}/{lpt_amount} | +| `AvailableAssetInPoolByDenom` | [QueryAvailableAssetInPoolByDenomRequest](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomRequest) | [QueryAvailableAssetInPoolByDenomResponse](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomResponse) | | GET | /ununifi/derivatives/pools/available-asset/{denom} | +| `AvailableAssetsInPool` | [QueryAvailableAssetsInPoolRequest](#ununifi.derivatives.QueryAvailableAssetsInPoolRequest) | [QueryAvailableAssetsInPoolResponse](#ununifi.derivatives.QueryAvailableAssetsInPoolResponse) | | GET | /ununifi/derivatives/pools/available-assets | + + +

Top

+## derivatives/tx.proto + - +### MsgClosePosition -### Market +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `position_id` | [string](#string) | | | + +### MsgClosePositionResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_denom` | [string](#string) | | | -| `quote_denom` | [string](#string) | | | + +### MsgDepositToPool +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgDepositToPoolResponse + - +### MsgOpenPosition -### PoolAssetConf +| Field | Type | Label | Description | +| ------------------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `market` | [Market](#ununifi.derivatives.Market) | | | +| `position_instance` | [google.protobuf.Any](#google.protobuf.Any) | | | + +### MsgOpenPositionResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `target_weight` | [string](#string) | | | + +### MsgReportLevyPeriod +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `position_id` | [string](#string) | | | +| `reward_recipient` | [string](#string) | | | + +### MsgReportLevyPeriodResponse + - +### MsgReportLiquidation -### PoolMarketCap +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `position_id` | [string](#string) | | | +| `reward_recipient` | [string](#string) | | | + +### MsgReportLiquidationResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `quote_ticker` | [string](#string) | | | -| `total` | [string](#string) | | | -| `asset_info` | [PoolMarketCap.AssetInfo](#ununifi.derivatives.PoolMarketCap.AssetInfo) | repeated | | + +### MsgWithdrawFromPool +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `lpt_amount` | [string](#string) | | | +| `redeem_denom` | [string](#string) | | | + +### MsgWithdrawFromPoolResponse + - + -### PoolMarketCap.AssetInfo + + +### Msg -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `amount` | [string](#string) | | | -| `price` | [string](#string) | | | -| `reserved` | [string](#string) | | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------- | ----------- | --------- | -------- | +| `DepositToPool` | [MsgDepositToPool](#ununifi.derivatives.MsgDepositToPool) | [MsgDepositToPoolResponse](#ununifi.derivatives.MsgDepositToPoolResponse) | | | +| `WithdrawFromPool` | [MsgWithdrawFromPool](#ununifi.derivatives.MsgWithdrawFromPool) | [MsgWithdrawFromPoolResponse](#ununifi.derivatives.MsgWithdrawFromPoolResponse) | | | +| `OpenPosition` | [MsgOpenPosition](#ununifi.derivatives.MsgOpenPosition) | [MsgOpenPositionResponse](#ununifi.derivatives.MsgOpenPositionResponse) | | | +| `ClosePosition` | [MsgClosePosition](#ununifi.derivatives.MsgClosePosition) | [MsgClosePositionResponse](#ununifi.derivatives.MsgClosePositionResponse) | | | +| `ReportLiquidation` | [MsgReportLiquidation](#ununifi.derivatives.MsgReportLiquidation) | [MsgReportLiquidationResponse](#ununifi.derivatives.MsgReportLiquidationResponse) | | | +| `ReportLevyPeriod` | [MsgReportLevyPeriod](#ununifi.derivatives.MsgReportLevyPeriod) | [MsgReportLevyPeriodResponse](#ununifi.derivatives.MsgReportLevyPeriodResponse) | | | + + +

Top

+## ecosystem-incentive/ecosystem_incentive.proto + - +### IncentiveUnit -### PoolParams +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------ | -------- | ----------- | +| `id` | [string](#string) | | | +| `subject_info_lists` | [SubjectInfo](#ununifi.ecosystemincentive.SubjectInfo) | repeated | | + +### IncentiveUnitIdsByAddr -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `quote_ticker` | [string](#string) | | | -| `base_lpt_mint_fee` | [string](#string) | | | -| `base_lpt_redeem_fee` | [string](#string) | | | -| `borrowing_fee_rate_per_hour` | [string](#string) | | | -| `report_liquidation_reward_rate` | [string](#string) | | | -| `report_levy_period_reward_rate` | [string](#string) | | | -| `accepted_assets_conf` | [PoolAssetConf](#ununifi.derivatives.PoolAssetConf) | repeated | | +| Field | Type | Label | Description | +| -------------------- | ----------------- | -------- | ----------- | +| `address` | [string](#string) | | | +| `incentive_unit_ids` | [string](#string) | repeated | | + +### RewardStore +| Field | Type | Label | Description | +| -------------- | ----------------------------------------------------- | -------- | ----------- | +| `subject_addr` | [string](#string) | | | +| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + +### SubjectInfo - +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `subject_addr` | [string](#string) | | | +| `weight` | [string](#string) | | | -### Position + + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `market` | [Market](#ununifi.derivatives.Market) | | | -| `address` | [string](#string) | | | -| `opened_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `opened_height` | [uint64](#uint64) | | | -| `opened_base_rate` | [string](#string) | | | -| `opened_quote_rate` | [string](#string) | | | -| `remaining_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `last_levied_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `position_instance` | [google.protobuf.Any](#google.protobuf.Any) | | | + + +

Top

+## ecosystem-incentive/event.proto + +### EventDeletedNftIdRecordedForFrontendReward - +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `incentive_unit_id` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | -### QueriedPosition + +### EventFailedParsingMemoInputs +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `memo` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `position` | [Position](#ununifi.derivatives.Position) | | | -| `valuation_profit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `remaining_margin_value` | [string](#string) | | | -| `effective_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `margin_maintenance_rate` | [string](#string) | | | + +### EventNotRecordedNftId +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventNotRegisteredIncentiveUnitId - +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `incentive_unit_id` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + - +### EventRecordedIncentiveUnitId -### PositionType +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `incentive_unit_id` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + -| Name | Number | Description | -| ---- | ------ | ----------- | -| POSITION_UNKNOWN | 0 | | -| LONG | 1 | | -| SHORT | 2 | | +### EventRegister +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------ | -------- | ----------- | +| `incentive_unit_id` | [string](#string) | | | +| `subject_info_lists` | [SubjectInfo](#ununifi.ecosystemincentive.SubjectInfo) | repeated | | - + - +### EventUpdatedReward - +| Field | Type | Label | Description | +| ------------------- | ----------------------------------------------------- | ----- | ----------- | +| `incentive_unit_id` | [string](#string) | | | +| `earned_reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### EventVersionUnmatched - -

Top

+| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `unmatched_version` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | -## derivatives/perpetual_futures.proto + +### EventWithdrawAllRewards +| Field | Type | Label | Description | +| ----------------------- | ----------------------------------------------------- | -------- | ----------- | +| `sender` | [string](#string) | | | +| `all_withdrawn_rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - + -### EventLossToLP +### EventWithdrawReward +| Field | Type | Label | Description | +| ------------------ | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `withdrawn_reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `position_id` | [string](#string) | | | -| `loss_amount` | [string](#string) | | | + + + + +

Top

+## ecosystem-incentive/params.proto - + -### EventPerpetualFuturesPositionClosed +### Params +Params defines the parameters for the module. +| Field | Type | Label | Description | +| ------------------------------ | -------------------------------------------------------- | -------- | ----------- | +| `reward_params` | [RewardParams](#ununifi.ecosystemincentive.RewardParams) | repeated | | +| `max_incentive_unit_id_len` | [uint64](#uint64) | | | +| `max_subject_info_num_in_unit` | [uint64](#uint64) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `position_id` | [string](#string) | | | -| `fee_amount` | [string](#string) | | | -| `trade_amount` | [string](#string) | | | -| `returning_amount` | [string](#string) | | | + +### RewardParams +RewardParams defines which module have which rewards type and rate +to maintain the correctness of the fee rate in a module +e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, +the combined those rates for the incentive cannot be exceed 1 +| Field | Type | Label | Description | +| ------------- | ---------------------------------------------------- | -------- | ----------- | +| `module_name` | [string](#string) | | | +| `reward_rate` | [RewardRate](#ununifi.ecosystemincentive.RewardRate) | repeated | | + +### RewardRate - +RewardRate defines the ratio to take reward for a specific reward_type. +The total sum of reward_rate in a module cannot be exceed 1 -### EventPerpetualFuturesPositionLevied +| Field | Type | Label | Description | +| ------------- | ---------------------------------------------------- | ----- | ----------- | +| `reward_type` | [RewardType](#ununifi.ecosystemincentive.RewardType) | | | +| `rate` | [string](#string) | | | + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `reward_recipient` | [string](#string) | | | -| `position_id` | [string](#string) | | | -| `remaining_margin` | [string](#string) | | | -| `reward_amount` | [string](#string) | | | +### RewardType +At first, we go with this one type. +NFTMARKET_FRONTEND type reward will be disributed for the creators of frontend of UnUniFi's services. +| Name | Number | Description | +| ------------------ | ------ | ----------- | +| NFTMARKET_FRONTEND | 0 | | + + + - + -### EventPerpetualFuturesPositionLiquidated +

Top

+## ecosystem-incentive/genesis.proto + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `reward_recipient` | [string](#string) | | | -| `position_id` | [string](#string) | | | -| `remaining_margin` | [string](#string) | | | -| `reward_amount` | [string](#string) | | | +### GenesisState +GenesisState defines the ecosystemincentive module's genesis state. +| Field | Type | Label | Description | +| ----------------- | ---------------------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.ecosystemincentive.Params) | | | +| `incentive_units` | [IncentiveUnit](#ununifi.ecosystemincentive.IncentiveUnit) | repeated | | +| `reward_stores` | [RewardStore](#ununifi.ecosystemincentive.RewardStore) | repeated | | + + + - + -### EventPerpetualFuturesPositionOpened + +

Top

+## ecosystem-incentive/memo.proto -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `position_id` | [string](#string) | | | + +### MemoInputs +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `version` | [string](#string) | | | +| `incentive_unit_id` | [string](#string) | | | + + + - + -### PerpetualFuturesGrossPositionOfMarket + +

Top

+## ecosystem-incentive/query.proto -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market` | [Market](#ununifi.derivatives.Market) | | | -| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | -| `position_size_in_denom_exponent` | [string](#string) | | | + +### QueryAllRewardsRequest +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `subject_addr` | [string](#string) | | | + +### QueryAllRewardsResponse +| Field | Type | Label | Description | +| --------- | ------------------------------------------------------ | ----- | ----------- | +| `rewards` | [RewardStore](#ununifi.ecosystemincentive.RewardStore) | | | - + -### PerpetualFuturesParams +### QueryIncentiveUnitIdsByAddrRequest +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `address` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `commission_rate` | [string](#string) | | | -| `margin_maintenance_rate` | [string](#string) | | | -| `imaginary_funding_rate_proportional_coefficient` | [string](#string) | | | -| `markets` | [Market](#ununifi.derivatives.Market) | repeated | | -| `max_leverage` | [uint32](#uint32) | | | +### QueryIncentiveUnitIdsByAddrResponse +| Field | Type | Label | Description | +| ---------------------------- | ---------------------------------------------------------------------------- | ----- | ----------- | +| `incentive_unit_ids_by_addr` | [IncentiveUnitIdsByAddr](#ununifi.ecosystemincentive.IncentiveUnitIdsByAddr) | | | + +### QueryIncentiveUnitRequest +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `incentive_unit_id` | [string](#string) | | | + - +### QueryIncentiveUnitResponse -### PerpetualFuturesPosition +| Field | Type | Label | Description | +| ---------------- | ---------------------------------------------------------- | ----- | ----------- | +| `incentive_unit` | [IncentiveUnit](#ununifi.ecosystemincentive.IncentiveUnit) | | | + +### QueryParamsRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `market` | [Market](#ununifi.derivatives.Market) | | | -| `address` | [string](#string) | | | -| `opened_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `opened_height` | [uint64](#uint64) | | | -| `opened_base_rate` | [string](#string) | | | -| `opened_quote_rate` | [string](#string) | | | -| `remaining_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `last_levied_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `position_instance` | [PerpetualFuturesPositionInstance](#ununifi.derivatives.PerpetualFuturesPositionInstance) | | | + +### QueryParamsResponse +| Field | Type | Label | Description | +| -------- | -------------------------------------------- | ----- | ----------------------------------------------- | +| `params` | [Params](#ununifi.ecosystemincentive.Params) | | params holds all the parameters of this module. | + +### QueryRecordedIncentiveUnitIdRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | - + -### PerpetualFuturesPositionInstance +### QueryRecordedIncentiveUnitIdResponse +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `incentive_unit_id` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | -| `size` | [string](#string) | | | -| `leverage` | [uint32](#uint32) | | | +### QueryRewardRequest +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `subject_addr` | [string](#string) | | | +| `denom` | [string](#string) | | | + +### QueryRewardResponse +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | @@ -1901,67 +2356,107 @@ Query defines the gRPC querier service. - + +### Query +Query defines the gRPC querier service. - -

Top

+| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | --------- | --------------------------------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.ecosystemincentive.QueryParamsRequest) | [QueryParamsResponse](#ununifi.ecosystemincentive.QueryParamsResponse) | Parameters queries the parameters of the module. | GET | /ununifi/ecosystem_incentive/params | +| `IncentiveUnit` | [QueryIncentiveUnitRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitRequest) | [QueryIncentiveUnitResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitResponse) | | GET | /ununifi/ecosystem_incentive/incentive_unit/{incentive_unit_id} | +| `AllRewards` | [QueryAllRewardsRequest](#ununifi.ecosystemincentive.QueryAllRewardsRequest) | [QueryAllRewardsResponse](#ununifi.ecosystemincentive.QueryAllRewardsResponse) | | GET | /ununifi/ecosystem_incentive/all_rewards/{subject_addr} | +| `Reward` | [QueryRewardRequest](#ununifi.ecosystemincentive.QueryRewardRequest) | [QueryRewardResponse](#ununifi.ecosystemincentive.QueryRewardResponse) | | GET | /ununifi/ecosystem_incentive/reward/{subject_addr}/{denom} | +| `RecordedIncentiveUnitId` | [QueryRecordedIncentiveUnitIdRequest](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdRequest) | [QueryRecordedIncentiveUnitIdResponse](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdResponse) | | GET | /ununifi/ecosystem_incentive/recorded_incentive_unit_id/{class_id}/{nft_id} | +| `IncentiveUnitIdsByAddr` | [QueryIncentiveUnitIdsByAddrRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrRequest) | [QueryIncentiveUnitIdsByAddrResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrResponse) | | GET | /ununifi/ecosystem_incentive/incentive_unit_ids_by_addr/{address} | -## derivatives/perpetual_options.proto + + +

Top

- +## ecosystem-incentive/tx.proto -### PerpetualOptionsParams + +### MsgRegister +| Field | Type | Label | Description | +| ------------------- | ----------------- | -------- | ----------- | +| `sender` | [string](#string) | | | +| `incentive_unit_id` | [string](#string) | | | +| `subject_addrs` | [string](#string) | repeated | | +| `weights` | [string](#string) | repeated | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `premium_commission_rate` | [string](#string) | | | -| `strike_commission_rate` | [string](#string) | | | -| `margin_maintenance_rate` | [string](#string) | | | -| `imaginary_funding_rate_proportional_coefficient` | [string](#string) | | | -| `markets` | [Market](#ununifi.derivatives.Market) | repeated | | + +### MsgRegisterResponse + +### MsgWithdrawAllRewards +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | + - +### MsgWithdrawAllRewardsResponse -### PerpetualOptionsPositionInstance + +### MsgWithdrawReward +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `denom` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `option_type` | [OptionType](#ununifi.derivatives.OptionType) | | | -| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | -| `strike_price` | [string](#string) | | | -| `premium` | [string](#string) | | | + +### MsgWithdrawRewardResponse + + + - + +### Msg - +Msg defines the Msg service. -### OptionType +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| -------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ----------- | --------- | -------- | +| `Register` | [MsgRegister](#ununifi.ecosystemincentive.MsgRegister) | [MsgRegisterResponse](#ununifi.ecosystemincentive.MsgRegisterResponse) | | | +| `WithdrawAllRewards` | [MsgWithdrawAllRewards](#ununifi.ecosystemincentive.MsgWithdrawAllRewards) | [MsgWithdrawAllRewardsResponse](#ununifi.ecosystemincentive.MsgWithdrawAllRewardsResponse) | | | +| `WithdrawReward` | [MsgWithdrawReward](#ununifi.ecosystemincentive.MsgWithdrawReward) | [MsgWithdrawRewardResponse](#ununifi.ecosystemincentive.MsgWithdrawRewardResponse) | | | + + + + + +

Top

+ +## ethereum/signdoc.proto + + +### SignDocForMetamask -| Name | Number | Description | -| ---- | ------ | ----------- | -| OPTION_UNKNOWN | 0 | | -| CALL | 1 | | -| PUT | 2 | | +| Field | Type | Label | Description | +| ---------------- | --------------------------------------------------------- | ----- | ----------- | +| `body` | [cosmos.tx.v1beta1.TxBody](#cosmos.tx.v1beta1.TxBody) | | | +| `auth_info` | [cosmos.tx.v1beta1.AuthInfo](#cosmos.tx.v1beta1.AuthInfo) | | | +| `chain_id` | [string](#string) | | | +| `account_number` | [uint64](#uint64) | | | + @@ -1969,30 +2464,79 @@ Query defines the gRPC querier service. + - -

Top

-## derivatives/params.proto +## incentive/incentive.proto + +### BaseClaim - +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + +### BaseMultiClaim + +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | -------- | ----------- | +| `owner` | [string](#string) | | | +| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + +### CdpMintingClaim + +| Field | Type | Label | Description | +| ---------------- | --------------------------------------------- | -------- | ----------- | +| `base_claim` | [BaseClaim](#ununifi.incentive.BaseClaim) | | | +| `reward_indexes` | [RewardIndex](#ununifi.incentive.RewardIndex) | repeated | | + + + +### Multiplier + +| Field | Type | Label | Description | +| --------------- | ----------------- | ----- | ----------- | +| `name` | [string](#string) | | | +| `months_lockup` | [int64](#int64) | | | +| `factor` | [string](#string) | | | + + ### Params +| Field | Type | Label | Description | +| ---------------------------- | ------------------------------------------------------- | -------- | ----------- | +| `cdp_minting_reward_periods` | [RewardPeriod](#ununifi.incentive.RewardPeriod) | repeated | | +| `claim_multipliers` | [Multiplier](#ununifi.incentive.Multiplier) | repeated | | +| `claim_end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pool_params` | [PoolParams](#ununifi.derivatives.PoolParams) | | | -| `perpetual_futures` | [PerpetualFuturesParams](#ununifi.derivatives.PerpetualFuturesParams) | | | -| `perpetual_options` | [PerpetualOptionsParams](#ununifi.derivatives.PerpetualOptionsParams) | | | +### RewardIndex +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `collateral_type` | [string](#string) | | | +| `reward_factor` | [string](#string) | | | + +### RewardPeriod +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------- | ----- | ----------- | +| `active` | [bool](#bool) | | | +| `collateral_type` | [string](#string) | | | +| `start` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `rewards_per_second` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | @@ -2002,31 +2546,42 @@ Query defines the gRPC querier service. + - -

Top

-## derivatives/genesis.proto +## incentive/genesis.proto + +### GenesisAccumulationTime - +| Field | Type | Label | Description | +| ---------------------------- | ------------------------------------------------------- | ----- | ----------- | +| `collateral_type` | [string](#string) | | | +| `previous_accumulation_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -### GenesisState -GenesisState defines the derivatives module's genesis state. + +### GenesisDenoms -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.derivatives.Params) | | | -| `positions` | [Position](#ununifi.derivatives.Position) | repeated | | -| `pool_market_cap` | [PoolMarketCap](#ununifi.derivatives.PoolMarketCap) | | | -| `perpetual_futures_gross_position_of_market` | [PerpetualFuturesGrossPositionOfMarket](#ununifi.derivatives.PerpetualFuturesGrossPositionOfMarket) | repeated | | +| Field | Type | Label | Description | +| -------------------------- | ----------------- | ----- | ----------- | +| `principal_denom` | [string](#string) | | | +| `cdp_minting_reward_denom` | [string](#string) | | | + +### GenesisState +GenesisState defines the incentive module's genesis state. +| Field | Type | Label | Description | +| ------------------------ | --------------------------------------------------------------------- | -------- | --------------------------------------------------------------- | +| `params` | [Params](#ununifi.incentive.Params) | | | +| `cdp_accumulation_times` | [GenesisAccumulationTime](#ununifi.incentive.GenesisAccumulationTime) | repeated | | +| `cdp_minting_claims` | [CdpMintingClaim](#ununifi.incentive.CdpMintingClaim) | repeated | | +| `denoms` | [GenesisDenoms](#ununifi.incentive.GenesisDenoms) | | this line is used by starport scaffolding # genesis/proto/state | @@ -2036,809 +2591,1548 @@ GenesisState defines the derivatives module's genesis state. + - -

Top

-## derivatives/query.proto +## incentive/query.proto + +### QueryParamsRequest - + -### QueryAddressPositionsRequest +### QueryParamsResponse +| Field | Type | Label | Description | +| -------- | ----------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.incentive.Params) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + + + +### Query +Query defines the gRPC querier service. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ----------------------------------------------------------- | ------------------------------------------------------------- | --------------------------------------------- | --------- | ------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.incentive.QueryParamsRequest) | [QueryParamsResponse](#ununifi.incentive.QueryParamsResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/incentive/params | - + -### QueryAddressPositionsResponse + +

Top

+## incentive/tx.proto -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `positions` | [QueriedPosition](#ununifi.derivatives.QueriedPosition) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### MsgClaimCdpMintingReward +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `multiplier_name` | [string](#string) | | | + +### MsgClaimCdpMintingRewardResponse + - + -### QueryAllPositionsRequest + + +### Msg -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ----------- | --------- | -------- | +| `ClaimCdpMintingReward` | [MsgClaimCdpMintingReward](#ununifi.incentive.MsgClaimCdpMintingReward) | [MsgClaimCdpMintingRewardResponse](#ununifi.incentive.MsgClaimCdpMintingRewardResponse) | | | + + +

Top

+## nftmarket/nftmarket.proto + - +### BidId -### QueryAllPositionsResponse +| Field | Type | Label | Description | +| -------- | ------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `bidder` | [string](#string) | | | + + +### EventBorrow +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `borrower` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `amount` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `positions` | [QueriedPosition](#ununifi.derivatives.QueriedPosition) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### EventCancelBid +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventCancelListNfting +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | - + -### QueryAvailableAssetInPoolByDenomRequest +### EventEndListNfting +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | +### EventExpandListingPeriod +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventLiquidate +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `liquidator` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + - +### EventListNft -### QueryAvailableAssetInPoolByDenomResponse +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventPayFullBid -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `available_asset` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventPlaceBid +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `amount` | [string](#string) | | | + +### EventRepay - +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `borrower` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `amount` | [string](#string) | | | -### QueryAvailableAssetsInPoolRequest + +### EventSellingDecision +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### Liquidation +| Field | Type | Label | Description | +| ------------------ | ------------------------------------------------------- | ----- | ----------- | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `liquidation_date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | + - +### Liquidations -### QueryAvailableAssetsInPoolResponse +| Field | Type | Label | Description | +| ------------------ | --------------------------------------------- | -------- | ----------- | +| `liquidation` | [Liquidation](#ununifi.nftmarket.Liquidation) | | | +| `next_liquidation` | [Liquidation](#ununifi.nftmarket.Liquidation) | repeated | | + +### ListedClass -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `available_assets` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| Field | Type | Label | Description | +| ---------- | ----------------- | -------- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_ids` | [string](#string) | repeated | | + +### Loan +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `loan` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### NftBid - +| Field | Type | Label | Description | +| ---------------------- | ------------------------------------------------------- | -------- | ------------------------------------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `bidder` | [string](#string) | | | +| `price` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `paid_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `bidding_period` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `deposit_lending_rate` | [string](#string) | | | +| `automatic_payment` | [bool](#bool) | | | +| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `interest_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `borrowings` | [borrowing](#ununifi.nftmarket.borrowing) | repeated | lister borrowing bidder info | +| `id` | [BidId](#ununifi.nftmarket.BidId) | | todo remove nft_id,bidder then use it | -### QueryDLPTokenRateRequest + +### NftIdentifier +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### NftInfo +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `uri` | [string](#string) | | | +| `uri_hash` | [string](#string) | | | + - +### NftListing -### QueryDLPTokenRateResponse +| Field | Type | Label | Description | +| --------------------------- | ------------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `owner` | [string](#string) | | | +| `listing_type` | [ListingType](#ununifi.nftmarket.ListingType) | | | +| `state` | [ListingState](#ununifi.nftmarket.ListingState) | | | +| `bid_token` | [string](#string) | | | +| `minimum_deposit_rate` | [string](#string) | | | +| `automatic_refinancing` | [bool](#bool) | | | +| `started_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `full_payment_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `successful_bid_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `auto_relisted_count` | [uint64](#uint64) | | | +| `collected_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `collected_amount_negative` | [bool] | | | +| `minimum_bidding_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | | + +### Params -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `symbol` | [string](#string) | | | -| `rates` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| Field | Type | Label | Description | +| ----------------------------------------- | ----------------------------------------------------- | -------- | ----------- | +| `min_staking_for_listing` | [string](#string) | | | +| `default_bid_active_rank` | [uint64](#uint64) | | | +| `bid_tokens` | [string](#string) | repeated | | +| `auto_relisting_count_if_no_bid` | [uint64](#uint64) | | | +| `nft_listing_delay_seconds` | [uint64](#uint64) | | | +| `nft_listing_period_initial` | [uint64](#uint64) | | | +| `nft_listing_cancel_required_seconds` | [uint64](#uint64) | | | +| `nft_listing_cancel_fee_percentage` | [uint64](#uint64) | | | +| `nft_listing_gap_time` | [uint64](#uint64) | | | +| `bid_cancel_required_seconds` | [uint64](#uint64) | | | +| `bid_token_disburse_seconds_after_cancel` | [uint64](#uint64) | | | +| `nft_listing_full_payment_period` | [uint64](#uint64) | | | +| `nft_listing_nft_delivery_period` | [uint64](#uint64) | | | +| `nft_creator_share_percentage` | [uint64](#uint64) | | | +| `market_administrator` | [string](#string) | | | +| `nft_listing_commission_fee` | [uint64](#uint64) | | | +| `nft_listing_extend_seconds` | [uint64](#uint64) | | | +| `nft_listing_period_extend_fee_per_hour` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### PaymentStatus +| Field | Type | Label | Description | +| ------------------- | ------------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `bidder` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `automatic_payment` | [bool](#bool) | | | +| `paid_amount` | [string](#string) | | | +| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `state` | [ListingState](#ununifi.nftmarket.ListingState) | | | +| `all_paid` | [bool](#bool) | | | + +### borrowing - +| Field | Type | Label | Description | +| ---------------------- | ------------------------------------------------------- | ----- | ----------- | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `paid_interest_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `start_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -### QueryEstimateDLPTokenAmountRequest + + +### ListingState -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `mint_denom` | [string](#string) | | | -| `amount` | [string](#string) | | | +| Name | Number | Description | +| -------------- | ------ | ----------- | +| UNKNOWN | 0 | | +| LISTING | 1 | | +| BIDDING | 2 | | +| SALE_DECISION | 3 | | +| LIQUIDATION | 4 | | +| SUCCESSFUL_BID | 5 | | + +### ListingType +| Name | Number | Description | +| ------------------------ | ------ | ----------- | +| DIRECT_ASSET_BORROW | 0 | | +| SYNTHETIC_ASSET_CREATION | 1 | | +| LATE_SHIPPING | 2 | | + + - + -### QueryEstimateDLPTokenAmountResponse + +

Top

+## nftmarket/genesis.proto -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `estimated_dlp_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `deposit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### GenesisState +GenesisState defines the nftbackedloan module's genesis state. +| Field | Type | Label | Description | +| ---------------- | ------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.nftmarket.Params) | | | +| `listings` | [NftListing](#ununifi.nftmarket.NftListing) | repeated | | +| `bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | +| `cancelled_bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | +| `loans` | [Loan](#ununifi.nftmarket.Loan) | repeated | | + + - + -### QueryEstimateRedeemAmountRequest + + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `redeem_denom` | [string](#string) | | | -| `lpt_amount` | [string](#string) | | | +## nftmarket/query.proto + +### NftListingDetail +| Field | Type | Label | Description | +| ---------- | ------------------------------------------- | ----- | ----------- | +| `listing` | [NftListing](#ununifi.nftmarket.NftListing) | | | +| `nft_info` | [NftInfo](#ununifi.nftmarket.NftInfo) | | | + +### QueryBidderBidsRequest - +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | -### QueryEstimateRedeemAmountResponse + +### QueryBidderBidsResponse +| Field | Type | Label | Description | +| ------ | ----------------------------------- | -------- | ----------- | +| `bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryCDPsListRequest + +### QueryCDPsListResponse + +### QueryLiquidationRequest - +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | -### QueryLiquidityProviderTokenNominalAPYRequest + +### QueryLiquidationResponse +| Field | Type | Label | Description | +| -------------- | ----------------------------------------------- | ----- | ----------- | +| `liquidations` | [Liquidations](#ununifi.nftmarket.Liquidations) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `before_height` | [int64](#int64) | | | -| `after_height` | [int64](#int64) | | | + +### QueryListedClassRequest +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_limit` | [int32](#int32) | | | + +### QueryListedClassResponse +| Field | Type | Label | Description | +| ------------- | ------------------------------------- | -------- | ----------- | +| `class_id` | [string](#string) | | | +| `name` | [string](#string) | | | +| `description` | [string](#string) | | | +| `symbol` | [string](#string) | | | +| `uri` | [string](#string) | | | +| `urihash` | [string](#string) | | | +| `nfts` | [NftInfo](#ununifi.nftmarket.NftInfo) | repeated | | +| `nft_count` | [uint64](#uint64) | | | - + -### QueryLiquidityProviderTokenNominalAPYResponse +### QueryListedClassesRequest +| Field | Type | Label | Description | +| ----------- | --------------- | ----- | ----------- | +| `nft_limit` | [int32](#int32) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `apy` | [string](#string) | | | +### QueryListedClassesResponse +| Field | Type | Label | Description | +| --------- | ----------------------------------------------------------------------- | -------- | ----------- | +| `classes` | [QueryListedClassResponse](#ununifi.nftmarket.QueryListedClassResponse) | repeated | | + +### QueryListedNftsRequest +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | + - +### QueryListedNftsResponse -### QueryLiquidityProviderTokenRealAPYRequest +| Field | Type | Label | Description | +| ---------- | ------------------------------------------------------- | -------- | ----------- | +| `listings` | [NftListingDetail](#ununifi.nftmarket.NftListingDetail) | repeated | | + +### QueryLoanRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `before_height` | [int64](#int64) | | | -| `after_height` | [int64](#int64) | | | +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### QueryLoanResponse +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `loan` | [Loan](#ununifi.nftmarket.Loan) | | | +| `borrowing_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `total_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryLoansRequest - + -### QueryLiquidityProviderTokenRealAPYResponse +### QueryLoansResponse +| Field | Type | Label | Description | +| ------- | ------------------------------- | -------- | ----------- | +| `loans` | [Loan](#ununifi.nftmarket.Loan) | repeated | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `apy` | [string](#string) | | | +### QueryNftBidsRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### QueryNftBidsResponse +| Field | Type | Label | Description | +| ------ | ----------------------------------- | -------- | ----------- | +| `bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | + - +### QueryNftListingRequest -### QueryParamsRequest -QueryParamsRequest is request type for the Query/Params RPC method. +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### QueryNftListingResponse +| Field | Type | Label | Description | +| --------- | ------------------------------------------- | ----- | ----------- | +| `listing` | [NftListing](#ununifi.nftmarket.NftListing) | | | + +### QueryParamsRequest - + ### QueryParamsResponse -QueryParamsResponse is response type for the Query/Params RPC method. +| Field | Type | Label | Description | +| -------- | ----------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.nftmarket.Params) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.derivatives.Params) | | params holds all the parameters of this module. | + +### QueryPaymentStatusRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `bidder` | [string](#string) | | | + +### QueryPaymentStatusResponse +| Field | Type | Label | Description | +| --------------- | ------------------------------------------------- | ----- | ----------- | +| `paymentStatus` | [PaymentStatus](#ununifi.nftmarket.PaymentStatus) | | | - + -### QueryPerpetualFuturesMarketRequest +### QueryRewardsRequest +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `address` | [uint64](#uint64) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_denom` | [string](#string) | | | -| `quote_denom` | [string](#string) | | | +### QueryRewardsResponse +| Field | Type | Label | Description | +| --------- | ----------------------------------------------------- | -------- | ----------- | +| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + - +### Query -### QueryPerpetualFuturesMarketResponse +Query defines the gRPC querier service. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| --------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------- | --------- | -------------------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.nftmarket.QueryParamsRequest) | [QueryParamsResponse](#ununifi.nftmarket.QueryParamsResponse) | | GET | /ununifi/nftmarket/params | +| `NftListing` | [QueryNftListingRequest](#ununifi.nftmarket.QueryNftListingRequest) | [QueryNftListingResponse](#ununifi.nftmarket.QueryNftListingResponse) | | GET | /ununifi/nftmarket/nft_listing/{class_id}/{nft_id} | +| `ListedNfts` | [QueryListedNftsRequest](#ununifi.nftmarket.QueryListedNftsRequest) | [QueryListedNftsResponse](#ununifi.nftmarket.QueryListedNftsResponse) | | GET | /ununifi/nftmarket/listed_nfts | +| `ListedClasses` | [QueryListedClassesRequest](#ununifi.nftmarket.QueryListedClassesRequest) | [QueryListedClassesResponse](#ununifi.nftmarket.QueryListedClassesResponse) | | GET | /ununifi/nftmarket/listed_classes | +| `ListedClass` | [QueryListedClassRequest](#ununifi.nftmarket.QueryListedClassRequest) | [QueryListedClassResponse](#ununifi.nftmarket.QueryListedClassResponse) | | GET | /ununifi/nftmarket/listed_class/{class_id}/{nft_limit} | +| `Loans` | [QueryLoansRequest](#ununifi.nftmarket.QueryLoansRequest) | [QueryLoansResponse](#ununifi.nftmarket.QueryLoansResponse) | | GET | /ununifi/nftmarket/loans | +| `Loan` | [QueryLoanRequest](#ununifi.nftmarket.QueryLoanRequest) | [QueryLoanResponse](#ununifi.nftmarket.QueryLoanResponse) | | GET | /ununifi/nftmarket/loans/{class_id}/{nft_id} | +| `CDPsList` | [QueryCDPsListRequest](#ununifi.nftmarket.QueryCDPsListRequest) | [QueryCDPsListResponse](#ununifi.nftmarket.QueryCDPsListResponse) | | GET | /ununifi/nftmarket/cdps_list | +| `NftBids` | [QueryNftBidsRequest](#ununifi.nftmarket.QueryNftBidsRequest) | [QueryNftBidsResponse](#ununifi.nftmarket.QueryNftBidsResponse) | | GET | /ununifi/nftmarket/nft_bids/{class_id}/{nft_id} | +| `BidderBids` | [QueryBidderBidsRequest](#ununifi.nftmarket.QueryBidderBidsRequest) | [QueryBidderBidsResponse](#ununifi.nftmarket.QueryBidderBidsResponse) | | GET | /ununifi/nftmarket/bidder_bids/{bidder} | +| `PaymentStatus` | [QueryPaymentStatusRequest](#ununifi.nftmarket.QueryPaymentStatusRequest) | [QueryPaymentStatusResponse](#ununifi.nftmarket.QueryPaymentStatusResponse) | | GET | /ununifi/nftmarket/payment_status/{class_id}/{nft_id}/{bidder} | +| `Rewards` | [QueryRewardsRequest](#ununifi.nftmarket.QueryRewardsRequest) | [QueryRewardsResponse](#ununifi.nftmarket.QueryRewardsResponse) | | GET | /ununifi/nftmarket/rewards/{address} | +| `Liquidation` | [QueryLiquidationRequest](#ununifi.nftmarket.QueryLiquidationRequest) | [QueryLiquidationResponse](#ununifi.nftmarket.QueryLiquidationResponse) | | GET | /ununifi/nftmarket/liquidation/{class_id}/{nft_id} | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `price` | [string](#string) | | | -| `metrics_quote_ticker` | [string](#string) | | | -| `volume_24hours` | [string](#string) | | | -| `fees_24hours` | [string](#string) | | | -| `long_positions` | [string](#string) | | | -| `short_positions` | [string](#string) | | | + +

Top

+## nftmarket/tx.proto + +### MsgBorrow +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - + -### QueryPerpetualFuturesPositionSizeRequest +### MsgBorrowResponse + +### MsgCancelBid -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `position_type` | [PositionType](#ununifi.derivatives.PositionType) | | | -| `address` | [string](#string) | | | +| Field | Type | Label | Description | +| -------- | ------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | + +### MsgCancelBidResponse + +### MsgCancelNftListing +| Field | Type | Label | Description | +| -------- | ------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | - + -### QueryPerpetualFuturesPositionSizeResponse +### MsgCancelNftListingResponse + +### MsgEndNftListing -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `total_position_size_usd` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| Field | Type | Label | Description | +| -------- | ------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | + +### MsgEndNftListingResponse + +### MsgListNft +| Field | Type | Label | Description | +| ------------------------ | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `listing_type` | [ListingType](#ununifi.nftmarket.ListingType) | | | +| `bid_token` | [string](#string) | | | +| `minimum_deposit_rate` | [string](#string) | | 1% = 0.01 | +| `automatic_refinancing` | [bool](#bool) | | | +| `minimum_bidding_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | | - + -### QueryPerpetualFuturesRequest +### MsgListNftResponse + +### MsgMintNft +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `classId` | [string](#string) | | | +| `nftId` | [string](#string) | | | +| `nftUri` | [string](#string) | | | +| `nftUriHash` | [string](#string) | | | + +### MsgMintNftResponse + - +### MsgPayFullBid -### QueryPerpetualFuturesResponse +| Field | Type | Label | Description | +| -------- | ------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | + +### MsgPayFullBidResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `metrics_quote_ticker` | [string](#string) | | | -| `volume_24hours` | [string](#string) | | | -| `fees_24hours` | [string](#string) | | | -| `long_positions` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `short_positions` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgPlaceBid +| Field | Type | Label | Description | +| ------------------- | ------------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `price` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `interest_rate` | [string](#string) | | | +| `automatic_payment` | [bool](#bool) | | | +| `deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgPlaceBidResponse + - +### MsgRepay -### QueryPerpetualOptionsMarketRequest +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgRepayResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_denom` | [string](#string) | | | -| `quote_denom` | [string](#string) | | | + +### MsgSellingDecision +| Field | Type | Label | Description | +| -------- | ------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | + +### MsgSellingDecisionResponse + - + -### QueryPerpetualOptionsMarketResponse + + +### Msg +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------------ | ------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------- | --------- | -------- | +| `MintNft` | [MsgMintNft](#ununifi.nftmarket.MsgMintNft) | [MsgMintNftResponse](#ununifi.nftmarket.MsgMintNftResponse) | | | +| `ListNft` | [MsgListNft](#ununifi.nftmarket.MsgListNft) | [MsgListNftResponse](#ununifi.nftmarket.MsgListNftResponse) | | | +| `CancelNftListing` | [MsgCancelNftListing](#ununifi.nftmarket.MsgCancelNftListing) | [MsgCancelNftListingResponse](#ununifi.nftmarket.MsgCancelNftListingResponse) | | | +| `PlaceBid` | [MsgPlaceBid](#ununifi.nftmarket.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.nftmarket.MsgPlaceBidResponse) | | | +| `CancelBid` | [MsgCancelBid](#ununifi.nftmarket.MsgCancelBid) | [MsgCancelBidResponse](#ununifi.nftmarket.MsgCancelBidResponse) | | | +| `SellingDecision` | [MsgSellingDecision](#ununifi.nftmarket.MsgSellingDecision) | [MsgSellingDecisionResponse](#ununifi.nftmarket.MsgSellingDecisionResponse) | | | +| `EndNftListing` | [MsgEndNftListing](#ununifi.nftmarket.MsgEndNftListing) | [MsgEndNftListingResponse](#ununifi.nftmarket.MsgEndNftListingResponse) | | | +| `PayFullBid` | [MsgPayFullBid](#ununifi.nftmarket.MsgPayFullBid) | [MsgPayFullBidResponse](#ununifi.nftmarket.MsgPayFullBidResponse) | | | +| `Borrow` | [MsgBorrow](#ununifi.nftmarket.MsgBorrow) | [MsgBorrowResponse](#ununifi.nftmarket.MsgBorrowResponse) | | | +| `Repay` | [MsgRepay](#ununifi.nftmarket.MsgRepay) | [MsgRepayResponse](#ununifi.nftmarket.MsgRepayResponse) | | | + + +

Top

- +## nftmarketv1/nftmarket.proto -### QueryPerpetualOptionsRequest + +### EventBorrow +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `borrower` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `amount` | [string](#string) | | | + +### EventCancelBid +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + - +### EventCancelListNfting -### QueryPerpetualOptionsResponse +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventEndListNfting +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventExpandListingPeriod +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | - + -### QueryPoolRequest -this line is used by starport scaffolding # 3 +### EventLiquidate +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `liquidator` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventListNft +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + - +### EventPayFullBid -### QueryPoolResponse +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### EventPlaceBid -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `metrics_quote_ticker` | [string](#string) | | | -| `pool_market_cap` | [PoolMarketCap](#ununifi.derivatives.PoolMarketCap) | | | -| `volume_24hours` | [string](#string) | | | -| `fees_24hours` | [string](#string) | | | +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `amount` | [string](#string) | | | + +### EventRepay +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `borrower` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `amount` | [string](#string) | | | + +### EventSellingDecision - +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | -### QueryPositionRequest + +### ListedClass +| Field | Type | Label | Description | +| ---------- | ----------------- | -------- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_ids` | [string](#string) | repeated | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `position_id` | [string](#string) | | | + +### ListedNft +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `uri` | [string](#string) | | | +| `uri_hash` | [string](#string) | | | + +### Loan +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `loan` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - + -### QueryPositionResponse +### NftBid +| Field | Type | Label | Description | +| ------------------- | ------------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `bidder` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `automatic_payment` | [bool](#bool) | | | +| `paid_amount` | [string](#string) | | | +| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `position` | [Position](#ununifi.derivatives.Position) | | | -| `valuation_profit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `margin_maintenance_rate` | [string](#string) | | | -| `effective_margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +### NftIdentifier +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### NftListing +| Field | Type | Label | Description | +| ----------------------- | ------------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `owner` | [string](#string) | | | +| `listing_type` | [ListingType](#ununifi.nftmarketv1.ListingType) | | | +| `state` | [ListingState](#ununifi.nftmarketv1.ListingState) | | | +| `bid_token` | [string](#string) | | | +| `min_bid` | [string](#string) | | | +| `bid_active_rank` | [uint64](#uint64) | | | +| `started_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `full_payment_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `successful_bid_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `auto_relisted_count` | [uint64](#uint64) | | | - + - +### Params - +| Field | Type | Label | Description | +| ----------------------------------------- | ----------------------------------------------------- | -------- | ----------- | +| `min_staking_for_listing` | [string](#string) | | | +| `default_bid_active_rank` | [uint64](#uint64) | | | +| `bid_tokens` | [string](#string) | repeated | | +| `auto_relisting_count_if_no_bid` | [uint64](#uint64) | | | +| `nft_listing_delay_seconds` | [uint64](#uint64) | | | +| `nft_listing_period_initial` | [uint64](#uint64) | | | +| `nft_listing_cancel_required_seconds` | [uint64](#uint64) | | | +| `nft_listing_cancel_fee_percentage` | [uint64](#uint64) | | | +| `nft_listing_gap_time` | [uint64](#uint64) | | | +| `bid_cancel_required_seconds` | [uint64](#uint64) | | | +| `bid_token_disburse_seconds_after_cancel` | [uint64](#uint64) | | | +| `nft_listing_full_payment_period` | [uint64](#uint64) | | | +| `nft_listing_nft_delivery_period` | [uint64](#uint64) | | | +| `nft_creator_share_percentage` | [uint64](#uint64) | | | +| `market_administrator` | [string](#string) | | | +| `nft_listing_commission_fee` | [uint64](#uint64) | | | +| `nft_listing_extend_seconds` | [uint64](#uint64) | | | +| `nft_listing_period_extend_fee_per_hour` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + - +### PaymentStatus -### Query -Query defines the gRPC querier service. +| Field | Type | Label | Description | +| ------------------- | ------------------------------------------------------- | ----- | ----------- | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `bidder` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `automatic_payment` | [bool](#bool) | | | +| `paid_amount` | [string](#string) | | | +| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `state` | [ListingState](#ununifi.nftmarketv1.ListingState) | | | +| `all_paid` | [bool](#bool) | | | -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.derivatives.QueryParamsRequest) | [QueryParamsResponse](#ununifi.derivatives.QueryParamsResponse) | Parameters queries the parameters of the module. | GET|/ununifi/derivatives/params| -| `Pool` | [QueryPoolRequest](#ununifi.derivatives.QueryPoolRequest) | [QueryPoolResponse](#ununifi.derivatives.QueryPoolResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/derivatives/pool| -| `LiquidityProviderTokenRealAPY` | [QueryLiquidityProviderTokenRealAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYRequest) | [QueryLiquidityProviderTokenRealAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenRealAPYResponse) | | GET|/ununifi/derivatives/liquidity-providers/real-apy| -| `LiquidityProviderTokenNominalAPY` | [QueryLiquidityProviderTokenNominalAPYRequest](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYRequest) | [QueryLiquidityProviderTokenNominalAPYResponse](#ununifi.derivatives.QueryLiquidityProviderTokenNominalAPYResponse) | | GET|/ununifi/derivatives/liquidity-providers/nominal-apy| -| `PerpetualFutures` | [QueryPerpetualFuturesRequest](#ununifi.derivatives.QueryPerpetualFuturesRequest) | [QueryPerpetualFuturesResponse](#ununifi.derivatives.QueryPerpetualFuturesResponse) | | GET|/ununifi/derivatives/perpetual-futures| -| `PerpetualFuturesMarket` | [QueryPerpetualFuturesMarketRequest](#ununifi.derivatives.QueryPerpetualFuturesMarketRequest) | [QueryPerpetualFuturesMarketResponse](#ununifi.derivatives.QueryPerpetualFuturesMarketResponse) | | GET|/ununifi/derivatives/perpetual-futures/{base_denom}/{quote_denom}| -| `PerpetualOptions` | [QueryPerpetualOptionsRequest](#ununifi.derivatives.QueryPerpetualOptionsRequest) | [QueryPerpetualOptionsResponse](#ununifi.derivatives.QueryPerpetualOptionsResponse) | | GET|/ununifi/derivatives/perpetual-options| -| `PerpetualOptionsMarket` | [QueryPerpetualOptionsMarketRequest](#ununifi.derivatives.QueryPerpetualOptionsMarketRequest) | [QueryPerpetualOptionsMarketResponse](#ununifi.derivatives.QueryPerpetualOptionsMarketResponse) | | GET|/ununifi/derivatives/perpetual-options/{base_denom}/{quote_denom}| -| `AllPositions` | [QueryAllPositionsRequest](#ununifi.derivatives.QueryAllPositionsRequest) | [QueryAllPositionsResponse](#ununifi.derivatives.QueryAllPositionsResponse) | | GET|/ununifi/derivatives/positions| -| `Position` | [QueryPositionRequest](#ununifi.derivatives.QueryPositionRequest) | [QueryPositionResponse](#ununifi.derivatives.QueryPositionResponse) | | GET|/ununifi/derivatives/positions/{position_id}| -| `PerpetualFuturesPositionSize` | [QueryPerpetualFuturesPositionSizeRequest](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeRequest) | [QueryPerpetualFuturesPositionSizeResponse](#ununifi.derivatives.QueryPerpetualFuturesPositionSizeResponse) | | GET|/ununifi/derivatives/positions/perpetual-futures/{position_type}/{address}| -| `AddressPositions` | [QueryAddressPositionsRequest](#ununifi.derivatives.QueryAddressPositionsRequest) | [QueryAddressPositionsResponse](#ununifi.derivatives.QueryAddressPositionsResponse) | | GET|/ununifi/derivatives/{address}/positions| -| `DLPTokenRates` | [QueryDLPTokenRateRequest](#ununifi.derivatives.QueryDLPTokenRateRequest) | [QueryDLPTokenRateResponse](#ununifi.derivatives.QueryDLPTokenRateResponse) | | GET|/ununifi/derivatives/pools/dlp| -| `EstimateDLPTokenAmount` | [QueryEstimateDLPTokenAmountRequest](#ununifi.derivatives.QueryEstimateDLPTokenAmountRequest) | [QueryEstimateDLPTokenAmountResponse](#ununifi.derivatives.QueryEstimateDLPTokenAmountResponse) | | GET|/ununifi/derivatives/estimate-dlp-token-amount/{mint_denom}/{amount}| -| `EstimateRedeemAmount` | [QueryEstimateRedeemAmountRequest](#ununifi.derivatives.QueryEstimateRedeemAmountRequest) | [QueryEstimateRedeemAmountResponse](#ununifi.derivatives.QueryEstimateRedeemAmountResponse) | | GET|/ununifi/derivatives/estimate-redeem-amount/{redeem_denom}/{lpt_amount}| -| `AvailableAssetInPoolByDenom` | [QueryAvailableAssetInPoolByDenomRequest](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomRequest) | [QueryAvailableAssetInPoolByDenomResponse](#ununifi.derivatives.QueryAvailableAssetInPoolByDenomResponse) | | GET|/ununifi/derivatives/pools/available-asset/{denom}| -| `AvailableAssetsInPool` | [QueryAvailableAssetsInPoolRequest](#ununifi.derivatives.QueryAvailableAssetsInPoolRequest) | [QueryAvailableAssetsInPoolResponse](#ununifi.derivatives.QueryAvailableAssetsInPoolResponse) | | GET|/ununifi/derivatives/pools/available-assets| + - + +### ListingState +| Name | Number | Description | +| ---------------- | ------ | ----------- | +| UNKNOWN | 0 | | +| LISTING | 1 | | +| BIDDING | 2 | | +| SELLING_DECISION | 3 | | +| LIQUIDATION | 4 | | +| SUCCESSFUL_BID | 5 | | - -

Top

+ -## derivatives/tx.proto +### ListingType +| Name | Number | Description | +| ------------------------ | ------ | ----------- | +| DIRECT_ASSET_BORROW | 0 | | +| SYNTHETIC_ASSET_CREATION | 1 | | +| LATE_SHIPPING | 2 | | + - + -### MsgClosePosition + + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `position_id` | [string](#string) | | | +## nftmarketv1/genesis.proto + +### GenesisState +GenesisState defines the nftbackedloan module's genesis state. +| Field | Type | Label | Description | +| ---------------- | --------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.nftmarketv1.Params) | | | +| `listings` | [NftListing](#ununifi.nftmarketv1.NftListing) | repeated | | +| `bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | +| `cancelled_bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | +| `loans` | [Loan](#ununifi.nftmarketv1.Loan) | repeated | | + - + -### MsgClosePositionResponse + + + +

Top

+## nftmarketv1/query.proto + +### QueryBidderBidsRequest - +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `bidder` | [string](#string) | | | -### MsgDepositToPool + +### QueryBidderBidsResponse +| Field | Type | Label | Description | +| ------ | ------------------------------------- | -------- | ----------- | +| `bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryCDPsListRequest + +### QueryCDPsListResponse + +### QueryListedClassRequest - +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_limit` | [int32](#int32) | | | -### MsgDepositToPoolResponse + +### QueryListedClassResponse +| Field | Type | Label | Description | +| ------------- | ------------------------------------------- | -------- | ----------- | +| `class_id` | [string](#string) | | | +| `name` | [string](#string) | | | +| `description` | [string](#string) | | | +| `symbol` | [string](#string) | | | +| `uri` | [string](#string) | | | +| `urihash` | [string](#string) | | | +| `nfts` | [ListedNft](#ununifi.nftmarketv1.ListedNft) | repeated | | +| `nft_count` | [uint64](#uint64) | | | + +### QueryListedClassesRequest +| Field | Type | Label | Description | +| ----------- | --------------- | ----- | ----------- | +| `nft_limit` | [int32](#int32) | | | + - +### QueryListedClassesResponse -### MsgOpenPosition +| Field | Type | Label | Description | +| --------- | ------------------------------------------------------------------------- | -------- | ----------- | +| `classes` | [QueryListedClassResponse](#ununifi.nftmarketv1.QueryListedClassResponse) | repeated | | + +### QueryListedNftsRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `margin` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `market` | [Market](#ununifi.derivatives.Market) | | | -| `position_instance` | [google.protobuf.Any](#google.protobuf.Any) | | | +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | + +### QueryListedNftsResponse +| Field | Type | Label | Description | +| ---------- | --------------------------------------------- | -------- | ----------- | +| `listings` | [NftListing](#ununifi.nftmarketv1.NftListing) | repeated | | + +### QueryLoanRequest - +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | -### MsgOpenPositionResponse + +### QueryLoanResponse +| Field | Type | Label | Description | +| ----------------- | ----------------------------------------------------- | ----- | ----------- | +| `loan` | [Loan](#ununifi.nftmarketv1.Loan) | | | +| `borrowing_limit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `total_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryLoansRequest + +### QueryLoansResponse - +| Field | Type | Label | Description | +| ------- | --------------------------------- | -------- | ----------- | +| `loans` | [Loan](#ununifi.nftmarketv1.Loan) | repeated | | -### MsgReportLevyPeriod + +### QueryNftBidsRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `position_id` | [string](#string) | | | -| `reward_recipient` | [string](#string) | | | + +### QueryNftBidsResponse +| Field | Type | Label | Description | +| ------ | ------------------------------------- | -------- | ----------- | +| `bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | + +### QueryNftListingRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | - + -### MsgReportLevyPeriodResponse +### QueryNftListingResponse +| Field | Type | Label | Description | +| --------- | --------------------------------------------- | ----- | ----------- | +| `listing` | [NftListing](#ununifi.nftmarketv1.NftListing) | | | + +### QueryParamsRequest + +### QueryParamsResponse +| Field | Type | Label | Description | +| -------- | ------------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.nftmarketv1.Params) | | | - + -### MsgReportLiquidation +### QueryPaymentStatusRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `bidder` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `position_id` | [string](#string) | | | -| `reward_recipient` | [string](#string) | | | +### QueryPaymentStatusResponse +| Field | Type | Label | Description | +| --------------- | --------------------------------------------------- | ----- | ----------- | +| `paymentStatus` | [PaymentStatus](#ununifi.nftmarketv1.PaymentStatus) | | | + +### QueryRewardsRequest +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `address` | [uint64](#uint64) | | | + - +### QueryRewardsResponse -### MsgReportLiquidationResponse +| Field | Type | Label | Description | +| --------- | ----------------------------------------------------- | -------- | ----------- | +| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + +### Query +Query defines the gRPC querier service. - +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| --------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------- | --------- | -------------------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.nftmarketv1.QueryParamsRequest) | [QueryParamsResponse](#ununifi.nftmarketv1.QueryParamsResponse) | | GET | /ununifi/nftmarket/params | +| `NftListing` | [QueryNftListingRequest](#ununifi.nftmarketv1.QueryNftListingRequest) | [QueryNftListingResponse](#ununifi.nftmarketv1.QueryNftListingResponse) | | GET | /ununifi/nftmarket/nft_listing/{class_id}/{nft_id} | +| `ListedNfts` | [QueryListedNftsRequest](#ununifi.nftmarketv1.QueryListedNftsRequest) | [QueryListedNftsResponse](#ununifi.nftmarketv1.QueryListedNftsResponse) | | GET | /ununifi/nftmarket/listed_nfts | +| `ListedClasses` | [QueryListedClassesRequest](#ununifi.nftmarketv1.QueryListedClassesRequest) | [QueryListedClassesResponse](#ununifi.nftmarketv1.QueryListedClassesResponse) | | GET | /ununifi/nftmarket/listed_classes | +| `ListedClass` | [QueryListedClassRequest](#ununifi.nftmarketv1.QueryListedClassRequest) | [QueryListedClassResponse](#ununifi.nftmarketv1.QueryListedClassResponse) | | GET | /ununifi/nftmarket/listed_class/{class_id}/{nft_limit} | +| `Loans` | [QueryLoansRequest](#ununifi.nftmarketv1.QueryLoansRequest) | [QueryLoansResponse](#ununifi.nftmarketv1.QueryLoansResponse) | | GET | /ununifi/nftmarket/loans | +| `Loan` | [QueryLoanRequest](#ununifi.nftmarketv1.QueryLoanRequest) | [QueryLoanResponse](#ununifi.nftmarketv1.QueryLoanResponse) | | GET | /ununifi/nftmarket/loans/{class_id}/{nft_id} | +| `CDPsList` | [QueryCDPsListRequest](#ununifi.nftmarketv1.QueryCDPsListRequest) | [QueryCDPsListResponse](#ununifi.nftmarketv1.QueryCDPsListResponse) | | GET | /ununifi/nftmarket/cdps_list | +| `NftBids` | [QueryNftBidsRequest](#ununifi.nftmarketv1.QueryNftBidsRequest) | [QueryNftBidsResponse](#ununifi.nftmarketv1.QueryNftBidsResponse) | | GET | /ununifi/nftmarket/nft_bids/{class_id}/{nft_id} | +| `BidderBids` | [QueryBidderBidsRequest](#ununifi.nftmarketv1.QueryBidderBidsRequest) | [QueryBidderBidsResponse](#ununifi.nftmarketv1.QueryBidderBidsResponse) | | GET | /ununifi/nftmarket/bidder_bids/{bidder} | +| `PaymentStatus` | [QueryPaymentStatusRequest](#ununifi.nftmarketv1.QueryPaymentStatusRequest) | [QueryPaymentStatusResponse](#ununifi.nftmarketv1.QueryPaymentStatusResponse) | | GET | /ununifi/nftmarket/payment_status/{class_id}/{nft_id}/{bidder} | +| `Rewards` | [QueryRewardsRequest](#ununifi.nftmarketv1.QueryRewardsRequest) | [QueryRewardsResponse](#ununifi.nftmarketv1.QueryRewardsResponse) | | GET | /ununifi/nftmarket/rewards/{address} | -### MsgWithdrawFromPool + + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `lpt_amount` | [string](#string) | | | -| `redeem_denom` | [string](#string) | | | +## nftmarketv1/tx.proto + +### MsgBorrow +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgBorrowResponse - + -### MsgWithdrawFromPoolResponse +### MsgBurnStableCoin +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | + +### MsgBurnStableCoinResponse + +### MsgCancelBid - +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - + - +### MsgCancelBidResponse + - +### MsgCancelNftListing -### Msg +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | + -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `DepositToPool` | [MsgDepositToPool](#ununifi.derivatives.MsgDepositToPool) | [MsgDepositToPoolResponse](#ununifi.derivatives.MsgDepositToPoolResponse) | | | -| `WithdrawFromPool` | [MsgWithdrawFromPool](#ununifi.derivatives.MsgWithdrawFromPool) | [MsgWithdrawFromPoolResponse](#ununifi.derivatives.MsgWithdrawFromPoolResponse) | | | -| `OpenPosition` | [MsgOpenPosition](#ununifi.derivatives.MsgOpenPosition) | [MsgOpenPositionResponse](#ununifi.derivatives.MsgOpenPositionResponse) | | | -| `ClosePosition` | [MsgClosePosition](#ununifi.derivatives.MsgClosePosition) | [MsgClosePositionResponse](#ununifi.derivatives.MsgClosePositionResponse) | | | -| `ReportLiquidation` | [MsgReportLiquidation](#ununifi.derivatives.MsgReportLiquidation) | [MsgReportLiquidationResponse](#ununifi.derivatives.MsgReportLiquidationResponse) | | | -| `ReportLevyPeriod` | [MsgReportLevyPeriod](#ununifi.derivatives.MsgReportLevyPeriod) | [MsgReportLevyPeriodResponse](#ununifi.derivatives.MsgReportLevyPeriodResponse) | | | +### MsgCancelNftListingResponse - + +### MsgEndNftListing +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - -

Top

+ -## ecosystem-incentive/ecosystem_incentive.proto +### MsgEndNftListingResponse + +### MsgExpandListingPeriod - +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -### IncentiveUnit + + +### MsgExpandListingPeriodResponse + + + +### MsgLiquidate +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `subject_info_lists` | [SubjectInfo](#ununifi.ecosystemincentive.SubjectInfo) | repeated | | +### MsgLiquidateResponse + +### MsgListNft +| Field | Type | Label | Description | +| ----------------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `listing_type` | [ListingType](#ununifi.nftmarketv1.ListingType) | | | +| `bid_token` | [string](#string) | | | +| `min_bid` | [string](#string) | | | +| `bid_active_rank` | [uint64](#uint64) | | | + +### MsgListNftResponse - + -### IncentiveUnitIdsByAddr +### MsgMintNft +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `classId` | [string](#string) | | | +| `nftId` | [string](#string) | | | +| `nftUri` | [string](#string) | | | +| `nftUriHash` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | | -| `incentive_unit_ids` | [string](#string) | repeated | | +### MsgMintNftResponse + +### MsgMintStableCoin +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | + +### MsgMintStableCoinResponse - + -### RewardStore +### MsgPayFullBid + +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | + +### MsgPayFullBidResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `subject_addr` | [string](#string) | | | -| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + +### MsgPlaceBid +| Field | Type | Label | Description | +| ------------------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `automatic_payment` | [bool](#bool) | | | + +### MsgPlaceBidResponse + - +### MsgRepay -### SubjectInfo +| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgRepayResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `subject_addr` | [string](#string) | | | -| `weight` | [string](#string) | | | + +### MsgSellingDecision +| Field | Type | Label | Description | +| -------- | --------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | + +### MsgSellingDecisionResponse @@ -2846,294 +4140,488 @@ Query defines the gRPC querier service. - + +### Msg +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| --------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ----------- | --------- | -------- | +| `MintNft` | [MsgMintNft](#ununifi.nftmarketv1.MsgMintNft) | [MsgMintNftResponse](#ununifi.nftmarketv1.MsgMintNftResponse) | | | +| `ListNft` | [MsgListNft](#ununifi.nftmarketv1.MsgListNft) | [MsgListNftResponse](#ununifi.nftmarketv1.MsgListNftResponse) | | | +| `CancelNftListing` | [MsgCancelNftListing](#ununifi.nftmarketv1.MsgCancelNftListing) | [MsgCancelNftListingResponse](#ununifi.nftmarketv1.MsgCancelNftListingResponse) | | | +| `ExpandListingPeriod` | [MsgExpandListingPeriod](#ununifi.nftmarketv1.MsgExpandListingPeriod) | [MsgExpandListingPeriodResponse](#ununifi.nftmarketv1.MsgExpandListingPeriodResponse) | | | +| `PlaceBid` | [MsgPlaceBid](#ununifi.nftmarketv1.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.nftmarketv1.MsgPlaceBidResponse) | | | +| `CancelBid` | [MsgCancelBid](#ununifi.nftmarketv1.MsgCancelBid) | [MsgCancelBidResponse](#ununifi.nftmarketv1.MsgCancelBidResponse) | | | +| `SellingDecision` | [MsgSellingDecision](#ununifi.nftmarketv1.MsgSellingDecision) | [MsgSellingDecisionResponse](#ununifi.nftmarketv1.MsgSellingDecisionResponse) | | | +| `EndNftListing` | [MsgEndNftListing](#ununifi.nftmarketv1.MsgEndNftListing) | [MsgEndNftListingResponse](#ununifi.nftmarketv1.MsgEndNftListingResponse) | | | +| `PayFullBid` | [MsgPayFullBid](#ununifi.nftmarketv1.MsgPayFullBid) | [MsgPayFullBidResponse](#ununifi.nftmarketv1.MsgPayFullBidResponse) | | | +| `Borrow` | [MsgBorrow](#ununifi.nftmarketv1.MsgBorrow) | [MsgBorrowResponse](#ununifi.nftmarketv1.MsgBorrowResponse) | | | +| `Repay` | [MsgRepay](#ununifi.nftmarketv1.MsgRepay) | [MsgRepayResponse](#ununifi.nftmarketv1.MsgRepayResponse) | | | +| `MintStableCoin` | [MsgMintStableCoin](#ununifi.nftmarketv1.MsgMintStableCoin) | [MsgMintStableCoinResponse](#ununifi.nftmarketv1.MsgMintStableCoinResponse) | | | +| `BurnStableCoin` | [MsgBurnStableCoin](#ununifi.nftmarketv1.MsgBurnStableCoin) | [MsgBurnStableCoinResponse](#ununifi.nftmarketv1.MsgBurnStableCoinResponse) | | | +| `Liquidate` | [MsgLiquidate](#ununifi.nftmarketv1.MsgLiquidate) | [MsgLiquidateResponse](#ununifi.nftmarketv1.MsgLiquidateResponse) | | | + + + + -

Top

-## ecosystem-incentive/event.proto +## nftmint/nftmint.proto + +### ClassAttributes - +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `owner` | [string](#string) | | | +| `base_token_uri` | [string](#string) | | | +| `minting_permission` | [MintingPermission](#ununifi.nftmint.MintingPermission) | | | +| `token_supply_cap` | [uint64](#uint64) | | | -### EventDeletedNftIdRecordedForFrontendReward + +### ClassNameIdList +| Field | Type | Label | Description | +| ------------ | ----------------- | -------- | ----------- | +| `class_name` | [string](#string) | | | +| `class_id` | [string](#string) | repeated | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | + +### OwningClassIdList +| Field | Type | Label | Description | +| ---------- | ----------------- | -------- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | repeated | | + +### Params +| Field | Type | Label | Description | +| ------------------- | ----------------- | ----- | ----------- | +| `MaxNFTSupplyCap` | [uint64](#uint64) | | | +| `MinClassNameLen` | [uint64](#uint64) | | | +| `MaxClassNameLen` | [uint64](#uint64) | | | +| `MinUriLen` | [uint64](#uint64) | | | +| `MaxUriLen` | [uint64](#uint64) | | | +| `MaxSymbolLen` | [uint64](#uint64) | | | +| `MaxDescriptionLen` | [uint64](#uint64) | | | - + -### EventFailedParsingMemoInputs + +### MintingPermission +| Name | Number | Description | +| --------- | ------ | -------------- | +| OnlyOwner | 0 | | +| Anyone | 1 | WhiteList = 2; | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `memo` | [string](#string) | | | + + + + +

Top

+## nftmint/event.proto - + -### EventNotRecordedNftId +### EventBurnNFT +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `burner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | +### EventCreateClass +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `base_token_uri` | [string](#string) | | | +| `token_supply_cap` | [string](#string) | | | +| `minting_permission` | [MintingPermission](#ununifi.nftmint.MintingPermission) | | | + +### EventMintNFT +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `owner` | [string](#string) | | | +| `minter` | [string](#string) | | | + - +### EventSendClassOwnership -### EventNotRegisteredIncentiveUnitId +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `receiver` | [string](#string) | | | +| `class_id` | [string](#string) | | | + +### EventUpdateBaseTokenUri -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | +| Field | Type | Label | Description | +| ---------------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `base_token_uri` | [string](#string) | | | + +### EventUpdateTokenSupplyCap +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `token_supply_cap` | [string](#string) | | | + + - + -### EventRecordedIncentiveUnitId + + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | +## nftmint/genesis.proto + +### GenesisState +GenesisState defines the nftmint module's genesis state. +| Field | Type | Label | Description | +| ----------------------- | --------------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.nftmint.Params) | | | +| `class_attributes_list` | [ClassAttributes](#ununifi.nftmint.ClassAttributes) | repeated | | + - + -### EventRegister + + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | -| `subject_info_lists` | [SubjectInfo](#ununifi.ecosystemincentive.SubjectInfo) | repeated | | +

Top

+## nftmint/query.proto + +### QueryClassAttributesRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | + - +### QueryClassAttributesResponse -### EventUpdatedReward +| Field | Type | Label | Description | +| ------------------ | --------------------------------------------------- | ----- | ----------- | +| `class_attributes` | [ClassAttributes](#ununifi.nftmint.ClassAttributes) | | | + +### QueryClassIdsByNameRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | -| `earned_reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `class_name` | [string](#string) | | | + +### QueryClassIdsByNameResponse +| Field | Type | Label | Description | +| -------------------- | --------------------------------------------------- | ----- | ----------- | +| `class_name_id_list` | [ClassNameIdList](#ununifi.nftmint.ClassNameIdList) | | | + +### QueryClassIdsByOwnerRequest - +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `owner` | [string](#string) | | | -### EventVersionUnmatched + +### QueryClassIdsByOwnerResponse +| Field | Type | Label | Description | +| ---------------------- | ------------------------------------------------------- | ----- | ----------- | +| `owning_class_id_list` | [OwningClassIdList](#ununifi.nftmint.OwningClassIdList) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `unmatched_version` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | + +### QueryNFTMinterRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + +### QueryNFTMinterResponse +| Field | Type | Label | Description | +| -------- | ----------------- | ----- | ----------- | +| `minter` | [string](#string) | | | - + -### EventWithdrawAllRewards +### QueryParamsRequest + +### QueryParamsResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `all_withdrawn_rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| Field | Type | Label | Description | +| -------- | --------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.nftmint.Params) | | | + + + + +### Query - +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------- | --------- | ----------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.nftmint.QueryParamsRequest) | [QueryParamsResponse](#ununifi.nftmint.QueryParamsResponse) | | GET | /ununifi/nftmint/params | +| `ClassAttributes` | [QueryClassAttributesRequest](#ununifi.nftmint.QueryClassAttributesRequest) | [QueryClassAttributesResponse](#ununifi.nftmint.QueryClassAttributesResponse) | | GET | /ununifi/nftmint/class_owner/{class_id} | +| `NFTMinter` | [QueryNFTMinterRequest](#ununifi.nftmint.QueryNFTMinterRequest) | [QueryNFTMinterResponse](#ununifi.nftmint.QueryNFTMinterResponse) | | GET | /ununifi/nftmint/nft_minter/{class_id}/{nft_id} | +| `ClassIdsByName` | [QueryClassIdsByNameRequest](#ununifi.nftmint.QueryClassIdsByNameRequest) | [QueryClassIdsByNameResponse](#ununifi.nftmint.QueryClassIdsByNameResponse) | | GET | /ununifi/nftmint/class_ids_by_name/{class_name} | +| `ClassIdsByOwner` | [QueryClassIdsByOwnerRequest](#ununifi.nftmint.QueryClassIdsByOwnerRequest) | [QueryClassIdsByOwnerResponse](#ununifi.nftmint.QueryClassIdsByOwnerResponse) | | GET | /ununifi/nftmint/class_ids_by_owner/{owner} | -### EventWithdrawReward + + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `withdrawn_reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +## nftmint/tx.proto + +### MsgBurnNFT +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | + - +### MsgBurnNFTResponse - + - +### MsgCreateClass - +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `name` | [string](#string) | | | +| `base_token_uri` | [string](#string) | | | +| `token_supply_cap` | [uint64](#uint64) | | | +| `minting_permission` | [MintingPermission](#ununifi.nftmint.MintingPermission) | | | +| `symbol` | [string](#string) | | | +| `description` | [string](#string) | | | +| `class_uri` | [string](#string) | | | + +### MsgCreateClassResponse - -

Top

+ -## ecosystem-incentive/params.proto +### MsgMintNFT +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `nft_id` | [string](#string) | | | +| `recipient` | [string](#string) | | | + - +### MsgMintNFTResponse -### Params -Params defines the parameters for the module. + +### MsgSendClassOwnership -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `reward_params` | [RewardParams](#ununifi.ecosystemincentive.RewardParams) | repeated | | -| `max_incentive_unit_id_len` | [uint64](#uint64) | | | -| `max_subject_info_num_in_unit` | [uint64](#uint64) | | | +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `recipient` | [string](#string) | | | + +### MsgSendClassOwnershipResponse + +### MsgUpdateBaseTokenUri +| Field | Type | Label | Description | +| ---------------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `base_token_uri` | [string](#string) | | | - + -### RewardParams -RewardParams defines which module have which rewards type and rate -to maintain the correctness of the fee rate in a module -e.g. if nftmarket module have "Frontend" and "Collection" incentive, -the combined those rates for the incentive cannot be exceed 1 +### MsgUpdateBaseTokenUriResponse + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `module_name` | [string](#string) | | | -| `reward_rate` | [RewardRate](#ununifi.ecosystemincentive.RewardRate) | repeated | | +### MsgUpdateTokenSupplyCap +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `class_id` | [string](#string) | | | +| `token_supply_cap` | [uint64](#uint64) | | | + +### MsgUpdateTokenSupplyCapResponse + + - + -### RewardRate -RewardRate defines the ratio to take reward for a specific reward_type. -The total sum of reward_rate in a module cannot be exceed 1 + +### Msg -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `reward_type` | [RewardType](#ununifi.ecosystemincentive.RewardType) | | | -| `rate` | [string](#string) | | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ---------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------- | --------- | -------- | +| `CreateClass` | [MsgCreateClass](#ununifi.nftmint.MsgCreateClass) | [MsgCreateClassResponse](#ununifi.nftmint.MsgCreateClassResponse) | | | +| `SendClassOwnership` | [MsgSendClassOwnership](#ununifi.nftmint.MsgSendClassOwnership) | [MsgSendClassOwnershipResponse](#ununifi.nftmint.MsgSendClassOwnershipResponse) | | | +| `UpdateBaseTokenUri` | [MsgUpdateBaseTokenUri](#ununifi.nftmint.MsgUpdateBaseTokenUri) | [MsgUpdateBaseTokenUriResponse](#ununifi.nftmint.MsgUpdateBaseTokenUriResponse) | | | +| `UpdateTokenSupplyCap` | [MsgUpdateTokenSupplyCap](#ununifi.nftmint.MsgUpdateTokenSupplyCap) | [MsgUpdateTokenSupplyCapResponse](#ununifi.nftmint.MsgUpdateTokenSupplyCapResponse) | | | +| `MintNFT` | [MsgMintNFT](#ununifi.nftmint.MsgMintNFT) | [MsgMintNFTResponse](#ununifi.nftmint.MsgMintNFTResponse) | | | +| `BurnNFT` | [MsgBurnNFT](#ununifi.nftmint.MsgBurnNFT) | [MsgBurnNFTResponse](#ununifi.nftmint.MsgBurnNFTResponse) | | | + + +

Top

+## pricefeed/pricefeed.proto - + +### CurrentPrice - +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `market_id` | [string](#string) | | | +| `price` | [string](#string) | | | -### RewardType -At first, we go with this one type. -NFTMARKET_FRONTEND type reward will be disributed for the creators of frontend of UnUniFi's services. + -| Name | Number | Description | -| ---- | ------ | ----------- | -| NFTMARKET_FRONTEND | 0 | | +### Market +| Field | Type | Label | Description | +| ------------- | ----------------- | -------- | ----------- | +| `market_id` | [string](#string) | | | +| `base_asset` | [string](#string) | | | +| `quote_asset` | [string](#string) | | | +| `oracles` | [string](#string) | repeated | | +| `active` | [bool](#bool) | | | - + - +### Params - +| Field | Type | Label | Description | +| --------- | ----------------------------------- | -------- | ----------- | +| `markets` | [Market](#ununifi.pricefeed.Market) | repeated | | + +### PostedPrice - -

Top

+| Field | Type | Label | Description | +| ---------------- | ------------------------------------------------------- | ----- | ----------- | +| `market_id` | [string](#string) | | | +| `oracle_address` | [string](#string) | | | +| `price` | [string](#string) | | | +| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -## ecosystem-incentive/genesis.proto + + + - + -### GenesisState -GenesisState defines the ecosystemincentive module's genesis state. + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.ecosystemincentive.Params) | | | -| `incentive_units` | [IncentiveUnit](#ununifi.ecosystemincentive.IncentiveUnit) | repeated | | -| `reward_stores` | [RewardStore](#ununifi.ecosystemincentive.RewardStore) | repeated | | +## pricefeed/genesis.proto + +### GenesisState +GenesisState defines the pricefeed module's genesis state. +| Field | Type | Label | Description | +| --------------- | --------------------------------------------- | -------- | --------------------------------------------------------------- | +| `params` | [Params](#ununifi.pricefeed.Params) | | | +| `posted_prices` | [PostedPrice](#ununifi.pricefeed.PostedPrice) | repeated | this line is used by starport scaffolding # genesis/proto/state | @@ -3143,5267 +4631,196 @@ GenesisState defines the ecosystemincentive module's genesis state. + - -

Top

-## ecosystem-incentive/memo.proto +## pricefeed/query.proto + +### QueryAllMarketRequest - - -### MemoInputs - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `version` | [string](#string) | | | -| `incentive_unit_id` | [string](#string) | | | - - - - - - - - - - - - - - - - -

Top

- -## ecosystem-incentive/query.proto - - - - - -### QueryAllRewardsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `subject_addr` | [string](#string) | | | - - - - - - - - -### QueryAllRewardsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `rewards` | [RewardStore](#ununifi.ecosystemincentive.RewardStore) | | | - - - - - - - - -### QueryIncentiveUnitIdsByAddrRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | | - - - - - - - - -### QueryIncentiveUnitIdsByAddrResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_ids_by_addr` | [IncentiveUnitIdsByAddr](#ununifi.ecosystemincentive.IncentiveUnitIdsByAddr) | | | - - - - - - - - -### QueryIncentiveUnitRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | - - - - - - - - -### QueryIncentiveUnitResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit` | [IncentiveUnit](#ununifi.ecosystemincentive.IncentiveUnit) | | | - - - - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.ecosystemincentive.Params) | | params holds all the parameters of this module. | - - - - - - - - -### QueryRecordedIncentiveUnitIdRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryRecordedIncentiveUnitIdResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `incentive_unit_id` | [string](#string) | | | - - - - - - - - -### QueryRewardRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `subject_addr` | [string](#string) | | | -| `denom` | [string](#string) | | | - - - - - - - - -### QueryRewardResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.ecosystemincentive.QueryParamsRequest) | [QueryParamsResponse](#ununifi.ecosystemincentive.QueryParamsResponse) | Parameters queries the parameters of the module. | GET|/ununifi/ecosystem_incentive/params| -| `IncentiveUnit` | [QueryIncentiveUnitRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitRequest) | [QueryIncentiveUnitResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitResponse) | | GET|/ununifi/ecosystem_incentive/incentive_unit/{incentive_unit_id}| -| `AllRewards` | [QueryAllRewardsRequest](#ununifi.ecosystemincentive.QueryAllRewardsRequest) | [QueryAllRewardsResponse](#ununifi.ecosystemincentive.QueryAllRewardsResponse) | | GET|/ununifi/ecosystem_incentive/all_rewards/{subject_addr}| -| `Reward` | [QueryRewardRequest](#ununifi.ecosystemincentive.QueryRewardRequest) | [QueryRewardResponse](#ununifi.ecosystemincentive.QueryRewardResponse) | | GET|/ununifi/ecosystem_incentive/reward/{subject_addr}/{denom}| -| `RecordedIncentiveUnitId` | [QueryRecordedIncentiveUnitIdRequest](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdRequest) | [QueryRecordedIncentiveUnitIdResponse](#ununifi.ecosystemincentive.QueryRecordedIncentiveUnitIdResponse) | | GET|/ununifi/ecosystem_incentive/recorded_incentive_unit_id/{class_id}/{nft_id}| -| `IncentiveUnitIdsByAddr` | [QueryIncentiveUnitIdsByAddrRequest](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrRequest) | [QueryIncentiveUnitIdsByAddrResponse](#ununifi.ecosystemincentive.QueryIncentiveUnitIdsByAddrResponse) | | GET|/ununifi/ecosystem_incentive/incentive_unit_ids_by_addr/{address}| - - - - - - -

Top

- -## ecosystem-incentive/tx.proto - - - - - -### MsgRegister - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `incentive_unit_id` | [string](#string) | | | -| `subject_addrs` | [string](#string) | repeated | | -| `weights` | [string](#string) | repeated | | - - - - - - - - -### MsgRegisterResponse - - - - - - - - - -### MsgWithdrawAllRewards - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | - - - - - - - - -### MsgWithdrawAllRewardsResponse - - - - - - - - - -### MsgWithdrawReward - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `denom` | [string](#string) | | | - - - - - - - - -### MsgWithdrawRewardResponse - - - - - - - - - - - - - - - -### Msg -Msg defines the Msg service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Register` | [MsgRegister](#ununifi.ecosystemincentive.MsgRegister) | [MsgRegisterResponse](#ununifi.ecosystemincentive.MsgRegisterResponse) | | | -| `WithdrawAllRewards` | [MsgWithdrawAllRewards](#ununifi.ecosystemincentive.MsgWithdrawAllRewards) | [MsgWithdrawAllRewardsResponse](#ununifi.ecosystemincentive.MsgWithdrawAllRewardsResponse) | | | -| `WithdrawReward` | [MsgWithdrawReward](#ununifi.ecosystemincentive.MsgWithdrawReward) | [MsgWithdrawRewardResponse](#ununifi.ecosystemincentive.MsgWithdrawRewardResponse) | | | - - - - - - -

Top

- -## ethereum/signdoc.proto - - - - - -### SignDocForMetamask - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `body` | [cosmos.tx.v1beta1.TxBody](#cosmos.tx.v1beta1.TxBody) | | | -| `auth_info` | [cosmos.tx.v1beta1.AuthInfo](#cosmos.tx.v1beta1.AuthInfo) | | | -| `chain_id` | [string](#string) | | | -| `account_number` | [uint64](#uint64) | | | - - - - - - - - - - - - - - - - -

Top

- -## incentive/incentive.proto - - - - - -### BaseClaim - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### BaseMultiClaim - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - - - - - - - - -### CdpMintingClaim - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_claim` | [BaseClaim](#ununifi.incentive.BaseClaim) | | | -| `reward_indexes` | [RewardIndex](#ununifi.incentive.RewardIndex) | repeated | | - - - - - - - - -### Multiplier - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `name` | [string](#string) | | | -| `months_lockup` | [int64](#int64) | | | -| `factor` | [string](#string) | | | - - - - - - - - -### Params - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `cdp_minting_reward_periods` | [RewardPeriod](#ununifi.incentive.RewardPeriod) | repeated | | -| `claim_multipliers` | [Multiplier](#ununifi.incentive.Multiplier) | repeated | | -| `claim_end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - -### RewardIndex - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `collateral_type` | [string](#string) | | | -| `reward_factor` | [string](#string) | | | - - - - - - - - -### RewardPeriod - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `active` | [bool](#bool) | | | -| `collateral_type` | [string](#string) | | | -| `start` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `rewards_per_second` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - - - - - - - - - -

Top

- -## incentive/genesis.proto - - - - - -### GenesisAccumulationTime - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `collateral_type` | [string](#string) | | | -| `previous_accumulation_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - -### GenesisDenoms - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `principal_denom` | [string](#string) | | | -| `cdp_minting_reward_denom` | [string](#string) | | | - - - - - - - - -### GenesisState -GenesisState defines the incentive module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.incentive.Params) | | | -| `cdp_accumulation_times` | [GenesisAccumulationTime](#ununifi.incentive.GenesisAccumulationTime) | repeated | | -| `cdp_minting_claims` | [CdpMintingClaim](#ununifi.incentive.CdpMintingClaim) | repeated | | -| `denoms` | [GenesisDenoms](#ununifi.incentive.GenesisDenoms) | | this line is used by starport scaffolding # genesis/proto/state | - - - - - - - - - - - - - - - - -

Top

- -## incentive/query.proto - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.incentive.Params) | | | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.incentive.QueryParamsRequest) | [QueryParamsResponse](#ununifi.incentive.QueryParamsResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/incentive/params| - - - - - - -

Top

- -## incentive/tx.proto - - - - - -### MsgClaimCdpMintingReward - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `multiplier_name` | [string](#string) | | | - - - - - - - - -### MsgClaimCdpMintingRewardResponse - - - - - - - - - - - - - - - -### Msg - - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `ClaimCdpMintingReward` | [MsgClaimCdpMintingReward](#ununifi.incentive.MsgClaimCdpMintingReward) | [MsgClaimCdpMintingRewardResponse](#ununifi.incentive.MsgClaimCdpMintingRewardResponse) | | | - - - - - - -

Top

- -## nftmarket/nftmarket.proto - - - - - -### BidId - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `bidder` | [string](#string) | | | - - - - - - - - -### EventBorrow - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `borrower` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `amount` | [string](#string) | | | - - - - - - - - -### EventCancelBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventCancelListNfting - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventEndListNfting - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventExpandListingPeriod - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventLiquidate - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `liquidator` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventListNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventPayFullBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventPlaceBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `amount` | [string](#string) | | | - - - - - - - - -### EventRepay - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `repayer` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `amount` | [string](#string) | | | - - - - - - - - -### EventSellingDecision - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### Liquidation - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `liquidation_date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - -### Liquidations - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `liquidation` | [Liquidation](#ununifi.nftmarket.Liquidation) | | | -| `next_liquidation` | [Liquidation](#ununifi.nftmarket.Liquidation) | repeated | | - - - - - - - - -### ListedClass - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_ids` | [string](#string) | repeated | | - - - - - - - - -### Loan - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `loan` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### NftBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `bidder` | [string](#string) | | | -| `bid_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `deposit_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `paid_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `bidding_period` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `deposit_lending_rate` | [string](#string) | | | -| `automatic_payment` | [bool](#bool) | | | -| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `interest_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `borrowings` | [borrowing](#ununifi.nftmarket.borrowing) | repeated | lister borrowing bidder info | -| `id` | [BidId](#ununifi.nftmarket.BidId) | | todo remove nft_id,bidder then use it | - - - - - - - - -### NftIdentifier - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### NftInfo - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `uri` | [string](#string) | | | -| `uri_hash` | [string](#string) | | | - - - - - - - - -### NftListing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `owner` | [string](#string) | | | -| `listing_type` | [ListingType](#ununifi.nftmarket.ListingType) | | | -| `state` | [ListingState](#ununifi.nftmarket.ListingState) | | | -| `bid_token` | [string](#string) | | | -| `minimum_deposit_rate` | [string](#string) | | | -| `automatic_refinancing` | [bool](#bool) | | | -| `started_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `full_payment_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `successful_bid_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `auto_relisted_count` | [uint64](#uint64) | | | -| `collected_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `minimum_bidding_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | | - - - - - - - - -### Params - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `min_staking_for_listing` | [string](#string) | | | -| `default_bid_active_rank` | [uint64](#uint64) | | | -| `bid_tokens` | [string](#string) | repeated | | -| `auto_relisting_count_if_no_bid` | [uint64](#uint64) | | | -| `nft_listing_delay_seconds` | [uint64](#uint64) | | | -| `nft_listing_period_initial` | [uint64](#uint64) | | | -| `nft_listing_cancel_required_seconds` | [uint64](#uint64) | | | -| `nft_listing_cancel_fee_percentage` | [uint64](#uint64) | | | -| `nft_listing_gap_time` | [uint64](#uint64) | | | -| `bid_cancel_required_seconds` | [uint64](#uint64) | | | -| `bid_token_disburse_seconds_after_cancel` | [uint64](#uint64) | | | -| `nft_listing_full_payment_period` | [uint64](#uint64) | | | -| `nft_listing_nft_delivery_period` | [uint64](#uint64) | | | -| `nft_creator_share_percentage` | [uint64](#uint64) | | | -| `market_administrator` | [string](#string) | | | -| `nft_listing_commission_fee` | [uint64](#uint64) | | | -| `nft_listing_extend_seconds` | [uint64](#uint64) | | | -| `nft_listing_period_extend_fee_per_hour` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### PaymentStatus - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `bidder` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `automatic_payment` | [bool](#bool) | | | -| `paid_amount` | [string](#string) | | | -| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `state` | [ListingState](#ununifi.nftmarket.ListingState) | | | -| `all_paid` | [bool](#bool) | | | - - - - - - - - -### borrowing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `paid_interest_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `start_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - - - -### ListingState - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| LISTING | 0 | | -| BIDDING | 1 | | -| SELLING_DECISION | 2 | | -| END_LISTING | 3 | | -| SUCCESSFUL_BID | 4 | | - - - - - -### ListingType - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| DIRECT_ASSET_BORROW | 0 | | -| SYNTHETIC_ASSET_CREATION | 1 | | -| LATE_SHIPPING | 2 | | - - - - - - - - - - - -

Top

- -## nftmarket/genesis.proto - - - - - -### GenesisState -GenesisState defines the nftmarket module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.nftmarket.Params) | | | -| `listings` | [NftListing](#ununifi.nftmarket.NftListing) | repeated | | -| `bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | -| `cancelled_bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | -| `loans` | [Loan](#ununifi.nftmarket.Loan) | repeated | | - - - - - - - - - - - - - - - - -

Top

- -## nftmarket/query.proto - - - - - -### NftListingDetail - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `listing` | [NftListing](#ununifi.nftmarket.NftListing) | | | -| `nft_info` | [NftInfo](#ununifi.nftmarket.NftInfo) | | | - - - - - - - - -### QueryBidderBidsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | - - - - - - - - -### QueryBidderBidsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | - - - - - - - - -### QueryCDPsListRequest - - - - - - - - - -### QueryCDPsListResponse - - - - - - - - - -### QueryLiquidationRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryLiquidationResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `liquidations` | [Liquidations](#ununifi.nftmarket.Liquidations) | | | - - - - - - - - -### QueryListedClassRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_limit` | [int32](#int32) | | | - - - - - - - - -### QueryListedClassResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `name` | [string](#string) | | | -| `description` | [string](#string) | | | -| `symbol` | [string](#string) | | | -| `uri` | [string](#string) | | | -| `urihash` | [string](#string) | | | -| `nfts` | [NftInfo](#ununifi.nftmarket.NftInfo) | repeated | | -| `nft_count` | [uint64](#uint64) | | | - - - - - - - - -### QueryListedClassesRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_limit` | [int32](#int32) | | | - - - - - - - - -### QueryListedClassesResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `classes` | [QueryListedClassResponse](#ununifi.nftmarket.QueryListedClassResponse) | repeated | | - - - - - - - - -### QueryListedNftsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | - - - - - - - - -### QueryListedNftsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `listings` | [NftListingDetail](#ununifi.nftmarket.NftListingDetail) | repeated | | - - - - - - - - -### QueryLoanRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryLoanResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `loan` | [Loan](#ununifi.nftmarket.Loan) | | | -| `borrowing_limit` | [string](#string) | | | - - - - - - - - -### QueryLoansRequest - - - - - - - - - -### QueryLoansResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `loans` | [Loan](#ununifi.nftmarket.Loan) | repeated | | - - - - - - - - -### QueryNftBidsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryNftBidsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bids` | [NftBid](#ununifi.nftmarket.NftBid) | repeated | | - - - - - - - - -### QueryNftListingRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryNftListingResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `listing` | [NftListing](#ununifi.nftmarket.NftListing) | | | - - - - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.nftmarket.Params) | | | - - - - - - - - -### QueryPaymentStatusRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `bidder` | [string](#string) | | | - - - - - - - - -### QueryPaymentStatusResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `paymentStatus` | [PaymentStatus](#ununifi.nftmarket.PaymentStatus) | | | - - - - - - - - -### QueryRewardsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [uint64](#uint64) | | | - - - - - - - - -### QueryRewardsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.nftmarket.QueryParamsRequest) | [QueryParamsResponse](#ununifi.nftmarket.QueryParamsResponse) | | GET|/ununifi/nftmarket/params| -| `NftListing` | [QueryNftListingRequest](#ununifi.nftmarket.QueryNftListingRequest) | [QueryNftListingResponse](#ununifi.nftmarket.QueryNftListingResponse) | | GET|/ununifi/nftmarket/nft_listing/{class_id}/{nft_id}| -| `ListedNfts` | [QueryListedNftsRequest](#ununifi.nftmarket.QueryListedNftsRequest) | [QueryListedNftsResponse](#ununifi.nftmarket.QueryListedNftsResponse) | | GET|/ununifi/nftmarket/listed_nfts| -| `ListedClasses` | [QueryListedClassesRequest](#ununifi.nftmarket.QueryListedClassesRequest) | [QueryListedClassesResponse](#ununifi.nftmarket.QueryListedClassesResponse) | | GET|/ununifi/nftmarket/listed_classes| -| `ListedClass` | [QueryListedClassRequest](#ununifi.nftmarket.QueryListedClassRequest) | [QueryListedClassResponse](#ununifi.nftmarket.QueryListedClassResponse) | | GET|/ununifi/nftmarket/listed_class/{class_id}/{nft_limit}| -| `Loans` | [QueryLoansRequest](#ununifi.nftmarket.QueryLoansRequest) | [QueryLoansResponse](#ununifi.nftmarket.QueryLoansResponse) | | GET|/ununifi/nftmarket/loans| -| `Loan` | [QueryLoanRequest](#ununifi.nftmarket.QueryLoanRequest) | [QueryLoanResponse](#ununifi.nftmarket.QueryLoanResponse) | | GET|/ununifi/nftmarket/loans/{class_id}/{nft_id}| -| `CDPsList` | [QueryCDPsListRequest](#ununifi.nftmarket.QueryCDPsListRequest) | [QueryCDPsListResponse](#ununifi.nftmarket.QueryCDPsListResponse) | | GET|/ununifi/nftmarket/cdps_list| -| `NftBids` | [QueryNftBidsRequest](#ununifi.nftmarket.QueryNftBidsRequest) | [QueryNftBidsResponse](#ununifi.nftmarket.QueryNftBidsResponse) | | GET|/ununifi/nftmarket/nft_bids/{class_id}/{nft_id}| -| `BidderBids` | [QueryBidderBidsRequest](#ununifi.nftmarket.QueryBidderBidsRequest) | [QueryBidderBidsResponse](#ununifi.nftmarket.QueryBidderBidsResponse) | | GET|/ununifi/nftmarket/bidder_bids/{bidder}| -| `PaymentStatus` | [QueryPaymentStatusRequest](#ununifi.nftmarket.QueryPaymentStatusRequest) | [QueryPaymentStatusResponse](#ununifi.nftmarket.QueryPaymentStatusResponse) | | GET|/ununifi/nftmarket/payment_status/{class_id}/{nft_id}/{bidder}| -| `Rewards` | [QueryRewardsRequest](#ununifi.nftmarket.QueryRewardsRequest) | [QueryRewardsResponse](#ununifi.nftmarket.QueryRewardsResponse) | | GET|/ununifi/nftmarket/rewards/{address}| -| `Liquidation` | [QueryLiquidationRequest](#ununifi.nftmarket.QueryLiquidationRequest) | [QueryLiquidationResponse](#ununifi.nftmarket.QueryLiquidationResponse) | | GET|/ununifi/nftmarket/liquidation/{class_id}/{nft_id}| - - - - - - -

Top

- -## nftmarket/tx.proto - - - - - -### MsgBorrow - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgBorrowResponse - - - - - - - - - -### MsgCancelBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | - - - - - - - - -### MsgCancelBidResponse - - - - - - - - - -### MsgCancelNftListing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | - - - - - - - - -### MsgCancelNftListingResponse - - - - - - - - - -### MsgEndNftListing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | - - - - - - - - -### MsgEndNftListingResponse - - - - - - - - - -### MsgListNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `listing_type` | [ListingType](#ununifi.nftmarket.ListingType) | | | -| `bid_token` | [string](#string) | | | -| `minimum_deposit_rate` | [string](#string) | | 1% = 0.01 | -| `automatic_refinancing` | [bool](#bool) | | | -| `minimum_bidding_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | | - - - - - - - - -### MsgListNftResponse - - - - - - - - - -### MsgMintNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `classId` | [string](#string) | | | -| `nftId` | [string](#string) | | | -| `nftUri` | [string](#string) | | | -| `nftUriHash` | [string](#string) | | | - - - - - - - - -### MsgMintNftResponse - - - - - - - - - -### MsgPayFullBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | - - - - - - - - -### MsgPayFullBidResponse - - - - - - - - - -### MsgPlaceBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `bid_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `bidding_period` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `deposit_lending_rate` | [string](#string) | | | -| `automatic_payment` | [bool](#bool) | | | -| `deposit_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgPlaceBidResponse - - - - - - - - - -### MsgRepay - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgRepayResponse - - - - - - - - - -### MsgSellingDecision - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarket.NftIdentifier) | | | - - - - - - - - -### MsgSellingDecisionResponse - - - - - - - - - - - - - - - -### Msg - - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `MintNft` | [MsgMintNft](#ununifi.nftmarket.MsgMintNft) | [MsgMintNftResponse](#ununifi.nftmarket.MsgMintNftResponse) | | | -| `ListNft` | [MsgListNft](#ununifi.nftmarket.MsgListNft) | [MsgListNftResponse](#ununifi.nftmarket.MsgListNftResponse) | | | -| `CancelNftListing` | [MsgCancelNftListing](#ununifi.nftmarket.MsgCancelNftListing) | [MsgCancelNftListingResponse](#ununifi.nftmarket.MsgCancelNftListingResponse) | | | -| `PlaceBid` | [MsgPlaceBid](#ununifi.nftmarket.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.nftmarket.MsgPlaceBidResponse) | | | -| `CancelBid` | [MsgCancelBid](#ununifi.nftmarket.MsgCancelBid) | [MsgCancelBidResponse](#ununifi.nftmarket.MsgCancelBidResponse) | | | -| `SellingDecision` | [MsgSellingDecision](#ununifi.nftmarket.MsgSellingDecision) | [MsgSellingDecisionResponse](#ununifi.nftmarket.MsgSellingDecisionResponse) | | | -| `EndNftListing` | [MsgEndNftListing](#ununifi.nftmarket.MsgEndNftListing) | [MsgEndNftListingResponse](#ununifi.nftmarket.MsgEndNftListingResponse) | | | -| `PayFullBid` | [MsgPayFullBid](#ununifi.nftmarket.MsgPayFullBid) | [MsgPayFullBidResponse](#ununifi.nftmarket.MsgPayFullBidResponse) | | | -| `Borrow` | [MsgBorrow](#ununifi.nftmarket.MsgBorrow) | [MsgBorrowResponse](#ununifi.nftmarket.MsgBorrowResponse) | | | -| `Repay` | [MsgRepay](#ununifi.nftmarket.MsgRepay) | [MsgRepayResponse](#ununifi.nftmarket.MsgRepayResponse) | | | - - - - - - -

Top

- -## nftmarketv1/nftmarket.proto - - - - - -### EventBorrow - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `borrower` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `amount` | [string](#string) | | | - - - - - - - - -### EventCancelBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventCancelListNfting - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventEndListNfting - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventExpandListingPeriod - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventLiquidate - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `liquidator` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventListNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventPayFullBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventPlaceBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `amount` | [string](#string) | | | - - - - - - - - -### EventRepay - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `repayer` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `amount` | [string](#string) | | | - - - - - - - - -### EventSellingDecision - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### ListedClass - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_ids` | [string](#string) | repeated | | - - - - - - - - -### ListedNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `uri` | [string](#string) | | | -| `uri_hash` | [string](#string) | | | - - - - - - - - -### Loan - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `loan` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### NftBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `bidder` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `automatic_payment` | [bool](#bool) | | | -| `paid_amount` | [string](#string) | | | -| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - -### NftIdentifier - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### NftListing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `owner` | [string](#string) | | | -| `listing_type` | [ListingType](#ununifi.nftmarketv1.ListingType) | | | -| `state` | [ListingState](#ununifi.nftmarketv1.ListingState) | | | -| `bid_token` | [string](#string) | | | -| `min_bid` | [string](#string) | | | -| `bid_active_rank` | [uint64](#uint64) | | | -| `started_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `full_payment_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `successful_bid_end_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `auto_relisted_count` | [uint64](#uint64) | | | - - - - - - - - -### Params - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `min_staking_for_listing` | [string](#string) | | | -| `default_bid_active_rank` | [uint64](#uint64) | | | -| `bid_tokens` | [string](#string) | repeated | | -| `auto_relisting_count_if_no_bid` | [uint64](#uint64) | | | -| `nft_listing_delay_seconds` | [uint64](#uint64) | | | -| `nft_listing_period_initial` | [uint64](#uint64) | | | -| `nft_listing_cancel_required_seconds` | [uint64](#uint64) | | | -| `nft_listing_cancel_fee_percentage` | [uint64](#uint64) | | | -| `nft_listing_gap_time` | [uint64](#uint64) | | | -| `bid_cancel_required_seconds` | [uint64](#uint64) | | | -| `bid_token_disburse_seconds_after_cancel` | [uint64](#uint64) | | | -| `nft_listing_full_payment_period` | [uint64](#uint64) | | | -| `nft_listing_nft_delivery_period` | [uint64](#uint64) | | | -| `nft_creator_share_percentage` | [uint64](#uint64) | | | -| `market_administrator` | [string](#string) | | | -| `nft_listing_commission_fee` | [uint64](#uint64) | | | -| `nft_listing_extend_seconds` | [uint64](#uint64) | | | -| `nft_listing_period_extend_fee_per_hour` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### PaymentStatus - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `bidder` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `automatic_payment` | [bool](#bool) | | | -| `paid_amount` | [string](#string) | | | -| `bid_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `state` | [ListingState](#ununifi.nftmarketv1.ListingState) | | | -| `all_paid` | [bool](#bool) | | | - - - - - - - - - - -### ListingState - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| LISTING | 0 | | -| BIDDING | 1 | | -| SELLING_DECISION | 2 | | -| LIQUIDATION | 3 | | -| END_LISTING | 4 | | -| SUCCESSFUL_BID | 5 | | - - - - - -### ListingType - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| DIRECT_ASSET_BORROW | 0 | | -| SYNTHETIC_ASSET_CREATION | 1 | | -| LATE_SHIPPING | 2 | | - - - - - - - - - - - -

Top

- -## nftmarketv1/genesis.proto - - - - - -### GenesisState -GenesisState defines the nftmarket module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.nftmarketv1.Params) | | | -| `listings` | [NftListing](#ununifi.nftmarketv1.NftListing) | repeated | | -| `bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | -| `cancelled_bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | -| `loans` | [Loan](#ununifi.nftmarketv1.Loan) | repeated | | - - - - - - - - - - - - - - - - -

Top

- -## nftmarketv1/query.proto - - - - - -### QueryBidderBidsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bidder` | [string](#string) | | | - - - - - - - - -### QueryBidderBidsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | - - - - - - - - -### QueryCDPsListRequest - - - - - - - - - -### QueryCDPsListResponse - - - - - - - - - -### QueryListedClassRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_limit` | [int32](#int32) | | | - - - - - - - - -### QueryListedClassResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `name` | [string](#string) | | | -| `description` | [string](#string) | | | -| `symbol` | [string](#string) | | | -| `uri` | [string](#string) | | | -| `urihash` | [string](#string) | | | -| `nfts` | [ListedNft](#ununifi.nftmarketv1.ListedNft) | repeated | | -| `nft_count` | [uint64](#uint64) | | | - - - - - - - - -### QueryListedClassesRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `nft_limit` | [int32](#int32) | | | - - - - - - - - -### QueryListedClassesResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `classes` | [QueryListedClassResponse](#ununifi.nftmarketv1.QueryListedClassResponse) | repeated | | - - - - - - - - -### QueryListedNftsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | - - - - - - - - -### QueryListedNftsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `listings` | [NftListing](#ununifi.nftmarketv1.NftListing) | repeated | | - - - - - - - - -### QueryLoanRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryLoanResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `loan` | [Loan](#ununifi.nftmarketv1.Loan) | | | -| `borrowing_limit` | [string](#string) | | | - - - - - - - - -### QueryLoansRequest - - - - - - - - - -### QueryLoansResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `loans` | [Loan](#ununifi.nftmarketv1.Loan) | repeated | | - - - - - - - - -### QueryNftBidsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryNftBidsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `bids` | [NftBid](#ununifi.nftmarketv1.NftBid) | repeated | | - - - - - - - - -### QueryNftListingRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryNftListingResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `listing` | [NftListing](#ununifi.nftmarketv1.NftListing) | | | - - - - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.nftmarketv1.Params) | | | - - - - - - - - -### QueryPaymentStatusRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `bidder` | [string](#string) | | | - - - - - - - - -### QueryPaymentStatusResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `paymentStatus` | [PaymentStatus](#ununifi.nftmarketv1.PaymentStatus) | | | - - - - - - - - -### QueryRewardsRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [uint64](#uint64) | | | - - - - - - - - -### QueryRewardsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.nftmarketv1.QueryParamsRequest) | [QueryParamsResponse](#ununifi.nftmarketv1.QueryParamsResponse) | | GET|/ununifi/nftmarket/params| -| `NftListing` | [QueryNftListingRequest](#ununifi.nftmarketv1.QueryNftListingRequest) | [QueryNftListingResponse](#ununifi.nftmarketv1.QueryNftListingResponse) | | GET|/ununifi/nftmarket/nft_listing/{class_id}/{nft_id}| -| `ListedNfts` | [QueryListedNftsRequest](#ununifi.nftmarketv1.QueryListedNftsRequest) | [QueryListedNftsResponse](#ununifi.nftmarketv1.QueryListedNftsResponse) | | GET|/ununifi/nftmarket/listed_nfts| -| `ListedClasses` | [QueryListedClassesRequest](#ununifi.nftmarketv1.QueryListedClassesRequest) | [QueryListedClassesResponse](#ununifi.nftmarketv1.QueryListedClassesResponse) | | GET|/ununifi/nftmarket/listed_classes| -| `ListedClass` | [QueryListedClassRequest](#ununifi.nftmarketv1.QueryListedClassRequest) | [QueryListedClassResponse](#ununifi.nftmarketv1.QueryListedClassResponse) | | GET|/ununifi/nftmarket/listed_class/{class_id}/{nft_limit}| -| `Loans` | [QueryLoansRequest](#ununifi.nftmarketv1.QueryLoansRequest) | [QueryLoansResponse](#ununifi.nftmarketv1.QueryLoansResponse) | | GET|/ununifi/nftmarket/loans| -| `Loan` | [QueryLoanRequest](#ununifi.nftmarketv1.QueryLoanRequest) | [QueryLoanResponse](#ununifi.nftmarketv1.QueryLoanResponse) | | GET|/ununifi/nftmarket/loans/{class_id}/{nft_id}| -| `CDPsList` | [QueryCDPsListRequest](#ununifi.nftmarketv1.QueryCDPsListRequest) | [QueryCDPsListResponse](#ununifi.nftmarketv1.QueryCDPsListResponse) | | GET|/ununifi/nftmarket/cdps_list| -| `NftBids` | [QueryNftBidsRequest](#ununifi.nftmarketv1.QueryNftBidsRequest) | [QueryNftBidsResponse](#ununifi.nftmarketv1.QueryNftBidsResponse) | | GET|/ununifi/nftmarket/nft_bids/{class_id}/{nft_id}| -| `BidderBids` | [QueryBidderBidsRequest](#ununifi.nftmarketv1.QueryBidderBidsRequest) | [QueryBidderBidsResponse](#ununifi.nftmarketv1.QueryBidderBidsResponse) | | GET|/ununifi/nftmarket/bidder_bids/{bidder}| -| `PaymentStatus` | [QueryPaymentStatusRequest](#ununifi.nftmarketv1.QueryPaymentStatusRequest) | [QueryPaymentStatusResponse](#ununifi.nftmarketv1.QueryPaymentStatusResponse) | | GET|/ununifi/nftmarket/payment_status/{class_id}/{nft_id}/{bidder}| -| `Rewards` | [QueryRewardsRequest](#ununifi.nftmarketv1.QueryRewardsRequest) | [QueryRewardsResponse](#ununifi.nftmarketv1.QueryRewardsResponse) | | GET|/ununifi/nftmarket/rewards/{address}| - - - - - - -

Top

- -## nftmarketv1/tx.proto - - - - - -### MsgBorrow - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgBorrowResponse - - - - - - - - - -### MsgBurnStableCoin - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | - - - - - - - - -### MsgBurnStableCoinResponse - - - - - - - - - -### MsgCancelBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgCancelBidResponse - - - - - - - - - -### MsgCancelNftListing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgCancelNftListingResponse - - - - - - - - - -### MsgEndNftListing - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgEndNftListingResponse - - - - - - - - - -### MsgExpandListingPeriod - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgExpandListingPeriodResponse - - - - - - - - - -### MsgLiquidate - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgLiquidateResponse - - - - - - - - - -### MsgListNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `listing_type` | [ListingType](#ununifi.nftmarketv1.ListingType) | | | -| `bid_token` | [string](#string) | | | -| `min_bid` | [string](#string) | | | -| `bid_active_rank` | [uint64](#uint64) | | | - - - - - - - - -### MsgListNftResponse - - - - - - - - - -### MsgMintNft - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `classId` | [string](#string) | | | -| `nftId` | [string](#string) | | | -| `nftUri` | [string](#string) | | | -| `nftUriHash` | [string](#string) | | | - - - - - - - - -### MsgMintNftResponse - - - - - - - - - -### MsgMintStableCoin - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | - - - - - - - - -### MsgMintStableCoinResponse - - - - - - - - - -### MsgPayFullBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgPayFullBidResponse - - - - - - - - - -### MsgPlaceBid - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `automatic_payment` | [bool](#bool) | | | - - - - - - - - -### MsgPlaceBidResponse - - - - - - - - - -### MsgRepay - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgRepayResponse - - - - - - - - - -### MsgSellingDecision - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `nft_id` | [NftIdentifier](#ununifi.nftmarketv1.NftIdentifier) | | | - - - - - - - - -### MsgSellingDecisionResponse - - - - - - - - - - - - - - - -### Msg - - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `MintNft` | [MsgMintNft](#ununifi.nftmarketv1.MsgMintNft) | [MsgMintNftResponse](#ununifi.nftmarketv1.MsgMintNftResponse) | | | -| `ListNft` | [MsgListNft](#ununifi.nftmarketv1.MsgListNft) | [MsgListNftResponse](#ununifi.nftmarketv1.MsgListNftResponse) | | | -| `CancelNftListing` | [MsgCancelNftListing](#ununifi.nftmarketv1.MsgCancelNftListing) | [MsgCancelNftListingResponse](#ununifi.nftmarketv1.MsgCancelNftListingResponse) | | | -| `ExpandListingPeriod` | [MsgExpandListingPeriod](#ununifi.nftmarketv1.MsgExpandListingPeriod) | [MsgExpandListingPeriodResponse](#ununifi.nftmarketv1.MsgExpandListingPeriodResponse) | | | -| `PlaceBid` | [MsgPlaceBid](#ununifi.nftmarketv1.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.nftmarketv1.MsgPlaceBidResponse) | | | -| `CancelBid` | [MsgCancelBid](#ununifi.nftmarketv1.MsgCancelBid) | [MsgCancelBidResponse](#ununifi.nftmarketv1.MsgCancelBidResponse) | | | -| `SellingDecision` | [MsgSellingDecision](#ununifi.nftmarketv1.MsgSellingDecision) | [MsgSellingDecisionResponse](#ununifi.nftmarketv1.MsgSellingDecisionResponse) | | | -| `EndNftListing` | [MsgEndNftListing](#ununifi.nftmarketv1.MsgEndNftListing) | [MsgEndNftListingResponse](#ununifi.nftmarketv1.MsgEndNftListingResponse) | | | -| `PayFullBid` | [MsgPayFullBid](#ununifi.nftmarketv1.MsgPayFullBid) | [MsgPayFullBidResponse](#ununifi.nftmarketv1.MsgPayFullBidResponse) | | | -| `Borrow` | [MsgBorrow](#ununifi.nftmarketv1.MsgBorrow) | [MsgBorrowResponse](#ununifi.nftmarketv1.MsgBorrowResponse) | | | -| `Repay` | [MsgRepay](#ununifi.nftmarketv1.MsgRepay) | [MsgRepayResponse](#ununifi.nftmarketv1.MsgRepayResponse) | | | -| `MintStableCoin` | [MsgMintStableCoin](#ununifi.nftmarketv1.MsgMintStableCoin) | [MsgMintStableCoinResponse](#ununifi.nftmarketv1.MsgMintStableCoinResponse) | | | -| `BurnStableCoin` | [MsgBurnStableCoin](#ununifi.nftmarketv1.MsgBurnStableCoin) | [MsgBurnStableCoinResponse](#ununifi.nftmarketv1.MsgBurnStableCoinResponse) | | | -| `Liquidate` | [MsgLiquidate](#ununifi.nftmarketv1.MsgLiquidate) | [MsgLiquidateResponse](#ununifi.nftmarketv1.MsgLiquidateResponse) | | | - - - - - - -

Top

- -## nftmint/nftmint.proto - - - - - -### ClassAttributes - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `owner` | [string](#string) | | | -| `base_token_uri` | [string](#string) | | | -| `minting_permission` | [MintingPermission](#ununifi.nftmint.MintingPermission) | | | -| `token_supply_cap` | [uint64](#uint64) | | | - - - - - - - - -### ClassNameIdList - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_name` | [string](#string) | | | -| `class_id` | [string](#string) | repeated | | - - - - - - - - -### OwningClassIdList - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | repeated | | - - - - - - - - -### Params - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `MaxNFTSupplyCap` | [uint64](#uint64) | | | -| `MinClassNameLen` | [uint64](#uint64) | | | -| `MaxClassNameLen` | [uint64](#uint64) | | | -| `MinUriLen` | [uint64](#uint64) | | | -| `MaxUriLen` | [uint64](#uint64) | | | -| `MaxSymbolLen` | [uint64](#uint64) | | | -| `MaxDescriptionLen` | [uint64](#uint64) | | | - - - - - - - - - - -### MintingPermission - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| OnlyOwner | 0 | | -| Anyone | 1 | WhiteList = 2; | - - - - - - - - - - - -

Top

- -## nftmint/event.proto - - - - - -### EventBurnNFT - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `burner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### EventCreateClass - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `base_token_uri` | [string](#string) | | | -| `token_supply_cap` | [string](#string) | | | -| `minting_permission` | [MintingPermission](#ununifi.nftmint.MintingPermission) | | | - - - - - - - - -### EventMintNFT - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `owner` | [string](#string) | | | -| `minter` | [string](#string) | | | - - - - - - - - -### EventSendClassOwnership - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `receiver` | [string](#string) | | | -| `class_id` | [string](#string) | | | - - - - - - - - -### EventUpdateBaseTokenUri - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `base_token_uri` | [string](#string) | | | - - - - - - - - -### EventUpdateTokenSupplyCap - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `token_supply_cap` | [string](#string) | | | - - - - - - - - - - - - - - - - -

Top

- -## nftmint/genesis.proto - - - - - -### GenesisState -GenesisState defines the nftmint module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.nftmint.Params) | | | -| `class_attributes_list` | [ClassAttributes](#ununifi.nftmint.ClassAttributes) | repeated | | - - - - - - - - - - - - - - - - -

Top

- -## nftmint/query.proto - - - - - -### QueryClassAttributesRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | - - - - - - - - -### QueryClassAttributesResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_attributes` | [ClassAttributes](#ununifi.nftmint.ClassAttributes) | | | - - - - - - - - -### QueryClassIdsByNameRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_name` | [string](#string) | | | - - - - - - - - -### QueryClassIdsByNameResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_name_id_list` | [ClassNameIdList](#ununifi.nftmint.ClassNameIdList) | | | - - - - - - - - -### QueryClassIdsByOwnerRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owner` | [string](#string) | | | - - - - - - - - -### QueryClassIdsByOwnerResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `owning_class_id_list` | [OwningClassIdList](#ununifi.nftmint.OwningClassIdList) | | | - - - - - - - - -### QueryNFTMinterRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### QueryNFTMinterResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `minter` | [string](#string) | | | - - - - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.nftmint.Params) | | | - - - - - - - - - - - - - - -### Query - - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.nftmint.QueryParamsRequest) | [QueryParamsResponse](#ununifi.nftmint.QueryParamsResponse) | | GET|/ununifi/nftmint/params| -| `ClassAttributes` | [QueryClassAttributesRequest](#ununifi.nftmint.QueryClassAttributesRequest) | [QueryClassAttributesResponse](#ununifi.nftmint.QueryClassAttributesResponse) | | GET|/ununifi/nftmint/class_owner/{class_id}| -| `NFTMinter` | [QueryNFTMinterRequest](#ununifi.nftmint.QueryNFTMinterRequest) | [QueryNFTMinterResponse](#ununifi.nftmint.QueryNFTMinterResponse) | | GET|/ununifi/nftmint/nft_minter/{class_id}/{nft_id}| -| `ClassIdsByName` | [QueryClassIdsByNameRequest](#ununifi.nftmint.QueryClassIdsByNameRequest) | [QueryClassIdsByNameResponse](#ununifi.nftmint.QueryClassIdsByNameResponse) | | GET|/ununifi/nftmint/class_ids_by_name/{class_name}| -| `ClassIdsByOwner` | [QueryClassIdsByOwnerRequest](#ununifi.nftmint.QueryClassIdsByOwnerRequest) | [QueryClassIdsByOwnerResponse](#ununifi.nftmint.QueryClassIdsByOwnerResponse) | | GET|/ununifi/nftmint/class_ids_by_owner/{owner}| - - - - - - -

Top

- -## nftmint/tx.proto - - - - - -### MsgBurnNFT - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | - - - - - - - - -### MsgBurnNFTResponse - - - - - - - - - -### MsgCreateClass - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `name` | [string](#string) | | | -| `base_token_uri` | [string](#string) | | | -| `token_supply_cap` | [uint64](#uint64) | | | -| `minting_permission` | [MintingPermission](#ununifi.nftmint.MintingPermission) | | | -| `symbol` | [string](#string) | | | -| `description` | [string](#string) | | | -| `class_uri` | [string](#string) | | | - - - - - - - - -### MsgCreateClassResponse - - - - - - - - - -### MsgMintNFT - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `nft_id` | [string](#string) | | | -| `recipient` | [string](#string) | | | - - - - - - - - -### MsgMintNFTResponse - - - - - - - - - -### MsgSendClassOwnership - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `recipient` | [string](#string) | | | - - - - - - - - -### MsgSendClassOwnershipResponse - - - - - - - - - -### MsgUpdateBaseTokenUri - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `base_token_uri` | [string](#string) | | | - - - - - - - - -### MsgUpdateBaseTokenUriResponse - - - - - - - - - -### MsgUpdateTokenSupplyCap - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `class_id` | [string](#string) | | | -| `token_supply_cap` | [uint64](#uint64) | | | - - - - - - - - -### MsgUpdateTokenSupplyCapResponse - - - - - - - - - - - - - - - -### Msg - - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `CreateClass` | [MsgCreateClass](#ununifi.nftmint.MsgCreateClass) | [MsgCreateClassResponse](#ununifi.nftmint.MsgCreateClassResponse) | | | -| `SendClassOwnership` | [MsgSendClassOwnership](#ununifi.nftmint.MsgSendClassOwnership) | [MsgSendClassOwnershipResponse](#ununifi.nftmint.MsgSendClassOwnershipResponse) | | | -| `UpdateBaseTokenUri` | [MsgUpdateBaseTokenUri](#ununifi.nftmint.MsgUpdateBaseTokenUri) | [MsgUpdateBaseTokenUriResponse](#ununifi.nftmint.MsgUpdateBaseTokenUriResponse) | | | -| `UpdateTokenSupplyCap` | [MsgUpdateTokenSupplyCap](#ununifi.nftmint.MsgUpdateTokenSupplyCap) | [MsgUpdateTokenSupplyCapResponse](#ununifi.nftmint.MsgUpdateTokenSupplyCapResponse) | | | -| `MintNFT` | [MsgMintNFT](#ununifi.nftmint.MsgMintNFT) | [MsgMintNFTResponse](#ununifi.nftmint.MsgMintNFTResponse) | | | -| `BurnNFT` | [MsgBurnNFT](#ununifi.nftmint.MsgBurnNFT) | [MsgBurnNFTResponse](#ununifi.nftmint.MsgBurnNFTResponse) | | | - - - - - - -

Top

- -## pricefeed/pricefeed.proto - - - - - -### CurrentPrice - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market_id` | [string](#string) | | | -| `price` | [string](#string) | | | - - - - - - - - -### Market - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market_id` | [string](#string) | | | -| `base_asset` | [string](#string) | | | -| `quote_asset` | [string](#string) | | | -| `oracles` | [string](#string) | repeated | | -| `active` | [bool](#bool) | | | - - - - - - - - -### Params - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `markets` | [Market](#ununifi.pricefeed.Market) | repeated | | - - - - - - - - -### PostedPrice - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market_id` | [string](#string) | | | -| `oracle_address` | [string](#string) | | | -| `price` | [string](#string) | | | -| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - - - - - - - - - -

Top

- -## pricefeed/genesis.proto - - - - - -### GenesisState -GenesisState defines the pricefeed module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.pricefeed.Params) | | | -| `posted_prices` | [PostedPrice](#ununifi.pricefeed.PostedPrice) | repeated | this line is used by starport scaffolding # genesis/proto/state | - - - - - - - - - - - - - - - - -

Top

- -## pricefeed/query.proto - - - - - -### QueryAllMarketRequest -this line is used by starport scaffolding # 3 - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - - - - -### QueryAllMarketResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `markets` | [Market](#ununifi.pricefeed.Market) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - - - - -### QueryAllOracleRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market_id` | [string](#string) | | | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - - - - -### QueryAllOracleResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `oracles` | [string](#string) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - - - - -### QueryAllPriceRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - - - - -### QueryAllPriceResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `prices` | [CurrentPrice](#ununifi.pricefeed.CurrentPrice) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - - - - -### QueryAllRawPriceRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market_id` | [string](#string) | | | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - - - - -### QueryAllRawPriceResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `prices` | [PostedPrice](#ununifi.pricefeed.PostedPrice) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - - - - -### QueryGetPriceRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `market_id` | [string](#string) | | | - - - - - - - - -### QueryGetPriceResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `price` | [CurrentPrice](#ununifi.pricefeed.CurrentPrice) | | | - - - - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.pricefeed.Params) | | | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.pricefeed.QueryParamsRequest) | [QueryParamsResponse](#ununifi.pricefeed.QueryParamsResponse) | | GET|/ununifi/pricefeed/params| -| `MarketAll` | [QueryAllMarketRequest](#ununifi.pricefeed.QueryAllMarketRequest) | [QueryAllMarketResponse](#ununifi.pricefeed.QueryAllMarketResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/pricefeed/markets| -| `OracleAll` | [QueryAllOracleRequest](#ununifi.pricefeed.QueryAllOracleRequest) | [QueryAllOracleResponse](#ununifi.pricefeed.QueryAllOracleResponse) | | GET|/ununifi/pricefeed/markets/{market_id}/oracles| -| `Price` | [QueryGetPriceRequest](#ununifi.pricefeed.QueryGetPriceRequest) | [QueryGetPriceResponse](#ununifi.pricefeed.QueryGetPriceResponse) | | GET|/ununifi/pricefeed/markets/{market_id}/price| -| `PriceAll` | [QueryAllPriceRequest](#ununifi.pricefeed.QueryAllPriceRequest) | [QueryAllPriceResponse](#ununifi.pricefeed.QueryAllPriceResponse) | | GET|/ununifi/pricefeed/prices| -| `RawPriceAll` | [QueryAllRawPriceRequest](#ununifi.pricefeed.QueryAllRawPriceRequest) | [QueryAllRawPriceResponse](#ununifi.pricefeed.QueryAllRawPriceResponse) | | GET|/ununifi/pricefeed/markets/{market_id}/raw_prices| - - - - - - -

Top

- -## pricefeed/tx.proto - - - - - -### MsgPostPrice - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from` | [string](#string) | | | -| `market_id` | [string](#string) | | | -| `price` | [string](#string) | | | -| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - -### MsgPostPriceResponse - - - - - - - - - - - - - - - -### Msg - - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `PostPrice` | [MsgPostPrice](#ununifi.pricefeed.MsgPostPrice) | [MsgPostPriceResponse](#ununifi.pricefeed.MsgPostPriceResponse) | | | - - - - - - -

Top

- -## ununifidist/ununifidist.proto - - - - - -### Params - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `active` | [bool](#bool) | | | -| `periods` | [Period](#ununifi.ununifidist.Period) | repeated | | - - - - - - - - -### Period - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `start` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `inflation` | [string](#string) | | | - - - - - - - - - - - - - - - - -

Top

- -## ununifidist/genesis.proto - - - - - -### GenesisState -GenesisState defines the ununifidist module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.ununifidist.Params) | | | -| `previous_block_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `gov_denom` | [string](#string) | | this line is used by starport scaffolding # genesis/proto/state | - - - - - - - - - - - - - - - - -

Top

- -## ununifidist/query.proto - - - - - -### QueryGetBalancesRequest - - - - - - - - - -### QueryGetBalancesResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `balances` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - - - - - - - - -### QueryParamsRequest - - - - - - - - - -### QueryParamsResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.ununifidist.Params) | | | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.ununifidist.QueryParamsRequest) | [QueryParamsResponse](#ununifi.ununifidist.QueryParamsResponse) | | GET|/ununifi/ununifidist/params| -| `Balances` | [QueryGetBalancesRequest](#ununifi.ununifidist.QueryGetBalancesRequest) | [QueryGetBalancesResponse](#ununifi.ununifidist.QueryGetBalancesResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/ununifidist/balances| - - - - - - -

Top

- -## yield-aggregator/params.proto - - - - - -### Params -Params defines the parameters for the module. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `commission_rate` | [string](#string) | | | -| `vault_creation_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `vault_creation_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - - - - - - - - - -

Top

- -## yield-aggregator/yield-aggregator.proto - - - - - -### Strategy - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `id` | [uint64](#uint64) | | | -| `contract_address` | [string](#string) | | | -| `name` | [string](#string) | | | - - - - - - - - -### StrategyMetrics - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `allocation` | [string](#string) | | | -| `apr` | [string](#string) | | | - - - - - - - - -### StrategyWeight - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `strategy_id` | [uint64](#uint64) | | | -| `weight` | [string](#string) | | | - - - - - - - - -### Vault - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | -| `denom` | [string](#string) | | | -| `owner` | [string](#string) | | | -| `owner_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `withdraw_commission_rate` | [string](#string) | | | -| `withdraw_reserve_rate` | [string](#string) | | | -| `strategy_weights` | [StrategyWeight](#ununifi.yieldaggregator.StrategyWeight) | repeated | | - - - - - - - - -### VaultMetrics - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `allocation` | [string](#string) | | | -| `apy` | [string](#string) | | | - - - - - - - - - - - - - - - - -

Top

- -## yield-aggregator/genesis.proto - - - - - -### GenesisState -GenesisState defines the yieldaggregator module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.yieldaggregator.Params) | | | -| `vaults` | [Vault](#ununifi.yieldaggregator.Vault) | repeated | this line is used by starport scaffolding # genesis/proto/state | -| `strategies` | [Strategy](#ununifi.yieldaggregator.Strategy) | repeated | | - - - - - - - - - - - - - - - - -

Top

- -## yield-aggregator/proposal.proto - - - - - -### ProposalAddStrategy -proposal to add new strategy. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `denom` | [string](#string) | | | -| `contract_address` | [string](#string) | | | -| `name` | [string](#string) | | | - - - - - - - - - - - - - - - - -

Top

- -## yield-aggregator/query.proto - - - - - -### QueryAllStrategyRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - - - - -### QueryAllStrategyResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `strategies` | [Strategy](#ununifi.yieldaggregator.Strategy) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - - - - -### QueryAllVaultRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - - - - - - - - -### QueryAllVaultResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `vaults` | [Vault](#ununifi.yieldaggregator.Vault) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - - - - - - - - -### QueryEstimateMintAmountRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | -| `deposit_amount` | [string](#string) | | | - - - - - - - - -### QueryEstimateMintAmountResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `mint_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### QueryEstimateRedeemAmountRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | -| `burn_amount` | [string](#string) | | | - - - - - - - - -### QueryEstimateRedeemAmountResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `redeem_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### QueryGetStrategyRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `id` | [uint64](#uint64) | | | - - - - - - - - -### QueryGetStrategyResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `strategy` | [Strategy](#ununifi.yieldaggregator.Strategy) | | | - - - - - - - - -### QueryGetVaultRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | - - - - - - - - -### QueryGetVaultResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `vault` | [Vault](#ununifi.yieldaggregator.Vault) | | | -| `strategies` | [Strategy](#ununifi.yieldaggregator.Strategy) | repeated | | -| `vault_address` | [string](#string) | | | -| `total_bonded_amount` | [string](#string) | | | -| `total_unbonding_amount` | [string](#string) | | | -| `total_withdrawal_balance` | [string](#string) | | | - - - - - - - - -### QueryParamsRequest -QueryParamsRequest is request type for the Query/Params RPC method. - - - - - - - - -### QueryParamsResponse -QueryParamsResponse is response type for the Query/Params RPC method. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.yieldaggregator.Params) | | params holds all the parameters of this module. | - - - - - - - - - - - - - - -### Query -Query defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.yieldaggregator.QueryParamsRequest) | [QueryParamsResponse](#ununifi.yieldaggregator.QueryParamsResponse) | Parameters queries the parameters of the module. | GET|/ununifi/yield-aggregator/params| -| `VaultAll` | [QueryAllVaultRequest](#ununifi.yieldaggregator.QueryAllVaultRequest) | [QueryAllVaultResponse](#ununifi.yieldaggregator.QueryAllVaultResponse) | this line is used by starport scaffolding # 2 | GET|/ununifi/yield-aggregator/vaults| -| `Vault` | [QueryGetVaultRequest](#ununifi.yieldaggregator.QueryGetVaultRequest) | [QueryGetVaultResponse](#ununifi.yieldaggregator.QueryGetVaultResponse) | | GET|/ununifi/yield-aggregator/vaults/{id}| -| `StrategyAll` | [QueryAllStrategyRequest](#ununifi.yieldaggregator.QueryAllStrategyRequest) | [QueryAllStrategyResponse](#ununifi.yieldaggregator.QueryAllStrategyResponse) | | GET|/ununifi/yield-aggregator/strategies/query-param| -| `Strategy` | [QueryGetStrategyRequest](#ununifi.yieldaggregator.QueryGetStrategyRequest) | [QueryGetStrategyResponse](#ununifi.yieldaggregator.QueryGetStrategyResponse) | | GET|/ununifi/yield-aggregator/strategies/{id}| -| `EstimateMintAmount` | [QueryEstimateMintAmountRequest](#ununifi.yieldaggregator.QueryEstimateMintAmountRequest) | [QueryEstimateMintAmountResponse](#ununifi.yieldaggregator.QueryEstimateMintAmountResponse) | | GET|/ununifi/yield-aggregator/vaults/{id}/estimate-mint-amount| -| `EstimateRedeemAmount` | [QueryEstimateRedeemAmountRequest](#ununifi.yieldaggregator.QueryEstimateRedeemAmountRequest) | [QueryEstimateRedeemAmountResponse](#ununifi.yieldaggregator.QueryEstimateRedeemAmountResponse) | | GET|/ununifi/yield-aggregator/vaults/{id}/estimate-redeem-amount| - - - - - - -

Top

- -## yield-aggregator/tx.proto - - - - - -### MsgCreateVault - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `denom` | [string](#string) | | | -| `commission_rate` | [string](#string) | | | -| `withdraw_reserve_rate` | [string](#string) | | | -| `strategy_weights` | [StrategyWeight](#ununifi.yieldaggregator.StrategyWeight) | repeated | | -| `fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | -| `deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgCreateVaultResponse - - - - - - - - - -### MsgDeleteVault - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `vault_id` | [uint64](#uint64) | | | - - - - - - - - -### MsgDeleteVaultResponse - - - - - - - - - -### MsgDepositToVault -this line is used by starport scaffolding # proto/tx/message - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `vault_id` | [uint64](#uint64) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### MsgDepositToVaultResponse - - - - - - - - - -### MsgTransferVaultOwnership - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `vault_id` | [uint64](#uint64) | | | -| `recipient` | [string](#string) | | | - - - - - - - - -### MsgTransferVaultOwnershipResponse - - - - - - - - - -### MsgWithdrawFromVault - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `sender` | [string](#string) | | | -| `vault_id` | [uint64](#uint64) | | | -| `lp_token_amount` | [string](#string) | | | - - - - - - - - -### MsgWithdrawFromVaultResponse - - - - - - - - - - - - - - - -### Msg -Msg defines the Msg service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `DepositToVault` | [MsgDepositToVault](#ununifi.yieldaggregator.MsgDepositToVault) | [MsgDepositToVaultResponse](#ununifi.yieldaggregator.MsgDepositToVaultResponse) | this line is used by starport scaffolding # proto/tx/rpc | | -| `WithdrawFromVault` | [MsgWithdrawFromVault](#ununifi.yieldaggregator.MsgWithdrawFromVault) | [MsgWithdrawFromVaultResponse](#ununifi.yieldaggregator.MsgWithdrawFromVaultResponse) | | | -| `CreateVault` | [MsgCreateVault](#ununifi.yieldaggregator.MsgCreateVault) | [MsgCreateVaultResponse](#ununifi.yieldaggregator.MsgCreateVaultResponse) | | | -| `DeleteVault` | [MsgDeleteVault](#ununifi.yieldaggregator.MsgDeleteVault) | [MsgDeleteVaultResponse](#ununifi.yieldaggregator.MsgDeleteVaultResponse) | | | -| `TransferVaultOwnership` | [MsgTransferVaultOwnership](#ununifi.yieldaggregator.MsgTransferVaultOwnership) | [MsgTransferVaultOwnershipResponse](#ununifi.yieldaggregator.MsgTransferVaultOwnershipResponse) | | | - - - - - - -

Top

- -## yieldaggregatorv1/params.proto - - - - - -### Params -Params defines the parameters for the module. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `reward_rate_feeders` | [string](#string) | | | - - - - - - - - - - - - - - - - -

Top

- -## yieldaggregatorv1/asset.proto - - - - - -### AssetCondition - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `denom` | [string](#string) | | | -| `min` | [string](#string) | | | -| `ratio` | [uint32](#uint32) | | | - - - - - - - - -### AssetManagementAccount - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `name` | [string](#string) | | | -| `enabled` | [bool](#bool) | | | - - - - - - - - -### AssetManagementTarget - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `asset_management_account_id` | [string](#string) | | | -| `account_address` | [string](#string) | | | -| `asset_conditions` | [AssetCondition](#ununifi.chain.yieldaggregator.AssetCondition) | repeated | | -| `unbonding_time` | [google.protobuf.Duration](#google.protobuf.Duration) | | | -| `integrate_info` | [IntegrateInfo](#ununifi.chain.yieldaggregator.IntegrateInfo) | | | -| `enabled` | [bool](#bool) | | | - - - - - - - - -### DailyPercent - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `account_id` | [string](#string) | | | -| `target_id` | [string](#string) | | | -| `rate` | [string](#string) | | | -| `date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - - - - - - - - -### DepositAllocation - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `order_id` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - - - - - - - - -### FarmingOrder - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `from_address` | [string](#string) | | | -| `strategy` | [Strategy](#ununifi.chain.yieldaggregator.Strategy) | | | -| `max_unbonding_time` | [google.protobuf.Duration](#google.protobuf.Duration) | | | -| `overall_ratio` | [uint32](#uint32) | | | -| `min` | [string](#string) | | | -| `max` | [string](#string) | | | -| `date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `active` | [bool](#bool) | | | - - - - - - - - -### FarmingUnit -FarmingUnit is managing users' investment on a yield farm target -Here, amount field is the amount withdrawable instantly, staked amount on yield farms are not calculated here -since the value of staked amount could change after deposit - it's only determined at the time of withdrawal -from the farm - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `account_id` | [string](#string) | | | -| `target_id` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -| `farming_start_time` | [string](#string) | | | -| `unbonding_starttime` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | -| `owner` | [string](#string) | | | +this line is used by starport scaffolding # 3 +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + +### QueryAllMarketResponse +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `markets` | [Market](#ununifi.pricefeed.Market) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + - +### QueryAllOracleRequest -### IntegrateInfo +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `market_id` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + +### QueryAllOracleResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `type` | [IntegrateType](#ununifi.chain.yieldaggregator.IntegrateType) | | | -| `contract_ibc_port_id` | [string](#string) | | for cosmwasm contract | -| `mod_name` | [string](#string) | | for golang module | +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `oracles` | [string](#string) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### QueryAllPriceRequest +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + +### QueryAllPriceResponse - +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `prices` | [CurrentPrice](#ununifi.pricefeed.CurrentPrice) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | -### Strategy -Strategy types -recent30DaysHighDPRStrategy - Invest in the best DPR destination in the last 30 days on average -recent1DayHighDPRStrategy - Invest in the best DPR destination in the last average day -notHaveDPRStrategy - Invest in something that does not have a DPR. -ManualStrategy - Manual investment, whiteTargetIdlist required. + +### QueryAllRawPriceRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `strategy_type` | [string](#string) | | | -| `whitelisted_target_ids` | [string](#string) | repeated | | -| `blacklisted_target_ids` | [string](#string) | repeated | | +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `market_id` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + +### QueryAllRawPriceResponse +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `prices` | [PostedPrice](#ununifi.pricefeed.PostedPrice) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### QueryGetPriceRequest - +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `market_id` | [string](#string) | | | -### UserDeposit + +### QueryGetPriceResponse +| Field | Type | Label | Description | +| ------- | ----------------------------------------------- | ----- | ----------- | +| `price` | [CurrentPrice](#ununifi.pricefeed.CurrentPrice) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `user` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + +### QueryParamsRequest + +### QueryParamsResponse +| Field | Type | Label | Description | +| -------- | ----------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.pricefeed.Params) | | | + - + -### UserInfo + + +### Query -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `user` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -| `farming_orders` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | repeated | | -| `farmed_counter` | [uint64](#uint64) | | | +Query defines the gRPC querier service. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------- | --------------------------------------------- | --------- | ------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.pricefeed.QueryParamsRequest) | [QueryParamsResponse](#ununifi.pricefeed.QueryParamsResponse) | | GET | /ununifi/pricefeed/params | +| `MarketAll` | [QueryAllMarketRequest](#ununifi.pricefeed.QueryAllMarketRequest) | [QueryAllMarketResponse](#ununifi.pricefeed.QueryAllMarketResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/pricefeed/markets | +| `OracleAll` | [QueryAllOracleRequest](#ununifi.pricefeed.QueryAllOracleRequest) | [QueryAllOracleResponse](#ununifi.pricefeed.QueryAllOracleResponse) | | GET | /ununifi/pricefeed/markets/{market_id}/oracles | +| `Price` | [QueryGetPriceRequest](#ununifi.pricefeed.QueryGetPriceRequest) | [QueryGetPriceResponse](#ununifi.pricefeed.QueryGetPriceResponse) | | GET | /ununifi/pricefeed/markets/{market_id}/price | +| `PriceAll` | [QueryAllPriceRequest](#ununifi.pricefeed.QueryAllPriceRequest) | [QueryAllPriceResponse](#ununifi.pricefeed.QueryAllPriceResponse) | | GET | /ununifi/pricefeed/prices | +| `RawPriceAll` | [QueryAllRawPriceRequest](#ununifi.pricefeed.QueryAllRawPriceRequest) | [QueryAllRawPriceResponse](#ununifi.pricefeed.QueryAllRawPriceResponse) | | GET | /ununifi/pricefeed/markets/{market_id}/raw_prices | + + +

Top

- +## pricefeed/tx.proto + - +### MsgPostPrice -### IntegrateType +| Field | Type | Label | Description | +| ----------- | ------------------------------------------------------- | ----- | ----------- | +| `from` | [string](#string) | | | +| `market_id` | [string](#string) | | | +| `price` | [string](#string) | | | +| `expiry` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | + -| Name | Number | Description | -| ---- | ------ | ----------- | -| GOLANG_MOD | 0 | | -| COSMWASM | 1 | | +### MsgPostPriceResponse + - - - + - -

Top

+### Msg -## yieldaggregatorv1/genesis.proto +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ----------------------------------------------- | --------------------------------------------------------------- | ----------- | --------- | -------- | +| `PostPrice` | [MsgPostPrice](#ununifi.pricefeed.MsgPostPrice) | [MsgPostPriceResponse](#ununifi.pricefeed.MsgPostPriceResponse) | | | + + - +

Top

-### GenesisState -GenesisState defines the yieldaggregator module's genesis state. +## ununifidist/ununifidist.proto + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.chain.yieldaggregator.Params) | | | -| `asset_management_accounts` | [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) | repeated | | -| `asset_management_targets` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | repeated | | -| `farming_orders` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | repeated | | -| `farming_units` | [FarmingUnit](#ununifi.chain.yieldaggregator.FarmingUnit) | repeated | | -| `user_deposits` | [UserDeposit](#ununifi.chain.yieldaggregator.UserDeposit) | repeated | | -| `daily_percents` | [DailyPercent](#ununifi.chain.yieldaggregator.DailyPercent) | repeated | | +### Params +| Field | Type | Label | Description | +| --------- | ------------------------------------- | -------- | ----------- | +| `active` | [bool](#bool) | | | +| `periods` | [Period](#ununifi.ununifidist.Period) | repeated | | + +### Period +| Field | Type | Label | Description | +| ----------- | ------------------------------------------------------- | ----- | ----------- | +| `start` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `inflation` | [string](#string) | | | @@ -8413,151 +4830,190 @@ GenesisState defines the yieldaggregator module's genesis state. + - -

Top

-## yieldaggregatorv1/proposal.proto - - - - - -### ProposalAddYieldFarm -proposal to add new yield farm. +## ununifidist/genesis.proto + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `account` | [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) | | | +### GenesisState +GenesisState defines the ununifidist module's genesis state. +| Field | Type | Label | Description | +| --------------------- | ------------------------------------------------------- | ----- | --------------------------------------------------------------- | +| `params` | [Params](#ununifi.ununifidist.Params) | | | +| `previous_block_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `gov_denom` | [string](#string) | | this line is used by starport scaffolding # genesis/proto/state | + + + - + -### ProposalAddYieldFarmTarget -proposal to add new yield farm target + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `target` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | | | +## ununifidist/query.proto + +### QueryGetBalancesRequest + +### QueryGetBalancesResponse +| Field | Type | Label | Description | +| ---------- | ----------------------------------------------------- | -------- | ----------- | +| `balances` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - + -### ProposalRemoveYieldFarm -proposal to remove yield farm +### QueryParamsRequest + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `id` | [string](#string) | | | +### QueryParamsResponse +| Field | Type | Label | Description | +| -------- | ------------------------------------- | ----- | ----------- | +| `params` | [Params](#ununifi.ununifidist.Params) | | | + + + + - +### Query -### ProposalRemoveYieldFarmTarget -proposal to delete yield farm target +Query defines the gRPC querier service. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------- | --------- | ----------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.ununifidist.QueryParamsRequest) | [QueryParamsResponse](#ununifi.ununifidist.QueryParamsResponse) | | GET | /ununifi/ununifidist/params | +| `Balances` | [QueryGetBalancesRequest](#ununifi.ununifidist.QueryGetBalancesRequest) | [QueryGetBalancesResponse](#ununifi.ununifidist.QueryGetBalancesResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/ununifidist/balances | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `id` | [string](#string) | | | -| `asset_management_account_id` | [string](#string) | | | + + +

Top

+## yield-aggregator/params.proto + +### Params - +Params defines the parameters for the module. -### ProposalStopYieldFarm -proposal to remove yield farm +| Field | Type | Label | Description | +| ------------------------ | ----------------------------------------------------- | ----- | ----------- | +| `commission_rate` | [string](#string) | | | +| `vault_creation_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `vault_creation_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `id` | [string](#string) | | | + + + + +

Top

+## yield-aggregator/yield-aggregator.proto - + -### ProposalStopYieldFarmTarget -proposal to stop yield farm target +### Strategy +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `id` | [uint64](#uint64) | | | +| `contract_address` | [string](#string) | | | +| `name` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `id` | [string](#string) | | | -| `asset_management_account_id` | [string](#string) | | | + +### StrategyMetrics +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `allocation` | [string](#string) | | | +| `apr` | [string](#string) | | | + +### StrategyWeight +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `strategy_id` | [uint64](#uint64) | | | +| `weight` | [string](#string) | | | - + -### ProposalUpdateYieldFarm -proposal to update yield farm info +### Vault +| Field | Type | Label | Description | +| -------------------------- | --------------------------------------------------------- | -------- | ----------- | +| `id` | [uint64](#uint64) | | | +| `denom` | [string](#string) | | | +| `owner` | [string](#string) | | | +| `owner_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `withdraw_commission_rate` | [string](#string) | | | +| `withdraw_reserve_rate` | [string](#string) | | | +| `strategy_weights` | [StrategyWeight](#ununifi.yieldaggregator.StrategyWeight) | repeated | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `account` | [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) | | | + +### VaultMetrics +| Field | Type | Label | Description | +| ------------ | ----------------- | ----- | ----------- | +| `allocation` | [string](#string) | | | +| `apy` | [string](#string) | | | + + + - + -### ProposalUpdateYieldFarmTarget -proposal to update yield farm target + +

Top

-| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `target` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | | | +## yield-aggregator/genesis.proto + +### GenesisState +GenesisState defines the yieldaggregator module's genesis state. +| Field | Type | Label | Description | +| ------------ | --------------------------------------------- | -------- | --------------------------------------------------------------- | +| `params` | [Params](#ununifi.yieldaggregator.Params) | | | +| `vaults` | [Vault](#ununifi.yieldaggregator.Vault) | repeated | this line is used by starport scaffolding # genesis/proto/state | +| `strategies` | [Strategy](#ununifi.yieldaggregator.Strategy) | repeated | | @@ -8567,524 +5023,914 @@ proposal to update yield farm target + - -

Top

-## yieldaggregatorv1/query.proto +## yield-aggregator/proposal.proto + +### ProposalAddStrategy - +proposal to add new strategy. -### AssetManagementAccountInfo +| Field | Type | Label | Description | +| ------------------ | ----------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `denom` | [string](#string) | | | +| `contract_address` | [string](#string) | | | +| `name` | [string](#string) | | | + + + + + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | -| `name` | [string](#string) | | | -| `asset_management_targets` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | repeated | | + +

Top

+## yield-aggregator/query.proto + +### QueryAllStrategyRequest +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | - + -### QueryAllAssetManagementAccountsRequest +### QueryAllStrategyResponse +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `strategies` | [Strategy](#ununifi.yieldaggregator.Strategy) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + +### QueryAllVaultRequest +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + +### QueryAllVaultResponse - +| Field | Type | Label | Description | +| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | +| `vaults` | [Vault](#ununifi.yieldaggregator.Vault) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | -### QueryAllAssetManagementAccountsResponse + +### QueryEstimateMintAmountRequest +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `id` | [uint64](#uint64) | | | +| `deposit` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `accounts` | [AssetManagementAccountInfo](#ununifi.chain.yieldaggregator.AssetManagementAccountInfo) | repeated | | + +### QueryEstimateMintAmountResponse +| Field | Type | Label | Description | +| ------------- | ----------------------------------------------------- | ----- | ----------- | +| `mint_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryEstimateRedeemAmountRequest +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `id` | [uint64](#uint64) | | | +| `burn_amount` | [string](#string) | | | - + -### QueryAllFarmingUnitsRequest +### QueryEstimateRedeemAmountResponse +| Field | Type | Label | Description | +| --------------- | ----------------------------------------------------- | ----- | ----------- | +| `redeem_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### QueryGetStrategyRequest +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `id` | [uint64](#uint64) | | | + +### QueryGetStrategyResponse - +| Field | Type | Label | Description | +| ---------- | --------------------------------------------- | ----- | ----------- | +| `strategy` | [Strategy](#ununifi.yieldaggregator.Strategy) | | | -### QueryAllFarmingUnitsResponse + +### QueryGetVaultRequest +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| `id` | [uint64](#uint64) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `units` | [FarmingUnit](#ununifi.chain.yieldaggregator.FarmingUnit) | repeated | | + +### QueryGetVaultResponse +| Field | Type | Label | Description | +| -------------------------- | --------------------------------------------- | -------- | ----------- | +| `vault` | [Vault](#ununifi.yieldaggregator.Vault) | | | +| `strategies` | [Strategy](#ununifi.yieldaggregator.Strategy) | repeated | | +| `vault_address` | [string](#string) | | | +| `total_bonded_amount` | [string](#string) | | | +| `total_unbonding_amount` | [string](#string) | | | +| `total_withdrawal_balance` | [string](#string) | | | + +### QueryParamsRequest +QueryParamsRequest is request type for the Query/Params RPC method. - + -### QueryAssetManagementAccountRequest +### QueryParamsResponse + +QueryParamsResponse is response type for the Query/Params RPC method. +| Field | Type | Label | Description | +| -------- | ----------------------------------------- | ----- | ----------------------------------------------- | +| `params` | [Params](#ununifi.yieldaggregator.Params) | | params holds all the parameters of this module. | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `id` | [string](#string) | | | + + + +### Query +Query defines the gRPC querier service. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ---------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------ | --------- | ------------------------------------------------------------ | +| `Params` | [QueryParamsRequest](#ununifi.yieldaggregator.QueryParamsRequest) | [QueryParamsResponse](#ununifi.yieldaggregator.QueryParamsResponse) | Parameters queries the parameters of the module. | GET | /ununifi/yield-aggregator/params | +| `VaultAll` | [QueryAllVaultRequest](#ununifi.yieldaggregator.QueryAllVaultRequest) | [QueryAllVaultResponse](#ununifi.yieldaggregator.QueryAllVaultResponse) | this line is used by starport scaffolding # 2 | GET | /ununifi/yield-aggregator/vaults | +| `Vault` | [QueryGetVaultRequest](#ununifi.yieldaggregator.QueryGetVaultRequest) | [QueryGetVaultResponse](#ununifi.yieldaggregator.QueryGetVaultResponse) | | GET | /ununifi/yield-aggregator/vaults/{id} | +| `StrategyAll` | [QueryAllStrategyRequest](#ununifi.yieldaggregator.QueryAllStrategyRequest) | [QueryAllStrategyResponse](#ununifi.yieldaggregator.QueryAllStrategyResponse) | | GET | /ununifi/yield-aggregator/strategies/query-param | +| `Strategy` | [QueryGetStrategyRequest](#ununifi.yieldaggregator.QueryGetStrategyRequest) | [QueryGetStrategyResponse](#ununifi.yieldaggregator.QueryGetStrategyResponse) | | GET | /ununifi/yield-aggregator/strategies/{id} | +| `EstimateMintAmount` | [QueryEstimateMintAmountRequest](#ununifi.yieldaggregator.QueryEstimateMintAmountRequest) | [QueryEstimateMintAmountResponse](#ununifi.yieldaggregator.QueryEstimateMintAmountResponse) | | GET | /ununifi/yield-aggregator/vaults/{id}/estimate-mint-amount | +| `EstimateRedeemAmount` | [QueryEstimateRedeemAmountRequest](#ununifi.yieldaggregator.QueryEstimateRedeemAmountRequest) | [QueryEstimateRedeemAmountResponse](#ununifi.yieldaggregator.QueryEstimateRedeemAmountResponse) | | GET | /ununifi/yield-aggregator/vaults/{id}/estimate-redeem-amount | - + -### QueryAssetManagementAccountResponse + +

Top

+## yield-aggregator/tx.proto -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `account` | [AssetManagementAccountInfo](#ununifi.chain.yieldaggregator.AssetManagementAccountInfo) | | | + +### MsgCreateVault +| Field | Type | Label | Description | +| ----------------------- | --------------------------------------------------------- | -------- | ----------- | +| `sender` | [string](#string) | | | +| `denom` | [string](#string) | | | +| `commission_rate` | [string](#string) | | | +| `withdraw_reserve_rate` | [string](#string) | | | +| `strategy_weights` | [StrategyWeight](#ununifi.yieldaggregator.StrategyWeight) | repeated | | +| `fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + +### MsgCreateVaultResponse + - +### MsgDeleteVault -### QueryDailyRewardPercentsRequest +| Field | Type | Label | Description | +| ---------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `vault_id` | [uint64](#uint64) | | | + +### MsgDeleteVaultResponse + +### MsgDepositToVault +this line is used by starport scaffolding # proto/tx/message +| Field | Type | Label | Description | +| ---------- | ----------------------------------------------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `vault_id` | [uint64](#uint64) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - + -### QueryDailyRewardPercentsResponse +### MsgDepositToVaultResponse + +### MsgTransferVaultOwnership -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `daily_percents` | [DailyPercent](#ununifi.chain.yieldaggregator.DailyPercent) | repeated | | +| Field | Type | Label | Description | +| ----------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `vault_id` | [uint64](#uint64) | | | +| `recipient` | [string](#string) | | | + +### MsgTransferVaultOwnershipResponse + +### MsgWithdrawFromVault +| Field | Type | Label | Description | +| ----------------- | ----------------- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `vault_id` | [uint64](#uint64) | | | +| `lp_token_amount` | [string](#string) | | | - + -### QueryParamsRequest -QueryParamsRequest is request type for the Query/Params RPC method. +### MsgWithdrawFromVaultResponse + + + + +### Msg - +Msg defines the Msg service. -### QueryParamsResponse -QueryParamsResponse is response type for the Query/Params RPC method. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------------------ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------- | --------- | -------- | +| `DepositToVault` | [MsgDepositToVault](#ununifi.yieldaggregator.MsgDepositToVault) | [MsgDepositToVaultResponse](#ununifi.yieldaggregator.MsgDepositToVaultResponse) | this line is used by starport scaffolding # proto/tx/rpc | | +| `WithdrawFromVault` | [MsgWithdrawFromVault](#ununifi.yieldaggregator.MsgWithdrawFromVault) | [MsgWithdrawFromVaultResponse](#ununifi.yieldaggregator.MsgWithdrawFromVaultResponse) | | | +| `CreateVault` | [MsgCreateVault](#ununifi.yieldaggregator.MsgCreateVault) | [MsgCreateVaultResponse](#ununifi.yieldaggregator.MsgCreateVaultResponse) | | | +| `DeleteVault` | [MsgDeleteVault](#ununifi.yieldaggregator.MsgDeleteVault) | [MsgDeleteVaultResponse](#ununifi.yieldaggregator.MsgDeleteVaultResponse) | | | +| `TransferVaultOwnership` | [MsgTransferVaultOwnership](#ununifi.yieldaggregator.MsgTransferVaultOwnership) | [MsgTransferVaultOwnershipResponse](#ununifi.yieldaggregator.MsgTransferVaultOwnershipResponse) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.chain.yieldaggregator.Params) | | params holds all the parameters of this module. | + +

Top

+## yieldaggregatorv1/params.proto + +### Params +Params defines the parameters for the module. - +| Field | Type | Label | Description | +| --------------------- | ----------------- | ----- | ----------- | +| `reward_rate_feeders` | [string](#string) | | | -### QueryUserInfo + + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -| `farming_orders` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | repeated | | -| `farmed_counter` | [uint64](#uint64) | | | + + +

Top

+## yieldaggregatorv1/asset.proto + +### AssetCondition - +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | ----------- | +| `denom` | [string](#string) | | | +| `min` | [string](#string) | | | +| `ratio` | [uint32](#uint32) | | | -### QueryUserInfoRequest + +### AssetManagementAccount +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `name` | [string](#string) | | | +| `enabled` | [bool](#bool) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | | + +### AssetManagementTarget +| Field | Type | Label | Description | +| ----------------------------- | --------------------------------------------------------------- | -------- | ----------- | +| `id` | [string](#string) | | | +| `asset_management_account_id` | [string](#string) | | | +| `account_address` | [string](#string) | | | +| `asset_conditions` | [AssetCondition](#ununifi.chain.yieldaggregator.AssetCondition) | repeated | | +| `unbonding_time` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `integrate_info` | [IntegrateInfo](#ununifi.chain.yieldaggregator.IntegrateInfo) | | | +| `enabled` | [bool](#bool) | | | + +### DailyPercent +| Field | Type | Label | Description | +| ------------ | ------------------------------------------------------- | ----- | ----------- | +| `account_id` | [string](#string) | | | +| `target_id` | [string](#string) | | | +| `rate` | [string](#string) | | | +| `date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | - + -### QueryUserInfoResponse +### DepositAllocation +| Field | Type | Label | Description | +| ---------- | ----------------------------------------------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `order_id` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `user_info` | [QueryUserInfo](#ununifi.chain.yieldaggregator.QueryUserInfo) | | | +### FarmingOrder +| Field | Type | Label | Description | +| -------------------- | ------------------------------------------------------- | ----- | ----------- | +| `id` | [string](#string) | | | +| `from_address` | [string](#string) | | | +| `strategy` | [Strategy](#ununifi.chain.yieldaggregator.Strategy) | | | +| `max_unbonding_time` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `overall_ratio` | [uint32](#uint32) | | | +| `min` | [string](#string) | | | +| `max` | [string](#string) | | | +| `date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `active` | [bool](#bool) | | | + +### FarmingUnit +FarmingUnit is managing users' investment on a yield farm target +Here, amount field is the amount withdrawable instantly, staked amount on yield farms are not calculated here +since the value of staked amount could change after deposit - it's only determined at the time of withdrawal +from the farm - +| Field | Type | Label | Description | +| --------------------- | ------------------------------------------------------- | -------- | ----------- | +| `account_id` | [string](#string) | | | +| `target_id` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `farming_start_time` | [string](#string) | | | +| `unbonding_starttime` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `owner` | [string](#string) | | | - + - +### IntegrateInfo +| Field | Type | Label | Description | +| ---------------------- | ------------------------------------------------------------- | ----- | --------------------- | +| `type` | [IntegrateType](#ununifi.chain.yieldaggregator.IntegrateType) | | | +| `contract_ibc_port_id` | [string](#string) | | for cosmwasm contract | +| `mod_name` | [string](#string) | | for golang module | - + -### Query -Query defines the gRPC querier service. +### Strategy -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#ununifi.chain.yieldaggregator.QueryParamsRequest) | [QueryParamsResponse](#ununifi.chain.yieldaggregator.QueryParamsResponse) | Parameters queries the parameters of the module. | GET|/UnUniFi/chain/yieldaggregatorv1/params| -| `AssetManagementAccount` | [QueryAssetManagementAccountRequest](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountRequest) | [QueryAssetManagementAccountResponse](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountResponse) | | GET|/UnUniFi/chain/yieldaggregatorv1/asset_management_account/{id}| -| `AllAssetManagementAccounts` | [QueryAllAssetManagementAccountsRequest](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsRequest) | [QueryAllAssetManagementAccountsResponse](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsResponse) | | GET|/UnUniFi/chain/yieldaggregatorv1/all_asset_management_accounts| -| `UserInfo` | [QueryUserInfoRequest](#ununifi.chain.yieldaggregator.QueryUserInfoRequest) | [QueryUserInfoResponse](#ununifi.chain.yieldaggregator.QueryUserInfoResponse) | | GET|/UnUniFi/chain/yieldaggregatorv1/user_info/{address}| -| `AllFarmingUnits` | [QueryAllFarmingUnitsRequest](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsRequest) | [QueryAllFarmingUnitsResponse](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsResponse) | | GET|/UnUniFi/chain/yieldaggregatorv1/all_user_infos| -| `DailyRewardPercents` | [QueryDailyRewardPercentsRequest](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsRequest) | [QueryDailyRewardPercentsResponse](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsResponse) | | GET|/UnUniFi/chain/yieldaggregatorv1/daily_reward_percents| +Strategy types +recent30DaysHighDPRStrategy - Invest in the best DPR destination in the last 30 days on average +recent1DayHighDPRStrategy - Invest in the best DPR destination in the last average day +notHaveDPRStrategy - Invest in something that does not have a DPR. +ManualStrategy - Manual investment, whiteTargetIdlist required. - +| Field | Type | Label | Description | +| ------------------------ | ----------------- | -------- | ----------- | +| `strategy_type` | [string](#string) | | | +| `whitelisted_target_ids` | [string](#string) | repeated | | +| `blacklisted_target_ids` | [string](#string) | repeated | | + +### UserDeposit - -

Top

+| Field | Type | Label | Description | +| -------- | ----------------------------------------------------- | -------- | ----------- | +| `user` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -## yieldaggregatorv1/tx.proto + +### UserInfo +| Field | Type | Label | Description | +| ---------------- | ----------------------------------------------------------- | -------- | ----------- | +| `user` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `farming_orders` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | repeated | | +| `farmed_counter` | [uint64](#uint64) | | | - + -### MsgActivateFarmingOrder + +### IntegrateType +| Name | Number | Description | +| ---------- | ------ | ----------- | +| GOLANG_MOD | 0 | | +| COSMWASM | 1 | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `order_id` | [string](#string) | | | + + + + +

Top

+## yieldaggregatorv1/genesis.proto - + -### MsgActivateFarmingOrderResponse +### GenesisState +GenesisState defines the yieldaggregator module's genesis state. +| Field | Type | Label | Description | +| --------------------------- | ------------------------------------------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.chain.yieldaggregator.Params) | | | +| `asset_management_accounts` | [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) | repeated | | +| `asset_management_targets` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | repeated | | +| `farming_orders` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | repeated | | +| `farming_units` | [FarmingUnit](#ununifi.chain.yieldaggregator.FarmingUnit) | repeated | | +| `user_deposits` | [UserDeposit](#ununifi.chain.yieldaggregator.UserDeposit) | repeated | | +| `daily_percents` | [DailyPercent](#ununifi.chain.yieldaggregator.DailyPercent) | repeated | | + + + + - + -### MsgAddFarmingOrder +

Top

+## yieldaggregatorv1/proposal.proto + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `order` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | | | +### ProposalAddYieldFarm +proposal to add new yield farm. +| Field | Type | Label | Description | +| ------------- | ------------------------------------------------------------------------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `account` | [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) | | | + +### ProposalAddYieldFarmTarget +proposal to add new yield farm target - +| Field | Type | Label | Description | +| ------------- | ----------------------------------------------------------------------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `target` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | | | -### MsgAddFarmingOrderResponse + +### ProposalRemoveYieldFarm +proposal to remove yield farm +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `id` | [string](#string) | | | + +### ProposalRemoveYieldFarmTarget +proposal to delete yield farm target - +| Field | Type | Label | Description | +| ----------------------------- | ----------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `id` | [string](#string) | | | +| `asset_management_account_id` | [string](#string) | | | -### MsgBeginWithdrawAll + +### ProposalStopYieldFarm +proposal to remove yield farm -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | +| Field | Type | Label | Description | +| ------------- | ----------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `id` | [string](#string) | | | + +### ProposalStopYieldFarmTarget +proposal to stop yield farm target +| Field | Type | Label | Description | +| ----------------------------- | ----------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `id` | [string](#string) | | | +| `asset_management_account_id` | [string](#string) | | | + - +### ProposalUpdateYieldFarm -### MsgBeginWithdrawAllResponse +proposal to update yield farm info +| Field | Type | Label | Description | +| ------------- | ------------------------------------------------------------------------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `account` | [AssetManagementAccount](#ununifi.chain.yieldaggregator.AssetManagementAccount) | | | + +### ProposalUpdateYieldFarmTarget +proposal to update yield farm target +| Field | Type | Label | Description | +| ------------- | ----------------------------------------------------------------------------- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `target` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | | | + - + -### MsgDeleteFarmingOrder + + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `order_id` | [string](#string) | | | +

Top

+## yieldaggregatorv1/query.proto + +### AssetManagementAccountInfo +| Field | Type | Label | Description | +| -------------------------- | ----------------------------------------------------------------------------- | -------- | ----------- | +| `id` | [string](#string) | | | +| `name` | [string](#string) | | | +| `asset_management_targets` | [AssetManagementTarget](#ununifi.chain.yieldaggregator.AssetManagementTarget) | repeated | | + - +### QueryAllAssetManagementAccountsRequest -### MsgDeleteFarmingOrderResponse + +### QueryAllAssetManagementAccountsResponse +| Field | Type | Label | Description | +| ---------- | --------------------------------------------------------------------------------------- | -------- | ----------- | +| `accounts` | [AssetManagementAccountInfo](#ununifi.chain.yieldaggregator.AssetManagementAccountInfo) | repeated | | + +### QueryAllFarmingUnitsRequest + +### QueryAllFarmingUnitsResponse - +| Field | Type | Label | Description | +| ------- | --------------------------------------------------------- | -------- | ----------- | +| `units` | [FarmingUnit](#ununifi.chain.yieldaggregator.FarmingUnit) | repeated | | -### MsgDeposit + +### QueryAssetManagementAccountRequest +| Field | Type | Label | Description | +| ----- | ----------------- | ----- | ----------- | +| `id` | [string](#string) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -| `execute_orders` | [bool](#bool) | | | + +### QueryAssetManagementAccountResponse +| Field | Type | Label | Description | +| --------- | --------------------------------------------------------------------------------------- | ----- | ----------- | +| `account` | [AssetManagementAccountInfo](#ununifi.chain.yieldaggregator.AssetManagementAccountInfo) | | | + +### QueryDailyRewardPercentsRequest + - +### QueryDailyRewardPercentsResponse -### MsgDepositResponse +| Field | Type | Label | Description | +| ---------------- | ----------------------------------------------------------- | -------- | ----------- | +| `daily_percents` | [DailyPercent](#ununifi.chain.yieldaggregator.DailyPercent) | repeated | | + +### QueryParamsRequest +QueryParamsRequest is request type for the Query/Params RPC method. + +### QueryParamsResponse +QueryParamsResponse is response type for the Query/Params RPC method. - +| Field | Type | Label | Description | +| -------- | ----------------------------------------------- | ----- | ----------------------------------------------- | +| `params` | [Params](#ununifi.chain.yieldaggregator.Params) | | params holds all the parameters of this module. | -### MsgExecuteFarmingOrders + +### QueryUserInfo +| Field | Type | Label | Description | +| ---------------- | ----------------------------------------------------------- | -------- | ----------- | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `farming_orders` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | repeated | | +| `farmed_counter` | [uint64](#uint64) | | | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `order_ids` | [string](#string) | repeated | | + +### QueryUserInfoRequest +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------- | +| `address` | [string](#string) | | | + +### QueryUserInfoResponse +| Field | Type | Label | Description | +| ----------- | ------------------------------------------------------------- | ----- | ----------- | +| `user_info` | [QueryUserInfo](#ununifi.chain.yieldaggregator.QueryUserInfo) | | | - + -### MsgExecuteFarmingOrdersResponse + + + +### Query +Query defines the gRPC querier service. +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ---------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | --------- | -------------------------------------------------------------- | +| `Params` | [QueryParamsRequest](#ununifi.chain.yieldaggregator.QueryParamsRequest) | [QueryParamsResponse](#ununifi.chain.yieldaggregator.QueryParamsResponse) | Parameters queries the parameters of the module. | GET | /UnUniFi/chain/yieldaggregatorv1/params | +| `AssetManagementAccount` | [QueryAssetManagementAccountRequest](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountRequest) | [QueryAssetManagementAccountResponse](#ununifi.chain.yieldaggregator.QueryAssetManagementAccountResponse) | | GET | /UnUniFi/chain/yieldaggregatorv1/asset_management_account/{id} | +| `AllAssetManagementAccounts` | [QueryAllAssetManagementAccountsRequest](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsRequest) | [QueryAllAssetManagementAccountsResponse](#ununifi.chain.yieldaggregator.QueryAllAssetManagementAccountsResponse) | | GET | /UnUniFi/chain/yieldaggregatorv1/all_asset_management_accounts | +| `UserInfo` | [QueryUserInfoRequest](#ununifi.chain.yieldaggregator.QueryUserInfoRequest) | [QueryUserInfoResponse](#ununifi.chain.yieldaggregator.QueryUserInfoResponse) | | GET | /UnUniFi/chain/yieldaggregatorv1/user_info/{address} | +| `AllFarmingUnits` | [QueryAllFarmingUnitsRequest](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsRequest) | [QueryAllFarmingUnitsResponse](#ununifi.chain.yieldaggregator.QueryAllFarmingUnitsResponse) | | GET | /UnUniFi/chain/yieldaggregatorv1/all_user_infos | +| `DailyRewardPercents` | [QueryDailyRewardPercentsRequest](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsRequest) | [QueryDailyRewardPercentsResponse](#ununifi.chain.yieldaggregator.QueryDailyRewardPercentsResponse) | | GET | /UnUniFi/chain/yieldaggregatorv1/daily_reward_percents | + - + -### MsgInactivateFarmingOrder +

Top

+## yieldaggregatorv1/tx.proto + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `order_id` | [string](#string) | | | +### MsgActivateFarmingOrder +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `from_address` | [string](#string) | | | +| `order_id` | [string](#string) | | | + +### MsgActivateFarmingOrderResponse + +### MsgAddFarmingOrder - +| Field | Type | Label | Description | +| -------------- | ----------------------------------------------------------- | ----- | ----------- | +| `from_address` | [string](#string) | | | +| `order` | [FarmingOrder](#ununifi.chain.yieldaggregator.FarmingOrder) | | | -### MsgInactivateFarmingOrderResponse + +### MsgAddFarmingOrderResponse + +### MsgBeginWithdrawAll +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `from_address` | [string](#string) | | | + +### MsgBeginWithdrawAllResponse - + -### MsgSetDailyRewardPercent +### MsgDeleteFarmingOrder +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `from_address` | [string](#string) | | | +| `order_id` | [string](#string) | | | + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `account_id` | [string](#string) | | | -| `target_id` | [string](#string) | | | -| `rate` | [string](#string) | | | -| `date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +### MsgDeleteFarmingOrderResponse + +### MsgDeposit +| Field | Type | Label | Description | +| ---------------- | ----------------------------------------------------- | -------- | ----------- | +| `from_address` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `execute_orders` | [bool](#bool) | | | + +### MsgDepositResponse - + -### MsgSetDailyRewardPercentResponse +### MsgExecuteFarmingOrders +| Field | Type | Label | Description | +| -------------- | ----------------- | -------- | ----------- | +| `from_address` | [string](#string) | | | +| `order_ids` | [string](#string) | repeated | | + +### MsgExecuteFarmingOrdersResponse + +### MsgInactivateFarmingOrder +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `from_address` | [string](#string) | | | +| `order_id` | [string](#string) | | | - + -### MsgWithdraw +### MsgInactivateFarmingOrderResponse + +### MsgSetDailyRewardPercent -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| Field | Type | Label | Description | +| -------------- | ------------------------------------------------------- | ----- | ----------- | +| `from_address` | [string](#string) | | | +| `account_id` | [string](#string) | | | +| `target_id` | [string](#string) | | | +| `rate` | [string](#string) | | | +| `date` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | + +### MsgSetDailyRewardPercentResponse + +### MsgWithdraw +| Field | Type | Label | Description | +| -------------- | ----------------------------------------------------- | -------- | ----------- | +| `from_address` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | ### MsgWithdrawResponse - - - - - - ### Msg + Msg defines the Msg service. -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Deposit` | [MsgDeposit](#ununifi.chain.yieldaggregator.MsgDeposit) | [MsgDepositResponse](#ununifi.chain.yieldaggregator.MsgDepositResponse) | | | -| `Withdraw` | [MsgWithdraw](#ununifi.chain.yieldaggregator.MsgWithdraw) | [MsgWithdrawResponse](#ununifi.chain.yieldaggregator.MsgWithdrawResponse) | | | -| `BeginWithdrawAll` | [MsgBeginWithdrawAll](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAll) | [MsgBeginWithdrawAllResponse](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAllResponse) | | | -| `AddFarmingOrder` | [MsgAddFarmingOrder](#ununifi.chain.yieldaggregator.MsgAddFarmingOrder) | [MsgAddFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgAddFarmingOrderResponse) | | | -| `DeleteFarmingOrder` | [MsgDeleteFarmingOrder](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrder) | [MsgDeleteFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrderResponse) | | | -| `ActivateFarmingOrder` | [MsgActivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrder) | [MsgActivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrderResponse) | | | -| `InactivateFarmingOrder` | [MsgInactivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrder) | [MsgInactivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrderResponse) | | | -| `ExecuteFarmingOrders` | [MsgExecuteFarmingOrders](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrders) | [MsgExecuteFarmingOrdersResponse](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrdersResponse) | | | -| `SetDailyRewardPercent` | [MsgSetDailyRewardPercent](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercent) | [MsgSetDailyRewardPercentResponse](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercentResponse) | | | +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------------------ | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------- | --------- | -------- | +| `Deposit` | [MsgDeposit](#ununifi.chain.yieldaggregator.MsgDeposit) | [MsgDepositResponse](#ununifi.chain.yieldaggregator.MsgDepositResponse) | | | +| `Withdraw` | [MsgWithdraw](#ununifi.chain.yieldaggregator.MsgWithdraw) | [MsgWithdrawResponse](#ununifi.chain.yieldaggregator.MsgWithdrawResponse) | | | +| `BeginWithdrawAll` | [MsgBeginWithdrawAll](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAll) | [MsgBeginWithdrawAllResponse](#ununifi.chain.yieldaggregator.MsgBeginWithdrawAllResponse) | | | +| `AddFarmingOrder` | [MsgAddFarmingOrder](#ununifi.chain.yieldaggregator.MsgAddFarmingOrder) | [MsgAddFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgAddFarmingOrderResponse) | | | +| `DeleteFarmingOrder` | [MsgDeleteFarmingOrder](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrder) | [MsgDeleteFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgDeleteFarmingOrderResponse) | | | +| `ActivateFarmingOrder` | [MsgActivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrder) | [MsgActivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgActivateFarmingOrderResponse) | | | +| `InactivateFarmingOrder` | [MsgInactivateFarmingOrder](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrder) | [MsgInactivateFarmingOrderResponse](#ununifi.chain.yieldaggregator.MsgInactivateFarmingOrderResponse) | | | +| `ExecuteFarmingOrders` | [MsgExecuteFarmingOrders](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrders) | [MsgExecuteFarmingOrdersResponse](#ununifi.chain.yieldaggregator.MsgExecuteFarmingOrdersResponse) | | | +| `SetDailyRewardPercent` | [MsgSetDailyRewardPercent](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercent) | [MsgSetDailyRewardPercentResponse](#ununifi.chain.yieldaggregator.MsgSetDailyRewardPercentResponse) | | | - - +

Top

## yieldfarm/params.proto - - ### Params -Params defines the parameters for the module. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `daily_reward` | [uint64](#uint64) | | | - - +Params defines the parameters for the module. +| Field | Type | Label | Description | +| -------------- | ----------------- | ----- | ----------- | +| `daily_reward` | [uint64](#uint64) | | | @@ -9094,30 +5940,21 @@ Params defines the parameters for the module. - - +

Top

## yieldfarm/yieldfarm.proto - - ### FarmerInfo - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `account` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - - - - +| Field | Type | Label | Description | +| --------- | ----------------------------------------------------- | -------- | ----------- | +| `account` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `rewards` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | @@ -9127,29 +5964,22 @@ Params defines the parameters for the module. - - +

Top

## yieldfarm/genesis.proto - - ### GenesisState -GenesisState defines the yieldfarm module's genesis state. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#ununifi.chain.yieldfarm.Params) | | | -| `farmer_infos` | [FarmerInfo](#ununifi.chain.yieldfarm.FarmerInfo) | repeated | | - - +GenesisState defines the yieldfarm module's genesis state. +| Field | Type | Label | Description | +| -------------- | ------------------------------------------------- | -------- | ----------- | +| `params` | [Params](#ununifi.chain.yieldfarm.Params) | | | +| `farmer_infos` | [FarmerInfo](#ununifi.chain.yieldfarm.FarmerInfo) | repeated | | @@ -9159,24 +5989,22 @@ GenesisState defines the yieldfarm module's genesis state. - - ## Scalar Value Types -| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | -| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | -| double | | double | double | float | float64 | double | float | Float | -| float | | float | float | float | float32 | float | float | Float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | -| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | ----------- | ------- | ---------- | -------------- | ------------------------------ | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/go.mod b/go.mod index cbfbf1992..4ec624833 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,13 @@ require ( cosmossdk.io/math v1.0.1 cosmossdk.io/tools/rosetta v0.2.1 github.com/CosmWasm/wasmd v0.40.1 + github.com/CosmWasm/wasmvm v1.2.4 github.com/cometbft/cometbft v0.37.1 github.com/cometbft/cometbft-db v0.7.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.10 + github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 github.com/cosmos/ibc-go/v7 v7.0.1 github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab github.com/gogo/protobuf v1.3.3 @@ -24,12 +26,13 @@ require ( github.com/prometheus/client_golang v1.15.0 github.com/pseudomuto/protoc-gen-doc v1.5.1 github.com/regen-network/cosmos-proto v0.3.1 + github.com/skip-mev/pob v1.0.3 github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.6.1 + github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.3 - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 + google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 google.golang.org/grpc v1.55.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 google.golang.org/protobuf v1.30.0 @@ -42,14 +45,13 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v0.12.0 // indirect cloud.google.com/go/storage v1.29.0 // indirect - cosmossdk.io/core v0.5.1 // indirect + cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.3 // indirect cosmossdk.io/log v1.1.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect + github.com/99designs/keyring v1.2.2 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/CosmWasm/wasmvm v1.2.4 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Masterminds/sprig v2.15.0+incompatible // indirect github.com/aokoli/goutils v1.0.1 // indirect @@ -70,7 +72,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect diff --git a/go.sum b/go.sum index 6bd55d95b..96afc810c 100644 --- a/go.sum +++ b/go.sum @@ -194,8 +194,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= -cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= +cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= +cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= @@ -214,8 +214,8 @@ git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFN git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= -github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= +github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0= +github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= @@ -384,8 +384,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -396,12 +396,14 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 h1:pCxyhIxgWTabAQC5UerkITraHG3SwajdLKKMCFDWCv4= +github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79/go.mod h1:JwHFbo1oX/ht4fPpnPvmhZr+dCkYK1Vihw+vZE9umR4= github.com/cosmos/ibc-go/v7 v7.0.1 h1:NIBNRWjlOoFvFQu1ZlgwkaSeHO5avf4C1YQiWegt8jw= github.com/cosmos/ibc-go/v7 v7.0.1/go.mod h1:vEaapV6nuLPQlS+g8IKmxMo6auPi0i7HMv1PhViht/E= github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab h1:I9ialKTQo7248V827Bba4OuKPmk+FPzmTVHsLXaIJWw= github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab/go.mod h1:2CwqasX5dSD7Hbp/9b6lhK6BwoBDCBldx7gPKRukR60= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= +github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= +github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -530,8 +532,8 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= @@ -765,7 +767,6 @@ github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= @@ -839,8 +840,8 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -954,7 +955,7 @@ github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWEr github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -1073,6 +1074,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/skip-mev/pob v1.0.3 h1:cipN/WUU+xfYbcfUQ4EefSvl3ItocsKgRn3tOtRF2OE= +github.com/skip-mev/pob v1.0.3/go.mod h1:PMs/dqcWOQruSN6zLExU0TzlBfBmGA8iTy+FJhxn0T8= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -1088,8 +1091,8 @@ github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -1761,8 +1764,8 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 h1:khxVcsk/FhnzxMKOyD+TDGwjbEOpcPuIpmafPGFmhMA= +google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= diff --git a/proto/ununifi/derivatives/derivatives.proto b/proto/ununifi/derivatives/derivatives.proto index 181bf0334..6b9c768f4 100644 --- a/proto/ununifi/derivatives/derivatives.proto +++ b/proto/ununifi/derivatives/derivatives.proto @@ -23,8 +23,8 @@ message Position { (gogoproto.moretags) = "yaml:\"market\"", (gogoproto.nullable) = false ]; - string address = 3 [ - (gogoproto.moretags) = "yaml:\"address\"" + string opener_address = 3 [ + (gogoproto.moretags) = "yaml:\"opener_address\"" ]; google.protobuf.Timestamp opened_at = 4 [ (gogoproto.moretags) = "yaml:\"opened_at\"", @@ -48,17 +48,42 @@ message Position { (gogoproto.moretags) = "yaml:\"remaining_margin\"", (gogoproto.nullable) = false ]; - google.protobuf.Timestamp last_levied_at = 9 [ + cosmos.base.v1beta1.Coin levied_amount = 9 [ + (gogoproto.moretags) = "yaml:\"levied_amount\"", + (gogoproto.nullable) = false + ]; + bool levied_amount_negative = 10 [ + (gogoproto.moretags) = "yaml:\"levied_amount_negative\"" + ]; + google.protobuf.Timestamp last_levied_at = 11 [ (gogoproto.moretags) = "yaml:\"last_levied_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; - google.protobuf.Any position_instance = 10 [ + google.protobuf.Any position_instance = 12 [ (gogoproto.moretags) = "yaml:\"position_instance\"", (gogoproto.nullable) = false ]; } +message PendingPaymentPosition { + string id = 1 [ + (gogoproto.moretags) = "yaml:\"id\"" + ]; + cosmos.base.v1beta1.Coin refundable_amount = 2 [ + (gogoproto.moretags) = "yaml:\"refundable_amount\"", + (gogoproto.nullable) = false + ]; + google.protobuf.Timestamp created_at = 3 [ + (gogoproto.moretags) = "yaml:\"created_at\"", + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + uint64 created_height = 4 [ + (gogoproto.moretags) = "yaml:\"created_height\"" + ]; +} + message QueriedPosition { Position position = 1 [ (gogoproto.moretags) = "yaml:\"position\"", @@ -130,6 +155,9 @@ message PoolParams { (gogoproto.moretags) = "yaml:\"accepted_assets_conf\"", (gogoproto.nullable) = false ]; + uint64 levy_period_required_seconds = 8 [ + (gogoproto.moretags) = "yaml:\"levy_period_required_seconds\"" + ]; } message PoolMarketCap { @@ -177,12 +205,6 @@ message Market { ]; } -message EventPriceIsNotFeeded { - string asset = 1 [ - (gogoproto.moretags) = "yaml:\"asset\"" - ]; -} - enum MarketType { UNKNOWN = 0; FUTURES = 1; @@ -198,3 +220,48 @@ message Reserve { (gogoproto.nullable) = false ]; } + +message EventPriceIsNotFed { + string asset = 1 [ + (gogoproto.moretags) = "yaml:\"asset\"" + ]; +} + +message EventPerpetualFuturesLevyFee { + cosmos.base.v1beta1.Coin fee = 1 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; + string position_id = 2 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} + +message EventPerpetualFuturesImaginaryFundingFee { + cosmos.base.v1beta1.Coin fee = 1 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; + bool fee_negative = 3 [ + (gogoproto.moretags) = "yaml:\"fee_negative\"" + ]; + string position_id = 2 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} + +message EventPerpetualFuturesLiquidationFee { + cosmos.base.v1beta1.Coin fee = 1 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; + string position_id = 2 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} + +message EventLiquidationNeeded { + string position_id = 1 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} diff --git a/proto/ununifi/derivatives/perpetual_futures.proto b/proto/ununifi/derivatives/perpetual_futures.proto index c151c6a45..5933a843f 100644 --- a/proto/ununifi/derivatives/perpetual_futures.proto +++ b/proto/ununifi/derivatives/perpetual_futures.proto @@ -32,7 +32,7 @@ message PerpetualFuturesParams { message PerpetualFuturesPosition { string id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; Market market = 2 [(gogoproto.moretags) = "yaml:\"market\"", (gogoproto.nullable) = false]; - string address = 3 [(gogoproto.moretags) = "yaml:\"address\""]; + string opener_address = 3 [(gogoproto.moretags) = "yaml:\"opener_address\""]; google.protobuf.Timestamp opened_at = 4 [(gogoproto.moretags) = "yaml:\"opened_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; uint64 opened_height = 5 [(gogoproto.moretags) = "yaml:\"opened_height\""]; @@ -46,12 +46,26 @@ message PerpetualFuturesPosition { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin remaining_margin = 8 - [(gogoproto.moretags) = "yaml:\"remaining_margin\"", (gogoproto.nullable) = false]; - google.protobuf.Timestamp last_levied_at = 9 - [(gogoproto.moretags) = "yaml:\"last_levied_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - PerpetualFuturesPositionInstance position_instance = 10 - [(gogoproto.moretags) = "yaml:\"position_instance\"", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin remaining_margin = 8 [ + (gogoproto.moretags) = "yaml:\"remaining_margin\"", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin levied_amount = 9 [ + (gogoproto.moretags) = "yaml:\"levied_amount\"", + (gogoproto.nullable) = false + ]; + bool levied_amount_negative = 10 [ + (gogoproto.moretags) = "yaml:\"levied_amount_negative\"" + ]; + google.protobuf.Timestamp last_levied_at = 11 [ + (gogoproto.moretags) = "yaml:\"last_levied_at\"", + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + PerpetualFuturesPositionInstance position_instance = 12 [ + (gogoproto.moretags) = "yaml:\"position_instance\"", + (gogoproto.nullable) = false + ]; } message PerpetualFuturesPositionInstance { @@ -82,8 +96,8 @@ message EventPerpetualFuturesPositionOpened { message EventPerpetualFuturesPositionClosed { string sender = 1; string position_id = 2; - string fee_amount = 3; - string trade_amount = 4; + string position_size = 3; + string pnl_amount = 4; string returning_amount = 5; } @@ -92,6 +106,7 @@ message EventPerpetualFuturesPositionLiquidated { string position_id = 2; string remaining_margin = 3; string reward_amount = 4; + string levied_amount = 5; } message EventPerpetualFuturesPositionLevied { @@ -99,6 +114,7 @@ message EventPerpetualFuturesPositionLevied { string position_id = 2; string remaining_margin = 3; string reward_amount = 4; + string levied_amount = 5; } message EventLossToLP { diff --git a/proto/ununifi/derivatives/query.proto b/proto/ununifi/derivatives/query.proto index 2f4a8d51a..53e9842ab 100644 --- a/proto/ununifi/derivatives/query.proto +++ b/proto/ununifi/derivatives/query.proto @@ -23,12 +23,12 @@ service Query { option (google.api.http).get = "/ununifi/derivatives/pool"; } - rpc LiquidityProviderTokenRealAPY(QueryLiquidityProviderTokenRealAPYRequest) + rpc LiquidityProviderTokenRealAPY(QueryLiquidityProviderTokenRealAPYRequest) returns (QueryLiquidityProviderTokenRealAPYResponse) { option (google.api.http).get = "/ununifi/derivatives/liquidity-providers/real-apy"; } - rpc LiquidityProviderTokenNominalAPY(QueryLiquidityProviderTokenNominalAPYRequest) + rpc LiquidityProviderTokenNominalAPY(QueryLiquidityProviderTokenNominalAPYRequest) returns (QueryLiquidityProviderTokenNominalAPYResponse) { option (google.api.http).get = "/ununifi/derivatives/liquidity-providers/nominal-apy"; } @@ -66,6 +66,14 @@ service Query { option (google.api.http).get = "/ununifi/derivatives/{address}/positions"; } + rpc AllPendingPaymentPositions(QueryAllPendingPaymentPositionsRequest) returns (QueryAllPendingPaymentPositionsResponse) { + option (google.api.http).get = "/ununifi/derivatives/pending-payment-positions"; + } + + rpc PendingPaymentPosition(QueryPendingPaymentPositionRequest) returns (QueryPendingPaymentPositionResponse) { + option (google.api.http).get = "/ununifi/derivatives/pending-payment-positions/{position_id}"; + } + rpc DLPTokenRates(QueryDLPTokenRateRequest) returns (QueryDLPTokenRateResponse) { option (google.api.http).get = "/ununifi/derivatives/pools/dlp"; } @@ -102,79 +110,87 @@ message QueryParamsResponse { message QueryPoolRequest {} message QueryPoolResponse { - string metrics_quote_ticker = 1 [(gogoproto.moretags) = "yaml:\"metrics_quote_ticker\""]; - PoolMarketCap pool_market_cap = 2 [(gogoproto.moretags) = "yaml:\"pool_market_cap\""]; - string volume_24hours = 3 [ - (gogoproto.moretags) = "yaml:\"volume_24hours\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" - ]; - string fees_24hours = 4 [ - (gogoproto.moretags) = "yaml:\"fees_24hours\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + string metrics_quote_ticker = 1 [ + (gogoproto.moretags) = "yaml:\"metrics_quote_ticker\"" ]; + PoolMarketCap pool_market_cap = 2 [ + (gogoproto.moretags) = "yaml:\"pool_market_cap\"" + ]; } message QueryLiquidityProviderTokenRealAPYRequest { - int64 before_height = 1 [(gogoproto.moretags) = "yaml:\"before_height\""]; - int64 after_height = 2 [(gogoproto.moretags) = "yaml:\"after_height\""]; + int64 before_height = 1 [ + (gogoproto.moretags) = "yaml:\"before_height\"" + ]; + int64 after_height = 2 [ + (gogoproto.moretags) = "yaml:\"after_height\"" + ]; } message QueryLiquidityProviderTokenRealAPYResponse { - string apy = 1 - [(gogoproto.moretags) = "yaml:\"apy\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + string apy = 1 [ + (gogoproto.moretags) = "yaml:\"apy\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + ]; } message QueryLiquidityProviderTokenNominalAPYRequest { - int64 before_height = 1 [(gogoproto.moretags) = "yaml:\"before_height\""]; - int64 after_height = 2 [(gogoproto.moretags) = "yaml:\"after_height\""]; + int64 before_height = 1 [ + (gogoproto.moretags) = "yaml:\"before_height\"" + ]; + int64 after_height = 2 [ + (gogoproto.moretags) = "yaml:\"after_height\"" + ]; } message QueryLiquidityProviderTokenNominalAPYResponse { - string apy = 1 - [(gogoproto.moretags) = "yaml:\"apy\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + string apy = 1 [ + (gogoproto.moretags) = "yaml:\"apy\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + ]; } message QueryPerpetualFuturesRequest {} message QueryPerpetualFuturesResponse { - string metrics_quote_ticker = 2 [(gogoproto.moretags) = "yaml:\"metrics_quote_ticker\""]; - string volume_24hours = 3 [ - (gogoproto.moretags) = "yaml:\"volume_24hours\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + string metrics_quote_ticker = 1 [ + (gogoproto.moretags) = "yaml:\"metrics_quote_ticker\"" ]; - string fees_24hours = 4 [ - (gogoproto.moretags) = "yaml:\"fees_24hours\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + string long_positions = 2 [ + (gogoproto.moretags) = "yaml:\"long_positions\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string short_positions = 3 [ + (gogoproto.moretags) = "yaml:\"short_positions\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin long_positions = 5 - [(gogoproto.moretags) = "yaml:\"long_positions\"", (gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin short_positions = 6 - [(gogoproto.moretags) = "yaml:\"short_positions\"", (gogoproto.nullable) = false]; } message QueryPerpetualFuturesMarketRequest { - string base_denom = 1 [(gogoproto.moretags) = "yaml:\"base_denom\""]; - string quote_denom = 2 [(gogoproto.moretags) = "yaml:\"quote_denom\""]; + string base_denom = 1 [ + (gogoproto.moretags) = "yaml:\"base_denom\"" + ]; + string quote_denom = 2 [ + (gogoproto.moretags) = "yaml:\"quote_denom\"" + ]; } message QueryPerpetualFuturesMarketResponse { - string price = 1 - [(gogoproto.moretags) = "yaml:\"price\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; - string metrics_quote_ticker = 2 [(gogoproto.moretags) = "yaml:\"metrics_quote_ticker\""]; - string volume_24hours = 3 [ - (gogoproto.moretags) = "yaml:\"volume_24hours\"", + string price = 1 [ + (gogoproto.moretags) = "yaml:\"price\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" ]; - string fees_24hours = 4 [ - (gogoproto.moretags) = "yaml:\"fees_24hours\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + string metrics_quote_ticker = 2 [ + (gogoproto.moretags) = "yaml:\"metrics_quote_ticker\"" ]; - string long_positions = 5 [ - (gogoproto.moretags) = "yaml:\"long_positions\"", + string long_positions = 3 [ + (gogoproto.moretags) = "yaml:\"long_positions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" ]; - string short_positions = 6 [ - (gogoproto.moretags) = "yaml:\"short_positions\"", + string short_positions = 4 [ + (gogoproto.moretags) = "yaml:\"short_positions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" ]; } @@ -184,8 +200,12 @@ message QueryPerpetualOptionsRequest {} message QueryPerpetualOptionsResponse {} message QueryPerpetualOptionsMarketRequest { - string base_denom = 1 [(gogoproto.moretags) = "yaml:\"base_denom\""]; - string quote_denom = 2 [(gogoproto.moretags) = "yaml:\"quote_denom\""]; + string base_denom = 1 [ + (gogoproto.moretags) = "yaml:\"base_denom\"" + ]; + string quote_denom = 2 [ + (gogoproto.moretags) = "yaml:\"quote_denom\"" + ]; } message QueryPerpetualOptionsMarketResponse {} @@ -195,8 +215,10 @@ message QueryAllPositionsRequest { } message QueryAllPositionsResponse { - repeated Position positions = 1 [(gogoproto.moretags) = "yaml:\"positions\""]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated Position positions = 1 [ + (gogoproto.moretags) = "yaml:\"positions\"" + ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryPositionRequest { @@ -204,79 +226,145 @@ message QueryPositionRequest { } message QueryPositionResponse { - Position position = 1 [(gogoproto.moretags) = "yaml:\"position\"", (gogoproto.nullable) = true]; - cosmos.base.v1beta1.Coin valuation_profit = 2 - [(gogoproto.moretags) = "yaml:\"valuation_profit\"", (gogoproto.nullable) = false]; + Position position = 1 [ + (gogoproto.moretags) = "yaml:\"position\"", + (gogoproto.nullable) = true + ]; + cosmos.base.v1beta1.Coin valuation_profit = 2 [ + (gogoproto.moretags) = "yaml:\"valuation_profit\"", + (gogoproto.nullable) = false + ]; string margin_maintenance_rate = 3 [ - (gogoproto.moretags) = "yaml:\"margin_maintenance_rate\"", + (gogoproto.moretags) = "yaml:\"margin_maintenance_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin effective_margin = 4 - [(gogoproto.moretags) = "yaml:\"effective_margin\"", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin effective_margin = 4 [ + (gogoproto.moretags) = "yaml:\"effective_margin\"", + (gogoproto.nullable) = false + ]; } message QueryPerpetualFuturesPositionSizeRequest { - PositionType position_type = 1 [(gogoproto.moretags) = "yaml:\"position_type\""]; - string address = 2 [(gogoproto.moretags) = "yaml:\"address\""]; + PositionType position_type = 1 [ + (gogoproto.moretags) = "yaml:\"position_type\"" + ]; + string address = 2 [ + (gogoproto.moretags) = "yaml:\"address\"" + ]; } message QueryPerpetualFuturesPositionSizeResponse { - cosmos.base.v1beta1.Coin total_position_size_usd = 1 - [(gogoproto.moretags) = "yaml:\"total_position_usd_size\"", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin total_position_size_usd = 1 [ + (gogoproto.moretags) = "yaml:\"total_position_usd_size\"", + (gogoproto.nullable) = false + ]; } message QueryAddressPositionsRequest { - string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; + string address = 1 [ + (gogoproto.moretags) = "yaml:\"address\"" + ]; } message QueryAddressPositionsResponse { - repeated QueriedPosition positions = 1 [(gogoproto.moretags) = "yaml:\"positions\"", (gogoproto.nullable) = false]; + repeated QueriedPosition positions = 1 [ + (gogoproto.moretags) = "yaml:\"positions\"", + (gogoproto.nullable) = false + ]; +} + +message QueryAllPendingPaymentPositionsRequest { +} + +message QueryAllPendingPaymentPositionsResponse { + repeated PendingPaymentPosition pending_payment_positions = 1 [ + (gogoproto.moretags) = "yaml:\"pending_payment_positions\"" + ]; +} + +message QueryPendingPaymentPositionRequest { + string position_id = 1; +} + +message QueryPendingPaymentPositionResponse { + PendingPaymentPosition pending_payment_position = 1 [ + (gogoproto.moretags) = "yaml:\"pending_payment_position\"", + (gogoproto.nullable) = true + ]; } -message QueryDLPTokenRateRequest {} +message QueryDLPTokenRateRequest { +} message QueryDLPTokenRateResponse { - string symbol = 1; - repeated cosmos.base.v1beta1.Coin rates = 2 - [(gogoproto.moretags) = "yaml:\"dlp_rates\"", (gogoproto.nullable) = false]; + string symbol = 1; + repeated cosmos.base.v1beta1.Coin rates = 2 [ + (gogoproto.moretags) = "yaml:\"dlp_rates\"", + (gogoproto.nullable) = false + ]; } message QueryEstimateDLPTokenAmountRequest { - string mint_denom = 1 [(gogoproto.moretags) = "yaml:\"mint_denom\""]; - string amount = 2 [(gogoproto.moretags) = "yaml:\"amount\""]; + string mint_denom = 1 [ + (gogoproto.moretags) = "yaml:\"mint_denom\"" + ]; + string amount = 2 [ + (gogoproto.moretags) = "yaml:\"amount\"" + ]; } message QueryEstimateDLPTokenAmountResponse { - cosmos.base.v1beta1.Coin estimated_dlp_amount = 1 - [(gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin deposit_fee = 2 - [(gogoproto.moretags) = "yaml:\"deposit_fee\"", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin estimated_dlp_amount = 1 [ + (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin deposit_fee = 2 [ + (gogoproto.moretags) = "yaml:\"deposit_fee\"", + (gogoproto.nullable) = false + ]; } message QueryEstimateRedeemTokenAmountRequest { - string redeem_denom = 1 [(gogoproto.moretags) = "yaml:\"redeem_denom\""]; - string lpt_amount = 2 [(gogoproto.moretags) = "yaml:\"lpt_amount\""]; + string redeem_denom = 1 [ + (gogoproto.moretags) = "yaml:\"redeem_denom\"" + ]; + string lpt_amount = 2 [ + (gogoproto.moretags) = "yaml:\"lpt_amount\"" + ]; } message QueryEstimateRedeemTokenAmountResponse { - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin fee = 2 [(gogoproto.moretags) = "yaml:\"fee\"", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin fee = 2 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; } message QueryAvailableAssetInPoolByDenomRequest { - string denom = 1 [(gogoproto.moretags) = "yaml:\"denom\""]; + string denom = 1 [ + (gogoproto.moretags) = "yaml:\"denom\"" + ]; } message QueryAvailableAssetInPoolByDenomResponse { - cosmos.base.v1beta1.Coin available_asset = 1 - [(gogoproto.moretags) = "yaml:\"available_asset\"", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin available_asset = 1 [ + (gogoproto.moretags) = "yaml:\"available_asset\"", + (gogoproto.nullable) = false + ]; } -message QueryAvailableAssetsInPoolRequest {} +message QueryAvailableAssetsInPoolRequest { +} message QueryAvailableAssetsInPoolResponse { - repeated cosmos.base.v1beta1.Coin available_assets = 1 - [(gogoproto.moretags) = "yaml:\"available_assets\"", (gogoproto.nullable) = false]; -} + repeated cosmos.base.v1beta1.Coin available_assets = 1 [ + (gogoproto.moretags) = "yaml:\"available_assets\"", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/ununifi/derivatives/tx.proto b/proto/ununifi/derivatives/tx.proto index 1876349b1..eb055dc5b 100644 --- a/proto/ununifi/derivatives/tx.proto +++ b/proto/ununifi/derivatives/tx.proto @@ -17,6 +17,8 @@ service Msg { rpc ClosePosition(MsgClosePosition) returns (MsgClosePositionResponse); rpc ReportLiquidation(MsgReportLiquidation) returns (MsgReportLiquidationResponse); rpc ReportLevyPeriod(MsgReportLevyPeriod) returns (MsgReportLevyPeriodResponse); + rpc AddMargin(MsgAddMargin) returns (MsgAddMarginResponse); + rpc RemoveMargin(MsgRemoveMargin) returns (MsgRemoveMarginResponse); } message MsgDepositToPool { @@ -70,3 +72,19 @@ message MsgReportLevyPeriod { } message MsgReportLevyPeriodResponse {} + +message MsgAddMargin { + string sender = 1 [(gogoproto.moretags) = "yaml:\"sender\""]; + cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false]; + string position_id = 3 [(gogoproto.moretags) = "yaml:\"position_id\""]; +} + +message MsgAddMarginResponse {} + +message MsgRemoveMargin { + string sender = 1 [(gogoproto.moretags) = "yaml:\"sender\""]; + cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false]; + string position_id = 3 [(gogoproto.moretags) = "yaml:\"position_id\""]; +} + +message MsgRemoveMarginResponse {} diff --git a/proto/ununifi/ecosystemincentive/ecosystemincentive.proto b/proto/ununifi/ecosystemincentive/ecosystemincentive.proto index 872b6e527..c8b664579 100644 --- a/proto/ununifi/ecosystemincentive/ecosystemincentive.proto +++ b/proto/ununifi/ecosystemincentive/ecosystemincentive.proto @@ -6,28 +6,7 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/UnUniFi/chain/x/ecosystemincentive/types"; -message RecipientContainer { - string id = 1 [ - (gogoproto.moretags) = "yaml:\"id\"" - ]; - repeated WeightedAddress weighted_addresses = 2 [ - (gogoproto.moretags) = "yaml:\"weighted_addresses\"", - (gogoproto.nullable) = false - ]; -} - -message WeightedAddress { - string address = 1 [ - (gogoproto.moretags) = "yaml:\"address\"" - ]; - string weight = 2 [ - (gogoproto.moretags) = "yaml:\"weight\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message RewardStore { +message RewardRecord { string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; @@ -37,10 +16,3 @@ message RewardStore { (gogoproto.nullable) = false ]; } - -message BelongingRecipientContainers { - string address = 1 [ - (gogoproto.moretags) = "yaml:\"address\"" - ]; - repeated string recipient_container_ids = 2 [ (gogoproto.moretags) = "yaml:\"recipient_container_ids\"" ]; -} diff --git a/proto/ununifi/ecosystemincentive/event.proto b/proto/ununifi/ecosystemincentive/event.proto index 20d72f4d2..93d55b88a 100644 --- a/proto/ununifi/ecosystemincentive/event.proto +++ b/proto/ununifi/ecosystemincentive/event.proto @@ -7,12 +7,6 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/UnUniFi/chain/x/ecosystemincentive/types"; -message EventRegister { - string recipient_container_id = 1 [(gogoproto.moretags) = "yaml:\"recipient_container_id\""]; - repeated WeightedAddress weighted_addresses = 2 - [(gogoproto.moretags) = "yaml:\"weighted_addresses\"", (gogoproto.nullable) = false]; -} - message EventWithdrawAllRewards { string sender = 1 [(gogoproto.moretags) = "yaml:\"sender\""]; repeated cosmos.base.v1beta1.Coin all_withdrawn_rewards = 2 [ @@ -31,33 +25,21 @@ message EventWithdrawReward { ]; } -message EventFailedParsingTxMemoData { - string class_id = 1 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 2 [(gogoproto.moretags) = "yaml:\"nft_id\""]; - string memo = 3 [(gogoproto.moretags) = "yaml:\"memo\""]; -} - -message EventRecordedRecipientContainerId { - string recipient_container_id = 1 [(gogoproto.moretags) = "yaml:\"recipient_container_id\""]; - string class_id = 2 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 3 [(gogoproto.moretags) = "yaml:\"nft_id\""]; -} +// message EventFailedParsingTxMemoData { +// string class_id = 1 [(gogoproto.moretags) = "yaml:\"class_id\""]; +// string nft_id = 2 [(gogoproto.moretags) = "yaml:\"nft_id\""]; +// string memo = 3 [(gogoproto.moretags) = "yaml:\"memo\""]; +// } message EventDeletedNftIdRecordedForFrontendReward { string recipient_container_id = 1 [(gogoproto.moretags) = "yaml:\"recipient_container_id\""]; string class_id = 2 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 3 [(gogoproto.moretags) = "yaml:\"nft_id\""]; -} - -message EventNotRegisteredRecipientContainerId { - string recipient_container_id = 1 [(gogoproto.moretags) = "yaml:\"recipient_container_id\""]; - string class_id = 2 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 3 [(gogoproto.moretags) = "yaml:\"nft_id\""]; + string token_id = 3 [(gogoproto.moretags) = "yaml:\"nft_id\""]; } message EventNotRecordedNftId { string class_id = 1 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 2 [(gogoproto.moretags) = "yaml:\"nft_id\""]; + string token_id = 2 [(gogoproto.moretags) = "yaml:\"nft_id\""]; } message EventUpdatedReward { @@ -69,12 +51,6 @@ message EventUpdatedReward { ]; } -message EventVersionUnmatched { - string unmatched_version = 1 [(gogoproto.moretags) = "yaml:\"unmatched_version\""]; - string class_id = 2 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 3 [(gogoproto.moretags) = "yaml:\"nft_id\""]; -} - message EventDistributionForStakers { cosmos.base.v1beta1.Coin distributed_amount = 1 [ (gogoproto.moretags) = "yaml:\"distributed_amount\"", @@ -83,3 +59,9 @@ message EventDistributionForStakers { ]; int64 block_height = 2 [(gogoproto.moretags) = "yaml:\"block_height\""]; } + +message EventVersionUnmatched { + uint32 unmatched_version = 1 [(gogoproto.moretags) = "yaml:\"unmatched_version\""]; + string class_id = 2 [(gogoproto.moretags) = "yaml:\"class_id\""]; + string nft_id = 3 [(gogoproto.moretags) = "yaml:\"nft_id\""]; +} diff --git a/proto/ununifi/ecosystemincentive/genesis.proto b/proto/ununifi/ecosystemincentive/genesis.proto index 8756eca97..88ba8a503 100644 --- a/proto/ununifi/ecosystemincentive/genesis.proto +++ b/proto/ununifi/ecosystemincentive/genesis.proto @@ -9,7 +9,6 @@ option go_package = "github.com/UnUniFi/chain/x/ecosystemincentive/types"; // GenesisState defines the ecosystemincentive module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated RecipientContainer recipient_containers = 2 [(gogoproto.nullable) = false]; - repeated RewardStore reward_stores = 3 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false]; + repeated RewardRecord reward_records = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/ununifi/ecosystemincentive/memo.proto b/proto/ununifi/ecosystemincentive/memo.proto index 9968ead72..ab9a86301 100644 --- a/proto/ununifi/ecosystemincentive/memo.proto +++ b/proto/ununifi/ecosystemincentive/memo.proto @@ -5,11 +5,11 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/UnUniFi/chain/x/ecosystemincentive/types"; -message TxMemoData { - string version = 1 [ +message FrontendMetadata { + uint32 version = 1 [ (gogoproto.moretags) = "yaml:\"version\"" ]; - string recipient_container_id = 2 [ - (gogoproto.moretags) = "yaml:\"recipient_container_id\"" + string recipient = 2 [ + (gogoproto.moretags) = "yaml:\"recipient\"" ]; } diff --git a/proto/ununifi/ecosystemincentive/params.proto b/proto/ununifi/ecosystemincentive/params.proto index 127f0f3e0..ef1e12df6 100644 --- a/proto/ununifi/ecosystemincentive/params.proto +++ b/proto/ununifi/ecosystemincentive/params.proto @@ -12,7 +12,7 @@ message Params { // RewardParams defines which module have which rewards type and rate // to maintain the correctness of the fee rate in a module -// e.g. if nftmarket module have "Frontend" and "Collection" incentive, +// e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, // the combined those rates for the incentive cannot be exceed 1 message RewardParams { string module_name = 1 [ (gogoproto.moretags) = "yaml:\"module_name\"" ]; @@ -33,9 +33,12 @@ message RewardRate { ]; } -// NFTMARKET_FRONTEND type reward will be disributed for the creators of frontend of UnUniFi's services. +// STAKERS type reward will be distributed for the stakers of GUU token. +// FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. +// COMMUNITY_POOL type reward will be distributed for the community pool. enum RewardType { UNKNOWN = 0; STAKERS = 1; FRONTEND_DEVELOPERS = 2; + COMMUNITY_POOL = 3; } \ No newline at end of file diff --git a/proto/ununifi/ecosystemincentive/query.proto b/proto/ununifi/ecosystemincentive/query.proto index f272d3633..467d7d7dd 100644 --- a/proto/ununifi/ecosystemincentive/query.proto +++ b/proto/ununifi/ecosystemincentive/query.proto @@ -17,10 +17,6 @@ service Query { option (google.api.http).get = "/ununifi/ecosystemincentive/params"; } - rpc RecipientContainer(QueryRecipientContainerRequest) returns (QueryRecipientContainerResponse) { - option (google.api.http).get = "/ununifi/ecosystemincentive/recipient-containers/{id}"; - } - rpc AllRewards(QueryAllRewardsRequest) returns (QueryAllRewardsResponse) { option (google.api.http).get = "/ununifi/ecosystemincentive/rewards/{address}"; } @@ -28,16 +24,6 @@ service Query { rpc Reward(QueryRewardRequest) returns (QueryRewardResponse) { option (google.api.http).get = "/ununifi/ecosystemincentive/rewards/{address}/{denom}"; } - - rpc RecordedRecipientContainerId(QueryRecordedRecipientContainerIdRequest) - returns (QueryRecordedRecipientContainerIdResponse) { - option (google.api.http).get = "/ununifi/ecosystemincentive/recorded-recipient-containers/{class_id}/{nft_id}"; - } - - rpc BelongingRecipientContainerIdsByAddr(QueryBelongingRecipientContainerIdsByAddrRequest) - returns (QueryBelongingRecipientContainerIdsByAddrResponse) { - option (google.api.http).get = "/ununifi/ecosystemincentive/belonging-recipient-containers/{address}"; - } } message QueryParamsRequest {} @@ -47,20 +33,12 @@ message QueryParamsResponse { Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; } -message QueryRecipientContainerRequest { - string id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; -} - -message QueryRecipientContainerResponse { - RecipientContainer recipient_container = 1 [(gogoproto.moretags) = "yaml:\"recipient_container\""]; -} - message QueryAllRewardsRequest { string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; } message QueryAllRewardsResponse { - RewardStore rewards = 1 [(gogoproto.moretags) = "yaml:\"rewards\"", (gogoproto.nullable) = false]; + RewardRecord reward_record = 1 [(gogoproto.moretags) = "yaml:\"reward_record\"", (gogoproto.nullable) = false]; } message QueryRewardRequest { @@ -75,20 +53,3 @@ message QueryRewardResponse { (gogoproto.nullable) = false ]; } - -message QueryRecordedRecipientContainerIdRequest { - string class_id = 1 [(gogoproto.moretags) = "yaml:\"class_id\""]; - string nft_id = 2 [(gogoproto.moretags) = "yaml:\"nft_id\""]; -} - -message QueryRecordedRecipientContainerIdResponse { - string recipient_container_id = 1 [(gogoproto.moretags) = "yaml:\"recipient_container_id\""]; -} - -message QueryBelongingRecipientContainerIdsByAddrRequest { - string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; -} - -message QueryBelongingRecipientContainerIdsByAddrResponse { - repeated string recipient_container_ids = 2 [(gogoproto.moretags) = "yaml:\"recipient_container_ids\""]; -} diff --git a/proto/ununifi/ecosystemincentive/tx.proto b/proto/ununifi/ecosystemincentive/tx.proto index 1a58d4f3b..3ad08ac2a 100644 --- a/proto/ununifi/ecosystemincentive/tx.proto +++ b/proto/ununifi/ecosystemincentive/tx.proto @@ -8,27 +8,10 @@ option go_package = "github.com/UnUniFi/chain/x/ecosystemincentive/types"; // Msg defines the Msg service. service Msg { - rpc Register(MsgRegister) returns (MsgRegisterResponse); rpc WithdrawAllRewards(MsgWithdrawAllRewards) returns (MsgWithdrawAllRewardsResponse); rpc WithdrawReward(MsgWithdrawReward) returns (MsgWithdrawRewardResponse); } -message MsgRegister { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"" - ]; - string recipient_container_id = 2 [ (gogoproto.moretags) = "yaml:\"recipient_container_id\"" ]; - repeated string addresses = 3 [ - (gogoproto.moretags) = "yaml:\"subject_addrs\"" - ]; - repeated string weights = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.moretags) = "yaml:\"weights\"", - (gogoproto.nullable) = false - ]; -} -message MsgRegisterResponse {} - message MsgWithdrawAllRewards { string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" diff --git a/proto/ununifi/eventhook/eventhook.proto b/proto/ununifi/eventhook/eventhook.proto index e421007b1..3c0839a78 100644 --- a/proto/ununifi/eventhook/eventhook.proto +++ b/proto/ununifi/eventhook/eventhook.proto @@ -2,16 +2,15 @@ syntax = "proto3"; package nftvault.eventhook; import "gogoproto/gogo.proto"; -import "ununifi/eventhook/params.proto"; option go_package = "github.com/UnUniFi/chain/x/eventhook/types"; message Hook { uint64 id = 1; - string event_type = 2; + string name = 2; string contract_address = 3; - string name = 4; - string git_url = 5; + string git_url = 4; + string event_type = 5; repeated KeyValuePair event_attributes = 6; } diff --git a/proto/ununifi/eventhook/proposal.proto b/proto/ununifi/eventhook/proposal.proto deleted file mode 100644 index 9a8005827..000000000 --- a/proto/ununifi/eventhook/proposal.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package nftvault.eventhook; - -import "gogoproto/gogo.proto"; -import "ununifi/eventhook/eventhook.proto"; - -option go_package = "github.com/UnUniFi/chain/x/eventhook/types"; - -// proposal to add new hook -message ProposalAddHook { - string title = 1; - string description = 2; - string event_type = 3; - string contract_address = 4; - string name = 5; - string git_url = 6; - repeated KeyValuePair event_attributes = 7; -} diff --git a/proto/ununifi/eventhook/tx.proto b/proto/ununifi/eventhook/tx.proto index 9969dbbef..f6d29db4d 100644 --- a/proto/ununifi/eventhook/tx.proto +++ b/proto/ununifi/eventhook/tx.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package nftvault.eventhook; +import "ununifi/eventhook/eventhook.proto"; // this line is used by starport scaffolding # proto/tx/import option go_package = "github.com/UnUniFi/chain/x/eventhook/types"; @@ -8,6 +9,29 @@ option go_package = "github.com/UnUniFi/chain/x/eventhook/types"; // Msg defines the Msg service. service Msg { // this line is used by starport scaffolding # proto/tx/rpc + rpc RegisterHook(MsgRegisterHook) returns (MsgRegisterHookResponse); + rpc UnregisterHook(MsgUnregisterHook) returns (MsgUnregisterHookResponse); } // this line is used by starport scaffolding # proto/tx/message +message MsgRegisterHook { + string sender = 1; + string name = 2; + string contract_address = 3; + string git_url = 4; + string event_type = 5; + repeated KeyValuePair event_attributes = 6; +} + +message MsgRegisterHookResponse { + uint64 id = 1; +} + +message MsgUnregisterHook { + string sender = 1; + string event_type = 2; + uint64 id = 3; +} + +message MsgUnregisterHookResponse { +} diff --git a/proto/ununifi/nft/nft.proto b/proto/ununifi/nft/nft.proto index f334642bd..f58f75168 100644 --- a/proto/ununifi/nft/nft.proto +++ b/proto/ununifi/nft/nft.proto @@ -3,9 +3,14 @@ package ununifi.nft; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; +import "google/protobuf/any.proto"; option go_package = "github.com/UnUniFi/chain/x/nft/types"; +message ClassData { + string send_prehook_contract = 1; +} + message NftData { bool send_disabled = 1; } diff --git a/proto/ununifi/nftbackedloan/event.proto b/proto/ununifi/nftbackedloan/event.proto new file mode 100644 index 000000000..d77d9e75f --- /dev/null +++ b/proto/ununifi/nftbackedloan/event.proto @@ -0,0 +1,73 @@ +syntax = "proto3"; +package ununifi.nftbackedloan; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/UnUniFi/chain/x/nftbackedloan/types"; + +message EventListNft { + string owner = 1; + string class_id = 2; + string token_id = 3; +} + +message EventCancelListing { + string owner = 1; + string class_id = 2; + string token_id = 3; +} + +message EventSellingDecision { + string owner = 1; + string class_id = 2; + string token_id = 3; +} + +message EventEndListing { + string owner = 1; + string class_id = 2; + string token_id = 3; +} + +message EventPlaceBid { + string bidder = 1; + string class_id = 2; + string token_id = 3; + string amount = 4; +} + +message EventCancelBid { + string bidder = 1; + string class_id = 2; + string token_id = 3; +} + +message EventPayRemainder { + string bidder = 1; + string class_id = 2; + string token_id = 3; +} + +message EventBorrow { + string borrower = 1; + string class_id = 2; + string token_id = 3; + string amount = 4; +} + +message EventRepay { + string borrower = 1; + string class_id = 2; + string token_id = 3; + string amount = 4; +} + +message EventLiquidate { + string liquidator = 1; + string class_id = 2; + string token_id = 3; +} diff --git a/proto/ununifi/nftbackedloan/genesis.proto b/proto/ununifi/nftbackedloan/genesis.proto index 50a2f638a..a9c046af6 100644 --- a/proto/ununifi/nftbackedloan/genesis.proto +++ b/proto/ununifi/nftbackedloan/genesis.proto @@ -3,17 +3,16 @@ package ununifi.nftbackedloan; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; +import "ununifi/nftbackedloan/params.proto"; import "ununifi/nftbackedloan/nftbackedloan.proto"; option go_package = "github.com/UnUniFi/chain/x/nftbackedloan/types"; // GenesisState defines the nftbackedloan module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; - repeated NftListing listings = 2 [(gogoproto.nullable) = false]; - repeated NftBid bids = 3 [(gogoproto.nullable) = false]; - repeated NftBid cancelled_bids = 4 [(gogoproto.nullable) = false]; - repeated Loan loans = 5 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; + repeated Listing listings = 2 [(gogoproto.nullable) = false]; + repeated Bid bids = 3 [(gogoproto.nullable) = false]; } // Built based on following spec diff --git a/proto/ununifi/nftbackedloan/nftbackedloan.proto b/proto/ununifi/nftbackedloan/nftbackedloan.proto index fb73c9b08..f174db362 100644 --- a/proto/ununifi/nftbackedloan/nftbackedloan.proto +++ b/proto/ununifi/nftbackedloan/nftbackedloan.proto @@ -9,32 +9,23 @@ import "cosmos_proto/cosmos.proto"; option go_package = "github.com/UnUniFi/chain/x/nftbackedloan/types"; -enum ListingType { - DIRECT_ASSET_BORROW = 0; - SYNTHETIC_ASSET_CREATION = 1; - LATE_SHIPPING = 2; -} enum ListingState { - LISTING = 0; - BIDDING = 1; - SELLING_DECISION = 2; - END_LISTING = 3; - SUCCESSFUL_BID = 4; + UNKNOWN = 0; + LISTING = 1; + BIDDING = 2; + SELLING_DECISION = 3; + LIQUIDATION = 4; + SUCCESSFUL_BID = 5; } -message NftIdentifier { +message NftId { string class_id = 1; - string nft_id = 2; + string token_id = 2; } message BidId { - NftIdentifier nft_id = 1; - string bidder = 2; -} - -message Loan { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin loan = 2 [(gogoproto.nullable) = false]; + NftId nft_id = 1; + string bidder = 2; } message ListedClass { @@ -48,181 +39,73 @@ message NftInfo { string uri_hash = 3; } -message NftListing { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - string owner = 2; - ListingType listing_type = 3; - ListingState state = 4; - string bid_token = 5; - string minimum_deposit_rate = 6 [ - (cosmos_proto.scalar) = "cosmos.Dec", +message Listing { + NftId nft_id = 1 [(gogoproto.nullable) = false]; + string owner = 2; + ListingState state = 3; + string bid_denom = 4; + string min_deposit_rate = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - bool automatic_refinancing = 7; - google.protobuf.Timestamp started_at = 8 - [(gogoproto.moretags) = "yaml:\"started_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp end_at = 9 - [(gogoproto.moretags) = "yaml:\"end_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp full_payment_end_at = 10 + google.protobuf.Duration min_bid_period = 6 [ + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false + ]; + google.protobuf.Timestamp started_at = 7 [ + (gogoproto.moretags) = "yaml:\"started_at\"", + (gogoproto.nullable) = false, (gogoproto.stdtime) = true + ]; + google.protobuf.Timestamp liquidated_at = 8 + [(gogoproto.moretags) = "yaml:\"liquidated_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp full_payment_end_at = 9 [(gogoproto.moretags) = "yaml:\"full_payment_end_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp successful_bid_end_at = 11 [ + google.protobuf.Timestamp successful_bid_end_at = 10 [ (gogoproto.moretags) = "yaml:\"successful_bid_end_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; - uint64 auto_relisted_count = 12; - cosmos.base.v1beta1.Coin collected_amount = 13 [(gogoproto.nullable) = false]; - google.protobuf.Duration minimum_bidding_period = 14 [ - (gogoproto.stdduration) = true, - (gogoproto.nullable) = false - ]; + cosmos.base.v1beta1.Coin collected_amount = 11 [(gogoproto.nullable) = false]; + bool collected_amount_negative = 12; } -message borrowing { - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin paid_interest_amount = 2 [(gogoproto.nullable) = false]; - google.protobuf.Timestamp start_at = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} - -message NftBid { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - string bidder = 2; - cosmos.base.v1beta1.Coin bid_amount = 3 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin deposit_amount = 4 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin paid_amount = 5 [(gogoproto.nullable) = false]; - google.protobuf.Timestamp bidding_period = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string deposit_lending_rate = 7 [ +message Bid { + BidId id = 1 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin price = 2 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin deposit = 3 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin paid_amount = 4 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp expiry = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string interest_rate = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - bool automatic_payment = 8; - google.protobuf.Timestamp bid_time = 9 - [(gogoproto.moretags) = "yaml:\"bid_time\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - cosmos.base.v1beta1.Coin interest_amount = 10 [(gogoproto.nullable) = false]; - // lister borrowing bidder info - repeated borrowing borrowings = 11 [(gogoproto.nullable) = false]; - // todo remove nft_id,bidder then use it - BidId id = 12 [(gogoproto.nullable) = false]; -} - -message Params { - string min_staking_for_listing = 1 [ - (gogoproto.moretags) = "yaml:\"min_staking_for_listing\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - uint64 default_bid_active_rank = 2; - repeated string bid_tokens = 3; - uint64 auto_relisting_count_if_no_bid = 4; - uint64 nft_listing_delay_seconds = 5; - uint64 nft_listing_period_initial = 6; - uint64 nft_listing_cancel_required_seconds = 7; - uint64 nft_listing_cancel_fee_percentage = 8; - uint64 nft_listing_gap_time = 9; - uint64 bid_cancel_required_seconds = 10; - uint64 bid_token_disburse_seconds_after_cancel = 11; - uint64 nft_listing_full_payment_period = 12; - uint64 nft_listing_nft_delivery_period = 13; - uint64 nft_creator_share_percentage = 14; - string market_administrator = 15; - uint64 nft_listing_commission_fee = 16; - uint64 nft_listing_extend_seconds = 17; - cosmos.base.v1beta1.Coin nft_listing_period_extend_fee_per_hour = 18 [(gogoproto.nullable) = false]; + bool automatic_payment = 7; + google.protobuf.Timestamp created_at = 8 + [(gogoproto.moretags) = "yaml:\"create_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // borrow info + Loan loan = 9 [(gogoproto.nullable) = false]; } -message EventListNft { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventCancelListNfting { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventExpandListingPeriod { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventSellingDecision { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventEndListNfting { - string owner = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventPlaceBid { - string bidder = 1; - string class_id = 2; - string nft_id = 3; - string amount = 4; -} - -message EventCancelBid { - string bidder = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventPayFullBid { - string bidder = 1; - string class_id = 2; - string nft_id = 3; -} - -message EventBorrow { - string borrower = 1; - string class_id = 2; - string nft_id = 3; - string amount = 4; -} - -message EventRepay { - string repayer = 1; - string class_id = 2; - string nft_id = 3; - string amount = 4; -} - -message EventLiquidate { - string liquidator = 1; - string class_id = 2; - string nft_id = 3; -} - -message PaymentStatus { - NftIdentifier nft_id = 1 [(gogoproto.nullable) = false]; - string bidder = 2; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; - bool automatic_payment = 4; - string paid_amount = 5 [ - (gogoproto.moretags) = "yaml:\"paid_amount\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp bid_time = 6 - [(gogoproto.moretags) = "yaml:\"bid_time\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - ListingState state = 7; - bool all_paid = 8; +message Loan { + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp last_repaid_at = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } -message Liquidation{ - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; +message Liquidation { + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; google.protobuf.Timestamp liquidation_date = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } -message Liquidations{ - Liquidation liquidation = 1 [(gogoproto.nullable) = true]; +message Liquidations { + Liquidation liquidation = 1 [(gogoproto.nullable) = true]; repeated Liquidation next_liquidation = 2 [(gogoproto.nullable) = false]; +} + +message RepayInfo { + cosmos.base.v1beta1.Coin repaid_amount = 1 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin repaid_interest_amount = 2 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin remaining_amount = 3 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp last_repaid_at = 4[(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } \ No newline at end of file diff --git a/proto/ununifi/nftbackedloan/params.proto b/proto/ununifi/nftbackedloan/params.proto new file mode 100644 index 000000000..b81977b85 --- /dev/null +++ b/proto/ununifi/nftbackedloan/params.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package ununifi.nftbackedloan; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/UnUniFi/chain/x/nftbackedloan/types"; + +message Params { + string min_staking_for_listing = 1 [ + (gogoproto.moretags) = "yaml:\"min_staking_for_listing\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + repeated string bid_tokens = 2; + uint64 nft_listing_cancel_required_seconds = 3; + uint64 bid_cancel_required_seconds = 4; + uint64 nft_listing_full_payment_period = 5; + uint64 nft_listing_nft_delivery_period = 6; + string nft_listing_commission_rate = 7 [ + (gogoproto.moretags) = "yaml:\"nft_listing_commission_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/ununifi/nftbackedloan/query.proto b/proto/ununifi/nftbackedloan/query.proto index c5092e0dc..9cfdd0554 100644 --- a/proto/ununifi/nftbackedloan/query.proto +++ b/proto/ununifi/nftbackedloan/query.proto @@ -7,6 +7,7 @@ import "google/protobuf/timestamp.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; +import "ununifi/nftbackedloan/params.proto"; import "ununifi/nftbackedloan/nftbackedloan.proto"; option go_package = "github.com/UnUniFi/chain/x/nftbackedloan/types"; @@ -17,37 +18,36 @@ service Query { option (google.api.http).get = "/ununifi/nftbackedloan/params"; } rpc NftListing(QueryNftListingRequest) returns (QueryNftListingResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/nft_listing/{class_id}/{nft_id}"; + option (google.api.http).get = "/ununifi/nftbackedloan/nft-listing/{class_id}/{nft_id}"; } rpc ListedNfts(QueryListedNftsRequest) returns (QueryListedNftsResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/listed_nfts"; + option (google.api.http).get = "/ununifi/nftbackedloan/listed-nfts"; } rpc ListedClasses(QueryListedClassesRequest) returns (QueryListedClassesResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/listed_classes"; + option (google.api.http).get = "/ununifi/nftbackedloan/listed-classes"; } rpc ListedClass(QueryListedClassRequest) returns (QueryListedClassResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/listed_class/{class_id}/{nft_limit}"; + option (google.api.http).get = "/ununifi/nftbackedloan/listed-class/{class_id}/{nft_limit}"; } - rpc Loans(QueryLoansRequest) returns (QueryLoansResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/loans"; - } + // rpc Loans(QueryLoansRequest) returns (QueryLoansResponse) { + // option (google.api.http).get = "/ununifi/nftbackedloan/loans"; + // } rpc Loan(QueryLoanRequest) returns (QueryLoanResponse) { option (google.api.http).get = "/ununifi/nftbackedloan/loans/{class_id}/{nft_id}"; } - rpc CDPsList(QueryCDPsListRequest) returns (QueryCDPsListResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/cdps_list"; - } rpc NftBids(QueryNftBidsRequest) returns (QueryNftBidsResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/nft_bids/{class_id}/{nft_id}"; + option (google.api.http).get = "/ununifi/nftbackedloan/nft-bids/{class_id}/{nft_id}"; } rpc BidderBids(QueryBidderBidsRequest) returns (QueryBidderBidsResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/bidder_bids/{bidder}"; - } - rpc PaymentStatus(QueryPaymentStatusRequest) returns (QueryPaymentStatusResponse) { - option (google.api.http).get = "/ununifi/nftbackedloan/payment_status/{class_id}/{nft_id}/{bidder}"; + option (google.api.http).get = "/ununifi/nftbackedloan/bidder-bids/{bidder}"; } + + // rpc PaymentStatus(QueryPaymentStatusRequest) returns (QueryPaymentStatusResponse) { + // option (google.api.http).get = "/ununifi/nftbackedloan/payment-status/{class_id}/{nft_id}/{bidder}"; + // } + rpc Rewards(QueryRewardsRequest) returns (QueryRewardsResponse) { option (google.api.http).get = "/ununifi/nftbackedloan/rewards/{address}"; } @@ -66,7 +66,7 @@ message QueryNftListingRequest { string nft_id = 2; } message QueryNftListingResponse { - NftListing listing = 1 [(gogoproto.nullable) = false]; + Listing listing = 1 [(gogoproto.nullable) = false]; } message QueryListedNftsRequest { @@ -84,7 +84,7 @@ message QueryListedClassRequest { } message NftListingDetail { - NftListing listing = 1 [(gogoproto.nullable) = false]; + Listing listing = 1 [(gogoproto.nullable) = false]; NftInfo nft_info = 2 [(gogoproto.nullable) = false]; } message QueryListedNftsResponse { @@ -105,10 +105,10 @@ message QueryListedClassResponse { uint64 nft_count = 8; } -message QueryLoansRequest {} -message QueryLoansResponse { - repeated Loan loans = 1 [(gogoproto.nullable) = false]; -} +// message QueryLoansRequest {} +// message QueryLoansResponse { +// repeated QueryLoanResponse loans = 1 [(gogoproto.nullable) = false]; +// } message QueryLoanRequest { string class_id = 1; @@ -116,18 +116,10 @@ message QueryLoanRequest { } message QueryLoanResponse { - Loan loan = 1 [(gogoproto.nullable) = false]; - string borrowing_limit = 2 [ - (gogoproto.moretags) = "yaml:\"borrowing_limit\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} - -message QueryCDPsListRequest {} -message QueryCDPsListResponse { - // List of collateral rates for each NFT secured - // Issuing stable tokens Balance list + NftId nft_id = 1 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin borrowing_amount = 2 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin borrowing_limit = 3 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin total_deposit = 4 [(gogoproto.nullable) = false]; } message QueryNftBidsRequest { @@ -135,20 +127,20 @@ message QueryNftBidsRequest { string nft_id = 2; } message QueryNftBidsResponse { - repeated NftBid bids = 1 [(gogoproto.nullable) = false]; -} -message QueryPaymentStatusRequest { - string class_id = 1; - string nft_id = 2; - string bidder = 3 [ - (gogoproto.moretags) = "yaml:\"bidder\"", - (cosmos_proto.scalar) = "github.com/UnUniFi/chain/types.StringAccAddress" - ]; + repeated Bid bids = 1 [(gogoproto.nullable) = false]; } -message QueryPaymentStatusResponse { - PaymentStatus paymentStatus = 1 [(gogoproto.nullable) = false]; -} +// message QueryPaymentStatusRequest { +// string class_id = 1; +// string nft_id = 2; +// string bidder = 3 [ +// (gogoproto.moretags) = "yaml:\"bidder\"", +// (cosmos_proto.scalar) = "github.com/UnUniFi/chain/types.StringAccAddress" +// ]; +// } +// message QueryPaymentStatusResponse { +// PaymentStatus paymentStatus = 1 [(gogoproto.nullable) = false]; +// } message QueryBidderBidsRequest { string bidder = 1 [ @@ -157,7 +149,7 @@ message QueryBidderBidsRequest { ]; } message QueryBidderBidsResponse { - repeated NftBid bids = 1 [(gogoproto.nullable) = false]; + repeated Bid bids = 1 [(gogoproto.nullable) = false]; } message QueryRewardsRequest { diff --git a/proto/ununifi/nftbackedloan/tx.proto b/proto/ununifi/nftbackedloan/tx.proto index 1e3294b96..4eaf8122d 100644 --- a/proto/ununifi/nftbackedloan/tx.proto +++ b/proto/ununifi/nftbackedloan/tx.proto @@ -11,98 +11,89 @@ import "cosmos_proto/cosmos.proto"; option go_package = "github.com/UnUniFi/chain/x/nftbackedloan/types"; service Msg { - rpc MintNft(MsgMintNft) returns (MsgMintNftResponse); rpc ListNft(MsgListNft) returns (MsgListNftResponse); - rpc CancelNftListing(MsgCancelNftListing) returns (MsgCancelNftListingResponse); + rpc CancelListing(MsgCancelListing) returns (MsgCancelListingResponse); rpc PlaceBid(MsgPlaceBid) returns (MsgPlaceBidResponse); rpc CancelBid(MsgCancelBid) returns (MsgCancelBidResponse); rpc SellingDecision(MsgSellingDecision) returns (MsgSellingDecisionResponse); - rpc EndNftListing(MsgEndNftListing) returns (MsgEndNftListingResponse); - rpc PayFullBid(MsgPayFullBid) returns (MsgPayFullBidResponse); + rpc PayRemainder(MsgPayRemainder) returns (MsgPayRemainderResponse); rpc Borrow(MsgBorrow) returns (MsgBorrowResponse); rpc Repay(MsgRepay) returns (MsgRepayResponse); } -message MsgMintNft { - string sender = 1; - string class_id = 2; - string nft_id = 3; - string nft_uri = 4; - string nft_uri_hash = 5; -} -message MsgMintNftResponse {} - message MsgListNft { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; - ListingType listing_type = 3; - string bid_token = 4; - // 1% = 0.01 - string minimum_deposit_rate = 5 [ + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; + string bid_denom = 3; + string min_deposit_rate = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - bool automatic_refinancing = 6; - google.protobuf.Duration minimum_bidding_period = 7 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; + google.protobuf.Duration min_bid_period = 5 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; } message MsgListNftResponse {} -message MsgCancelNftListing { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; +message MsgCancelListing { + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; } -message MsgCancelNftListingResponse {} +message MsgCancelListingResponse {} message MsgPlaceBid { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin bid_amount = 3 [(gogoproto.nullable) = false]; - google.protobuf.Timestamp bidding_period = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string deposit_lending_rate = 5 [ + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin price = 3 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp expiry = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string interest_rate = 5 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; bool automatic_payment = 6; - cosmos.base.v1beta1.Coin deposit_amount = 7 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin deposit = 7 [(gogoproto.nullable) = false]; } message MsgPlaceBidResponse {} message MsgCancelBid { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; } message MsgCancelBidResponse {} message MsgEndNftListing { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; } message MsgEndNftListingResponse {} message MsgSellingDecision { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; } message MsgSellingDecisionResponse {} -message MsgPayFullBid { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; +message MsgPayRemainder { + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; +} +message MsgPayRemainderResponse {} + +message BorrowBid { + string bidder = 1; + cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; } -message MsgPayFullBidResponse {} message MsgBorrow { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; + repeated BorrowBid borrow_bids = 3 [(gogoproto.nullable) = false]; } message MsgBorrowResponse {} message MsgRepay { - string sender = 1; - NftIdentifier nft_id = 2 [(gogoproto.nullable) = false]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + string sender = 1; + NftId nft_id = 2 [(gogoproto.nullable) = false]; + repeated BorrowBid repay_bids = 3 [(gogoproto.nullable) = false]; } message MsgRepayResponse {} diff --git a/proto/ununifi/nftfactory/event.proto b/proto/ununifi/nftfactory/event.proto index e837ea7bc..03fce426b 100644 --- a/proto/ununifi/nftfactory/event.proto +++ b/proto/ununifi/nftfactory/event.proto @@ -7,40 +7,30 @@ import "ununifi/nftfactory/nftfactory.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; message EventCreateClass { - string owner = 1; - string class_id = 2; - string base_token_uri = 3; - string token_supply_cap = 4; - MintingPermission minting_permission = 5; -} - -message EventSendClassOwnership { string sender = 1; - string receiver = 2; - string class_id = 3; -} - -message EventUpdateBaseTokenUri { - string owner = 1; - string class_id = 2; - string base_token_uri = 3; + string class_id = 2; } -message EventUpdateTokenSupplyCap { - string owner = 1; - string class_id = 2; - string token_supply_cap = 3; +message EventUpdateClass { + string sender = 1; + string class_id = 2; } message EventMintNFT { - string class_id = 1; - string nft_id = 2; - string owner = 3; - string minter = 4; + string sender = 1; + string class_id = 2; + string token_id = 3; + string recipient = 4; } message EventBurnNFT { - string burner = 1; + string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; +} + +message EventChangeAdmin { + string admin = 1; + string class_id = 3; + string new_admin = 2; } diff --git a/proto/ununifi/nftfactory/genesis.proto b/proto/ununifi/nftfactory/genesis.proto index cb25f04cc..0d6c86088 100644 --- a/proto/ununifi/nftfactory/genesis.proto +++ b/proto/ununifi/nftfactory/genesis.proto @@ -8,7 +8,17 @@ option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; // GenesisState defines the nftfactory module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; - repeated ClassAttributes class_attributes_list = 2 - [(gogoproto.moretags) = "yaml:\"class_attributes_list\"", (gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.moretags) = "yaml:\"params\"", (gogoproto.nullable) = false]; + repeated GenesisClass classes = 2 + [(gogoproto.moretags) = "yaml:\"class_ownerships\"", (gogoproto.nullable) = false]; } + +message GenesisClass { + option (gogoproto.equal) = true; + + string class_id = 1 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + ClassAuthorityMetadata authority_metadata = 2 [ + (gogoproto.moretags) = "yaml:\"authority_metadata\"", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/ununifi/nftfactory/nftfactory.proto b/proto/ununifi/nftfactory/nftfactory.proto index 3f786c51a..af87fc5fb 100644 --- a/proto/ununifi/nftfactory/nftfactory.proto +++ b/proto/ununifi/nftfactory/nftfactory.proto @@ -2,40 +2,28 @@ syntax = "proto3"; package ununifi.nftfactory; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; -enum MintingPermission { - OnlyOwner = 0; - Anyone = 1; - // WhiteList = 2; -} - -message ClassAttributes { - string class_id = 1; - string owner = 2; - string base_token_uri = 3; - MintingPermission minting_permission = 4; - uint64 token_supply_cap = 5; -} +// ClassAuthorityMetadata specifies metadata for addresses that have specific +// capabilities over a nft factory class. Right now there is only one Admin +// permission, but is planned to be extended to the future. +message ClassAuthorityMetadata { + option (gogoproto.equal) = true; -message OwningClassIdList { - string owner = 1; - repeated string class_id = 2; -} - -message ClassNameIdList { - string class_name = 1; - repeated string class_id = 2; + // Can be empty for no admin, or a valid address + string Admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; } message Params { - uint64 MaxNFTSupplyCap = 1; - uint64 MinClassNameLen = 2; - uint64 MaxClassNameLen = 3; - uint64 MinUriLen = 4; - uint64 MaxUriLen = 5; - uint64 MaxSymbolLen = 6; - uint64 MaxDescriptionLen = 7; + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + repeated cosmos.base.v1beta1.Coin class_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", + (gogoproto.nullable) = false + ]; + + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 2; } diff --git a/proto/ununifi/nftfactory/query.proto b/proto/ununifi/nftfactory/query.proto index 057e2b5bb..12a1ee81a 100644 --- a/proto/ununifi/nftfactory/query.proto +++ b/proto/ununifi/nftfactory/query.proto @@ -11,50 +11,41 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/ununifi/nftfactory/params"; } - rpc ClassAttributes(QueryClassAttributesRequest) returns (QueryClassAttributesResponse) { - option (google.api.http).get = "/ununifi/nftfactory/class_owner/{class_id}"; + rpc ClassAuthorityMetadata(QueryClassAuthorityMetadataRequest) + returns (QueryClassAuthorityMetadataResponse) { + option (google.api.http).get = + "/ununifi/nftfactory/class/factory/{creator}/{subclass}/authority-metadata"; } - rpc NFTMinter(QueryNFTMinterRequest) returns (QueryNFTMinterResponse) { - option (google.api.http).get = "/ununifi/nftfactory/nft_minter/{class_id}/{nft_id}"; - } - rpc ClassIdsByName(QueryClassIdsByNameRequest) returns (QueryClassIdsByNameResponse) { - option (google.api.http).get = "/ununifi/nftfactory/class_ids_by_name/{class_name}"; - } - rpc ClassIdsByOwner(QueryClassIdsByOwnerRequest) returns (QueryClassIdsByOwnerResponse) { - option (google.api.http).get = "/ununifi/nftfactory/class_ids_by_owner/{owner}"; + rpc ClassesFromCreator(QueryClassesFromCreatorRequest) + returns (QueryClassesFromCreatorResponse) { + option (google.api.http).get = + "/ununifi/nftfactory/classes-from-creator/{creator}"; } } +// QueryParamsRequest is the request type for the Query/Params RPC method. message QueryParamsRequest {} -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryClassAttributesRequest { - string class_id = 1; -} -message QueryClassAttributesResponse { - ClassAttributes class_attributes = 1; -} -message QueryNFTMinterRequest { - string class_id = 1; - string nft_id = 2; -} -message QueryNFTMinterResponse { - string minter = 1; +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; } -message QueryClassIdsByNameRequest { - string class_name = 1; +message QueryClassAuthorityMetadataRequest { + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string subclass = 2 [ (gogoproto.moretags) = "yaml:\"subclass\"" ]; } -message QueryClassIdsByNameResponse { - ClassNameIdList class_name_id_list = 1; +message QueryClassAuthorityMetadataResponse { + ClassAuthorityMetadata authority_metadata = 1 [ + (gogoproto.moretags) = "yaml:\"authority_metadata\"", + (gogoproto.nullable) = false + ]; } -message QueryClassIdsByOwnerRequest { - string owner = 1; -} -message QueryClassIdsByOwnerResponse { - OwningClassIdList owning_class_id_list = 1; +message QueryClassesFromCreatorRequest { + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; } +message QueryClassesFromCreatorResponse { + repeated string classes = 1 [ (gogoproto.moretags) = "yaml:\"classes\"" ]; +} \ No newline at end of file diff --git a/proto/ununifi/nftfactory/tx.proto b/proto/ununifi/nftfactory/tx.proto index 6b2423b1a..a3574885a 100644 --- a/proto/ununifi/nftfactory/tx.proto +++ b/proto/ununifi/nftfactory/tx.proto @@ -2,63 +2,82 @@ syntax = "proto3"; package ununifi.nftfactory; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; import "ununifi/nftfactory/nftfactory.proto"; option go_package = "github.com/UnUniFi/chain/x/nftfactory/types"; service Msg { rpc CreateClass(MsgCreateClass) returns (MsgCreateClassResponse); - rpc SendClassOwnership(MsgSendClassOwnership) returns (MsgSendClassOwnershipResponse); - rpc UpdateBaseTokenUri(MsgUpdateBaseTokenUri) returns (MsgUpdateBaseTokenUriResponse); - rpc UpdateTokenSupplyCap(MsgUpdateTokenSupplyCap) returns (MsgUpdateTokenSupplyCapResponse); + rpc UpdateClass(MsgUpdateClass) returns (MsgUpdateClassResponse); rpc MintNFT(MsgMintNFT) returns (MsgMintNFTResponse); rpc BurnNFT(MsgBurnNFT) returns (MsgBurnNFTResponse); + rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } message MsgCreateClass { - string sender = 1; - string name = 2; - string base_token_uri = 3; - uint64 token_supply_cap = 4; - MintingPermission minting_permission = 5; - string symbol = 7; - string description = 8; - string class_uri = 9; + string sender = 1; + string subclass = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; } -message MsgCreateClassResponse {} -message MsgSendClassOwnership { - string sender = 1; - string class_id = 2; - string recipient = 3; -} -message MsgSendClassOwnershipResponse {} +message MsgCreateClassResponse {} -message MsgUpdateBaseTokenUri { - string sender = 1; - string class_id = 2; - string base_token_uri = 3; +message MsgUpdateClass { + string sender = 1; + string class_id = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; } -message MsgUpdateBaseTokenUriResponse {} -message MsgUpdateTokenSupplyCap { - string sender = 1; - string class_id = 2; - uint64 token_supply_cap = 3; -} -message MsgUpdateTokenSupplyCapResponse {} +message MsgUpdateClassResponse {} message MsgMintNFT { string sender = 1; string class_id = 2; - string nft_id = 3; - string recipient = 4; + string token_id = 3; + string uri = 4; + string uri_hash = 5; + string recipient = 6; } + message MsgMintNFTResponse {} message MsgBurnNFT { string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; } + message MsgBurnNFTResponse {} + +// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign +// adminship of a class to a new account +message MsgChangeAdmin { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; +} + +message MsgChangeAdminResponse {} + +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "sender"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Params params = 2 [(gogoproto.nullable) = false]; +} + +message MsgUpdateParamsResponse {} diff --git a/proto/ununifi/pricefeed/tx.proto b/proto/ununifi/pricefeed/tx.proto index 861d7565a..7d29d9f51 100644 --- a/proto/ununifi/pricefeed/tx.proto +++ b/proto/ununifi/pricefeed/tx.proto @@ -26,7 +26,6 @@ message MsgPostPrice { (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; - cosmos.base.v1beta1.Coin deposit = 5 [(gogoproto.nullable) = false]; } message MsgPostPriceResponse {} diff --git a/proto/ununifi/yieldaggregator/params.proto b/proto/ununifi/yieldaggregator/params.proto index f267f7dd7..6e809e594 100644 --- a/proto/ununifi/yieldaggregator/params.proto +++ b/proto/ununifi/yieldaggregator/params.proto @@ -7,15 +7,16 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/UnUniFi/chain/x/yieldaggregator/types"; -// Params defines the parameters for the module. message Params { - option (gogoproto.goproto_stringer) = false; - + // TODO: add deposit_commission_rate + // TODO: add reserve_annual_commission_rate + // TODO: rename to withdraw_commission_rate string commission_rate = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; cosmos.base.v1beta1.Coin vault_creation_fee = 2 [(gogoproto.nullable) = false]; cosmos.base.v1beta1.Coin vault_creation_deposit = 3 [(gogoproto.nullable) = false]; + string fee_collector_address = 4; } diff --git a/proto/ununifi/yieldaggregator/proposal.proto b/proto/ununifi/yieldaggregator/proposal.proto deleted file mode 100644 index 5ee78efeb..000000000 --- a/proto/ununifi/yieldaggregator/proposal.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package ununifi.yieldaggregator; - -import "gogoproto/gogo.proto"; -import "ununifi/yieldaggregator/params.proto"; - -option go_package = "github.com/UnUniFi/chain/x/yieldaggregator/types"; - -// proposal to add new strategy. -message ProposalAddStrategy { - string title = 1; - string description = 2; - string denom = 3; - string contract_address = 4; - string name = 5; - string git_url = 6; -} diff --git a/proto/ununifi/yieldaggregator/query.proto b/proto/ununifi/yieldaggregator/query.proto index 0912ac79b..8592e6108 100644 --- a/proto/ununifi/yieldaggregator/query.proto +++ b/proto/ununifi/yieldaggregator/query.proto @@ -110,11 +110,7 @@ message QueryGetStrategyResponse { message QueryEstimateMintAmountRequest { uint64 id = 1; - string deposit_amount = 2 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; + string deposit_amount = 2; } message QueryEstimateMintAmountResponse { @@ -123,11 +119,7 @@ message QueryEstimateMintAmountResponse { message QueryEstimateRedeemAmountRequest { uint64 id = 1; - string burn_amount = 2 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; + string burn_amount = 2; } message QueryEstimateRedeemAmountResponse { diff --git a/proto/ununifi/yieldaggregator/tx.proto b/proto/ununifi/yieldaggregator/tx.proto index e9f017f16..542f9b799 100644 --- a/proto/ununifi/yieldaggregator/tx.proto +++ b/proto/ununifi/yieldaggregator/tx.proto @@ -8,6 +8,7 @@ import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; import "ununifi/yieldaggregator/yieldaggregator.proto"; +import "ununifi/yieldaggregator/params.proto"; option go_package = "github.com/UnUniFi/chain/x/yieldaggregator/types"; @@ -17,8 +18,10 @@ service Msg { rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse); rpc WithdrawFromVault(MsgWithdrawFromVault) returns (MsgWithdrawFromVaultResponse); rpc CreateVault(MsgCreateVault) returns (MsgCreateVaultResponse); - rpc DeleteVault(MsgDeleteVault) returns (MsgDeleteVaultResponse); rpc TransferVaultOwnership(MsgTransferVaultOwnership) returns (MsgTransferVaultOwnershipResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc RegisterStrategy(MsgRegisterStrategy) returns (MsgRegisterStrategyResponse); + rpc DeleteVault(MsgDeleteVault) returns (MsgDeleteVaultResponse); } // this line is used by starport scaffolding # proto/tx/message @@ -45,7 +48,7 @@ message MsgWithdrawFromVault { uint64 vault_id = 2; string lp_token_amount = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -62,12 +65,12 @@ message MsgCreateVault { string denom = 2; string commission_rate = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string withdraw_reserve_rate = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; repeated StrategyWeight strategy_weights = 5 [(gogoproto.nullable) = false]; @@ -75,29 +78,58 @@ message MsgCreateVault { cosmos.base.v1beta1.Coin deposit = 7 [(gogoproto.nullable) = false]; } -message MsgCreateVaultResponse {} +message MsgCreateVaultResponse { + uint64 id = 1; +} -message MsgDeleteVault { +message MsgTransferVaultOwnership { option (cosmos.msg.v1.signer) = "sender"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - uint64 vault_id = 2; + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + uint64 vault_id = 2; + string recipient = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -message MsgDeleteVaultResponse {} +message MsgTransferVaultOwnershipResponse {} -message MsgTransferVaultOwnership { +message MsgUpdateParams { option (cosmos.msg.v1.signer) = "sender"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - uint64 vault_id = 2; - string recipient = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Params params = 2 [(gogoproto.nullable) = false]; } -message MsgTransferVaultOwnershipResponse {} +message MsgUpdateParamsResponse {} + +message MsgRegisterStrategy { + option (cosmos.msg.v1.signer) = "sender"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string denom = 2; + string contract_address = 3; + string name = 4; + string git_url = 5; +} + +message MsgRegisterStrategyResponse {} + +message MsgDeleteVault { + option (cosmos.msg.v1.signer) = "sender"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + uint64 vault_id = 2; +} + +message MsgDeleteVaultResponse {} diff --git a/proto/ununifi/yieldaggregator/yieldaggregator.proto b/proto/ununifi/yieldaggregator/yieldaggregator.proto index c0c1b622a..ce9a6fc77 100644 --- a/proto/ununifi/yieldaggregator/yieldaggregator.proto +++ b/proto/ununifi/yieldaggregator/yieldaggregator.proto @@ -11,7 +11,7 @@ message StrategyWeight { uint64 strategy_id = 1; string weight = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -23,12 +23,12 @@ message Vault { cosmos.base.v1beta1.Coin owner_deposit = 4 [(gogoproto.nullable) = false]; string withdraw_commission_rate = 5 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string withdraw_reserve_rate = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; repeated StrategyWeight strategy_weights = 7 [ @@ -43,29 +43,3 @@ message Strategy { string name = 4; string git_url = 5; } - -message VaultMetrics { - string allocation = 1 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string apy = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message StrategyMetrics { - string allocation = 1 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string apr = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} \ No newline at end of file diff --git a/scripts/commands/derivatives/msgs.sh b/scripts/commands/derivatives/msgs.sh index c509819d2..cb691c59b 100755 --- a/scripts/commands/derivatives/msgs.sh +++ b/scripts/commands/derivatives/msgs.sh @@ -32,6 +32,12 @@ $BINARY tx derivatives withdraw-from-pool 1 ubtc --from=$USER1 $conf | jq .raw_l $BINARY tx derivatives open-position perpetual-futures 100ubtc ubtc uusdc long --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g' $BINARY tx derivatives open-position perpetual-futures 100uusdc ubtc uusdc short --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g' +# add-margin +$BINARY tx derivatives add-margin 1 100ubtc --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g' + +# withdraw-margin +$BINARY tx derivatives withdraw-margin 1 100ubtc --from=$USER1 $conf | jq .raw_log | sed 's/\\n/\n/g' + # query positions $BINARY q derivatives positions $USER_ADDRESS_1 diff --git a/scripts/commands/derivatives/start.sh b/scripts/commands/derivatives/start.sh index 3e89268a0..d24fcdd68 100755 --- a/scripts/commands/derivatives/start.sh +++ b/scripts/commands/derivatives/start.sh @@ -52,7 +52,7 @@ jq '.app_state.derivatives.params.perpetual_futures.margin_maintenance_rate = "0 jq '.app_state.derivatives.params.perpetual_futures.imaginary_funding_rate_proportional_coefficient = "0.0005"' ~/.ununifi/config/genesis.json > temp.json ; mv temp.json ~/.ununifi/config/genesis.json; jq '.app_state.derivatives.params.perpetual_futures.markets = [{"base_denom": "ubtc", "quote_denom": "uusd" }]' ~/.ununifi/config/genesis.json > temp.json ; mv temp.json ~/.ununifi/config/genesis.json; -jq '.app_state.bank.denom_metadata = [{"base" : "ubtc" , "symbol": "ubtc"}, {"base" : "uusd", "symbol": "uusdc"}]' ~/.ununifi/config/genesis.json > temp.json ; mv temp.json ~/.ununifi/config/genesis.json; +jq '.app_state.bank.denom_metadata = [{"base" : "ubtc" , "symbol": "BTC"}, {"base" : "uusd", "symbol": "USDC"}]' ~/.ununifi/config/genesis.json > temp.json ; mv temp.json ~/.ununifi/config/genesis.json; # run pricefeed $SCRIPT_DIR/setup_pricefeed.sh diff --git a/scripts/commands/ecosystem-incentive/debug_ecosystem_incentive.sh b/scripts/commands/ecosystem-incentive/debug_ecosystem_incentive.sh index 9c40bc1d4..bd02fa5c6 100755 --- a/scripts/commands/ecosystem-incentive/debug_ecosystem_incentive.sh +++ b/scripts/commands/ecosystem-incentive/debug_ecosystem_incentive.sh @@ -18,19 +18,19 @@ sleep 5; ./ununifid tx ecosystem-incentive register --register-file ../scripts/commands/ecosystem-incentive/register.json --from validator --chain-id test -y --keyring-backend=test; sleep 5; # # to see if AfterNftUnlistedWithoutPayment hook method will be trigger -# ./ununifid tx nftmarket listing $CLASS_ID a10 --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y --broadcast-mode=block \ +# ./ununifid tx nftbackedloan listing $CLASS_ID a10 --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y --broadcast-mode=block \ # --note=""; # sleep 15; -# ./ununifid tx nftmarket cancel_listing $CLASS_ID a10 --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y --broadcast-mode=block; +# ./ununifid tx nftbackedloan cancel_listing $CLASS_ID a10 --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y --broadcast-mode=block; # to see if AfterNftPaymentWithCommission hook method will be triggered -./ununifid tx nftmarket listing $CLASS_ID a10 --min-minimum-deposit-rate=0.001 --bid-token=uguu --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y \ +./ununifid tx nftbackedloan listing $CLASS_ID a10 --min-deposit-rate=0.001 --bid-token=uguu --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y \ --note='{"version":"v1","incentive_unit_id":"incentive-unit-1"}'; sleep 5; -./ununifid tx nftmarket placebid $CLASS_ID a10 100000000uguu 100000uguu 0.01 100000 --automatic-payment=true --chain-id=test --from=debug --keyring-backend=test --gas=300000 -y; +./ununifid tx nftbackedloan placebid $CLASS_ID a10 100000000uguu 100000uguu 0.01 100000 --automatic-payment=true --chain-id=test --from=debug --keyring-backend=test --gas=300000 -y; sleep 5; -./ununifid tx nftmarket selling_decision $CLASS_ID a10 --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y; +./ununifid tx nftbackedloan selling_decision $CLASS_ID a10 --chain-id=test --from=validator --keyring-backend=test --gas=300000 -y; sleep 5; # expect accumulating rewards diff --git a/scripts/commands/nftmarket_v2.sh b/scripts/commands/nftmarket_v2.sh index 055239537..5040ad2a1 100755 --- a/scripts/commands/nftmarket_v2.sh +++ b/scripts/commands/nftmarket_v2.sh @@ -3,62 +3,62 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd) . $SCRIPT_DIR/../setup/variables.sh -$BINARY tx nftmarket mint a10 a10 uri 888838 --home $CHAIN_DIR/$CHAINID_1 --from=$VAL1 $conf| jq .; -$BINARY tx nftmarket mint a10 a11 uri 888838 --home $CHAIN_DIR/$CHAINID_1 --from=$VAL1 $conf| jq .; +$BINARY tx nftbackedloan mint a10 a10 uri 888838 --home $CHAIN_DIR/$CHAINID_1 --from=$VAL1 $conf| jq .; +$BINARY tx nftbackedloan mint a10 a11 uri 888838 --home $CHAIN_DIR/$CHAINID_1 --from=$VAL1 $conf| jq .; # auto-refinancing -$BINARY tx nftmarket listing a10 a10 --min-minimum-deposit-rate 0.01 --bid-token uguu -r --from $VAL1 $conf| jq . ; +$BINARY tx nftbackedloan listing a10 a10 --min-deposit-rate 0.01 --bid-token uguu -r --from $VAL1 $conf| jq . ; # not auto-refinancing -# ununifid tx nftmarket listing a10 a10 --min-minimum-deposit-rate 0.1 --bid-token uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; -$BINARY tx nftmarket listing a10 a11 --min-minimum-deposit-rate 0.1 --bid-token uguu --from $VAL1 $conf| jq . ; +# ununifid tx nftbackedloan listing a10 a10 --min-deposit-rate 0.1 --bid-token uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; +$BINARY tx nftbackedloan listing a10 a11 --min-deposit-rate 0.1 --bid-token uguu --from $VAL1 $conf| jq . ; -# ununifid tx nftmarket placebid a10 a10 100uguu 80uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; -# ununifid tx nftmarket placebid a10 a10 100uguu 1uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +# ununifid tx nftbackedloan placebid a10 a10 100uguu 80uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +# ununifid tx nftbackedloan placebid a10 a10 100uguu 1uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; -# ununifid tx nftmarket placebid a10 a10 100uguu 60uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; -$BINARY tx nftmarket placebid a10 a10 100uguu 50uguu 0.1 10000000000 --from $USER1 $conf| jq .; -# ununifid tx nftmarket placebid a10 a10 102uguu 20uguu 0.3 12000000 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; -ununifid tx nftmarket placebid a10 a10 103uguu 2uguu 0.2 12000000 --from $USER3 $conf| jq .; +# ununifid tx nftbackedloan placebid a10 a10 100uguu 60uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +$BINARY tx nftbackedloan placebid a10 a10 100uguu 50uguu 0.1 10000000000 --from $USER1 $conf| jq .; +# ununifid tx nftbackedloan placebid a10 a10 102uguu 20uguu 0.3 12000000 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +ununifid tx nftbackedloan placebid a10 a10 103uguu 2uguu 0.2 12000000 --from $USER3 $conf| jq .; # not automatic payment -ununifid tx nftmarket placebid a10 a10 102uguu 20uguu 0.3 12000000 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block | jq .; +ununifid tx nftbackedloan placebid a10 a10 102uguu 20uguu 0.3 12000000 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block | jq .; -# ununifid tx nftmarket placebid a10 a11 100uguu 50uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; -# ununifid tx nftmarket placebid a10 a11 100uguu 52uguu 0.2 120 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; -# ununifid tx nftmarket placebid a10 a11 100uguu 51uguu 0.2 120 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER3 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +# ununifid tx nftbackedloan placebid a10 a11 100uguu 50uguu 0.1 20 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER1 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +# ununifid tx nftbackedloan placebid a10 a11 100uguu 52uguu 0.2 120 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; +# ununifid tx nftbackedloan placebid a10 a11 100uguu 51uguu 0.2 120 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER3 --keyring-backend test --gas 300000 -y --broadcast-mode=block --automatic-payment| jq .; # normal borrowing -ununifid tx nftmarket borrow a10 a10 72uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; -# ununifid tx nftmarket borrow a10 a10 150uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; -# ununifid tx nftmarket borrow a10 a10 130uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; +ununifid tx nftbackedloan borrow a10 a10 72uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; +# ununifid tx nftbackedloan borrow a10 a10 150uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; +# ununifid tx nftbackedloan borrow a10 a10 130uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; # borrowing twice -# ununifid tx nftmarket borrow a10 a10 10uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; +# ununifid tx nftbackedloan borrow a10 a10 10uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; # try over borrowing -# ununifid tx nftmarket borrow a10 a10 230uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; +# ununifid tx nftbackedloan borrow a10 a10 230uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from=$VAL1 --keyring-backend test --gas 300000 -y --broadcast-mode=block| jq .; -# ununifid q nftmarket liquidation a10 a10 +# ununifid q nftbackedloan liquidation a10 a10 # cancel bid ## can cancelbid -# ununifid tx nftmarket cancelbid a10 a10 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block | jq .; +# ununifid tx nftbackedloan cancelbid a10 a10 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER2 --keyring-backend test --gas 300000 -y --broadcast-mode=block | jq .; ## can't cancelbid -# ununifid tx nftmarket cancelbid a10 a10 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER3 --keyring-backend test --gas 300000 -y --broadcast-mode=block | jq .; +# ununifid tx nftbackedloan cancelbid a10 a10 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $USER3 --keyring-backend test --gas 300000 -y --broadcast-mode=block | jq .; -# ununifid tx nftmarket selling_decision a10 a10 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; +# ununifid tx nftbackedloan selling_decision a10 a10 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; # cancel listing -# ununifid tx nftmarket cancel_listing a10 a11 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --keyring-backend test --from=$VAL1 --gas=300000 -y --broadcast-mode=block| jq .; +# ununifid tx nftbackedloan cancel_listing a10 a11 --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --keyring-backend test --from=$VAL1 --gas=300000 -y --broadcast-mode=block| jq .; # repay -# ununifid tx nftmarket repay a10 a10 10uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; +# ununifid tx nftbackedloan repay a10 a10 10uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; -watch ununifid q nftmarket nft_bids a10 a10 +watch ununifid q nftbackedloan nft_bids a10 a10 # sleep 5 -# ununifid tx nftmarket repay a10 a10 50uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; +# ununifid tx nftbackedloan repay a10 a10 50uguu --home $CHAIN_DIR/$CHAINID_1 --chain-id $CHAINID_1 --from $VAL1 --keyring-backend test --gas 300000 -y| jq . ; # watch ununifid q bank balances $USER_ADDRESS_1 \ No newline at end of file diff --git a/scripts/commands/nftmint.sh b/scripts/commands/nftmint.sh index 57c58d8cc..4ab29beec 100755 --- a/scripts/commands/nftmint.sh +++ b/scripts/commands/nftmint.sh @@ -23,17 +23,17 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd) # create class and get the class id # ununifid tx nftmint create-class Test[ClassName] ipfs://testcid/[BaseTokenUri] 1000[TokenSupplyCap] 0[MintingPermission] --from debug --chain-id test" # onlyOwner can create nft -$BINARY tx nftmint create-class Test ipfs://testcid/ 100000 0 --from $USER1 $conf +$BINARY tx nftfactory create-class Test-onlyOwner ipfs://testcid/ 100000 0 --from $USER1 $conf # everyone can create nft -$BINARY tx nftmint create-class Test ipfs://testcid/ 100000 1 --from $USER1 $conf +$BINARY tx nftfactory create-class Test-everyone ipfs://testcid/ 100000 1 --from $USER1 $conf CLASS_ID_ONLYOWNER=$(ununifid q nftmint class-ids-by-owner $USER_ADDRESS_1 --output json |jq .owning_class_id_list.class_id[0] |sed -e 's/\"//g') CLASS_ID_EVERYONE=$(ununifid q nftmint class-ids-by-owner $USER_ADDRESS_1 --output json |jq .owning_class_id_list.class_id[1] |sed -e 's/\"//g') ## NOTE: $CLASS_ID returns "class_id" that returns error against below messages. ## Just try redefine CLASS_ID with simple text or just replace once you get the class_id. ## If you know the solution for this, please let me know or just commit and push. # mint nft -$BINARY tx nftmint mint-nft $CLASS_ID_ONLYOWNER a00 $USER_ADDRESS_1 --from $USER1 --chain-id test -y -$BINARY tx nftmint mint-nft $CLASS_ID_EVERYONE a00 $USER_ADDRESS_1 --from $USER1 --chain-id test -y +$BINARY tx nftfactory mint-nft $CLASS_ID_ONLYOWNER a00 $USER_ADDRESS_1 --from $USER1 --chain-id test -y +$BINARY tx nftfactory mint-nft $CLASS_ID_EVERYONE a00 $USER_ADDRESS_1 --from $USER1 --chain-id test -y # # burn nft # $BINARY tx nftmint burn-nft $CLASS_ID a00 --from debug --chain-id test -y diff --git a/scripts/setup/init.sh b/scripts/setup/init.sh index 46bc2912d..55a4d4c88 100755 --- a/scripts/setup/init.sh +++ b/scripts/setup/init.sh @@ -81,13 +81,13 @@ jq '.app_state.derivatives.params.pool_params.base_lpt_redeem_fee = "0.001"' $NO jq '.app_state.derivatives.params.pool_params.report_liquidation_reward_rate = "0.3"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.derivatives.params.pool_params.report_levy_period_reward_rate = "0.3"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.derivatives.params.pool_params.accepted_assets_conf = [{"denom":"ubtc", "target_weight": "0.6"}, {"denom":"uusdc", "target_weight":"0.4"}]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; -jq '.app_state.derivatives.params.perpetual_futures.commission_rate = "0.001"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; +jq '.app_state.derivatives.params.pool_params.levy_period_required_seconds = "28800"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.derivatives.params.perpetual_futures.margin_maintenance_rate = "0.5"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.derivatives.params.perpetual_futures.imaginary_funding_rate_proportional_coefficient = "0.0005"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.derivatives.params.perpetual_futures.markets = [{"base_denom": "ubtc", "quote_denom": "uusdc" }]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.bank.denom_metadata = [ - {"base" : "ubtc" , "symbol": "ubtc"}, - {"base" : "uusdc", "symbol": "uusdc"} + {"base" : "ubtc" , "symbol": "BTC"}, + {"base" : "uusdc", "symbol": "USDC"} ]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.pricefeed.posted_prices = [ {"expiry": "2024-02-20T12:02:01Z","market_id": "ubtc:usd","oracle_address": "ununifi1h7ulktk5p2gt7tnxwhqzlq0yegq47hum0fahcr","price": "0.024508410211260500"}, @@ -101,22 +101,32 @@ jq '.app_state.pricefeed.posted_prices = [ # ununifid start --home=$NODE_HOME # for nftmint -jq '.app_state.nftmint.class_attributes_list = [ - { - "base_token_uri": "ipfs://testcid/", - "class_id": "ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3", - "minting_permission": "Anyone", - "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - "token_supply_cap": "100000" - }, - { - "base_token_uri": "ipfs://testcid/", - "class_id": "ununifi-D4AC8DBC54261BB1B6ACBBF721A60D131A048F83", - "minting_permission": "OnlyOwner", - "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - "token_supply_cap": "100000" - } -]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; +jq '.app_state.nftfactory.params.class_creation_fee = []' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; +jq '.app_state.nftfactory.params.fee_collector_address = ""' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; + +# jq '.app_state.nftfactory.class_attributes_list = [ +# { +# "base_token_uri": "ipfs://testcid/", +# "class_id": "ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3", +# "minting_permission": "Anyone", +# "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", +# "token_supply_cap": "100000" +# }, +# { +# "base_token_uri": "ipfs://testcid/", +# "class_id": "ununifi-D4AC8DBC54261BB1B6ACBBF721A60D131A048F83", +# "minting_permission": "OnlyOwner", +# "owner": "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", +# "token_supply_cap": "100000" +# }, +# { +# "base_token_uri": "ipfs://testcid/", +# "class_id": "derivatives/perpetual_futures/positions", +# "minting_permission": "OnlyOwner", +# "owner": "ununifi1j0ugkvzyjdlyhkeje27fexlwurv6xezdmpxm68", +# "token_supply_cap": "100000" +# } +# ]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.nft.classes = [ { "data": null, @@ -135,6 +145,15 @@ jq '.app_state.nft.classes = [ "symbol": "", "uri": "", "uri_hash": "" + }, + { + "data": null, + "description": "", + "id": "derivatives/perpetual_futures/positions", + "name": "derivatives/perpetual_futures/positions", + "symbol": "", + "uri": "", + "uri_hash": "" } ]' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; @@ -143,7 +162,7 @@ jq '.app_state.stakeibc.params.deposit_interval = "1"' $NODE_HOME/config/genesis jq '.app_state.stakeibc.params.delegate_interval = "1"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.stakeibc.params.rewards_interval = "1"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.stakeibc.params.redemption_rate_interval = "1"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; -jq '.app_state.stakeibc.params.stride_commission = "10"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; +jq '.app_state.stakeibc.params.ununifi_commission = "1"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.stakeibc.params.reinvest_interval = "1"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.stakeibc.params.validator_rebalancing_threshold = "100"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; jq '.app_state.stakeibc.params.ica_timeout_nanos = "600000000000"' $NODE_HOME/config/genesis.json > temp.json ; mv temp.json $NODE_HOME/config/genesis.json; diff --git a/testutil/keeper/derivatives.go b/testutil/keeper/derivatives.go new file mode 100644 index 000000000..17f4051da --- /dev/null +++ b/testutil/keeper/derivatives.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "testing" + + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/stretchr/testify/require" + + "github.com/UnUniFi/chain/x/derivatives/keeper" + "github.com/UnUniFi/chain/x/derivatives/types" +) + +func DerivativesKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := sdk.NewKVStoreKey(types.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + + paramsSubspace := typesparams.NewSubspace(cdc, + types.Amino, + storeKey, + memStoreKey, + "LoanParams", + ) + k := keeper.NewKeeper( + cdc, + storeKey, + memStoreKey, + paramsSubspace, + nil, + nil, + nil, + nil, + ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/utils/utils.go b/utils/utils.go index 81c4ea639..0c28d0f54 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -12,7 +12,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) func FilterDepositRecords(arr []recordstypes.DepositRecord, condition func(recordstypes.DepositRecord) bool) (ret []recordstypes.DepositRecord) { diff --git a/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go new file mode 100644 index 000000000..bb9f1a78e --- /dev/null +++ b/wasmbinding/bindings/msg.go @@ -0,0 +1,17 @@ +package bindings + +import ( + wasmvmtypes "github.com/CosmWasm/wasmvm/types" +) + +type UnunifiMsg struct { + SubmitICQRequest *SubmitICQRequest `json:"submit_i_c_q_request,omitempty"` + IBCTransfer *wasmvmtypes.TransferMsg `json:"ibc_transfer,omitempty"` +} + +type SubmitICQRequest struct { + ConnectionId string `json:"connection_id"` + ChainId string `json:"chain_id"` + QueryPrefix string `json:"query_prefix"` + QueryKey []byte `json:"query_key"` +} diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go new file mode 100644 index 000000000..7574288ed --- /dev/null +++ b/wasmbinding/bindings/query.go @@ -0,0 +1,4 @@ +package bindings + +type UnunifiQuery struct { +} diff --git a/wasmbinding/message_plugin.go b/wasmbinding/message_plugin.go new file mode 100644 index 000000000..37c3de09b --- /dev/null +++ b/wasmbinding/message_plugin.go @@ -0,0 +1,124 @@ +package wasmbinding + +import ( + "encoding/json" + "time" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + + "github.com/UnUniFi/chain/wasmbinding/bindings" + icqkeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/keeper" + interchainquerytypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + recordskeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" +) + +// CustomMessageDecorator returns decorator for custom CosmWasm bindings messages +func CustomMessageDecorator(bank *bankkeeper.BaseKeeper, icqKeeper *icqkeeper.Keeper, recordsKeeper *recordskeeper.Keeper) func(wasmkeeper.Messenger) wasmkeeper.Messenger { + return func(old wasmkeeper.Messenger) wasmkeeper.Messenger { + return &CustomMessenger{ + wrapped: old, + bank: bank, + icqKeeper: icqKeeper, + recordsKeeper: recordsKeeper, + } + } +} + +type CustomMessenger struct { + wrapped wasmkeeper.Messenger + bank *bankkeeper.BaseKeeper + icqKeeper *icqkeeper.Keeper + recordsKeeper *recordskeeper.Keeper +} + +var _ wasmkeeper.Messenger = (*CustomMessenger)(nil) + +// DispatchMsg executes on the contractMsg. +func (m *CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error) { + if msg.Custom != nil { + var contractMsg bindings.UnunifiMsg + if err := json.Unmarshal(msg.Custom, &contractMsg); err != nil { + return nil, nil, sdkerrors.Wrap(err, "ununifi msg") + } + if contractMsg.SubmitICQRequest != nil { + return m.submitICQRequest(ctx, contractAddr, contractMsg.SubmitICQRequest) + } + if contractMsg.IBCTransfer != nil { + return m.ibcTransfer(ctx, contractAddr, contractMsg.IBCTransfer) + } + } + return m.wrapped.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) +} + +func (m *CustomMessenger) submitICQRequest(ctx sdk.Context, contractAddr sdk.AccAddress, submitICQRequest *bindings.SubmitICQRequest) ([]sdk.Event, [][]byte, error) { + err := PerformSubmitICQRequest(m.icqKeeper, m.bank, ctx, contractAddr, submitICQRequest) + if err != nil { + return nil, nil, sdkerrors.Wrap(err, "perform icq request submission") + } + return nil, nil, nil +} + +func PerformSubmitICQRequest(f *icqkeeper.Keeper, b *bankkeeper.BaseKeeper, ctx sdk.Context, contractAddr sdk.AccAddress, submitICQRequest *bindings.SubmitICQRequest) error { + if submitICQRequest == nil { + return wasmvmtypes.InvalidRequest{Err: "icq request empty"} + } + + ttl := ctx.BlockTime().Add(time.Hour*504).Unix() * time.Second.Nanoseconds() // 3 weeks + err := f.MakeRequest( + ctx, + submitICQRequest.ConnectionId, + submitICQRequest.ChainId, + submitICQRequest.QueryPrefix, + submitICQRequest.QueryKey, + sdk.NewInt(-1), + interchainquerytypes.ModuleName, + contractAddr.String(), // set contract address on callback id + uint64(ttl), // ttl + 0, // height always 0 (which means current height) + ) + if err != nil { + return sdkerrors.Wrap(err, "creating icq request") + } + return nil +} + +func (m *CustomMessenger) ibcTransfer(ctx sdk.Context, contractAddr sdk.AccAddress, ibcTransfer *wasmvmtypes.TransferMsg) ([]sdk.Event, [][]byte, error) { + err := PerformIBCTransfer(m.recordsKeeper, ctx, contractAddr, ibcTransfer) + if err != nil { + return nil, nil, sdkerrors.Wrap(err, "perform ibc transfer") + } + return nil, nil, nil +} + +func PerformIBCTransfer(f *recordskeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, ibcTransfer *wasmvmtypes.TransferMsg) error { + if ibcTransfer == nil { + return wasmvmtypes.InvalidRequest{Err: "icq request empty"} + } + + amount, err := wasmkeeper.ConvertWasmCoinToSdkCoin(ibcTransfer.Amount) + if err != nil { + return err + } + + err = f.ContractTransfer( + ctx, + &ibctransfertypes.MsgTransfer{ + SourcePort: "transfer", + SourceChannel: ibcTransfer.ChannelID, + Token: amount, + Sender: contractAddr.String(), + Receiver: ibcTransfer.ToAddress, + TimeoutHeight: wasmkeeper.ConvertWasmIBCTimeoutHeightToCosmosHeight(ibcTransfer.Timeout.Block), + TimeoutTimestamp: ibcTransfer.Timeout.Timestamp, + }) + if err != nil { + return sdkerrors.Wrap(err, "sending ibc transfer") + } + return nil +} diff --git a/wasmbinding/queries.go b/wasmbinding/queries.go new file mode 100644 index 000000000..ebc548596 --- /dev/null +++ b/wasmbinding/queries.go @@ -0,0 +1,9 @@ +package wasmbinding + +type QueryPlugin struct { +} + +// NewQueryPlugin returns a reference to a new QueryPlugin. +func NewQueryPlugin() *QueryPlugin { + return &QueryPlugin{} +} diff --git a/wasmbinding/query_plugin.go b/wasmbinding/query_plugin.go new file mode 100644 index 000000000..ce54d5e3b --- /dev/null +++ b/wasmbinding/query_plugin.go @@ -0,0 +1,66 @@ +package wasmbinding + +import ( + "encoding/json" + + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/wasmbinding/bindings" +) + +// CustomQuerier dispatches custom CosmWasm bindings queries. +func CustomQuerier(qp *QueryPlugin) func(ctx sdk.Context, request json.RawMessage) ([]byte, error) { + return func(ctx sdk.Context, request json.RawMessage) ([]byte, error) { + var contractQuery bindings.UnunifiQuery + if err := json.Unmarshal(request, &contractQuery); err != nil { + return nil, sdkerrors.Wrap(err, "ununifi query") + } + + switch { + default: + return nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown ununifi query variant"} + } + } +} + +// ConvertProtoToJsonMarshal unmarshals the given bytes into a proto message and then marshals it to json. +// This is done so that clients calling stargate queries do not need to define their own proto unmarshalers, +// being able to use response directly by json marshalling, which is supported in cosmwasm. +func ConvertProtoToJSONMarshal(protoResponseType codec.ProtoMarshaler, bz []byte, cdc codec.Codec) ([]byte, error) { + // unmarshal binary into stargate response data structure + err := cdc.Unmarshal(bz, protoResponseType) + if err != nil { + return nil, wasmvmtypes.Unknown{} + } + + bz, err = cdc.MarshalJSON(protoResponseType) + if err != nil { + return nil, wasmvmtypes.Unknown{} + } + + protoResponseType.Reset() + + return bz, nil +} + +// ConvertSdkCoinsToWasmCoins converts sdk type coins to wasm vm type coins +func ConvertSdkCoinsToWasmCoins(coins []sdk.Coin) wasmvmtypes.Coins { + var toSend wasmvmtypes.Coins + for _, coin := range coins { + c := ConvertSdkCoinToWasmCoin(coin) + toSend = append(toSend, c) + } + return toSend +} + +// ConvertSdkCoinToWasmCoin converts a sdk type coin to a wasm vm type coin +func ConvertSdkCoinToWasmCoin(coin sdk.Coin) wasmvmtypes.Coin { + return wasmvmtypes.Coin{ + Denom: coin.Denom, + // Note: gamm tokens have 18 decimal places, so 10^22 is common, no longer in u64 range + Amount: coin.Amount.String(), + } +} diff --git a/wasmbinding/wasm.go b/wasmbinding/wasm.go new file mode 100644 index 000000000..f8fbce59e --- /dev/null +++ b/wasmbinding/wasm.go @@ -0,0 +1,31 @@ +package wasmbinding + +import ( + "github.com/CosmWasm/wasmd/x/wasm" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + + interchainquerykeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/keeper" + recordskeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" +) + +func RegisterCustomPlugins( + bank *bankkeeper.BaseKeeper, + icqKeeper *interchainquerykeeper.Keeper, + recordsKeeper *recordskeeper.Keeper, +) []wasmkeeper.Option { + wasmQueryPlugin := NewQueryPlugin() + + queryPluginOpt := wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ + Custom: CustomQuerier(wasmQueryPlugin), + }) + messengerDecoratorOpt := wasmkeeper.WithMessageHandlerDecorator( + CustomMessageDecorator(bank, icqKeeper, recordsKeeper), + ) + + return []wasm.Option{ + queryPluginOpt, + messengerDecoratorOpt, + } +} diff --git a/x/derivatives/LICENSE.md b/x/derivatives/LICENSE.md new file mode 100644 index 000000000..e2ad27d0d --- /dev/null +++ b/x/derivatives/LICENSE.md @@ -0,0 +1,102 @@ +Business Source License 1.1 + +License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. +"Business Source License" is a trademark of MariaDB Corporation Ab. + +----------------------------------------------------------------------------- + +Parameters + +Licensor: CAUCHYE ASIA PTE. LTD. + +Licensed Work: UnUniFi Core NFT Backed loan module + UnUniFi Core Interchain Yield Aggregator module + UnUniFi Core Derivatives module + The Licensed Work is (c) 2023 CAUCHYE ASIA PTE. LTD. + +Additional Use Grant: Non-commercial testnet building + Development of smart contracts that are integrated with the Licensed Work + Type definition files for developing interoperable modules or smart contracts that are integrated with the Licensed Work + +Change Date: The earlier of 2027-08-01 + +Change License: GNU General Public License v3.0 or later + +----------------------------------------------------------------------------- + +Terms + +The Licensor hereby grants you the right to copy, modify, create derivative +works, redistribute, and make non-production use of the Licensed Work. The +Licensor may make an Additional Use Grant, above, permitting limited +production use. + +Effective on the Change Date, or the fourth anniversary of the first publicly +available distribution of a specific version of the Licensed Work under this +License, whichever comes first, the Licensor hereby grants you rights under +the terms of the Change License, and the rights granted in the paragraph +above terminate. + +If your use of the Licensed Work does not comply with the requirements +currently in effect as described in this License, you must purchase a +commercial license from the Licensor, its affiliated entities, or authorized +resellers, or you must refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works +of the Licensed Work, are subject to this License. This License applies +separately for each version of the Licensed Work and the Change Date may vary +for each version of the Licensed Work released by Licensor. + +You must conspicuously display this License on each original or modified copy +of the Licensed Work. If you receive the Licensed Work in original or +modified form from a third party, the terms and conditions set forth in this +License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically +terminate your rights under this License for the current and all other +versions of the Licensed Work. + +This License does not grant you any right in any trademark or logo of +Licensor or its affiliates (provided that you may use a trademark or logo of +Licensor as expressly required by this License). + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +TITLE. + +MariaDB hereby grants you permission to use this License’s text to license +your works, and to refer to it using the trademark "Business Source License", +as long as you comply with the Covenants of Licensor below. + +----------------------------------------------------------------------------- + +Covenants of Licensor + +In consideration of the right to use this License’s text and the "Business +Source License" name and trademark, Licensor covenants to MariaDB, and to all +other recipients of the licensed work to be provided by Licensor: + +1. To specify as the Change License the GPL Version 2.0 or any later version, + or a license that is compatible with GPL Version 2.0 or a later version, + where "compatible" means that software provided under the Change License can + be included in a program with software provided under GPL Version 2.0 or a + later version. Licensor may specify additional Change Licenses without + limitation. + +2. To either: (a) specify an additional grant of rights to use that does not + impose any additional restriction on the right granted in this License, as + the Additional Use Grant; or (b) insert the text "None". + +3. To specify a Change Date. + +4. Not to modify this License in any other way. + +----------------------------------------------------------------------------- + +Notice + +The Business Source License (this document, or the "License") is not an Open +Source license. However, the Licensed Work will eventually be made available +under an Open Source License, as stated in this License. diff --git a/x/derivatives/README.md b/x/derivatives/README.md index 360216025..14b8e3199 100644 --- a/x/derivatives/README.md +++ b/x/derivatives/README.md @@ -1,6 +1,6 @@ -# DERIBATIVES +# DERIVATIVES -The `DERIBATIVES` module provides deriving functions +The `DERIVATIVES` module provides deriving functions ## Contents @@ -14,9 +14,9 @@ The `DERIBATIVES` module provides deriving functions ## Concepts The model of Perpetual Futures feature of this module totally follows GMX perpetual futures model. -(ref: https://gmxio.gitbook.io/gmx/) +(ref: ) -Briefly saying, the tradings on the perpetual futures market are supported by a unique multi-asset pool that earns liquidity prodicers fees from market making, swap fees and levrage trading. +Briefly saying, the tradings on the perpetual futures market are supported by a unique multi-asset pool that earns liquidity producers fees from market making, swap fees, and leverage trading. Because pool asset will take the counter part of the arbitral trade by a user, users can trade with high leverage and no slippage to the price from oracle with low fee. ## Pool @@ -57,15 +57,18 @@ There's no fee as the default settings for borrowing at this moment. But, it can ### Liquidation A position will be liquidated if the losses and fees reduce the margin to the point where: -`remaining_margin / (price * position_size / leverage) <= MarginMaintenanceRate` +`EffectiveMargin / (Rate * Price / Leverage) <= MarginMaintenanceRate` +`EffectiveMargin = MArgin + Profit (- Loss) - LevyPeriodFee` + MaintenanceMarginRate is defined as a parameter in the protocol. The default value of it is `0.5`. The values are all based on `QuoteTicker` of the protocol, in which the default value is `USD`. This is achieved through any user sending a `MsgReportLiquidation` tx. If the liquidation is needed, The reporter gets a portion of the commission fee based on the remaining margin. The remaining margin is then returned to the position owner after deducting a commission fee. -`commission_fee = remaining_margin * commission_rate` -The default value of `commission_rate` is `0.001`. +`Report Liquidation Fee = PositionSize * CommissionRate` +The default value of `CommissionRate` is `0.001`. +A portion of the fee is paid to the reporter. The default value of `ReportLiquidationRewardRate` is `0.3`. There's no penalty for reporting a position that is not needed to be liquidated. ### Levy Period @@ -73,12 +76,13 @@ There's no penalty for reporting a position that is not needed to be liquidated. Levy Period is set to reduce the imbalance in the positions of the entire market. If the Long positions are biased in the entire market, a imaginary funding fee will be deducted from the margin of the Long positions and added to the margin of the Short positions. At the same time, commission fees are also subtracted. -`imaginary_funding_fee = position_size * imaginary_funding_rate` -`imaginary_funding_rate = imaginary_funding_coefficient * net_position (long - short) / total_position (long + short)` +`ImaginaryFunding_fee = PositionSize * ImaginaryFundingRate` +`ImaginaryFundingRate = ImaginaryFundingCoefficient * NetPosition (long - short) / TotalPosition (long + short)` The default value of `imaginary_funding_coefficient` is `0.0005`. The calculation method for a commission fee is the same as that for the Liquidation. +The default value of `ReportLevyPeriodRewardRate` is `0.3`. From the perspective of economics, it can be expressed that this model unifies the conventional funding rate and the time cost of waiting for matchmaking to the imaginary funding rate. @@ -101,8 +105,8 @@ Price data is treated in this form: ```go type CurrentPrice struct { - MarketId string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty" yaml:"market_id"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price" yaml:"price"` + MarketId string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty" yaml:"market_id"` + Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price" yaml:"price"` } ``` @@ -121,17 +125,23 @@ message GenesisState { `GenesisState` is the data structure of the genesis state of the derivatives module. It contains the following fields: `params`, `positions`, `pool_market_cap` and `perpetual_futures_gross_position_of_market`. -These fields are made to be able to start the network from aribitrary genesis state. +These fields are made to be able to start the network from an arbitrary genesis state. ### Params -Go to [05_params](https://github.com/UnUniFi/chain/blob/newDevelop/proto/derivatives/params.proto) page. +Go to [05_params](https://github.com/UnUniFi/chain/blob/main/proto/derivatives/params.proto) page. ## Position `Position` field is for the complete data of the all opening position. ```protobuf +enum PositionType { + POSITION_UNKNOWN = 0; + LONG = 1; + SHORT = 2; +} + message Position { string id = 1 [ (gogoproto.moretags) = "yaml:\"id\"" @@ -153,24 +163,42 @@ message Position { uint64 opened_height = 5 [ (gogoproto.moretags) = "yaml:\"opened_height\"" ]; - string opened_rate = 6 [ - (gogoproto.moretags) = "yaml:\"opened_rate\"", + string opened_base_rate = 6 [ + (gogoproto.moretags) = "yaml:\"opened_base_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string opened_quote_rate = 7 [ + (gogoproto.moretags) = "yaml:\"opened_quote_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + cosmos.base.v1beta1.Coin remaining_margin = 8 [ + (gogoproto.moretags) = "yaml:\"remaining_margin\"", + (gogoproto.nullable) = false + ]; cosmos.base.v1beta1.Coin remaining_margin = 7 [ (gogoproto.moretags) = "yaml:\"remaining_margin\"", (gogoproto.nullable) = false ]; - google.protobuf.Timestamp last_levied_at = 8 [ + cosmos.base.v1beta1.Coin levied_amount = 9 [ + (gogoproto.moretags) = "yaml:\"levied_amount\"", + (gogoproto.nullable) = false + ]; + bool levied_amount_negative = 10 [ + (gogoproto.moretags) = "yaml:\"levied_amount_negative\"", + (gogoproto.nullable) = false + ]; + google.protobuf.Timestamp last_levied_at = 11 [ (gogoproto.moretags) = "yaml:\"last_levied_at\"", (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; - google.protobuf.Any position_instance = 9 [ + google.protobuf.Any position_instance = 12 [ (gogoproto.moretags) = "yaml:\"position_instance\"", (gogoproto.nullable) = false ]; + } ``` @@ -179,10 +207,25 @@ message Position { - `address` is the address of the position owner. - `opened_at` is the timestamp of the position opening. - `opened_height` is the block height of the position opening. -- `opened_rate` is the price rate of the trading pair at the opening. +- `opened_base_rate` is the price rate of the base denom at the opening. +- `opened_quote_rate` is the price rate of the quote denom at the opening. - `remaining_margin` is the remaining margin for the position. -- `last_levied_at` is the timestamp of the last levied time. -- `position_instance` is the `Any` type which contains the actual position data. If it's about perpetual futures, it contains `PositionType`, `Size_`, `SizeInMicro` and `Leverage` fields. +- `levied_amount` is the total of the Levy Period fees, plus the ReportLiquidation fee, if liquidated. +- `levied_amount_negative` is levied_amount is negative or not. Basically true, but false depending on LevyPeriod position bias. +- `last_levied_at` is the timestamp of the last levied time. Initialized to BlockTime when the position is opened +- `position_instance` is the `Any` type which contains the actual position data. If it's about perpetual futures, it contains `PositionType`, `Size_`, and `Leverage` fields. + +```protobuf +message PerpetualFuturesPositionInstance { + PositionType position_type = 1 [(gogoproto.moretags) = "yaml:\"position_type\""]; + string size = 2 [ + (gogoproto.moretags) = "yaml:\"size\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + uint32 leverage = 3 [(gogoproto.moretags) = "yaml:\"leverage\""]; +} +``` ## PoolMarketCap @@ -190,7 +233,7 @@ message Position { ```proto message PoolMarketCap { - message Breakdown { + message AssetInfo { string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; @@ -204,6 +247,11 @@ message PoolMarketCap { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + string reserved = 4 [ + (gogoproto.moretags) = "yaml:\"reserved\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; } string quote_ticker = 1 [ @@ -214,8 +262,8 @@ message PoolMarketCap { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - repeated Breakdown breakdown = 3 [ - (gogoproto.moretags) = "yaml:\"breakdown\"", + repeated AssetInfo asset_info = 3 [ + (gogoproto.moretags) = "yaml:\"asset_info\"", (gogoproto.nullable) = false ]; } @@ -223,36 +271,31 @@ message PoolMarketCap { - `quote_ticker` is the ticker of the key currency for the root value. - `total` is the total value of the all pool assets combined. -- `breakdown` is the list of the `Breakdown` which contains the information regarding the specific pool asset. +- `asset_info` is the list of the information regarding the specific pool asset. ## PerpetualFuturesGrossPositionOfMarket `PerpetualFuturesGrossPositionOfMarket` is the data which contains the inclusive information regarding x/derivatives's PerpetualFutures market. ```protobuf -message PerpetualFuturesPositionInstance { - PositionType position_type = 1 [ - (gogoproto.moretags) = "yaml:\"position_type\"" - ]; - string size = 2 [ - (gogoproto.moretags) = "yaml:\"size\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - // Use micro level size in the backend logic to be consistent with the scale of the coin amount - // and price information. - string size_in_micro = 3 [ - (gogoproto.moretags) = "yaml:\"size_in_micro\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" - ]; - uint32 leverage = 4 [ - (gogoproto.moretags) = "yaml:\"leverage\"" +message PerpetualFuturesGrossPositionOfMarket { + Market market = 1 [(gogoproto.moretags) = "yaml:\"market\"", (gogoproto.nullable) = false]; + PositionType position_type = 2 [(gogoproto.moretags) = "yaml:\"position_type\""]; + string position_size_in_denom_exponent = 3 [ + (gogoproto.moretags) = "yaml:\"position_size_in_denom_exponent\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false ]; } ``` -- `market` is the `Market` representive. `Market` itself is the information of the trading pair. -- `position_size` is the total net position size of the market. It tries to define the total cap of the opening position of the market. +- `market` is the information of the trading pair. +- `position_type` is the position type. LONG or SHORT. +- `position_size_in_denom_exponent` is the gross position size of the market. + +NetPosition and TotalPosition are calculated using these gross positions. +`NetPosition = GrossPosition(LONG) - GrossPosition(SHORT)` +`TotalPosition = GrossPosition(LONG) + GrossPosition(SHORT)` ## Reserve @@ -329,40 +372,40 @@ type Keeper interface { ### Messages -#### MintLiquidityProviderToken +#### DepositToPool -[MintLiquidityProviderToken](https://github.com/UnUniFi/chain/blob/caf28770588ef1370f5ca8d58e9b17e2b131064b/proto/derivatives/tx.proto#L22-L32) +[DepositToPool](https://github.com/UnUniFi/chain/blob/main/proto/ununifi/derivatives/tx.proto) -Mint liquidity provider token `DLP` by providing the acceptable asset into the pool. +MsgDepositToPool deposits tokens into the pool and mint liquidity provider token `DLP`. The token's price is determined by the worth of all tokens within the pool and factoring in the profits and losses of all currently opened positions. Hence, the `DLP` amount of being minted is determined at the time of minting. Fee is charged based on the defined static param. -#### BurnLiquidityProviderToken +#### WithdrawFromPool -[BurnLiquidityProviderToken](https://github.com/UnUniFi/chain/blob/caf28770588ef1370f5ca8d58e9b17e2b131064b/proto/derivatives/tx.proto#L36-L50) +[MsgWithdrawFromPool](https://github.com/UnUniFi/chain/blob/main/proto/ununifi/derivatives/tx.proto) -Burn liquidity provider token `DLP` to the arbitrary acceptable token. +MsgWithdrawFromPool withdraws tokens from the pool and burn liquidity provider token `DLP`. Fee is charged based on the defined static param. #### OpenPosition -[OpenPosition](https://github.com/UnUniFi/chain/blob/caf28770588ef1370f5ca8d58e9b17e2b131064b/proto/derivatives/tx.proto#L54-L72) +[MsgOpenPosition](https://github.com/UnUniFi/chain/blob/main/proto/ununifi/derivatives/tx.proto) Open a perpetual futures position. -User defines the trading pair, long/short, position size and levarage rate. +User defines the trading pair, long/short, position size and leverage rate. The maximum position size is limited by the amount of the corresponding token in the pool. User cannot take a position that is larger than the pool size. #### ClosePosition -[ClosePosition](https://github.com/UnUniFi/chain/blob/caf28770588ef1370f5ca8d58e9b17e2b131064b/proto/derivatives/tx.proto#L76-L85) +[MsgClosePosition](https://github.com/UnUniFi/chain/blob/main/proto/ununifi/derivatives/tx.proto) Close a whole position by defining a unique position id. Only the owner of the position can close it. If the position has profit, the profit will be distributed in the same token of the position margin. #### ReportLiquidation -[ReportLiquidation](https://github.com/UnUniFi/chain/blob/caf28770588ef1370f5ca8d58e9b17e2b131064b/proto/derivatives/tx.proto#L89-L103) +[MsgReportLiquidation](https://github.com/UnUniFi/chain/blob/main/proto/ununifi/derivatives/tx.proto) Report a position for which the margin maintenance ratio is below a certain level and need to be liquidated. If a liquidation is made, the reporter gets a portion of the commission fee as a reward. @@ -418,18 +461,18 @@ message Params { ### PoolParams ```proto -message PoolParams { - message Asset { - string denom = 1 [ - (gogoproto.moretags) = "yaml:\"denom\"" - ]; - string target_weight = 2 [ - (gogoproto.moretags) = "yaml:\"target_weight\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - } +message PoolAssetConf { + string denom = 1 [ + (gogoproto.moretags) = "yaml:\"denom\"" + ]; + string target_weight = 2 [ + (gogoproto.moretags) = "yaml:\"target_weight\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} +message PoolParams { string quote_ticker = 1 [ (gogoproto.moretags) = "yaml:\"quote_ticker\"" ]; @@ -458,8 +501,9 @@ message PoolParams { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - repeated Asset accepted_assets = 7 [ - (gogoproto.moretags) = "yaml:\"accepted_assets\"" + repeated PoolAssetConf accepted_assets_conf = 7 [ + (gogoproto.moretags) = "yaml:\"accepted_assets_conf\"", + (gogoproto.nullable) = false ]; } ``` @@ -475,31 +519,31 @@ message PoolParams { The default value is `0.3`. - `ReportLevyPeriodRewardRate` defines reward ratio for the reporting the levy period for a reporter. The reward is the commission fee multiplied by this rate. The default value is `0.3`. -- `AcceptedAssets` defines the tokens which can be deposited into a pool to get DLP. +- `AcceptedAssetsConf` defines the tokens which can be deposited into a pool to get DLP. The tokens in `AcceptedAssets` have to have `DenomMetadata` in bank module in this current implementation (could be changed). +- `LevyPeriodRequiredSeconds` defines the required time for the next Levy Period. the default value is `28800`(8 hours) ### PerpetualFuturesParams ```proto message PerpetualFuturesParams { string commission_rate = 1 [ - (gogoproto.moretags) = "yaml:\"commission_rate\"", + (gogoproto.moretags) = "yaml:\"commission_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; string margin_maintenance_rate = 2 [ - (gogoproto.moretags) = "yaml:\"margin_maintenance_rate\"", + (gogoproto.moretags) = "yaml:\"margin_maintenance_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; string imaginary_funding_rate_proportional_coefficient = 3 [ - (gogoproto.moretags) = "yaml:\"imaginary_funding_rate_proportonal_coefficient\"", + (gogoproto.moretags) = "yaml:\"imaginary_funding_rate_proportonal_coefficient\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - repeated Market markets = 4 [ - (gogoproto.moretags) = "yaml:\"markets\"" + (gogoproto.nullable) = false ]; + repeated Market markets = 4 [(gogoproto.moretags) = "yaml:\"markets\""]; + uint32 max_leverage = 5 [(gogoproto.moretags) = "yaml:\"max_leverage\""]; } ``` @@ -507,6 +551,7 @@ message PerpetualFuturesParams { - `MarginMaintenanceRate` is used for the determination of the liquidation condition. The default value is `0.5`. - `ImaginaryFundingRateProportionalCoefficient` is the fee ratio for the imaginary funding. The default value is `0.0005`. - `Markets` defines the available trading pair on the perpetual futures market. +- `MaxLeverage` is the maximum leverage allowed. The default value is `30`. ### PerpetualOptionsParams @@ -514,12 +559,72 @@ nothing is defined yet. ## Events -- [EventPriceIsNotFeeded](https://github.com/UnUniFi/chain/blob/0dc4f717a4ef3e4b32731069d1dba503babe5998/proto/derivatives/derivatives.proto#L175-L179) -- [EventPerpetualFuturesPositionOpened](https://github.com/UnUniFi/chain/blob/0dc4f717a4ef3e4b32731069d1dba503babe5998/proto/derivatives/perpetual_futures.proto#L105-L108) -- [EventPerpetualFuturesPositionClosed](https://github.com/UnUniFi/chain/blob/0dc4f717a4ef3e4b32731069d1dba503babe5998/proto/derivatives/perpetual_futures.proto#L110-L115) -- [EventPerpetualFuturesPositionLiquidated](https://github.com/UnUniFi/chain/blob/0dc4f717a4ef3e4b32731069d1dba503babe5998/proto/derivatives/perpetual_futures.proto#L117-L122) -- [EventPerpetualFuturesPositionLevied](https://github.com/UnUniFi/chain/blob/0dc4f717a4ef3e4b32731069d1dba503babe5998/proto/derivatives/perpetual_futures.proto#L124-L129) +- [EventPriceIsNotFed](README.md#EventPriceIsNotFed) +- [EventPerpetualFuturesPositionOpened](README.md#EventPerpetualFuturesPositionOpened) +- [EventPerpetualFuturesPositionClosed](README.md#EventPerpetualFuturesPositionClosed) +- [EventPerpetualFuturesPositionLiquidated](README.md#EventPerpetualFuturesPositionLiquidated) +- [EventPerpetualFuturesPositionLevied](README.md#EventPerpetualFuturesPositionLevied) +- [EventPerpetualFuturesLiquidationFee](README.md#EventPerpetualFuturesLiquidationFee) +- [EventPerpetualFuturesLevyFee](README.md#EventPerpetualFuturesLevyFee) +- [EventPerpetualFuturesImaginaryFundingFee](README.md#EventPerpetualFuturesImaginaryFundingFee) ### EventPriceIsNotFed This event is emitted when at least one necessary price is not fed in the pricefeed module to be referenced in the derivatives module. + +## Events for the fee earned by the protocol + +The following events are emitted when the protocol earns the fee from the traders. + +### EventPerpetualFuturesLevyFee + +This event is emitted when the protocol earns the commission fee from the traders in LevyPeriod. + +```protobuf +message EventPerpetualFuturesLevyFee { + cosmos.base.v1beta1.Coin fee = 1 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; + string position_id = 2 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} +``` + +### EventPerpetualFuturesImaginaryFundingFee + +This event is emitted when the protocol earns the imaginary funding fee from the traders in LevyPeriod. +The imaginary funding fee can be minus if the protocol funds the position. +In that case, the `fee_negative` property has `false`. + +```protobuf +message EventPerpetualFuturesImaginaryFundingFee { + cosmos.base.v1beta1.Coin fee = 1 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; + bool fee_negative = 3 [ + (gogoproto.moretags) = "yaml:\"fee_negative\"" + ]; + string position_id = 2 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} +``` + +### EventPerpetualFuturesLiquidationFee + +This event is emitted when the protocol earns the liquidation fee from the traders when the position is liquidated. + +```protobuf +message EventPerpetualFuturesLiquidationFee { + cosmos.base.v1beta1.Coin fee = 1 [ + (gogoproto.moretags) = "yaml:\"fee\"", + (gogoproto.nullable) = false + ]; + string position_id = 2 [ + (gogoproto.moretags) = "yaml:\"position_id\"" + ]; +} +``` diff --git a/x/derivatives/abci.go b/x/derivatives/abci.go index bfcd9633b..6ff60b0b3 100644 --- a/x/derivatives/abci.go +++ b/x/derivatives/abci.go @@ -48,18 +48,19 @@ func CheckPosition(ctx sdk.Context, k keeper.Keeper) { } baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, currentBaseUsdRate) quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, currentQuoteUsdRate) + moduleAddr := k.GetModuleAddress() if position.NeedLiquidation(params.PerpetualFutures.MarginMaintenanceRate, baseMetricsRate, quoteMetricsRate) { msg := types.MsgReportLiquidation{ - Sender: position.Address, + Sender: moduleAddr.String(), PositionId: position.Id, - RewardRecipient: position.Address, + RewardRecipient: moduleAddr.String(), } k.ReportLiquidation(ctx, &msg) } msg := types.MsgReportLevyPeriod{ - Sender: position.Address, + Sender: moduleAddr.String(), PositionId: position.Id, - RewardRecipient: position.Address, + RewardRecipient: moduleAddr.String(), } k.ReportLevyPeriod(ctx, &msg) } diff --git a/x/derivatives/client/cli/query.go b/x/derivatives/client/cli/query.go index c2b43b0a3..d83dd90ae 100644 --- a/x/derivatives/client/cli/query.go +++ b/x/derivatives/client/cli/query.go @@ -27,7 +27,6 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdQueryLiquidityProviderTokenRealAPY(), CmdQueryLiquidityProviderTokenNominalAPY(), CmdQueryAddressPositions()) cmd.AddCommand(CmdQueryPool()) cmd.AddCommand(CmdQueryLiquidityProviderTokenRealAPY()) cmd.AddCommand(CmdQueryLiquidityProviderTokenNominalAPY()) @@ -43,6 +42,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdQueryEstimateRedeemTokenAmount()) cmd.AddCommand(CmdQueryAvailableAssetInPoolByDenom()) cmd.AddCommand(CmdQueryAvailableAssetsInPool()) + cmd.AddCommand(CmdQueryAllPendingPaymentPositions()) + cmd.AddCommand(CmdQueryPendingPaymentPosition()) return cmd } @@ -272,6 +273,52 @@ func CmdQueryPosition() *cobra.Command { return cmd } +func CmdQueryAllPendingPaymentPositions() *cobra.Command { + cmd := &cobra.Command{ + Use: "pending-payment-positions", + Short: "shows all pending payment positions", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.AllPendingPaymentPositions(context.Background(), &types.QueryAllPendingPaymentPositionsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryPendingPaymentPosition() *cobra.Command { + cmd := &cobra.Command{ + Use: "pending-payment-position [position-id]", + Short: "shows pending payment position of the specified position id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.PendingPaymentPosition(context.Background(), &types.QueryPendingPaymentPositionRequest{PositionId: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + func CmdQueryPerpetualFuturesPositionSize() *cobra.Command { cmd := &cobra.Command{ Use: "perpetual-futures-position-size [position-type] [address]", @@ -368,7 +415,7 @@ func CmdQueryEstimateDLPTokenAmount() *cobra.Command { func CmdQueryEstimateRedeemTokenAmount() *cobra.Command { cmd := &cobra.Command{ - Use: "estimate-delp-token-amount [redeem-denom] [amount]", + Use: "estimate-redeem-token-amount [redeem-denom] [amount]", Long: "shows the estimated redeem token amount for the specified amount of the asset", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/derivatives/client/cli/tx.go b/x/derivatives/client/cli/tx.go index 5e0f44386..1abe4baba 100644 --- a/x/derivatives/client/cli/tx.go +++ b/x/derivatives/client/cli/tx.go @@ -46,6 +46,7 @@ func GetTxCmd() *cobra.Command { CmdClosePosition(), CmdReportLiquidation(), CmdReportLevyPeriod(), + CmdAddMargin(), ) return cmd @@ -74,10 +75,7 @@ $ %s tx %s deposit-to-pool --from myKeyName --chain-id ununifi-x return err } - msg := types.MsgDepositToPool{ - Sender: sender.String(), - Amount: amount, - } + msg := types.NewMsgDepositToPool(sender.String(), amount) if err := msg.ValidateBasic(); err != nil { return err @@ -285,7 +283,7 @@ func CmdReportLiquidation() *cobra.Command { Example: $ %s tx %s report-liquidation --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -293,16 +291,11 @@ $ %s tx %s report-liquidation --from myKeyName --chain-id ununifi-x } sender := clientCtx.GetFromAddress() - recipient, err := sdk.AccAddressFromBech32(args[1]) - if err != nil { - return err - } - - msg := types.MsgReportLiquidation{ - Sender: sender.String(), - PositionId: args[0], - RewardRecipient: recipient.String(), - } + msg := types.NewMsgReportLiquidation( + sender.String(), + args[0], + args[1], + ) if err := msg.ValidateBasic(); err != nil { return err @@ -324,7 +317,7 @@ func CmdReportLevyPeriod() *cobra.Command { Example: $ %s tx %s report-levy-period --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -332,17 +325,47 @@ $ %s tx %s report-levy-period --from myKeyName --chain-id ununifi-x } sender := clientCtx.GetFromAddress() - recipient, err := sdk.AccAddressFromBech32(args[1]) + msg := types.NewMsgReportLevyPeriod( + sender.String(), + args[0], + args[1], + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func CmdAddMargin() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-margin [position-id] [amount]", + Short: fmt.Sprintf("%s add margin into a position", types.ModuleName), + Long: strings.TrimSpace( + fmt.Sprintf(`add margin. +Example: +$ %s tx %s add-margin [position-id] [amount] --from myKeyName --chain-id ununifi-x +`, version.AppName, types.ModuleName)), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - msg := types.MsgReportLevyPeriod{ - Sender: sender.String(), - PositionId: args[0], - RewardRecipient: recipient.String(), + sender := clientCtx.GetFromAddress() + potisionId := args[0] + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err } + msg := types.NewMsgAddMargin(sender.String(), potisionId, amount) + if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/derivatives/keeper/grpc_query.go b/x/derivatives/keeper/grpc_query.go index b90fc5b48..a936b1c73 100644 --- a/x/derivatives/keeper/grpc_query.go +++ b/x/derivatives/keeper/grpc_query.go @@ -6,6 +6,7 @@ package keeper import ( "context" + "fmt" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -25,8 +26,8 @@ func (k Keeper) LiquidityProviderTokenRealAPY(c context.Context, req *types.Quer ctx := sdk.UnwrapSDKContext(c) rate := k.GetLPNominalYieldRate(ctx, req.BeforeHeight, req.AfterHeight) - annualized := k.AnnualizeYieldRate(ctx, rate, req.BeforeHeight, req.AfterHeight) + annualized := k.AnnualizeYieldRate(ctx, rate, req.BeforeHeight, req.AfterHeight) return &types.QueryLiquidityProviderTokenRealAPYResponse{Apy: &annualized}, nil } @@ -38,7 +39,6 @@ func (k Keeper) LiquidityProviderTokenNominalAPY(c context.Context, req *types.Q rate := k.GetLPNominalYieldRate(ctx, req.BeforeHeight, req.AfterHeight) annualized := k.AnnualizeYieldRate(ctx, rate, req.BeforeHeight, req.AfterHeight) - return &types.QueryLiquidityProviderTokenNominalAPYResponse{Apy: &annualized}, nil } @@ -48,28 +48,29 @@ func (k Keeper) PerpetualFutures(c context.Context, req *types.QueryPerpetualFut } ctx := sdk.UnwrapSDKContext(c) - positions := types.Positions(k.GetAllPositions(ctx)) - getPriceFunc := func(ctx sdk.Context) func(denom string) (sdk.Dec, error) { - return func(denom string) (sdk.Dec, error) { - return k.GetCurrentPrice(ctx, denom) + + markets := k.GetParams(ctx).PerpetualFutures.Markets + longPositions := sdk.ZeroDec() + shortPositions := sdk.ZeroDec() + for _, market := range markets { + totalLongPositionSize := k.GetPerpetualFuturesPositionSizeInMetrics(ctx, *market, types.PositionType_LONG) + + if totalLongPositionSize.IsZero() { + return nil, fmt.Errorf("long position size is zero") } + totalShortPositionSize := k.GetPerpetualFuturesPositionSizeInMetrics(ctx, *market, types.PositionType_SHORT) + if totalShortPositionSize.IsZero() { + return nil, fmt.Errorf("short position size is zero") + } + longPositions.AddMut(totalLongPositionSize) + shortPositions.AddMut(totalShortPositionSize) } - quoteTicker := k.GetPoolQuoteTicker(ctx) - longUUsd, _ := positions.EvaluateLongPositions(quoteTicker, getPriceFunc(ctx)) - shortUUsd, _ := positions.EvaluateShortPositions(quoteTicker, getPriceFunc(ctx)) - // TODO: implement the handler logic - ctx.BlockHeight() - metricsQuoteTicker := "USD" - volume24Hours := sdk.NewDec(0) - fees24Hours := sdk.NewDec(0) - + metricsQuoteTicker := k.GetParams(ctx).PoolParams.QuoteTicker return &types.QueryPerpetualFuturesResponse{ MetricsQuoteTicker: metricsQuoteTicker, - Volume_24Hours: &volume24Hours, - Fees_24Hours: &fees24Hours, - LongPositions: sdk.NewCoin("uusd", longUUsd.TruncateInt()), - ShortPositions: sdk.NewCoin("uusd", shortUUsd.TruncateInt()), + LongPositions: longPositions, + ShortPositions: shortPositions, }, nil } @@ -79,22 +80,27 @@ func (k Keeper) PerpetualFuturesMarket(c context.Context, req *types.QueryPerpet } ctx := sdk.UnwrapSDKContext(c) - // TODO: implement the handler logic - ctx.BlockHeight() + price := sdk.NewDec(0) - metricsQuoteTicker := "" - volume24Hours := sdk.NewDec(0) - fees24Hours := sdk.NewDec(0) - longPositions := sdk.NewDec(0) - shortPositions := sdk.NewDec(0) + metricsQuoteTicker := k.GetParams(ctx).PoolParams.QuoteTicker + market := types.Market{ + BaseDenom: req.BaseDenom, + QuoteDenom: req.QuoteDenom, + } + totalLongPositionSize := k.GetPerpetualFuturesPositionSizeInMetrics(ctx, market, types.PositionType_LONG) + if totalLongPositionSize.IsZero() { + return nil, fmt.Errorf("long position size is zero") + } + totalShortPositionSize := k.GetPerpetualFuturesPositionSizeInMetrics(ctx, market, types.PositionType_SHORT) + if totalShortPositionSize.IsZero() { + return nil, fmt.Errorf("short position size is zero") + } return &types.QueryPerpetualFuturesMarketResponse{ Price: &price, MetricsQuoteTicker: metricsQuoteTicker, - Volume_24Hours: &volume24Hours, - Fees_24Hours: &fees24Hours, - LongPositions: &longPositions, - ShortPositions: &shortPositions, + LongPositions: &totalLongPositionSize, + ShortPositions: &totalShortPositionSize, }, nil } @@ -128,20 +134,16 @@ func (k Keeper) Pool(c context.Context, req *types.QueryPoolRequest) (*types.Que } ctx := sdk.UnwrapSDKContext(c) - // TODO: implement the handler logic - metricsQuoteTicker := "" + + metricsQuoteTicker := k.GetPoolQuoteTicker(ctx) poolMarketCap, err := k.GetPoolMarketCap(ctx) if err != nil { return nil, err } - volume24Hours := sdk.NewDec(0) - fees24Hours := sdk.NewDec(0) return &types.QueryPoolResponse{ MetricsQuoteTicker: metricsQuoteTicker, PoolMarketCap: &poolMarketCap, - Volume_24Hours: &volume24Hours, - Fees_24Hours: &fees24Hours, }, nil } @@ -185,7 +187,8 @@ func (k Keeper) AddressPositions(c context.Context, req *types.QueryAddressPosit if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - positions := k.GetAddressPositionsVal(ctx, address) + // Get all positions of NFTs owned by the address + positions := k.GetAddressNFTPositions(ctx, address) queriedPositions, err := k.MakeQueriedPositions(ctx, positions) if err != nil { @@ -231,6 +234,11 @@ func (k Keeper) MakeQueriedPositions(ctx sdk.Context, positions types.Positions) baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, currentBaseUsdRate) quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, currentQuoteUsdRate) profit := perpetualFuturesPosition.ProfitAndLossInMetrics(baseMetricsRate, quoteMetricsRate) + if perpetualFuturesPosition.LeviedAmountNegative { + profit = profit.Sub(perpetualFuturesPosition.LeviedAmountInMetrics(baseMetricsRate, quoteMetricsRate)) + } else { + profit = profit.Add(perpetualFuturesPosition.LeviedAmountInMetrics(baseMetricsRate, quoteMetricsRate)) + } // fixme do not use sdk.Coin directly positiveOrNegativeProfitCoin := sdk.Coin{ Denom: "uusd", @@ -287,6 +295,34 @@ func (k Keeper) Position(c context.Context, req *types.QueryPositionRequest) (*t }, nil } +func (k Keeper) AllPendingPaymentPositions(c context.Context, req *types.QueryAllPendingPaymentPositionsRequest) (*types.QueryAllPendingPaymentPositionsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + // Get all pending payment positions + pendingPaymentPositions := k.GetAllPendingPaymentPositions(ctx) + + return &types.QueryAllPendingPaymentPositionsResponse{ + PendingPaymentPositions: pendingPaymentPositions, + }, nil +} + +func (k Keeper) PendingPaymentPosition(c context.Context, req *types.QueryPendingPaymentPositionRequest) (*types.QueryPendingPaymentPositionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + // Get all pending payment position by position id + pendingPaymentPosition := k.GetPendingPaymentPosition(ctx, req.PositionId) + + return &types.QueryPendingPaymentPositionResponse{ + PendingPaymentPosition: pendingPaymentPosition, + }, nil +} + func (k Keeper) PerpetualFuturesPositionSize(c context.Context, req *types.QueryPerpetualFuturesPositionSizeRequest) (*types.QueryPerpetualFuturesPositionSizeResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -297,7 +333,8 @@ func (k Keeper) PerpetualFuturesPositionSize(c context.Context, req *types.Query if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - positions := types.Positions(k.GetAddressPositionsVal(ctx, address)) + // Get all positions of NFTs owned by the address + positions := types.Positions(k.GetAddressNFTPositions(ctx, address)) getPriceFunc := func(ctx sdk.Context) func(denom string) (sdk.Dec, error) { return func(denom string) (sdk.Dec, error) { return k.GetCurrentPrice(ctx, denom) @@ -338,6 +375,7 @@ func (k Keeper) DLPTokenRates(c context.Context, req *types.QueryDLPTokenRateReq // todo error handing continue } + // TODO: Is microzation necessary? // TODO: don't use NormalToMicroInt like this since it is hard to be consistent rates = append(rates, sdk.NewCoin(asset.Denom, types.NormalToMicroInt(ldpDenomRate))) } diff --git a/x/derivatives/keeper/grpc_query_test.go b/x/derivatives/keeper/grpc_query_test.go index d4298dfcd..a5441acf0 100644 --- a/x/derivatives/keeper/grpc_query_test.go +++ b/x/derivatives/keeper/grpc_query_test.go @@ -1,5 +1,17 @@ package keeper_test +import ( + "testing" + "time" + + testkeeper "github.com/UnUniFi/chain/testutil/keeper" + "github.com/UnUniFi/chain/x/derivatives/types" + "github.com/cometbft/cometbft/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/stretchr/testify/require" +) + // TODO: add test for followings after full implementation // LiquidityProviderTokenRealAPY // LiquidityProviderTokenNominalAPY @@ -7,3 +19,270 @@ package keeper_test // PerpetualFuturesMarket // PerpetualOptions // Pool + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.DerivativesKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + params := types.DefaultParams() + keeper.SetParams(ctx, params) + + response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} + +func (suite *KeeperTestSuite) TestQueryLiquidityProviderTokenRealAPY() { + // setup snapshot for block height 1 + suite.keeper.SetLPTokenSupplySnapshot(suite.ctx, 1, sdk.NewInt(1000000)) + suite.keeper.SetPoolMarketCapSnapshot(suite.ctx, 1, types.PoolMarketCap{ + QuoteTicker: "uatom", + Total: sdk.NewDec(100000000), + AssetInfo: []types.PoolMarketCap_AssetInfo{}, + }) + + suite.keeper.SetLPTokenSupplySnapshot(suite.ctx, 1, sdk.NewInt(1000000)) + // setup snapshot for block height 11 + suite.keeper.SetLPTokenSupplySnapshot(suite.ctx, 11, sdk.NewInt(2000000)) + suite.keeper.SetPoolMarketCapSnapshot(suite.ctx, 11, types.PoolMarketCap{ + QuoteTicker: "uatom", + Total: sdk.NewDec(300000000), + AssetInfo: []types.PoolMarketCap_AssetInfo{}, + }) + now := time.Now() + future := time.Now().Add(time.Second * 11 * 100) + suite.keeper.SaveBlockTimestamp(suite.ctx, 1, now) + suite.keeper.SaveBlockTimestamp(suite.ctx, 11, future) + req := &types.QueryLiquidityProviderTokenRealAPYRequest{ + BeforeHeight: 1, + AfterHeight: 11, + } + + suite.ctx = suite.ctx.WithBlockHeight(20) + + actual, err := suite.keeper.LiquidityProviderTokenRealAPY(suite.ctx, req) + suite.Require().NoError(err) + //rate: 0.5 duration: 100seconds + apy := sdk.MustNewDecFromStr("14334.545454545454545455") + expected := &types.QueryLiquidityProviderTokenRealAPYResponse{ + Apy: &apy, + } + suite.Require().Equal( + expected, + actual, + ) +} + +func (suite *KeeperTestSuite) TestQueryLiquidityProviderTokenNominalAPY() { + // setup snapshot for block height 1 + suite.keeper.SetLPTokenSupplySnapshot(suite.ctx, 1, sdk.NewInt(1000000)) + suite.keeper.SetPoolMarketCapSnapshot(suite.ctx, 1, types.PoolMarketCap{ + QuoteTicker: "uatom", + Total: sdk.NewDec(100000000), + AssetInfo: []types.PoolMarketCap_AssetInfo{}, + }) + + suite.keeper.SetLPTokenSupplySnapshot(suite.ctx, 1, sdk.NewInt(1000000)) + // setup snapshot for block height 11 + suite.keeper.SetLPTokenSupplySnapshot(suite.ctx, 11, sdk.NewInt(2000000)) + suite.keeper.SetPoolMarketCapSnapshot(suite.ctx, 11, types.PoolMarketCap{ + QuoteTicker: "uatom", + Total: sdk.NewDec(300000000), + AssetInfo: []types.PoolMarketCap_AssetInfo{}, + }) + now := time.Now() + future := time.Now().Add(time.Second * 11 * 100) + suite.keeper.SaveBlockTimestamp(suite.ctx, 1, now) + suite.keeper.SaveBlockTimestamp(suite.ctx, 11, future) + + suite.ctx = suite.ctx.WithBlockHeight(20) + + req := &types.QueryLiquidityProviderTokenNominalAPYRequest{ + BeforeHeight: 1, + AfterHeight: 11, + } + actual, err := suite.keeper.LiquidityProviderTokenNominalAPY(suite.ctx, req) + suite.Require().NoError(err) + apy := sdk.MustNewDecFromStr("14334.545454545454545455") + expected := &types.QueryLiquidityProviderTokenNominalAPYResponse{ + Apy: &apy, + } + suite.Require().Equal( + expected, + actual, + ) +} + +func (suite *KeeperTestSuite) TestQueryPerpetualFutures() { + // suite.SetParams() + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + market := types.Market{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + } + + coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(5000000)), sdk.NewCoin("uusdc", sdk.NewInt(50000000))} + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, coins) + positions := []struct { + positionId string + margin sdk.Coin + instance types.PerpetualFuturesPositionInstance + availableAssetInPool sdk.Coin + }{ + { + positionId: "0", + margin: sdk.NewCoin("uatom", sdk.NewInt(500000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.MustNewDecFromStr("2"), + Leverage: 5, + }, + availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(2000000)), + }, + { + positionId: "1", + margin: sdk.NewCoin("uatom", sdk.NewInt(500000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_SHORT, + Size_: sdk.MustNewDecFromStr("1"), + Leverage: 5, + }, + availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + }, + } + for _, testPosition := range positions { + err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.availableAssetInPool}) + suite.Require().NoError(err) + + position, err := suite.keeper.OpenPerpetualFuturesPosition(suite.ctx, testPosition.positionId, owner.String(), testPosition.margin, market, testPosition.instance) + suite.Require().NoError(err) + suite.Require().NotNil(position) + + _ = suite.keeper.SetPosition(suite.ctx, *position) + _ = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.margin}) + } + + req := &types.QueryPerpetualFuturesRequest{} + + actual, err := suite.keeper.PerpetualFutures(suite.ctx, req) + suite.Require().NoError(err) + expected := &types.QueryPerpetualFuturesResponse{ + MetricsQuoteTicker: "usd", + LongPositions: sdk.NewDec(20000000), //position_size * 1000000 * price_per_quote + ShortPositions: sdk.NewDec(10000000), //position_size*1000000 * price_per_quote + } + suite.Require().Equal( + expected, + actual, + ) +} + +func (suite *KeeperTestSuite) TestQueryPerpetualFuturesMarket() { + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + market := types.Market{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + } + + coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(5000000)), sdk.NewCoin("uusdc", sdk.NewInt(50000000))} + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, coins) + positions := []struct { + positionId string + margin sdk.Coin + instance types.PerpetualFuturesPositionInstance + availableAssetInPool sdk.Coin + }{ + { + positionId: "0", + margin: sdk.NewCoin("uatom", sdk.NewInt(500000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.MustNewDecFromStr("2"), + Leverage: 5, + }, + availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(2000000)), + }, + { + positionId: "1", + margin: sdk.NewCoin("uatom", sdk.NewInt(500000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_SHORT, + Size_: sdk.MustNewDecFromStr("1"), + Leverage: 5, + }, + availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + }, + } + for _, testPosition := range positions { + err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.availableAssetInPool}) + suite.Require().NoError(err) + + position, err := suite.keeper.OpenPerpetualFuturesPosition(suite.ctx, testPosition.positionId, owner.String(), testPosition.margin, market, testPosition.instance) + suite.Require().NoError(err) + suite.Require().NotNil(position) + + _ = suite.keeper.SetPosition(suite.ctx, *position) + _ = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.margin}) + } + req := &types.QueryPerpetualFuturesMarketRequest{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + } + + actual, err := suite.keeper.PerpetualFuturesMarket(suite.ctx, req) + //error + suite.Require().NoError(err) + price := sdk.NewDec(0) + longPositions := sdk.NewDec(20000000) + shortPositions := sdk.NewDec(10000000) + expected := &types.QueryPerpetualFuturesMarketResponse{ + Price: &price, + MetricsQuoteTicker: "usd", + LongPositions: &longPositions, + ShortPositions: &shortPositions, + } + suite.Require().Equal( + expected, + actual, + ) +} + +// func (suite *KeeperTestSuite) TestPerpetualOptions() { +// req := &types.QueryPerpetualOptionsRequest{} +// actual, err := suite.keeper.PerpetualOptions(suite.ctx, req) +// suite.Require().NoError(err) +// expected := &types.QueryPerpetualOptionsResponse{} +// suite.Require().Equal( +// actual, +// expected, +// ) +// } +func (suite *KeeperTestSuite) TestPool() { + req := &types.QueryPoolRequest{} + actual, err := suite.keeper.Pool(suite.ctx, req) + suite.Require().NoError(err) + expected := &types.QueryPoolResponse{ + MetricsQuoteTicker: "usd", + PoolMarketCap: &types.PoolMarketCap{ + QuoteTicker: "usd", + Total: sdk.NewDec(0), + AssetInfo: []types.PoolMarketCap_AssetInfo{ + { + Denom: "uatom", + Amount: sdk.NewInt(0), + Price: sdk.MustNewDecFromStr("0.000010000000000000"), + }, + { + Denom: "uusdc", + Amount: sdk.NewInt(0), + Price: sdk.MustNewDecFromStr("0.000001000000000000"), + }, + }, + }, + } + suite.Require().Equal( + actual, + expected, + ) +} diff --git a/x/derivatives/keeper/keeper.go b/x/derivatives/keeper/keeper.go index b58e2cdae..cd0476525 100644 --- a/x/derivatives/keeper/keeper.go +++ b/x/derivatives/keeper/keeper.go @@ -18,8 +18,10 @@ type ( storeKey storetypes.StoreKey memKey storetypes.StoreKey paramstore paramtypes.Subspace + accountKeeper types.AccountKeeper bankKeeper types.BankKeeper pricefeedKeeper types.PricefeedKeeper + nftKeeper types.NftKeeper } ) @@ -28,8 +30,10 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, + accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, pricefeedKeeper types.PricefeedKeeper, + nftKeeper types.NftKeeper, ) Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -41,8 +45,10 @@ func NewKeeper( storeKey: storeKey, memKey: memKey, paramstore: ps, + accountKeeper: accountKeeper, bankKeeper: bankKeeper, pricefeedKeeper: pricefeedKeeper, + nftKeeper: nftKeeper, } } diff --git a/x/derivatives/keeper/keeper_test.go b/x/derivatives/keeper/keeper_test.go index 23c8afc33..56b7bc8b1 100644 --- a/x/derivatives/keeper/keeper_test.go +++ b/x/derivatives/keeper/keeper_test.go @@ -7,6 +7,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/nft" "github.com/stretchr/testify/suite" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -14,8 +15,9 @@ import ( pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper" pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" + "github.com/cosmos/cosmos-sdk/baseapp" + simapp "github.com/UnUniFi/chain/app" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" "github.com/UnUniFi/chain/x/derivatives/keeper" "github.com/UnUniFi/chain/x/derivatives/types" ) @@ -31,18 +33,22 @@ type KeeperTestSuite struct { ctx sdk.Context app *simapp.App // addrs []sdk.AccAddress - // queryClient types.QueryClient + queryClient types.QueryClient keeper keeper.Keeper pricefeedKeeper pricefeedkeeper.Keeper } func (suite *KeeperTestSuite) SetupTest() { isCheckTx := false - app := simapp.Setup(suite.T(), ([]wasm.Option{})...) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, app.DerivativesKeeper) + queryClient := types.NewQueryClient(queryHelper) suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) suite.app = app + suite.queryClient = queryClient metadataAtom := banktypes.Metadata{ DenomUnits: []*banktypes.DenomUnit{ @@ -71,8 +77,8 @@ func (suite *KeeperTestSuite) SetupTest() { pfParams := pricefeedtypes.Params{ Markets: []pricefeedtypes.Market{ - {MarketId: "uusdc:usd", BaseAsset: TestQuoteTokenDenom, QuoteAsset: TestQuoteTokenDenom, Oracles: []ununifitypes.StringAccAddress{}, Active: true}, - {MarketId: "uatom:usd", BaseAsset: TestBaseTokenDenom, QuoteAsset: TestQuoteTokenDenom, Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uusdc:usd", BaseAsset: TestQuoteTokenDenom, QuoteAsset: TestQuoteTokenDenom, Oracles: []string{}, Active: true}, + {MarketId: "uatom:usd", BaseAsset: TestBaseTokenDenom, QuoteAsset: TestQuoteTokenDenom, Oracles: []string{}, Active: true}, }, } app.PricefeedKeeper.SetParams(suite.ctx, pfParams) @@ -96,6 +102,14 @@ func (suite *KeeperTestSuite) SetupTest() { suite.keeper = app.DerivativesKeeper suite.pricefeedKeeper = app.PricefeedKeeper + + _ = app.NFTKeeper.SaveClass(suite.ctx, nft.Class{ + Id: "derivatives/perpetual_futures/positions", + Name: "UnUniFi Derivatives Perpetual Futures Positions", + Symbol: "", + Description: "", + Uri: "", + }) } func TestKeeperSuite(t *testing.T) { diff --git a/x/derivatives/keeper/lpt.go b/x/derivatives/keeper/lpt.go index 3d6f378d9..acba439f8 100644 --- a/x/derivatives/keeper/lpt.go +++ b/x/derivatives/keeper/lpt.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/derivatives/types" - pftypes "github.com/UnUniFi/chain/x/pricefeed/types" ) func (k Keeper) GetLPTokenBaseMintFee(ctx sdk.Context) sdk.Dec { @@ -67,7 +66,7 @@ func (k Keeper) DetermineMintingLPTokenAmount(ctx sdk.Context, amount sdk.Coin) // assetMc is the market cap of the asset that will go to the pool, in metrics ticker (USD in default) assetMc := assetPrice.Price.Mul(sdk.NewDecFromInt(amount.Amount)) if currentSupply.Amount.IsZero() { - return k.InitialLiquidityProviderTokenSupply(ctx, assetPrice, assetMc, amount.Denom) + return k.InitialLiquidityProviderTokenSupply(ctx, amount) } lptPrice := k.GetLPTokenPrice(ctx) @@ -110,13 +109,13 @@ func (k Keeper) GetRedeemDenomAmount(ctx sdk.Context, lptAmount sdk.Int, redeemD redeemAssetBalance := k.GetAssetBalanceInPoolByDenom(ctx, redeemDenom) if redeemAssetPrice.Price.IsNil() || redeemAssetPrice.Price.IsZero() { - return sdk.Coin{}, sdk.Coin{}, types.ErrInvalidRedeemAmount + return sdk.Coin{}, sdk.Coin{}, types.ErrZeroLpTokenPrice } // redeemAmount = lptPrice * lptAmount / redeemAssetPrice - totalRedeemAmount := lptPrice.Mul(sdk.NewDecFromInt(lptAmount)).Quo(redeemAssetPrice.Price) + totalRedeemAmount := lptPrice.Mul(sdk.NewDecFromInt(lptAmount)).Quo(redeemAssetPrice.Price).TruncateInt() - if totalRedeemAmount.GT(sdk.NewDecFromInt(redeemAssetBalance.Amount)) { - return sdk.Coin{}, sdk.Coin{}, types.ErrInvalidRedeemAmount + if redeemAssetBalance.Amount.LT(totalRedeemAmount) { + return sdk.Coin{}, sdk.Coin{}, types.ErrInsufficientPoolFund } targetAmount, err := k.GetAssetTargetAmount(ctx, redeemDenom) @@ -133,8 +132,8 @@ func (k Keeper) GetRedeemDenomAmount(ctx sdk.Context, lptAmount sdk.Int, redeemD // redeemFeeRate = baseRedeemFeeRate * (1 + increaseRate) redeemFeeRate := k.GetLPTokenBaseRedeemFee(ctx).Mul(increaseRate.Add(sdk.NewDecWithPrec(1, 0))) - redeem := sdk.NewCoin(redeemDenom, totalRedeemAmount.TruncateInt()) - fee := sdk.NewCoin(redeemDenom, totalRedeemAmount.Mul(redeemFeeRate).TruncateInt()) + redeem := sdk.NewCoin(redeemDenom, totalRedeemAmount) + fee := sdk.NewCoin(redeemDenom, sdk.NewDecFromInt(totalRedeemAmount).Mul(redeemFeeRate).TruncateInt()) redeem, err = redeem.SafeSub(fee) if err != nil { return sdk.Coin{}, sdk.Coin{}, err @@ -146,15 +145,17 @@ func (k Keeper) GetRedeemDenomAmount(ctx sdk.Context, lptAmount sdk.Int, redeemD // initial_lp_token_price = Σ target_weight_of_ith_asset * price_of_ith_asset // pool_marketcap = price_of_ith_asset * amount_of_ith_deopsited_asset // initial_lp_supply = pool_marketcap / initial_lp_token_price -func (k Keeper) InitialLiquidityProviderTokenSupply(ctx sdk.Context, assetPrice *pftypes.CurrentPrice, assetMarketCap sdk.Dec, depositDenom string) (sdk.Coin, error) { - assetInfo, err := k.GetPoolAcceptedAssetConfByDenom(ctx, depositDenom) - if err != nil { - return sdk.Coin{}, err - } - initialLPTokenPrice := assetPrice.Price.Mul(assetInfo.TargetWeight) - initialLPTokenSupply := assetMarketCap.Quo(initialLPTokenPrice) - - return sdk.NewCoin(types.LiquidityProviderTokenDenom, initialLPTokenSupply.TruncateInt()), +// Fix: This is just the number of deposit tokens divided by TargetWeight +// so, Initial supply amount equals the number of tokens deposited +func (k Keeper) InitialLiquidityProviderTokenSupply(ctx sdk.Context, amount sdk.Coin) (sdk.Coin, error) { + // assetInfo, err := k.GetPoolAcceptedAssetConfByDenom(ctx, depositDenom) + // if err != nil { + // return sdk.Coin{}, err + // } + // initialLPTokenPrice := assetPrice.Price.Mul(assetInfo.TargetWeight) + // initialLPTokenSupply := assetMarketCap.Quo(initialLPTokenPrice) + + return sdk.NewCoin(types.LiquidityProviderTokenDenom, amount.Amount), nil } @@ -170,15 +171,25 @@ func (k Keeper) MintLiquidityProviderToken(ctx sdk.Context, msg *types.MsgDeposi return fmt.Errorf("invalid deposit token: %s", msg.Amount.Denom) } - if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositor, types.ModuleName, sdk.Coins{msg.Amount}); err != nil { + fee, err := k.CalcDepositingFee(ctx, msg.Amount, params.PoolParams.BaseLptMintFee) + if err != nil { return err } - fee, err := k.CalcDepositingFee(ctx, msg.Amount, params.PoolParams.BaseLptMintFee) + deposit, err := msg.Amount.SafeSub(fee) if err != nil { return err } + mintingDLP, err := k.DetermineMintingLPTokenAmount(ctx, deposit) + if err != nil { + return err + } + + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositor, types.ModuleName, sdk.Coins{msg.Amount}); err != nil { + return err + } + // TODO: integrate into ecosystem-incentive module // temporarily, send mint fee to fee pool of the derivatives module if fee.IsPositive() { @@ -191,16 +202,6 @@ func (k Keeper) MintLiquidityProviderToken(ctx sdk.Context, msg *types.MsgDeposi } } - deposit, err := msg.Amount.SafeSub(fee) - if err != nil { - return err - } - - mintingDLP, err := k.DetermineMintingLPTokenAmount(ctx, deposit) - if err != nil { - return err - } - if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.Coins{mintingDLP}); err != nil { return err } @@ -229,8 +230,6 @@ func (k Keeper) BurnLiquidityProviderToken(ctx sdk.Context, msg *types.MsgWithdr return fmt.Errorf("invalid withdraw token: %s", msg.RedeemDenom) } - // todo:check validator address,amount,redeem denom - // todo: use CacheCtx sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return err @@ -257,11 +256,19 @@ func (k Keeper) BurnLiquidityProviderToken(ctx sdk.Context, msg *types.MsgWithdr return err } if availableAsset.Amount.LT(redeemAmount.Amount) { - return types.ErrInsufficientPoolFund + return types.ErrInsufficientAvailablePoolBalance + } + + // First, Get the correct amount of udlp and burn it + err = k.BurnCoin(ctx, sender, sdk.NewCoin(types.LiquidityProviderTokenDenom, amount)) + if err != nil { + return err } if redeemFee.IsPositive() { // send redeem fee to fee pool + // TODO: integrate into ecosystem-incentive module + // temporarily, send mint fee to fee pool of the derivatives module err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.DerivativeFeeCollector, sdk.Coins{redeemFee}) if err != nil { return err @@ -274,20 +281,12 @@ func (k Keeper) BurnLiquidityProviderToken(ctx sdk.Context, msg *types.MsgWithdr return err } - err = k.BurnCoin(ctx, sender, sdk.NewCoin(types.LiquidityProviderTokenDenom, amount)) - if err != nil { - return err - } - - err = k.CollectedFee(ctx, redeemFee) - if err != nil { - return err - } - // todo emit event return nil } +// BurnCoin is used especially for the process of burning udlp. +// It executes retrieving udlp from the user's account and burning it. func (k Keeper) BurnCoin(ctx sdk.Context, burner sdk.AccAddress, amount sdk.Coin) error { err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, burner, types.ModuleName, sdk.Coins{amount}) if err != nil { @@ -299,13 +298,3 @@ func (k Keeper) BurnCoin(ctx sdk.Context, burner sdk.AccAddress, amount sdk.Coin } return nil } - -// collect fee -func (k Keeper) CollectedFee(ctx sdk.Context, fee sdk.Coin) error { - // todo: implement - // LP fee = 70% - // Protocol fee = 30% - // fee.Amount.Mul(sdk.NewInt(0.7)) - // k.IncreaseRedeemDenomAmount(ctx, fee) - return nil -} diff --git a/x/derivatives/keeper/lpt_test.go b/x/derivatives/keeper/lpt_test.go index 2f6be519e..5b666388c 100644 --- a/x/derivatives/keeper/lpt_test.go +++ b/x/derivatives/keeper/lpt_test.go @@ -8,25 +8,24 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" "github.com/UnUniFi/chain/x/derivatives/types" - pftypes "github.com/UnUniFi/chain/x/pricefeed/types" pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" ) // TODO: impl more various situations for the test cases func (suite *KeeperTestSuite) TestInitialLiquidityProviderTokenSupply() { - mockPrice := sdk.OneDec() - mockAssetPrice := &pftypes.CurrentPrice{ - MarketId: "uatom:usd", - Price: mockPrice, - } - - mockDepositingTokenAmount := sdk.OneDec() - mockAssetMarketCap := mockPrice.Mul(mockDepositingTokenAmount) - - initialLPTSupply, err := suite.app.DerivativesKeeper.InitialLiquidityProviderTokenSupply(suite.ctx, mockAssetPrice, mockAssetMarketCap, TestBaseTokenDenom) - suite.Require().Equal(sdk.NewInt(2), initialLPTSupply.Amount) + mockAmount := sdk.NewInt64Coin("uatom", 1000000) + // mockPrice := sdk.OneDec() + // mockAssetPrice := &pftypes.CurrentPrice{ + // MarketId: "uatom:usd", + // Price: mockPrice, + // } + + //mockDepositingTokenAmount := sdk.OneDec() + //mockAssetMarketCap := mockPrice.Mul(mockDepositingTokenAmount) + + initialLPTSupply, err := suite.app.DerivativesKeeper.InitialLiquidityProviderTokenSupply(suite.ctx, mockAmount) + suite.Require().Equal(mockAmount.Amount, initialLPTSupply.Amount) suite.Require().Nil(err) } @@ -34,7 +33,7 @@ func (suite *KeeperTestSuite) TestDetermineMintingLPTokenAmount() { // when no liquidity provider token's available mintAmount, err := suite.keeper.DetermineMintingLPTokenAmount(suite.ctx, sdk.NewInt64Coin("uatom", 10000)) suite.Require().NoError(err) - suite.Require().Equal(mintAmount.String(), "20000udlp") + suite.Require().Equal(mintAmount.String(), "10000udlp") // set price for asset _, err = suite.app.PricefeedKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, "uatom:usd", sdk.MustNewDecFromStr("0.000013"), suite.ctx.BlockTime().Add(time.Hour*3)) @@ -43,7 +42,7 @@ func (suite *KeeperTestSuite) TestDetermineMintingLPTokenAmount() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) @@ -91,7 +90,7 @@ func (suite *KeeperTestSuite) TestGetLPTokenPrice() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) @@ -122,7 +121,7 @@ func (suite *KeeperTestSuite) TestGetRedeemDenomAmount() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) @@ -199,7 +198,7 @@ func (suite *KeeperTestSuite) TestMintLiquidityProviderToken() { _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, sdk.Coins{tc.sendCoin}) err := suite.keeper.MintLiquidityProviderToken(suite.ctx, &types.MsgDepositToPool{ - Sender: owner.Bytes(), + Sender: owner.String(), Amount: tc.sendCoin, }) @@ -210,29 +209,25 @@ func (suite *KeeperTestSuite) TestMintLiquidityProviderToken() { if i == 0 { balance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "udlp") - // Initial atom:lpt=1:2 - // (1000000 - 2000) * 2 = 1996000 - suite.Require().Equal("1996000udlp", balance.String()) - - feeBalance := suite.app.BankKeeper.GetAllBalances(suite.ctx, derivativeFeeCollector) - suite.Require().Equal("2000uatom", feeBalance.String()) + // Initial supply + // 1000000 - 0fee= 1000000 + suite.Require().Equal("1000000udlp", balance.String()) suite.CheckLptPrice(poolAddress) } else if i == 1 { balance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "udlp") - // LPT 10USD (19.96usd / supply 1996000udlp) - // (1000000 - 2000) / 1 = 998000 - suite.Require().Equal("2994000udlp", balance.String()) + // 1000000 - 2000fee = 998000 + suite.Require().Equal("1998000udlp", balance.String()) feeBalance := suite.app.BankKeeper.GetAllBalances(suite.ctx, derivativeFeeCollector) - suite.Require().Equal("4000uatom", feeBalance.String()) + suite.Require().Equal("2000uatom", feeBalance.String()) suite.CheckLptPrice(poolAddress) } else if i == 2 { balance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "udlp") - // LPT 10.003340013360USD (29.95usd / supply 2994000udlp) - // (10000000 - 10000) * 10.003340013360 = 998666 - suite.Require().Equal("3992666udlp", balance.String()) + // usdc:lpt=10:2 + // (10000000 - 10000) / 10 = 999000 + suite.Require().Equal("2997000udlp", balance.String()) feeBalance := suite.app.BankKeeper.GetBalance(suite.ctx, derivativeFeeCollector, tc.sendCoin.Denom) suite.Require().Equal("10000uusdc", feeBalance.String()) @@ -240,9 +235,9 @@ func (suite *KeeperTestSuite) TestMintLiquidityProviderToken() { suite.CheckLptPrice(poolAddress) } else if i == 3 { balance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "udlp") - // LPT 7.751462306138USD (30.949usd / supply 3992666udlp) - // (1000000 - 1000) / 7.751462306138 = 128878 - suite.Require().Equal("4121544udlp", balance.String()) + // usdc:lpt=10:2 + // 1000000 - 1000 / 10 = 99900 + suite.Require().Equal("3096900udlp", balance.String()) feeBalance := suite.app.BankKeeper.GetBalance(suite.ctx, derivativeFeeCollector, tc.sendCoin.Denom) suite.Require().Equal("11000uusdc", feeBalance.String()) diff --git a/x/derivatives/keeper/margin.go b/x/derivatives/keeper/margin.go index 22c4c6a33..c90b19213 100644 --- a/x/derivatives/keeper/margin.go +++ b/x/derivatives/keeper/margin.go @@ -6,6 +6,80 @@ import ( "github.com/UnUniFi/chain/x/derivatives/types" ) +func (k Keeper) AddMargin(ctx sdk.Context, sender sdk.AccAddress, positionId string, amount sdk.Coin) error { + position := k.GetPositionWithId(ctx, positionId) + if position == nil { + return types.ErrPositionDoesNotExist + } + + position.RemainingMargin = position.RemainingMargin.Add(amount) + + // Send additional margin by sender to the margin manager module account + if err := k.SendMarginToMarginManager(ctx, sender, sdk.NewCoins(amount)); err != nil { + return err + } + + err := k.SetPosition(ctx, *position) + if err != nil { + return err + } + + return nil +} + +func (k Keeper) RemoveMargin(ctx sdk.Context, withdrawer sdk.AccAddress, positionId string, amount sdk.Coin) error { + position := k.GetPositionWithId(ctx, positionId) + if position == nil { + return types.ErrPositionDoesNotExist + } + + // // Check withdrawer (sender) matches the owner of the position + // if position.Address != withdrawer.String() { + // return types.ErrUnauthorized + // } + + // check withdrawer has owner nft + owner := k.GetPositionNFTOwner(ctx, positionId) + if owner.String() != withdrawer.String() { + return types.ErrUnauthorized + } + + // Update RemainingMargin + updatedRemainingMargin, err := position.RemainingMargin.SafeSub(amount) + // Check if the updated margin is positive + if err != nil { + return err + } + position.RemainingMargin = updatedRemainingMargin + + // Check if the updated margin is not under liquidation + params := k.GetParams(ctx) + currentBaseUsdRate, currentQuoteUsdRate, err := k.GetPairUsdPriceFromMarket(ctx, position.Market) + if err != nil { + return err + } + quoteTicker := k.GetPoolQuoteTicker(ctx) + baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, currentBaseUsdRate) + quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, currentQuoteUsdRate) + + if position.NeedLiquidation(params.PerpetualFutures.MarginMaintenanceRate, baseMetricsRate, quoteMetricsRate) { + // Return err as the result of this tx + return types.ErrTooMuchMarginToWithdraw + } + + // Send margin from the margin manager module account to the withdrawer + if err := k.SendBackMargin(ctx, withdrawer, sdk.NewCoins(amount)); err != nil { + return err + } + + err = k.SetPosition(ctx, *position) + if err != nil { + return err + } + + return nil +} + func (k Keeper) SendMarginToMarginManager(ctx sdk.Context, sender sdk.AccAddress, margin sdk.Coins) error { return k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.MarginManager, margin) } @@ -19,5 +93,9 @@ func (k Keeper) SendCoinFromPoolToMarginManager(ctx sdk.Context, amount sdk.Coin } func (k Keeper) SendBackMargin(ctx sdk.Context, recipient sdk.AccAddress, amount sdk.Coins) error { - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, amount) + return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.MarginManager, recipient, amount) +} + +func (k Keeper) SendPendingMargin(ctx sdk.Context, amount sdk.Coins) error { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.MarginManager, types.PendingPaymentManager, amount) } diff --git a/x/derivatives/keeper/margin_test.go b/x/derivatives/keeper/margin_test.go index 942926490..d7343765a 100644 --- a/x/derivatives/keeper/margin_test.go +++ b/x/derivatives/keeper/margin_test.go @@ -1 +1,255 @@ package keeper_test + +import ( + "time" + + "github.com/cometbft/cometbft/crypto/ed25519" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + + "github.com/UnUniFi/chain/x/derivatives/types" +) + +func (suite *KeeperTestSuite) TestAddMargin() { + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + + testCases := []struct { + name string + positionId string + margin sdk.Coin + instance types.PerpetualFuturesPositionInstance + basedRate sdk.Dec + addingMargin sdk.Coin + expPass bool + expMargin sdk.Coin + }{ + { + name: "success in quote denom", + positionId: "1", + margin: sdk.NewCoin("uusdc", sdk.NewInt(100000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.000009"), + addingMargin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + expPass: true, + expMargin: sdk.NewCoin("uusdc", sdk.NewInt(100000000).Add(sdk.NewInt(10000000))), + }, + { + name: "success in base denom", + positionId: "2", + margin: sdk.NewCoin("uatom", sdk.NewInt(10000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.000009"), + addingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + expPass: true, + expMargin: sdk.NewCoin("uatom", sdk.NewInt(10000000).Add(sdk.NewInt(1000000))), + }, + { + name: "success in short position", + positionId: "3", + margin: sdk.NewCoin("uusdc", sdk.NewInt(100000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_SHORT, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.000011"), + addingMargin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + expPass: true, + expMargin: sdk.NewCoin("uusdc", sdk.NewInt(100000000).Add(sdk.NewInt(10000000))), + }, + } + + market := types.Market{BaseDenom: "uatom", QuoteDenom: "uusdc"} + for _, tc := range testCases { + openedBaseRate, _ := suite.keeper.GetCurrentPrice(suite.ctx, market.BaseDenom) + openedQuoteRate, _ := suite.keeper.GetCurrentPrice(suite.ctx, market.QuoteDenom) + any, _ := codecTypes.NewAnyWithValue(&tc.instance) + + position := types.Position{ + Id: tc.positionId, + Market: market, + OpenerAddress: owner.String(), + OpenedBaseRate: openedBaseRate, + OpenedQuoteRate: openedQuoteRate, + RemainingMargin: tc.margin, + PositionInstance: *any, + } + suite.keeper.SetPosition(suite.ctx, position) + + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.NewCoins(tc.addingMargin)) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, sdk.NewCoins(tc.addingMargin)) + + _, _ = suite.app.PricefeedKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, "uatom:usd", tc.basedRate, suite.ctx.BlockTime().Add(time.Hour*3)) + _ = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uatom:usd") + + err := suite.keeper.AddMargin(suite.ctx, owner, tc.positionId, tc.addingMargin) + if tc.expPass { + suite.Require().NoError(err) + position := suite.keeper.GetPositionWithId(suite.ctx, tc.positionId) + suite.Require().Equal(tc.expMargin, position.RemainingMargin) + } else { + suite.Require().Error(err) + } + } +} + +func (suite *KeeperTestSuite) TestRemoveMargin() { + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + + testCases := []struct { + name string + positionId string + margin sdk.Coin + instance types.PerpetualFuturesPositionInstance + basedRate sdk.Dec + removeMargin sdk.Coin + expPass bool + expMargin sdk.Coin + expOwnerBalance sdk.Coin + }{ + { + name: "success in quote denom margin", + positionId: "1", + margin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.00002"), + removeMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), + expPass: true, + expMargin: sdk.NewCoin("uusdc", sdk.NewInt(10000000).Sub(sdk.NewInt(1000000))), + expOwnerBalance: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), + }, + { + name: "success in base denom margin", + positionId: "2", + margin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.00002"), + removeMargin: sdk.NewCoin("uatom", sdk.NewInt(100000)), + expPass: true, + expMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000).Sub(sdk.NewInt(100000))), + expOwnerBalance: sdk.NewCoin("uatom", sdk.NewInt(100000)), + }, + { + name: "success in base denom margin", + positionId: "3", + margin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_SHORT, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.000001"), + removeMargin: sdk.NewCoin("uatom", sdk.NewInt(100000)), + expPass: true, + expMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000).Sub(sdk.NewInt(100000))), + expOwnerBalance: sdk.NewCoin("uatom", sdk.NewInt(100000)).AddAmount(sdk.NewInt(100000)), + }, + { + name: "fail in withdrawing margin more than remaining", + positionId: "4", + margin: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.00001"), + removeMargin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + expPass: false, + }, + { + name: "fail in insufficient margin", + positionId: "5", + margin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.00001"), + removeMargin: sdk.NewCoin("uatom", sdk.NewInt(500000)), + expPass: false, + }, + { + name: "fail in withdrawing margin in different denom", + positionId: "6", + margin: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.00001"), + removeMargin: sdk.NewCoin("uatom", sdk.NewInt(100000)), + expPass: false, + }, + { + name: "fail in not nft owner", + positionId: "7", + margin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + instance: types.PerpetualFuturesPositionInstance{ + PositionType: types.PositionType_LONG, + Size_: sdk.NewDec(1), + Leverage: 1, + }, + basedRate: sdk.MustNewDecFromStr("0.00002"), + removeMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), + expPass: false, + }, + } + + market := types.Market{BaseDenom: "uatom", QuoteDenom: "uusdc"} + for _, tc := range testCases { + openedBaseRate, _ := suite.keeper.GetCurrentPrice(suite.ctx, market.BaseDenom) + openedQuoteRate, _ := suite.keeper.GetCurrentPrice(suite.ctx, market.QuoteDenom) + any, _ := codecTypes.NewAnyWithValue(&tc.instance) + + position := types.Position{ + Id: tc.positionId, + Market: market, + OpenerAddress: owner.String(), + OpenedBaseRate: openedBaseRate, + OpenedQuoteRate: openedQuoteRate, + RemainingMargin: tc.margin, + PositionInstance: *any, + } + _ = suite.keeper.SetPosition(suite.ctx, position) + if tc.positionId != "7" { + _ = suite.keeper.MintFuturePositionNFT(suite.ctx, position) + } + + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.NewCoins(tc.removeMargin)) + _ = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.MarginManager, sdk.NewCoins(tc.removeMargin)) + + _, _ = suite.app.PricefeedKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, "uatom:usd", tc.basedRate, suite.ctx.BlockTime().Add(time.Hour*3)) + _ = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uatom:usd") + + err := suite.keeper.RemoveMargin(suite.ctx, owner, tc.positionId, tc.removeMargin) + if tc.expPass { + suite.Require().NoError(err) + position := suite.keeper.GetPositionWithId(suite.ctx, tc.positionId) + suite.Require().Equal(tc.expMargin, position.RemainingMargin) + ownerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, tc.removeMargin.Denom) + suite.Require().Equal(tc.expOwnerBalance, ownerBalance) + } else { + suite.Require().Error(err) + } + } +} diff --git a/x/derivatives/keeper/market_test.go b/x/derivatives/keeper/market_test.go index 6abbc4838..488ef6720 100644 --- a/x/derivatives/keeper/market_test.go +++ b/x/derivatives/keeper/market_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" ) @@ -21,7 +20,7 @@ func (suite *KeeperTestSuite) TestGetAssetPrice() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uatom:usd", BaseAsset: "uatom", QuoteAsset: "usd", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uatom:usd", BaseAsset: "uatom", QuoteAsset: "usd", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) err = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uatom:usd") @@ -45,7 +44,7 @@ func (suite *KeeperTestSuite) TestGetPrice() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uusdc:usd", BaseAsset: "uusdc", QuoteAsset: "usd", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uusdc:usd", BaseAsset: "uusdc", QuoteAsset: "usd", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) err = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uusdc:usd") diff --git a/x/derivatives/keeper/msg_server.go b/x/derivatives/keeper/msg_server.go index ec85c740d..edebe62a0 100644 --- a/x/derivatives/keeper/msg_server.go +++ b/x/derivatives/keeper/msg_server.go @@ -80,3 +80,25 @@ func (k msgServer) ReportLevyPeriod(c context.Context, msg *types.MsgReportLevyP return &types.MsgReportLevyPeriodResponse{}, nil } + +func (k msgServer) AddMargin(c context.Context, msg *types.MsgAddMargin) (*types.MsgAddMarginResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + err := k.Keeper.AddMargin(ctx, sdk.AccAddress(msg.Sender), msg.PositionId, msg.Amount) + if err != nil { + return nil, err + } + + return &types.MsgAddMarginResponse{}, nil +} + +func (k msgServer) RemoveMargin(c context.Context, msg *types.MsgRemoveMargin) (*types.MsgRemoveMarginResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + err := k.Keeper.RemoveMargin(ctx, sdk.AccAddress(msg.Sender), msg.PositionId, msg.Amount) + if err != nil { + return nil, err + } + + return &types.MsgRemoveMarginResponse{}, nil +} diff --git a/x/derivatives/keeper/nft.go b/x/derivatives/keeper/nft.go new file mode 100644 index 000000000..02c2a1c9e --- /dev/null +++ b/x/derivatives/keeper/nft.go @@ -0,0 +1,126 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/nft" + + "github.com/UnUniFi/chain/x/derivatives/types" +) + +func (k Keeper) GetPositionNFTSendDisabled(ctx sdk.Context, positionId string) (bool, error) { + futureDisabled, err := k.GetFuturePositionNFTSendDisabled(ctx, positionId) + if err == nil { + return futureDisabled, nil + } + optionDisabled, err := k.GetOptionPositionNFTSendDisabled(ctx, positionId) + if err != nil { + return false, err + } + return optionDisabled, nil +} + +func (k Keeper) GetFuturePositionNFTSendDisabled(ctx sdk.Context, positionId string) (bool, error) { + data, found := k.nftKeeper.GetNftData(ctx, types.PerpFuturePositionNFTClassId, positionId) + if !found { + return false, types.ErrPositionNFTNotFound + } + return data.SendDisabled, nil +} + +func (k Keeper) GetOptionPositionNFTSendDisabled(ctx sdk.Context, positionId string) (bool, error) { + data, found := k.nftKeeper.GetNftData(ctx, types.PerpOptionPositionNFTClassId, positionId) + if !found { + return false, types.ErrPositionNFTNotFound + } + return data.SendDisabled, nil +} + +func (k Keeper) GetPositionNFTOwner(ctx sdk.Context, positionId string) sdk.AccAddress { + futureOwner := k.GetFuturePositionNFTOwner(ctx, positionId) + if futureOwner != nil { + return futureOwner + } + optionOwner := k.GetOptionPositionNFTOwner(ctx, positionId) + if optionOwner != nil { + return optionOwner + } + return nil +} + +func (k Keeper) GetFuturePositionNFTOwner(ctx sdk.Context, positionId string) sdk.AccAddress { + owner := k.nftKeeper.GetOwner(ctx, types.PerpFuturePositionNFTClassId, positionId) + return owner +} + +func (k Keeper) GetOptionPositionNFTOwner(ctx sdk.Context, positionId string) sdk.AccAddress { + owner := k.nftKeeper.GetOwner(ctx, types.PerpOptionPositionNFTClassId, positionId) + return owner +} + +func (k Keeper) GetAddressNFTPositions(ctx sdk.Context, address sdk.AccAddress) []types.Position { + futurePositions := k.GetAddressNFTFuturePositions(ctx, address) + optionPositions := k.GetAddressNFTOptionPositions(ctx, address) + positions := append(futurePositions, optionPositions...) + return positions +} + +func (k Keeper) GetAddressNFTFuturePositions(ctx sdk.Context, address sdk.AccAddress) []types.Position { + nfts := k.nftKeeper.GetNFTsOfClassByOwner(ctx, types.PerpFuturePositionNFTClassId, address) + positions := []types.Position{} + for _, nft := range nfts { + position := k.GetPositionWithId(ctx, nft.Id) + if position == nil { + continue + } + positions = append(positions, *position) + } + return positions +} + +func (k Keeper) GetAddressNFTOptionPositions(ctx sdk.Context, address sdk.AccAddress) []types.Position { + nfts := k.nftKeeper.GetNFTsOfClassByOwner(ctx, types.PerpOptionPositionNFTClassId, address) + positions := []types.Position{} + for _, nft := range nfts { + position := k.GetPositionWithId(ctx, nft.Id) + if position == nil { + continue + } + positions = append(positions, *position) + } + return positions +} + +func (k Keeper) MintFuturePositionNFT(ctx sdk.Context, position types.Position) error { + receiver, err := sdk.AccAddressFromBech32(position.OpenerAddress) + err = k.nftKeeper.Mint(ctx, nft.NFT{ + ClassId: types.PerpFuturePositionNFTClassId, + Id: position.Id, + Uri: "", + }, + receiver) + if err != nil { + return err + } + return nil +} + +func (k Keeper) CloseFuturePositionNFT(ctx sdk.Context, positionId string) error { + moduleAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) + err := k.nftKeeper.Transfer(ctx, types.PerpFuturePositionNFTClassId, positionId, moduleAddr) + if err != nil { + return err + } + err = k.BurnFuturePositionNFT(ctx, positionId) + if err != nil { + return err + } + return nil +} + +func (k Keeper) BurnFuturePositionNFT(ctx sdk.Context, positionId string) error { + err := k.nftKeeper.Burn(ctx, types.PerpFuturePositionNFTClassId, positionId) + if err != nil { + return err + } + return nil +} diff --git a/x/derivatives/keeper/params.go b/x/derivatives/keeper/params.go index 1a24320fb..63e93d447 100644 --- a/x/derivatives/keeper/params.go +++ b/x/derivatives/keeper/params.go @@ -16,3 +16,7 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramstore.SetParamSet(ctx, ¶ms) } + +func (k Keeper) GetModuleAddress() sdk.AccAddress { + return k.accountKeeper.GetModuleAddress(types.ModuleName) +} diff --git a/x/derivatives/keeper/params_test.go b/x/derivatives/keeper/params_test.go index 45a311b13..3c82e8216 100644 --- a/x/derivatives/keeper/params_test.go +++ b/x/derivatives/keeper/params_test.go @@ -21,6 +21,7 @@ func (suite *KeeperTestSuite) TestParamsGetSet() { TargetWeight: sdk.OneDec(), }, }, + LevyPeriodRequiredSeconds: 28800, } params.PerpetualFutures = types.PerpetualFuturesParams{ diff --git a/x/derivatives/keeper/pending_position.go b/x/derivatives/keeper/pending_position.go new file mode 100644 index 000000000..e29745b9f --- /dev/null +++ b/x/derivatives/keeper/pending_position.go @@ -0,0 +1,97 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/UnUniFi/chain/x/derivatives/types" +) + +func (k Keeper) SetPendingPaymentPosition(ctx sdk.Context, positionId string, amount sdk.Coin) { + pendingPaymentPosition := types.PendingPaymentPosition{ + Id: positionId, + RefundableAmount: amount, + CreatedAt: ctx.BlockTime(), + CreatedHeight: uint64(ctx.BlockHeight()), + } + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&pendingPaymentPosition) + store.Set(types.PendingPaymentPositionWithIdKeyPrefix(positionId), bz) +} + +func (k Keeper) DeletePendingPaymentPosition(ctx sdk.Context, Id string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PendingPaymentPositionWithIdKeyPrefix(Id)) +} + +func (k Keeper) GetPendingPaymentPosition(ctx sdk.Context, Id string) *types.PendingPaymentPosition { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PendingPaymentPositionWithIdKeyPrefix(Id)) + if bz == nil { + return nil + } + pendingPaymentPosition := types.PendingPaymentPosition{} + k.cdc.MustUnmarshal(bz, &pendingPaymentPosition) + return &pendingPaymentPosition +} + +func (k Keeper) GetAllPendingPaymentPositions(ctx sdk.Context) []*types.PendingPaymentPosition { + store := ctx.KVStore(k.storeKey) + + pendingPaymentPositions := []*types.PendingPaymentPosition{} + it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixPendingPaymentPosition)) + defer it.Close() + + for ; it.Valid(); it.Next() { + pendingPaymentPosition := types.PendingPaymentPosition{} + err := k.cdc.Unmarshal(it.Value(), &pendingPaymentPosition) + if err != nil { + continue + } + + pendingPaymentPositions = append(pendingPaymentPositions, &pendingPaymentPosition) + } + return pendingPaymentPositions +} + +func (k Keeper) ClosePendingPaymentPosition(ctx sdk.Context, pendingPosition types.PendingPaymentPosition, address sdk.AccAddress) error { + err := k.ClosePendingPaymentFuturePosition(ctx, pendingPosition, address) + if err == nil { + return nil + } + err = k.ClosePendingPaymentOptionPosition(ctx, pendingPosition, address) + if err != nil { + return err + } + return nil +} + +func (k Keeper) ClosePendingPaymentFuturePosition(ctx sdk.Context, pendingPosition types.PendingPaymentPosition, address sdk.AccAddress) error { + owner := k.GetFuturePositionNFTOwner(ctx, pendingPosition.Id) + if owner.String() != address.String() { + return types.ErrUnauthorized + } + sendDisabled, err := k.GetFuturePositionNFTSendDisabled(ctx, pendingPosition.Id) + if err != nil { + return err + } + if sendDisabled { + return types.ErrPositionNFTSendDisabled + } + if pendingPosition.RefundableAmount.IsPositive() { + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.PendingPaymentManager, address, sdk.NewCoins(pendingPosition.RefundableAmount)) + if err != nil { + return err + } + } + err = k.CloseFuturePositionNFT(ctx, pendingPosition.Id) + if err != nil { + return err + } + k.DeletePendingPaymentPosition(ctx, pendingPosition.Id) + return nil +} + +func (k Keeper) ClosePendingPaymentOptionPosition(ctx sdk.Context, pendingPosition types.PendingPaymentPosition, address sdk.AccAddress) error { + // todo: impl + return types.ErrNotImplemented +} diff --git a/x/derivatives/keeper/perpetual_futures.go b/x/derivatives/keeper/perpetual_futures.go index ee5ed5936..05494c557 100644 --- a/x/derivatives/keeper/perpetual_futures.go +++ b/x/derivatives/keeper/perpetual_futures.go @@ -58,15 +58,18 @@ func (k Keeper) OpenPerpetualFuturesPosition(ctx sdk.Context, positionId string, } position := types.Position{ - Id: positionId, - Market: market, - Address: sender, - OpenedAt: ctx.BlockTime(), - OpenedHeight: uint64(ctx.BlockHeight()), - OpenedBaseRate: openedBaseRate, - OpenedQuoteRate: openedQuoteRate, - PositionInstance: *any, - RemainingMargin: margin, + Id: positionId, + Market: market, + OpenerAddress: sender, + OpenedAt: ctx.BlockTime(), + OpenedHeight: uint64(ctx.BlockHeight()), + OpenedBaseRate: openedBaseRate, + OpenedQuoteRate: openedQuoteRate, + RemainingMargin: margin, + LeviedAmount: sdk.NewInt64Coin(margin.Denom, 0), + LeviedAmountNegative: true, + LastLeviedAt: ctx.BlockTime(), + PositionInstance: *any, } // General validation for the position creation @@ -106,6 +109,21 @@ func (k Keeper) OpenPerpetualFuturesPosition(ctx sdk.Context, positionId string, return nil, fmt.Errorf("unknown position type") } + senderAccAddr, err := sdk.AccAddressFromBech32(sender) + if err != nil { + return nil, err + } + + if err := k.SendMarginToMarginManager(ctx, senderAccAddr, sdk.NewCoins(margin)); err != nil { + return nil, err + } + + // mint position nft + err = k.MintFuturePositionNFT(ctx, position) + if err != nil { + return nil, err + } + _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesPositionOpened{ Sender: sender, PositionId: positionId, @@ -114,7 +132,7 @@ func (k Keeper) OpenPerpetualFuturesPosition(ctx sdk.Context, positionId string, return &position, nil } -// AddReserveTokensForPosition adds the tokens o the amount of the popsition size to pay the maximum profit +// AddReserveTokensForPosition adds the tokens o the amount of the position size to pay the maximum profit // in reserved property of the PoolMarketCap func (k Keeper) AddReserveTokensForPosition(ctx sdk.Context, marketType types.MarketType, positionSizeInDenomExponent sdk.Int, denom string) error { reserveOld, err := k.GetReservedCoin(ctx, marketType, denom) @@ -130,7 +148,7 @@ func (k Keeper) AddReserveTokensForPosition(ctx sdk.Context, marketType types.Ma return nil } -// SubReserveTokensForPosition subtracts the tokens o the amount of the popsition size to pay the maximum profit +// SubReserveTokensForPosition subtracts the tokens o the amount of the position size to pay the maximum profit // in reserved property of the PoolMarketCap func (k Keeper) SubReserveTokensForPosition(ctx sdk.Context, marketType types.MarketType, positionSizeInDenomExponent sdk.Int, denom string) error { reserveOld, err := k.GetReservedCoin(ctx, marketType, denom) @@ -147,19 +165,7 @@ func (k Keeper) SubReserveTokensForPosition(ctx sdk.Context, marketType types.Ma return nil } -func (k Keeper) ClosePerpetualFuturesPosition(ctx sdk.Context, position types.PerpetualFuturesPosition) error { - // params := k.GetParams(ctx) - // commissionRate := params.PerpetualFutures.CommissionRate - // Set the ClosePosition commission rate to 0. The commission will be deducted by Levy instead. - commissionRate := sdk.MustNewDecFromStr("0") - - // At closing the position, the trading fee is deducted. - // fee = positionSize * commissionRate - positionSizeInDenomUnit := sdk.NewDecFromInt(position.PositionInstance.SizeInDenomExponent(types.OneMillionInt)) - feeAmountDec := positionSizeInDenomUnit.Mul(commissionRate) - tradeAmount := positionSizeInDenomUnit.Sub(feeAmountDec) - feeAmount := feeAmountDec.RoundInt() - +func (k Keeper) ClosePerpetualFuturesPosition(ctx sdk.Context, position types.PerpetualFuturesPosition, sender string) error { baseUsdPrice, err := k.GetCurrentPrice(ctx, position.Market.BaseDenom) if err != nil { return err @@ -172,31 +178,55 @@ func (k Keeper) ClosePerpetualFuturesPosition(ctx sdk.Context, position types.Pe quoteTicker := k.GetPoolQuoteTicker(ctx) baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, baseUsdPrice) quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, quoteUsdPrice) + + // profit or loss amount in margin denom pnlAmount := position.ProfitAndLoss(baseMetricsRate, quoteMetricsRate) + if position.LeviedAmountNegative { + pnlAmount = pnlAmount.Sub(position.LeviedAmount.Amount) + } else { + pnlAmount = pnlAmount.Add(position.LeviedAmount.Amount) + } returningAmount, err := k.HandleReturnAmount(ctx, pnlAmount, position) if err != nil { return err } - // TODO: Fix position size in total by removing the closing position switch position.PositionInstance.PositionType { - // FIXME: Don't use OneMillionInt derectly to make it decimal unit. issue #476 + // FIXME: Don't use OneMillionInt directly to make it decimal unit. issue #476 case types.PositionType_LONG: k.SubPerpetualFuturesGrossPositionOfMarket(ctx, position.Market, position.PositionInstance.PositionType, position.PositionInstance.SizeInDenomExponent(types.OneMillionInt)) - // break + // Sub reserve tokens of pool + if err := k.SubReserveTokensForPosition(ctx, types.MarketType_FUTURES, position.PositionInstance.SizeInDenomExponent(types.OneMillionInt), position.Market.BaseDenom); err != nil { + return err + } case types.PositionType_SHORT: k.SubPerpetualFuturesGrossPositionOfMarket(ctx, position.Market, position.PositionInstance.PositionType, position.PositionInstance.SizeInDenomExponent(types.OneMillionInt)) - // break + // Sub reserve tokens of pool + if err := k.SubReserveTokensForPosition(ctx, types.MarketType_FUTURES, position.PositionInstance.SizeInDenomExponent(types.OneMillionInt), position.Market.QuoteDenom); err != nil { + return err + } case types.PositionType_POSITION_UNKNOWN: return fmt.Errorf("unknown position type") } + pending, err := k.GetFuturePositionNFTSendDisabled(ctx, position.Id) + if err != nil { + return err + } + if !pending { + // delete position nft + err = k.CloseFuturePositionNFT(ctx, position.Id) + if err != nil { + return err + } + } + _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesPositionClosed{ - Sender: position.Address, + Sender: sender, PositionId: position.Id, - FeeAmount: feeAmount.String(), - TradeAmount: tradeAmount.String(), + PositionSize: position.PositionInstance.SizeInDenomExponent(types.OneMillionInt).String(), + PnlAmount: pnlAmount.String(), ReturningAmount: returningAmount.String(), }) @@ -206,105 +236,128 @@ func (k Keeper) ClosePerpetualFuturesPosition(ctx sdk.Context, position types.Pe // If the profit exists, the profit always comes from the pool. // If the loss exists, the loss always goes to the pool from the users' margin. func (k Keeper) HandleReturnAmount(ctx sdk.Context, pnlAmount sdk.Int, position types.PerpetualFuturesPosition) (returningAmount sdk.Int, err error) { - addr, err := sdk.AccAddressFromBech32(position.Address) + pending, err := k.GetFuturePositionNFTSendDisabled(ctx, position.Id) if err != nil { return sdk.ZeroInt(), err } + var addr sdk.AccAddress + if !pending { + addr = k.GetFuturePositionNFTOwner(ctx, position.Id) + if addr == nil { + return sdk.ZeroInt(), types.ErrNotPositionNFTOwner + } + } + if pnlAmount.IsNegative() { - returningAmount = position.RemainingMargin.Amount.Sub(pnlAmount.Abs()) - // Tell the loss to the LP happened by a trade - // This has to be restricted by the protocol behavior in the future - if !(returningAmount.IsNegative()) { + loss := pnlAmount.Abs() + returningAmount = position.RemainingMargin.Amount.Sub(loss) + + if returningAmount.IsNegative() { _ = ctx.EventManager().EmitTypedEvent(&types.EventLossToLP{ PositionId: position.Id, LossAmount: returningAmount.String(), }) + // Send margin to the pool from MarginManager + // The loss is taken by the pool + if err := k.SendCoinFromMarginManagerToPool(ctx, sdk.NewCoins(position.RemainingMargin)); err != nil { + return sdk.ZeroInt(), err + } } else { returningCoin := sdk.NewCoin(position.RemainingMargin.Denom, returningAmount) - // Send coin including margin - if err := k.SendBackMargin(ctx, addr, sdk.NewCoins(returningCoin)); err != nil { - return sdk.ZeroInt(), err + // Send margin-loss from MarginManager + if pending { + if err := k.SendPendingMargin(ctx, sdk.NewCoins(returningCoin)); err != nil { + return sdk.ZeroInt(), err + } + } else { + if err := k.SendBackMargin(ctx, addr, sdk.NewCoins(returningCoin)); err != nil { + return sdk.ZeroInt(), err + } } - // Send Loss of the position to the pool - if err := k.SendCoinFromMarginManagerToPool(ctx, sdk.NewCoins(sdk.NewCoin(position.RemainingMargin.Denom, pnlAmount))); err != nil { + // Send loss to the pool + if err := k.SendCoinFromMarginManagerToPool(ctx, sdk.NewCoins(sdk.NewCoin(position.RemainingMargin.Denom, loss))); err != nil { return sdk.ZeroInt(), err } } } else { returningAmount = position.RemainingMargin.Amount.Add(pnlAmount) - fromMarginManagerAmount := position.RemainingMargin - if err := k.SendBackMargin(ctx, addr, sdk.NewCoins(fromMarginManagerAmount)); err != nil { + // Send margin from MarginManager & profit from the pool + if err := k.SendBackMargin(ctx, addr, sdk.NewCoins(position.RemainingMargin)); err != nil { return sdk.ZeroInt(), err } - if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, sdk.NewCoins(sdk.NewCoin(position.RemainingMargin.Denom, pnlAmount))); err != nil { return sdk.ZeroInt(), err } } + // create pending payment position + if pending { + if returningAmount.IsNegative() { + k.SetPendingPaymentPosition(ctx, position.Id, sdk.NewCoin(position.RemainingMargin.Denom, sdk.NewInt(0))) + } else { + k.SetPendingPaymentPosition(ctx, position.Id, sdk.NewCoin(position.RemainingMargin.Denom, returningAmount)) + } + } + return returningAmount, nil } -func (k Keeper) ReportLiquidationNeededPerpetualFuturesPosition(ctx sdk.Context, rewardRecipient string, position types.PerpetualFuturesPosition) error { - params := k.GetParams(ctx) - - currentBaseUsdRate, currentQuoteUsdRate, err := k.GetPairUsdPriceFromMarket(ctx, position.Market) - if err != nil { - return err +// LiquidateFuturesPosition is called if a position is needed to be liquidated. +// In fact, this function executes the liquidation operation, which closes the position, +// sends the liquidation reward to the rewardRecipient, and sends the rest of the margin back to the position owner. +func (k Keeper) LiquidateFuturesPosition(ctx sdk.Context, rewardRecipient string, position types.PerpetualFuturesPosition, commissionRate, rewardRate sdk.Dec) error { + // In case of closing position by Liquidation, a commission fee is charged. + commissionBaseFee := sdk.NewDecFromInt(position.PositionInstance.SizeInDenomExponent(types.OneMillionInt)).Mul(commissionRate).RoundInt() + var commissionFee sdk.Int + if position.Market.BaseDenom == position.RemainingMargin.Denom { + commissionFee = commissionBaseFee + } else { + commissionFee = k.ConvertBaseAmountToQuoteAmount(ctx, position.Market, commissionBaseFee) } - - quoteTicker := k.GetPoolQuoteTicker(ctx) - baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, currentBaseUsdRate) - quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, currentQuoteUsdRate) - if position.NeedLiquidation(params.PerpetualFutures.MarginMaintenanceRate, baseMetricsRate, quoteMetricsRate) { - // In case of closing position by Liquidation, a commission fee is charged. - commissionBaseFee := sdk.NewDecFromInt(position.PositionInstance.SizeInDenomExponent(types.OneMillionInt)).Mul(params.PerpetualFutures.CommissionRate).RoundInt() - var commissionFee sdk.Int - if position.Market.BaseDenom == position.RemainingMargin.Denom { - commissionFee = commissionBaseFee + if position.LeviedAmountNegative { + position.LeviedAmount.Amount = position.LeviedAmount.Amount.Add(commissionFee) + } else { + rest := position.LeviedAmount.Amount.Sub(commissionFee) + if rest.IsNegative() { + position.LeviedAmountNegative = true + position.LeviedAmount.Amount = rest.Abs() } else { - commissionFee = k.ConvertBaseAmountToQuoteAmount(ctx, position.Market, commissionBaseFee) - } - - // If the margin is lower than the fee, the fee is equal to the margin. - if position.RemainingMargin.Amount.LT(commissionFee) { - commissionFee = position.RemainingMargin.Amount + position.LeviedAmount.Amount = rest } + } - position.RemainingMargin.Amount = position.RemainingMargin.Amount.Sub(commissionFee) - rewardAmount := sdk.NewDecFromInt(position.RemainingMargin.Amount).Mul(params.PoolParams.ReportLiquidationRewardRate).RoundInt() - reward := sdk.NewCoins(sdk.NewCoin(position.RemainingMargin.Denom, rewardAmount)) + if err := k.ClosePerpetualFuturesPosition(ctx, position, rewardRecipient); err != nil { + return err + } - if err := k.ClosePerpetualFuturesPosition(ctx, position); err != nil { - return err - } - recipient, err := sdk.AccAddressFromBech32(rewardRecipient) - if err != nil { - return err - } + // Delete Position + openerAddress, err := sdk.AccAddressFromBech32(position.OpenerAddress) + if err != nil { + return err + } + k.DeletePosition(ctx, openerAddress, position.Id) - positionAddress, err := sdk.AccAddressFromBech32(position.Address) - if err != nil { - return err - } + // Send Reward + rewardAmount := sdk.NewDecFromInt(commissionFee).Mul(rewardRate).RoundInt() + err = k.SendRewardFromCommission(ctx, rewardAmount, position.RemainingMargin.Denom, rewardRecipient) + if err != nil { + return err + } - // Delete Position - k.DeletePosition(ctx, positionAddress, position.Id) - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, reward) - if err != nil { - return err - } + _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesPositionLiquidated{ + RewardRecipient: rewardRecipient, + PositionId: position.Id, + RemainingMargin: position.RemainingMargin.String(), + RewardAmount: rewardAmount.String(), + LeviedAmount: position.LeviedAmount.String(), + }) - _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesPositionLiquidated{ - RewardRecipient: rewardRecipient, - PositionId: position.Id, - RemainingMargin: position.RemainingMargin.String(), - RewardAmount: rewardAmount.String(), - }) - return nil - } + _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesLiquidationFee{ + Fee: sdk.NewCoin(position.RemainingMargin.Denom, commissionFee), + PositionId: position.Id, + }) return nil } @@ -315,7 +368,6 @@ func (k Keeper) ReportLevyPeriodPerpetualFuturesPosition(ctx sdk.Context, reward netPosition := k.GetPerpetualFuturesNetPositionOfMarket(ctx, position.Market).PositionSizeInDenomExponent totalPosition := k.GetPerpetualFuturesTotalPositionOfMarket(ctx, position.Market).PositionSizeInDenomExponent commissionBaseFee := sdk.NewDecFromInt(positionInstance.SizeInDenomExponent(types.OneMillionInt)).Mul(params.PerpetualFutures.CommissionRate).RoundInt() - // NetPosition / TotalPosition * LevyCoefficient imaginaryFundingRate := sdk.NewDecFromInt(netPosition).Quo(sdk.NewDecFromInt(totalPosition)).Mul(params.PerpetualFutures.ImaginaryFundingRateProportionalCoefficient) imaginaryFundingBaseFee := sdk.NewDecFromInt(positionInstance.SizeInDenomExponent(types.OneMillionInt)).Mul(imaginaryFundingRate).RoundInt() @@ -328,45 +380,34 @@ func (k Keeper) ReportLevyPeriodPerpetualFuturesPosition(ctx sdk.Context, reward commissionFee = k.ConvertBaseAmountToQuoteAmount(ctx, position.Market, commissionBaseFee) imaginaryFundingFee = k.ConvertBaseAmountToQuoteAmount(ctx, position.Market, imaginaryFundingBaseFee) } + var totalFee sdk.Int if positionInstance.PositionType == types.PositionType_LONG { - // If the margin is lower than the fee, the fee is equal to the margin. - if position.RemainingMargin.Amount.LT(imaginaryFundingFee) { - imaginaryFundingFee = position.RemainingMargin.Amount - } - if position.RemainingMargin.Amount.Sub(imaginaryFundingFee).LT(commissionFee) { - commissionFee = position.RemainingMargin.Amount.Sub(imaginaryFundingFee) - } - position.RemainingMargin.Amount = position.RemainingMargin.Amount.Sub(imaginaryFundingFee).Sub(commissionFee) - + totalFee = commissionFee.Add(imaginaryFundingFee) } else { - if position.RemainingMargin.Amount.Add(imaginaryFundingFee).LT(commissionFee) { - commissionFee = position.RemainingMargin.Amount.Add(imaginaryFundingFee) - } - position.RemainingMargin.Amount = position.RemainingMargin.Amount.Add(imaginaryFundingFee).Sub(commissionFee) + totalFee = commissionFee.Sub(imaginaryFundingFee) } - // Transfer the fees from pool to manager or manager to pool appropriately - // to keep the remaining margin of the position match the actual number to the balance - if err := k.HandleImaginaryFundingFeeTransfer(ctx, imaginaryFundingFee, commissionFee, positionInstance.PositionType, position.RemainingMargin.Denom); err != nil { - return err + if position.LeviedAmountNegative { + position.LeviedAmount.Amount = position.LeviedAmount.Amount.Add(totalFee) + } else { + rest := position.LeviedAmount.Amount.Sub(totalFee) + if rest.IsNegative() { + position.LeviedAmountNegative = true + position.LeviedAmount.Amount = rest.Abs() + } else { + position.LeviedAmount.Amount = rest + } } position.LastLeviedAt = ctx.BlockTime() - // Reward is part of the commission fee - rewardAmount := sdk.NewDecFromInt(commissionFee).Mul(params.PoolParams.ReportLevyPeriodRewardRate).RoundInt() - - recipient, err := sdk.AccAddressFromBech32(rewardRecipient) - if err != nil { - return err - } - - reward := sdk.NewCoins(sdk.NewCoin(position.RemainingMargin.Denom, rewardAmount)) - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, reward) + err := k.SetPosition(ctx, position) if err != nil { return err } - err = k.SetPosition(ctx, position) + // Send Reward + rewardAmount := sdk.NewDecFromInt(commissionFee).Mul(params.PoolParams.ReportLevyPeriodRewardRate).RoundInt() + err = k.SendRewardFromCommission(ctx, rewardAmount, position.RemainingMargin.Denom, rewardRecipient) if err != nil { return err } @@ -376,32 +417,58 @@ func (k Keeper) ReportLevyPeriodPerpetualFuturesPosition(ctx sdk.Context, reward PositionId: position.Id, RemainingMargin: position.RemainingMargin.String(), RewardAmount: rewardAmount.String(), + LeviedAmount: position.LeviedAmount.String(), + }) + + _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesLevyFee{ + Fee: sdk.NewCoin(position.RemainingMargin.Denom, commissionFee), + PositionId: position.Id, + }) + + _ = ctx.EventManager().EmitTypedEvent(&types.EventPerpetualFuturesImaginaryFundingFee{ + Fee: sdk.NewCoin(position.RemainingMargin.Denom, imaginaryFundingFee.Abs()), + FeeNegative: imaginaryFundingFee.IsNegative(), + PositionId: position.Id, }) return nil } -func (k Keeper) HandleImaginaryFundingFeeTransfer(ctx sdk.Context, imaginaryFundingFee, commissionFee sdk.Int, positionType types.PositionType, denom string) error { - var totalFee sdk.Int - if positionType == types.PositionType_LONG { - totalFee = imaginaryFundingFee.Add(commissionFee) - } else { - totalFee = commissionFee.Sub(imaginaryFundingFee) +func (k Keeper) SendRewardFromCommission(ctx sdk.Context, rewardAmount sdk.Int, denom string, recipientAddr string) error { + recipient, err := sdk.AccAddressFromBech32(recipientAddr) + if err != nil { + return err } - if totalFee.IsPositive() { - if err := k.SendCoinFromMarginManagerToPool(ctx, sdk.NewCoins(sdk.NewCoin(denom, totalFee))); err != nil { - return err - } - } else { - if err := k.SendCoinFromPoolToMarginManager(ctx, sdk.NewCoins(sdk.NewCoin(denom, totalFee.Abs()))); err != nil { - return err - } + reward := sdk.NewCoins(sdk.NewCoin(denom, rewardAmount)) + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, recipient, reward) + if err != nil { + return err } - return nil } +// func (k Keeper) HandleImaginaryFundingFeeTransfer(ctx sdk.Context, imaginaryFundingFee, commissionFee sdk.Int, positionType types.PositionType, denom string) error { +// var totalFee sdk.Int +// if positionType == types.PositionType_LONG { +// totalFee = imaginaryFundingFee.Add(commissionFee) +// } else { +// totalFee = commissionFee.Sub(imaginaryFundingFee) +// } + +// if totalFee.IsPositive() { +// if err := k.SendCoinFromMarginManagerToPool(ctx, sdk.NewCoins(sdk.NewCoin(denom, totalFee))); err != nil { +// return err +// } +// } else { +// if err := k.SendCoinFromPoolToMarginManager(ctx, sdk.NewCoins(sdk.NewCoin(denom, totalFee.Abs()))); err != nil { +// return err +// } +// } + +// return nil +// } + func (k Keeper) GetPerpetualFuturesGrossPositionOfMarket(ctx sdk.Context, market types.Market, positionType types.PositionType) types.PerpetualFuturesGrossPositionOfMarket { store := ctx.KVStore(k.storeKey) @@ -419,16 +486,6 @@ func (k Keeper) GetPerpetualFuturesGrossPositionOfMarket(ctx sdk.Context, market return grossPositionOfMarket } -/// GetPositionSizeOfGrossPositionOfMarket is not used anymore. -/// This can be deleted. -// func (k Keeper) GetPositionSizeOfGrossPositionOfMarket(ctx sdk.Context, market types.Market) sdk.Int { -// position := k.GetPerpetualFuturesGrossPositionOfMarket(ctx, market, ) -// if position.PositionSizeInDenomUnit.IsNil() { -// return sdk.ZeroInt() -// } -// return position.PositionSizeInDenomUnit -// } - func (k Keeper) GetAllPerpetualFuturesGrossPositionOfMarket(ctx sdk.Context) []types.PerpetualFuturesGrossPositionOfMarket { store := ctx.KVStore(k.storeKey) @@ -499,3 +556,17 @@ func (k Keeper) ConvertBaseAmountToQuoteAmount(ctx sdk.Context, market types.Mar return sdk.NewDecFromInt(amount).Mul(quoteMetricsRate.Amount.Amount).Quo(baseMetricsRate.Amount.Amount).RoundInt() } + +func (k Keeper) GetPerpetualFuturesPositionSizeInMetrics(ctx sdk.Context, market types.Market, pType types.PositionType) sdk.Dec { + perpFuturesLongPositionNum := k.GetPerpetualFuturesGrossPositionOfMarket(ctx, market, pType) + currentBaseUsdRate, currentQuoteUsdRate, err := k.GetPairUsdPriceFromMarket(ctx, market) + if err != nil { + return sdk.ZeroDec() + } + baseDenomPrice := currentBaseUsdRate.Quo(currentQuoteUsdRate) + // baseDenomPrice, err := k.GetPrice(ctx, market.BaseDenom, market.QuoteDenom) + if err != nil { + return sdk.ZeroDec() + } + return sdk.NewDecFromInt(perpFuturesLongPositionNum.PositionSizeInDenomExponent).Mul(baseDenomPrice) +} diff --git a/x/derivatives/keeper/perpetual_futures_test.go b/x/derivatives/keeper/perpetual_futures_test.go index e9f2693eb..0e59b5b98 100644 --- a/x/derivatives/keeper/perpetual_futures_test.go +++ b/x/derivatives/keeper/perpetual_futures_test.go @@ -1,10 +1,10 @@ package keeper_test import ( - // "fmt" "time" "github.com/cometbft/cometbft/crypto/ed25519" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/UnUniFi/chain/x/derivatives/types" @@ -12,7 +12,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) -// TODO: Add checks to ensure the margin is handed to MarginManager module account appropriately. func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) @@ -22,11 +21,12 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { } positions := []struct { - positionId string - margin sdk.Coin - instance types.PerpetualFuturesPositionInstance - availableAssetInPool sdk.Coin - expGrossPosition sdk.Int + positionId string + margin sdk.Coin + instance types.PerpetualFuturesPositionInstance + availableAssetInPool sdk.Coin + expGrossPosition sdk.Int + expMarginManagerBalance sdk.Coin }{ { positionId: "-1", @@ -36,8 +36,9 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("1"), Leverage: 1, }, - availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(1)), - expGrossPosition: sdk.MustNewDecFromStr("0").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(1)), + expGrossPosition: sdk.MustNewDecFromStr("0").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uatom", sdk.NewInt(0)), }, { positionId: "0", @@ -47,8 +48,9 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("2"), Leverage: 5, }, - availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(2000000)), - expGrossPosition: sdk.MustNewDecFromStr("2").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(2000000)), + expGrossPosition: sdk.MustNewDecFromStr("2").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uatom", sdk.NewInt(500000)), }, { positionId: "1", @@ -58,8 +60,9 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("1"), Leverage: 5, }, - availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), - expGrossPosition: sdk.MustNewDecFromStr("1").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + expGrossPosition: sdk.MustNewDecFromStr("1").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uatom", sdk.NewInt(1000000)), }, { positionId: "2", @@ -69,8 +72,9 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("2"), Leverage: 20, }, - availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(20000000)), - expGrossPosition: sdk.MustNewDecFromStr("4").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(20000000)), + expGrossPosition: sdk.MustNewDecFromStr("4").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), }, { positionId: "3", @@ -80,11 +84,16 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("1"), Leverage: 10, }, - availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), - expGrossPosition: sdk.MustNewDecFromStr("2").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + expGrossPosition: sdk.MustNewDecFromStr("2").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uusdc", sdk.NewInt(2000000)), }, } + coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(5000000)), sdk.NewCoin("uusdc", sdk.NewInt(50000000))} + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, coins) + for _, testPosition := range positions { err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.availableAssetInPool}) suite.Require().NoError(err) @@ -100,8 +109,11 @@ func (suite *KeeperTestSuite) TestOpenPerpetualFuturesPosition() { // Check if the position was added grossPosition := suite.keeper.GetPerpetualFuturesGrossPositionOfMarket(suite.ctx, market, testPosition.instance.PositionType) - suite.Require().Equal(testPosition.expGrossPosition, grossPosition.PositionSizeInDenomExponent) + + // Check if the margin manager module account has the margin + balance := suite.app.BankKeeper.GetBalance(suite.ctx, authtypes.NewModuleAddress(types.MarginManager), testPosition.margin.Denom) + suite.Require().Equal(testPosition.expMarginManagerBalance, balance) } } @@ -129,7 +141,7 @@ func (suite *KeeperTestSuite) TestAddReserveTokensForPosition() { reserve, err := suite.keeper.GetReservedCoin(suite.ctx, types.MarketType_FUTURES, tc.reserveCoin.Denom) suite.Require().NoError(err) - suite.Require().Equal(tc.expReserve, reserve) + suite.Require().Equal(tc.expReserve, reserve.Amount) } } @@ -162,13 +174,11 @@ func (suite *KeeperTestSuite) TestSubReserveTokensForPosition() { reserve, err := suite.keeper.GetReservedCoin(suite.ctx, types.MarketType_FUTURES, tc.reserveCoin.Denom) suite.Require().NoError(err) - suite.Require().Equal(tc.expReserve, reserve) + suite.Require().Equal(tc.expReserve, reserve.Amount) } } -// TODO: Add chekcs for the proper token transfer from MarginManager and Pool(derivatives) module accounts -// You can refer how the token should be distributed from those two. -// Actually, many cases could be happened. All of them have to be checked. +// TODO: Add check for profit and loss func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) @@ -177,13 +187,14 @@ func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { QuoteDenom: "uusdc", } - // TODO: Check the returning amount to the owner positions := []struct { - positionId string - margin sdk.Coin - instance types.PerpetualFuturesPositionInstance - availableAssetInPool sdk.Coin - expGrossPosition sdk.Int + positionId string + margin sdk.Coin + instance types.PerpetualFuturesPositionInstance + availableAssetInPool sdk.Coin + expGrossPosition sdk.Int + expMarginManagerBalance sdk.Coin + expOwnerBalance sdk.Coin }{ { positionId: "0", @@ -195,7 +206,9 @@ func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { }, availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(10000000)), // 2+2-2 = 2 - expGrossPosition: sdk.MustNewDecFromStr("2").MulInt64(1000000).TruncateInt(), + expGrossPosition: sdk.MustNewDecFromStr("2").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uatom", sdk.NewInt(500000)), + expOwnerBalance: sdk.NewCoin("uatom", sdk.NewInt(4500000)), }, { positionId: "1", @@ -207,7 +220,9 @@ func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { }, availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), // 2+1-2 = 1 - expGrossPosition: sdk.MustNewDecFromStr("1").MulInt64(1000000).TruncateInt(), + expGrossPosition: sdk.MustNewDecFromStr("1").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uatom", sdk.NewInt(0)), + expOwnerBalance: sdk.NewCoin("uatom", sdk.NewInt(5000000)), }, { positionId: "2", @@ -217,8 +232,10 @@ func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("2"), Leverage: 20, }, - availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(10000000)), - expGrossPosition: sdk.MustNewDecFromStr("0").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(10000000)), + expGrossPosition: sdk.MustNewDecFromStr("0").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uusdc", sdk.NewInt(1000000)), + expOwnerBalance: sdk.NewCoin("uusdc", sdk.NewInt(49000000)), }, { positionId: "3", @@ -228,11 +245,17 @@ func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { Size_: sdk.MustNewDecFromStr("1"), Leverage: 10, }, - availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), - expGrossPosition: sdk.MustNewDecFromStr("0").MulInt64(1000000).TruncateInt(), + availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + expGrossPosition: sdk.MustNewDecFromStr("0").MulInt64(1000000).TruncateInt(), + expMarginManagerBalance: sdk.NewCoin("uusdc", sdk.NewInt(0)), + expOwnerBalance: sdk.NewCoin("uusdc", sdk.NewInt(50000000)), }, } + coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(5000000)), sdk.NewCoin("uusdc", sdk.NewInt(50000000))} + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, coins) + for _, testPosition := range positions { err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.availableAssetInPool}) suite.Require().NoError(err) @@ -241,20 +264,23 @@ func (suite *KeeperTestSuite) TestClosePerpetualFuturesPosition() { suite.Require().NoError(err) suite.Require().NotNil(position) - suite.keeper.SetPosition(suite.ctx, *position) - - _ = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.margin}) + _ = suite.keeper.SetPosition(suite.ctx, *position) } for _, testPosition := range positions { position := suite.keeper.GetPositionWithId(suite.ctx, testPosition.positionId) - err := suite.keeper.ClosePerpetualFuturesPosition(suite.ctx, types.NewPerpetualFuturesPosition(*position, testPosition.instance)) + err := suite.keeper.ClosePerpetualFuturesPosition(suite.ctx, types.NewPerpetualFuturesPosition(*position, testPosition.instance), owner.String()) suite.Require().NoError(err) // Check if the position was added grossPosition := suite.keeper.GetPerpetualFuturesGrossPositionOfMarket(suite.ctx, market, testPosition.instance.PositionType) - suite.Require().Equal(testPosition.expGrossPosition, grossPosition.PositionSizeInDenomExponent) + + // Check if the margin manager module account has the margin + balance := suite.app.BankKeeper.GetBalance(suite.ctx, authtypes.NewModuleAddress(types.MarginManager), testPosition.margin.Denom) + suite.Require().Equal(testPosition.expMarginManagerBalance, balance) + ownerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, testPosition.margin.Denom) + suite.Require().Equal(testPosition.expOwnerBalance, ownerBalance) } } @@ -273,6 +299,9 @@ func (suite *KeeperTestSuite) TestReportLiquidationNeededPerpetualFuturesPositio suite.Require().NoError(err) err = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uusdc:usd") suite.Require().NoError(err) + coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(5000000)), sdk.NewCoin("uusdc", sdk.NewInt(50000000))} + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, coins) positions := []struct { positionId string @@ -327,11 +356,11 @@ func (suite *KeeperTestSuite) TestReportLiquidationNeededPerpetualFuturesPositio err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.availableAssetInPool}) suite.Require().NoError(err) - position, err := suite.keeper.OpenPerpetualFuturesPosition(suite.ctx, testPosition.positionId, owner.Bytes(), testPosition.margin, market, testPosition.instance) + position, err := suite.keeper.OpenPerpetualFuturesPosition(suite.ctx, testPosition.positionId, owner.String(), testPosition.margin, market, testPosition.instance) suite.Require().NoError(err) suite.Require().NotNil(position) - suite.keeper.SetPosition(suite.ctx, *position) + _ = suite.keeper.SetPosition(suite.ctx, *position) _ = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.margin}) } @@ -348,9 +377,17 @@ func (suite *KeeperTestSuite) TestReportLiquidationNeededPerpetualFuturesPositio switch positionInstance := positionInstance.(type) { case *types.PerpetualFuturesPositionInstance: perpetualFuturesPosition := types.NewPerpetualFuturesPosition(*position, *positionInstance) - err = suite.keeper.ReportLiquidationNeededPerpetualFuturesPosition(suite.ctx, owner.String(), perpetualFuturesPosition) + params := suite.keeper.GetParams(suite.ctx) + currentBaseUsdRate, currentQuoteUsdRate, err := suite.keeper.GetPairUsdPriceFromMarket(suite.ctx, position.Market) + suite.Require().NoError(err) + quoteTicker := suite.keeper.GetPoolQuoteTicker(suite.ctx) + baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, currentBaseUsdRate) + quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, currentQuoteUsdRate) + if position.NeedLiquidation(params.PerpetualFutures.MarginMaintenanceRate, baseMetricsRate, quoteMetricsRate) { + err = suite.keeper.LiquidateFuturesPosition(suite.ctx, owner.String(), perpetualFuturesPosition, params.PerpetualFutures.CommissionRate, params.PoolParams.ReportLiquidationRewardRate) + suite.Require().NoError(err) + } } - suite.Require().NoError(err) // Check if the position was closed grossPosition := suite.keeper.GetPerpetualFuturesGrossPositionOfMarket(suite.ctx, market, testPosition.instance.PositionType) @@ -365,12 +402,16 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { BaseDenom: "uatom", QuoteDenom: "uusdc", } + coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(5000000)), sdk.NewCoin("uusdc", sdk.NewInt(50000000))} + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, coins) positions := []struct { positionId string margin sdk.Coin instance types.PerpetualFuturesPositionInstance availableAssetInPool sdk.Coin expMargin sdk.Int + expLeviedAmount sdk.Int }{ { positionId: "0", @@ -381,9 +422,20 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { Leverage: 5, }, availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(2000000)), - // -funding 2000000 * 0.0005 * 2 / 6 = 333uatom - // 500000 - 333 - 500(commission) = 499167 - expMargin: sdk.MustNewDecFromStr("499167").TruncateInt(), + //position_size: 2 + //commission_fee: 0.001 ( 1%) + //commission_base_fee: position_size * 1000000 * commission_fee = 2 * 1000000 * 0.001 = 2000 + //ImaginaryFundingRateProportionalCoefficient: 0.0005 (0.05%) (default param) + //net_position: long_position_size * 1000000 - short_position_size * 1000000 = (2+2)*1000000 - (1+1)*1000000 = 2000000 + //total_position: long + short = (2+2)*1000000+(1+1)*1000000 = 6000000 + // imaginaryFundingRate: (net_position/total_position)* ImaginaryFundingRateProportionalCoefficient = 2/6 * 0.0005 + // imaginaryFundingBaseFee: position_size * 1000000 * imaginaryFundingRate = 2000000 * 2/6 * 0.0005 = 333 + // total_fee : commission_base_fee+ imaginaryFundingBaseFee = 2333 + //// + //// + // repoart_levyperiod_perpetual_fucturs_position doesn't change margin in position + expMargin: sdk.MustNewDecFromStr("500000").TruncateInt(), + expLeviedAmount: sdk.MustNewDecFromStr("2333").TruncateInt(), }, { positionId: "1", @@ -394,9 +446,17 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { Leverage: 5, }, availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), - // +funding 1000000 * 0.0005 * 2 / 6 = 167uatom - // 500000 + 167 - 500(commission) = 499667 - expMargin: sdk.MustNewDecFromStr("499667").TruncateInt(), + //position_size: 1 + //commission_base_fee: position_size * 1000000 * commission_fee = 1 * 1000000 * 0.001 = 1000 + //ImaginaryFundingRateProportionalCoefficient: 0.0005 (0.05%) (default param) + //net_position: long_position_size * 1000000 - short_position_size * 1000000 = (2+2)*1000000 - (1+1)*1000000 = 2000000 + //total_position: long + short = (2+2)*1000000+(1+1)*1000000 = 6000000 + // imaginaryFundingRate: (net_position/total_position)* ImaginaryFundingRateProportionalCoefficient = 2/6 * 0.0005 + // imaginaryFundingBaseFee: position_size * 1000000 * imaginaryFundingRate = 1000000 * 2/6 * 0.0005 = 167 + // total_fee : commission_base_fee - imaginaryFundingBaseFee = 1000 - 167 = 833 + // 500000 + 167 - 1000(commission) = 499167 + expMargin: sdk.MustNewDecFromStr("500000").TruncateInt(), + expLeviedAmount: sdk.MustNewDecFromStr("833").TruncateInt(), }, { positionId: "2", @@ -407,9 +467,11 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { Leverage: 20, }, availableAssetInPool: sdk.NewCoin("uatom", sdk.NewInt(20000000)), - // -funding 2000000 * 0.0005 * 2 / 6 = 333uatom - // 1000000 - 33(funding) - 1000(commission) = 998967 - expMargin: sdk.MustNewDecFromStr("998967").TruncateInt(), + //commission_base_fee: 2000 * 1 / 10 = 200 (margin.denom == quote.denom) quote_price/base_price + //imaginaryFundingFee: 333 * 1 / 10 = 33 + //total_fee: commission_base_fee + imaginaryFundFee + expMargin: sdk.MustNewDecFromStr("1000000").TruncateInt(), + expLeviedAmount: sdk.MustNewDecFromStr("233").TruncateInt(), }, { positionId: "3", @@ -420,9 +482,12 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { Leverage: 10, }, availableAssetInPool: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), - // +funding 1000000 * 0.0005 * 2 / 6 = 167uatom - // 1000000 + 17(funding) - 1000(commission) = 999017 - expMargin: sdk.MustNewDecFromStr("999017").TruncateInt(), + //commission_base_fee: 1000*1/10 = 100 + //imaginaryFundingFee: 167*1/10 = 17 + //total_fee = commission_base_fee- imaginaryFundingFee = 83 + + expMargin: sdk.MustNewDecFromStr("1000000").TruncateInt(), + expLeviedAmount: sdk.MustNewDecFromStr("83").TruncateInt(), }, } @@ -434,7 +499,7 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { suite.Require().NoError(err) suite.Require().NotNil(position) - suite.keeper.SetPosition(suite.ctx, *position) + _ = suite.keeper.SetPosition(suite.ctx, *position) _ = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{testPosition.margin}) } @@ -451,6 +516,7 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { // Check if the position was changed updatedPosition := suite.keeper.GetPositionWithId(suite.ctx, testPosition.positionId) suite.Require().Equal(testPosition.expMargin, updatedPosition.RemainingMargin.Amount) + suite.Require().Equal(testPosition.expLeviedAmount, updatedPosition.LeviedAmount.Amount) } } @@ -460,78 +526,80 @@ func (suite *KeeperTestSuite) TestReportLevyPeriodPerpetualFuturesPosition() { // imaginaryFundingFee: sdk.Int // commissionFee: sdk.Int // denom: string -// We can test the functionaly with above params and the balance of the MarginManager and Pool(derivatives) Module account +// We can test the functionally with above params and the balance of the MarginManager and Pool(derivatives) Module account // By checking those two balance after the function -func (suite *KeeperTestSuite) TestHandleImaginaryFundingFeeTransfer() { - testcases := []struct { - name string - positionType types.PositionType - imaginaryFundingFee sdk.Int - commissionFee sdk.Int - denom string - beforeMarginManagerPool sdk.Int - beforePool sdk.Int - expMarginManagerPool sdk.Int - expPool sdk.Int - }{ - { - name: "long position with positive imaginary funding fee", - positionType: types.PositionType_LONG, - imaginaryFundingFee: sdk.NewInt(1000000), - commissionFee: sdk.NewInt(100), - denom: "uatom", - beforeMarginManagerPool: sdk.NewInt(1000100), - beforePool: sdk.NewInt(0), - expMarginManagerPool: sdk.NewInt(0), - expPool: sdk.NewInt(1000100), - }, - { - name: "long position with negative imaginary funding fee", - positionType: types.PositionType_LONG, - imaginaryFundingFee: sdk.NewInt(-1000200), - commissionFee: sdk.NewInt(100), - denom: "uatom", - beforeMarginManagerPool: sdk.NewInt(0), - beforePool: sdk.NewInt(1000100), - expMarginManagerPool: sdk.NewInt(1000100), - expPool: sdk.NewInt(0), - }, - { - name: "short position with negative imaginary funding fee", - positionType: types.PositionType_SHORT, - imaginaryFundingFee: sdk.NewInt(-1000200), - commissionFee: sdk.NewInt(100), - denom: "uatom", - beforeMarginManagerPool: sdk.NewInt(1000100), - beforePool: sdk.NewInt(0), - expMarginManagerPool: sdk.NewInt(0), - expPool: sdk.NewInt(1000100), - }, - { - name: "short position with positive imaginary funding fee", - positionType: types.PositionType_SHORT, - imaginaryFundingFee: sdk.NewInt(1000200), - commissionFee: sdk.NewInt(100), - denom: "uatom", - beforeMarginManagerPool: sdk.NewInt(0), - beforePool: sdk.NewInt(1000100), - expMarginManagerPool: sdk.NewInt(1000100), - expPool: sdk.NewInt(0), - }, - } - - err := suite.app.BankKeeper.MintCoins(suite.ctx, types.MarginManager, sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(1000100))}) - suite.Require().NoError(err) - for _, tc := range testcases { - suite.Run(tc.name, func() { - suite.keeper.HandleImaginaryFundingFeeTransfer(suite.ctx, tc.imaginaryFundingFee, tc.commissionFee, tc.positionType, tc.denom) - - // Check if the balance of the MarginManager and Pool(derivatives) Module account was changed - suite.Require().Equal(tc.expMarginManagerPool, suite.app.BankKeeper.GetBalance(suite.ctx, authtypes.NewModuleAddress(types.MarginManager), tc.denom).Amount) - suite.Require().Equal(tc.expPool, suite.app.BankKeeper.GetBalance(suite.ctx, authtypes.NewModuleAddress(types.ModuleName), tc.denom).Amount) - }) - } -} +// func (suite *KeeperTestSuite) TestHandleImaginaryFundingFeeTransfer() { +// testcases := []struct { +// name string +// positionType types.PositionType +// imaginaryFundingFee sdk.Int +// commissionFee sdk.Int +// denom string +// beforeMarginManagerPool sdk.Int +// beforePool sdk.Int +// expMarginManagerPool sdk.Int +// expPool sdk.Int +// }{ +// { +// name: "long position with positive imaginary funding fee", +// positionType: types.PositionType_LONG, +// imaginaryFundingFee: sdk.NewInt(1000000), +// commissionFee: sdk.NewInt(100), +// denom: "uatom", +// beforeMarginManagerPool: sdk.NewInt(1000100), +// beforePool: sdk.NewInt(0), +// expMarginManagerPool: sdk.NewInt(0), +// expPool: sdk.NewInt(1000100), +// }, +// { +// name: "long position with negative imaginary funding fee", +// positionType: types.PositionType_LONG, +// imaginaryFundingFee: sdk.NewInt(-1000200), +// commissionFee: sdk.NewInt(100), +// denom: "uatom", +// beforeMarginManagerPool: sdk.NewInt(0), +// beforePool: sdk.NewInt(1000100), +// expMarginManagerPool: sdk.NewInt(1000100), +// expPool: sdk.NewInt(0), +// }, +// { +// name: "short position with negative imaginary funding fee", +// positionType: types.PositionType_SHORT, +// imaginaryFundingFee: sdk.NewInt(-1000200), +// commissionFee: sdk.NewInt(100), +// denom: "uatom", +// beforeMarginManagerPool: sdk.NewInt(1000100), +// beforePool: sdk.NewInt(0), +// expMarginManagerPool: sdk.NewInt(0), +// expPool: sdk.NewInt(1000100), +// }, +// { +// name: "short position with positive imaginary funding fee", +// positionType: types.PositionType_SHORT, +// imaginaryFundingFee: sdk.NewInt(1000200), +// commissionFee: sdk.NewInt(100), +// denom: "uatom", +// beforeMarginManagerPool: sdk.NewInt(0), +// beforePool: sdk.NewInt(1000100), +// expMarginManagerPool: sdk.NewInt(1000100), +// expPool: sdk.NewInt(0), +// }, +// } + +// coins := sdk.Coins{sdk.NewCoin("uatom", sdk.NewInt(1000100))} +// _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) +// _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, authtypes.NewModuleAddress(types.MarginManager), coins) + +// for _, tc := range testcases { +// suite.Run(tc.name, func() { +// err := suite.keeper.HandleImaginaryFundingFeeTransfer(suite.ctx, tc.imaginaryFundingFee, tc.commissionFee, tc.positionType, tc.denom) +// suite.Require().NoError(err) +// // Check if the balance of the MarginManager and Pool(derivatives) Module account was changed +// suite.Require().Equal(tc.expMarginManagerPool, suite.app.BankKeeper.GetBalance(suite.ctx, authtypes.NewModuleAddress(types.MarginManager), tc.denom).Amount) +// suite.Require().Equal(tc.expPool, suite.app.BankKeeper.GetBalance(suite.ctx, authtypes.NewModuleAddress(types.ModuleName), tc.denom).Amount) +// }) +// } +// } func (suite *KeeperTestSuite) TestSetPerpetualFuturesGrossPositionOfMarket() { market := types.Market{ @@ -617,6 +685,7 @@ func (suite *KeeperTestSuite) SetParams() { TargetWeight: sdk.OneDec(), }, }, + LevyPeriodRequiredSeconds: 28800, } params.PerpetualFutures = types.PerpetualFuturesParams{ CommissionRate: sdk.MustNewDecFromStr("0.001"), diff --git a/x/derivatives/keeper/pool.go b/x/derivatives/keeper/pool.go index 92d70cbe4..ac65a7cab 100644 --- a/x/derivatives/keeper/pool.go +++ b/x/derivatives/keeper/pool.go @@ -92,7 +92,6 @@ func (k Keeper) GetPoolQuoteTicker(ctx sdk.Context) string { func (k Keeper) GetPoolMarketCap(ctx sdk.Context) (types.PoolMarketCap, error) { assets := k.GetPoolAcceptedAssetsConf(ctx) - assetInfoList := []types.PoolMarketCap_AssetInfo{} mc := sdk.NewDec(0) @@ -123,7 +122,7 @@ func (k Keeper) GetPoolMarketCap(ctx sdk.Context) (types.PoolMarketCap, error) { }, nil } -// IsPriceReady returns true if all assets have price feeded. +// IsPriceReady returns true if all assets have price fed. // This is used to decide to run setPoolMarketCapSnapshot to avoid unnecessary snapshot. func (k Keeper) IsPriceReady(ctx sdk.Context) bool { assets := k.GetPoolAcceptedAssetsConf(ctx) @@ -131,7 +130,7 @@ func (k Keeper) IsPriceReady(ctx sdk.Context) bool { for _, asset := range assets { _, err := k.GetAssetPrice(ctx, asset.Denom) if err != nil { - _ = ctx.EventManager().EmitTypedEvent(&types.EventPriceIsNotFeeded{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventPriceIsNotFed{ Asset: asset.String(), }) @@ -143,7 +142,7 @@ func (k Keeper) IsPriceReady(ctx sdk.Context) bool { } func (k Keeper) SetReservedCoin(ctx sdk.Context, reserve types.Reserve) error { - bz, err := reserve.Amount.Marshal() + bz, err := reserve.Amount.Amount.Marshal() if err != nil { return err } @@ -158,17 +157,17 @@ func (k Keeper) GetReservedCoin(ctx sdk.Context, marketType types.MarketType, de store := ctx.KVStore(k.storeKey) bz := store.Get(types.ReservedCoinKeyPrefix(marketType, denom)) - var reserve types.Reserve + reserveAmount := sdk.Int{} - if err := k.cdc.Unmarshal(bz, &reserve); err != nil { + if err := reserveAmount.Unmarshal(bz); err != nil { return types.Reserve{}, err } - if reserve.Amount.Amount.IsNil() { - reserve.Amount.Amount = sdk.ZeroInt() + if reserveAmount.IsNil() { + reserveAmount = sdk.ZeroInt() } - return reserve, nil + return types.NewReserve(marketType, sdk.NewCoin(denom, reserveAmount)), nil } func (k Keeper) AvailableAssetInPoolWithMarketType(ctx sdk.Context, marketType types.MarketType, denom string) (sdk.Coin, error) { @@ -176,10 +175,6 @@ func (k Keeper) AvailableAssetInPoolWithMarketType(ctx sdk.Context, marketType t reserve, err := k.GetReservedCoin(ctx, marketType, denom) if err != nil { - return sdk.Coin{}, err - } - - if reserve.Amount.IsZero() { reserve.Amount = sdk.NewCoin(denom, sdk.ZeroInt()) } @@ -188,16 +183,19 @@ func (k Keeper) AvailableAssetInPoolWithMarketType(ctx sdk.Context, marketType t } func (k Keeper) AvailableAssetInPool(ctx sdk.Context, denom string) (sdk.Coin, error) { - availableInFutures, err := k.AvailableAssetInPoolWithMarketType(ctx, types.MarketType_FUTURES, denom) - availableInOptions, err := k.AvailableAssetInPoolWithMarketType(ctx, types.MarketType_OPTIONS, denom) - + // Pool Balance - Reserved Balance (Future + Options) + assetBalance := k.GetAssetBalanceInPoolByDenom(ctx, denom) + reserveFuture, err := k.GetReservedCoin(ctx, types.MarketType_FUTURES, denom) + if err != nil { + return sdk.Coin{}, err + } + reserveOptions, err := k.GetReservedCoin(ctx, types.MarketType_OPTIONS, denom) if err != nil { return sdk.Coin{}, err } - availableInTotal := availableInFutures.Add(availableInOptions) - - return availableInTotal, nil + available := assetBalance.Sub(reserveFuture.Amount).Sub(reserveOptions.Amount) + return available, nil } // AvailableAssetInPool returns the available amount of the all asset in the pool. diff --git a/x/derivatives/keeper/pool_test.go b/x/derivatives/keeper/pool_test.go index 532867111..be3bf20bc 100644 --- a/x/derivatives/keeper/pool_test.go +++ b/x/derivatives/keeper/pool_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "time" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" "github.com/UnUniFi/chain/x/derivatives/types" pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" @@ -108,7 +107,7 @@ func (suite *KeeperTestSuite) TestIsPriceReady() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) err = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uatom:uusdc") @@ -117,3 +116,11 @@ func (suite *KeeperTestSuite) TestIsPriceReady() { isReady = suite.keeper.IsPriceReady(suite.ctx) suite.Require().True(isReady) } + +// check in integration test +func (suite *KeeperTestSuite) TestAvailableAssetInPool() { + // get the value when nothing is set + availableAssets, err := suite.keeper.AvailableAssetInPool(suite.ctx, "uatom") + suite.Require().NoError(err) + suite.Require().Equal(availableAssets, sdk.NewCoin("uatom", sdk.ZeroInt())) +} diff --git a/x/derivatives/keeper/positions.go b/x/derivatives/keeper/positions.go index 4889d84c7..360f440d6 100644 --- a/x/derivatives/keeper/positions.go +++ b/x/derivatives/keeper/positions.go @@ -130,7 +130,7 @@ func (k Keeper) GetAddressPositionWithId(ctx sdk.Context, address sdk.AccAddress } func (k Keeper) SetPosition(ctx sdk.Context, position types.Position) error { - addr, err := sdk.AccAddressFromBech32(position.Address) + addr, err := sdk.AccAddressFromBech32(position.OpenerAddress) if err != nil { return err } @@ -164,11 +164,6 @@ func (k Keeper) OpenPosition(ctx sdk.Context, msg *types.MsgOpenPosition) error return err } - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - var position *types.Position switch positionInstance := positionInstance.(type) { case *types.PerpetualFuturesPositionInstance: @@ -183,12 +178,11 @@ func (k Keeper) OpenPosition(ctx sdk.Context, msg *types.MsgOpenPosition) error return err } - k.SetPosition(ctx, *position) - k.IncreaseLastPositionId(ctx) - - if err := k.SendMarginToMarginManager(ctx, sender, sdk.NewCoins(msg.Margin)); err != nil { + err = k.SetPosition(ctx, *position) + if err != nil { return err } + k.IncreaseLastPositionId(ctx) return nil } @@ -198,16 +192,33 @@ func (k Keeper) ClosePosition(ctx sdk.Context, msg *types.MsgClosePosition) erro if err != nil { return err } - positionId := msg.PositionId - position := k.GetAddressPositionWithId(ctx, sender, positionId) + // check withdrawer has owner nft + owner := k.GetPositionNFTOwner(ctx, positionId) + if owner.String() != msg.Sender { + return types.ErrNotPositionNFTOwner + } + sendDisabled, err := k.GetPositionNFTSendDisabled(ctx, positionId) + if err != nil { + return err + } + if sendDisabled { + return types.ErrPositionNFTSendDisabled + } - if position == nil { - return errors.New("position not found") + pendingPosition := k.GetPendingPaymentPosition(ctx, positionId) + if pendingPosition != nil { + err = k.ClosePendingPaymentPosition(ctx, *pendingPosition, sender) + if err != nil { + return err + } + return nil } - if msg.Sender != position.Address { - return errors.New("not owner") + position := k.GetPositionWithId(ctx, positionId) + + if position == nil { + return types.ErrPositionDoesNotExist } positionInstance, err := types.UnpackPositionInstance(position.PositionInstance) @@ -218,11 +229,9 @@ func (k Keeper) ClosePosition(ctx sdk.Context, msg *types.MsgClosePosition) erro switch positionInstance := positionInstance.(type) { case *types.PerpetualFuturesPositionInstance: perpetualFuturesPosition := types.NewPerpetualFuturesPosition(*position, *positionInstance) - err = k.ClosePerpetualFuturesPosition(ctx, perpetualFuturesPosition) - break + err = k.ClosePerpetualFuturesPosition(ctx, perpetualFuturesPosition, owner.String()) case *types.PerpetualOptionsPositionInstance: err = k.ClosePerpetualOptionsPosition(ctx, *position, *positionInstance) - break default: return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "position instance: %s", positionInstance) } @@ -248,10 +257,24 @@ func (k Keeper) ReportLiquidation(ctx sdk.Context, msg *types.MsgReportLiquidati return err } + params := k.GetParams(ctx) + + currentBaseUsdRate, currentQuoteUsdRate, err := k.GetPairUsdPriceFromMarket(ctx, position.Market) + if err != nil { + return err + } + quoteTicker := k.GetPoolQuoteTicker(ctx) + baseMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.BaseDenom, currentBaseUsdRate) + quoteMetricsRate := types.NewMetricsRateType(quoteTicker, position.Market.QuoteDenom, currentQuoteUsdRate) + switch positionInstance := positionInstance.(type) { case *types.PerpetualFuturesPositionInstance: perpetualFuturesPosition := types.NewPerpetualFuturesPosition(*position, *positionInstance) - err = k.ReportLiquidationNeededPerpetualFuturesPosition(ctx, msg.RewardRecipient, perpetualFuturesPosition) + if position.NeedLiquidation(params.PerpetualFutures.MarginMaintenanceRate, baseMetricsRate, quoteMetricsRate) { + err = k.LiquidateFuturesPosition(ctx, msg.RewardRecipient, perpetualFuturesPosition, params.PerpetualFutures.CommissionRate, params.PoolParams.ReportLiquidationRewardRate) + } else { + return types.ErrLiquidationNotNeeded + } break case *types.PerpetualOptionsPositionInstance: err = k.ReportLiquidationNeededPerpetualOptionsPosition(ctx, msg.RewardRecipient, *position, *positionInstance) @@ -274,8 +297,9 @@ func (k Keeper) ReportLevyPeriod(ctx sdk.Context, msg *types.MsgReportLevyPeriod return errors.New("position not found") } - if ctx.BlockTime().Sub(position.LastLeviedAt) < time.Duration(8)*time.Hour { - return errors.New("It hasn't passed 8 hours since last levy") + params := k.GetParams(ctx) + if position.LastLeviedAt.Add(time.Duration(params.PoolParams.LevyPeriodRequiredSeconds) * time.Second).After(ctx.BlockTime()) { + return errors.New("levy period is allowed after the time set by params") } positionInstance, err := types.UnpackPositionInstance(position.PositionInstance) diff --git a/x/derivatives/keeper/positions_test.go b/x/derivatives/keeper/positions_test.go index e10956984..dcf1a25e6 100644 --- a/x/derivatives/keeper/positions_test.go +++ b/x/derivatives/keeper/positions_test.go @@ -47,8 +47,8 @@ func (suite *KeeperTestSuite) TestGetAllPositions() { positions := []types.Position{ { - Id: "0", - Address: owner.Bytes(), + Id: "0", + OpenerAddress: owner.String(), Market: types.Market{ BaseDenom: "uatom", QuoteDenom: "uusdc", @@ -60,10 +60,11 @@ func (suite *KeeperTestSuite) TestGetAllPositions() { PositionInstance: *position0Inst, RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000)), LastLeviedAt: time.Now().UTC(), + LeviedAmount: sdk.NewCoin("uusdc", sdk.NewInt(100)), }, { - Id: "1", - Address: owner.Bytes(), + Id: "1", + OpenerAddress: owner.String(), Market: types.Market{ BaseDenom: "uatom", QuoteDenom: "uusdc", @@ -75,6 +76,7 @@ func (suite *KeeperTestSuite) TestGetAllPositions() { PositionInstance: *position1Inst, RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000)), LastLeviedAt: time.Now().UTC(), + LeviedAmount: sdk.NewCoin("uatom", sdk.NewInt(100)), }, } @@ -131,8 +133,8 @@ func (suite *KeeperTestSuite) TestDeletePosition() { positions := []types.Position{ { - Id: "0", - Address: owner.Bytes(), + Id: "0", + OpenerAddress: owner.String(), Market: types.Market{ BaseDenom: "uatom", QuoteDenom: "uusdc", @@ -142,8 +144,8 @@ func (suite *KeeperTestSuite) TestDeletePosition() { PositionInstance: *position0Inst, }, { - Id: "1", - Address: owner2.Bytes(), + Id: "1", + OpenerAddress: owner2.String(), Market: types.Market{ BaseDenom: "uatom", QuoteDenom: "uusdc", @@ -164,7 +166,9 @@ func (suite *KeeperTestSuite) TestDeletePosition() { // check per id for _, position := range positions { - p := suite.keeper.GetAddressPositionWithId(suite.ctx, position.Address.AccAddress(), position.Id) + address, err := sdk.AccAddressFromBech32(position.OpenerAddress) + suite.Require().NoError(err) + p := suite.keeper.GetAddressPositionWithId(suite.ctx, address, position.Id) suite.Require().NotNil(p) suite.Require().Equal(p.Id, position.Id) suite.Require().Equal(p.Market, position.Market) diff --git a/x/derivatives/keeper/test/01_pool_all_withdraw.sh b/x/derivatives/keeper/test/01_pool_all_withdraw.sh new file mode 100644 index 000000000..b64d37435 --- /dev/null +++ b/x/derivatives/keeper/test/01_pool_all_withdraw.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +user1_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') + +# initial same amounts +expected_user1_udlp_balance=$(($init_udlp_balance + 100000000)) +expected_user1_ubtc_balance=$(($init_ubtc_balance - 100000000)) + +if [ "$user1_udlp_balance" = "$expected_user1_udlp_balance" ]; then + echo "pass: udlp balance is correct: $user1_udlp_balance" +else + echo "error: udlp balance is incorrect:" + echo "expected: $expected_user1_udlp_balance actual: $user1_udlp_balance" +fi + +if [ "$user1_ubtc_balance" = "$expected_user1_ubtc_balance" ]; then + echo "pass: ubtc balance is correct: $user1_ubtc_balance" +else + echo "error: ubtc balance is incorrect:" + echo "expected: $expected_user1_ubtc_balance actual: $user1_ubtc_balance" +fi + +echo "------------deposit to pool 2nd------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +expected_user1_udlp_balance=$(($expected_user1_udlp_balance + 99833334)) + +if [ "$user1_udlp_balance" = "$expected_user1_udlp_balance" ]; then + echo "pass: udlp balance is correct: $user1_udlp_balance" +else + echo "error: udlp balance is incorrect:" + echo "expected: $expected_user1_udlp_balance actual: $user1_udlp_balance" +fi + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') + +if [ "$user1_ubtc_balance" > "$init_ubtc_balance" ]; then + echo "pass: ubtc balance is correct: $user1_ubtc_balance" +else + echo "error: ubtc balance is incorrect:" + echo "initial: $init_ubtc_balance actual: $user1_ubtc_balance" +fi + +# 0udlp supply +rate=$(ununifid q derivatives delp-token-rate -o json | jq .rates[0].amount | tr -d '"') +if [ "$rate" = "0" ]; then + echo "pass: delp token rate is correct: $rate" +else + echo "error: delp token rate is incorrect:" + echo "expected: 0 actual: $rate" +fi + +pool_mc=$(ununifid q derivatives pool -o json | jq .pool_market_cap.total | tr -d '"') +if [ "$pool_mc" = "0.000000000000000000" ]; then + echo "pass: pool market cap is correct: $pool_mc" +else + echo "error: pool market cap is incorrect:" + echo "expected: 0.000000000000000000 actual: $pool_mc" +fi diff --git a/x/derivatives/keeper/test/02_pool_left_1udlp.sh b/x/derivatives/keeper/test/02_pool_left_1udlp.sh new file mode 100644 index 000000000..a298459c5 --- /dev/null +++ b/x/derivatives/keeper/test/02_pool_left_1udlp.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +user1_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') + +# initial same amounts +expected_user1_udlp_balance=$(($init_udlp_balance + 100000000)) +expected_user1_ubtc_balance=$(($init_ubtc_balance - 100000000)) + +if [ "$user1_udlp_balance" = "$expected_user1_udlp_balance" ]; then + echo "pass: udlp balance is correct: $user1_udlp_balance" +else + echo "error: udlp balance is incorrect:" + echo "expected: $expected_user1_udlp_balance actual: $user1_udlp_balance" +fi + +if [ "$user1_ubtc_balance" = "$expected_user1_ubtc_balance" ]; then + echo "pass: ubtc balance is correct: $user1_ubtc_balance" +else + echo "error: ubtc balance is incorrect:" + echo "expected: $expected_user1_ubtc_balance actual: $user1_ubtc_balance" +fi + +echo "------------deposit to pool 2nd------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +expected_user1_udlp_balance=$(($expected_user1_udlp_balance + 99833334)) + +if [ "$user1_udlp_balance" = "$expected_user1_udlp_balance" ]; then + echo "pass: udlp balance is correct: $user1_udlp_balance" +else + echo "error: udlp balance is incorrect:" + echo "expected: $expected_user1_udlp_balance actual: $user1_udlp_balance" +fi + +# left 1udlp +withdraw_amount=$(($user1_udlp_balance - 1)) + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $withdraw_amount ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user1_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') + +if [ "$user1_ubtc_balance" > "$init_ubtc_balance" ]; then + echo "pass: ubtc balance is correct: $user1_ubtc_balance" +else + echo "error: ubtc balance is incorrect:" + echo "initial: $init_ubtc_balance actual: $user1_ubtc_balance" +fi + +echo "------------udlp rate check------------" +# 1udlp supply & price 1udlp=1ubtc +# 0udlp supply +rate=$(ununifid q derivatives delp-token-rate -o json | jq .rates[0].amount | tr -d '"') +if [ "$rate" = "1000000" ]; then + echo "pass: delp token rate is correct: $rate" +else + echo "error: delp token rate is incorrect:" + echo "expected: 1000000 actual: $rate" +fi + +pool_mc=$(ununifid q derivatives pool -o json | jq .pool_market_cap.total | tr -d '"') +if [ "$pool_mc" = "0.024508410211260500" ]; then + echo "pass: pool market cap is correct: $pool_mc" +else + echo "error: pool market cap is incorrect:" + echo "expected: 0.024508410211260500 actual: $pool_mc" +fi diff --git a/x/derivatives/keeper/test/03_pool_liquidation.sh b/x/derivatives/keeper/test/03_pool_liquidation.sh new file mode 100644 index 000000000..e9d7b8060 --- /dev/null +++ b/x/derivatives/keeper/test/03_pool_liquidation.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------opened position------------" +ununifid q derivatives positions $user2_address + +echo "------------price change------------" +ununifid tx pricefeed postprice ubtc:usd 0.012508410211260500 1200 \ +--from=pricefeed --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------report liquidation------------" +ununifid tx derivatives report-liquidation 1 $user1_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------liquidated position------------" +ununifid q derivatives positions $user2_address + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user1_ubtc_balance=$(ununifid q bank balances $user1_address --denom ubtc -o json | jq .amount | tr -d '"') +user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') +user1_profit=$(($user1_ubtc_balance - $init_ubtc_balance)) +user2_loss=$(($init_user2_ubtc_balance - $user2_ubtc_balance)) + +if [ "$user1_ubtc_balance" -gt "$init_ubtc_balance" ]; then + echo "pass: ubtc balance is correct: $user1_ubtc_balance" + echo "profit $user1_profit trader's loss $user2_loss" +else + echo "error: ubtc balance is incorrect:" + echo "initial: $init_ubtc_balance actual: $user1_ubtc_balance" +fi \ No newline at end of file diff --git a/x/derivatives/keeper/test/04_pool_levy_period.sh b/x/derivatives/keeper/test/04_pool_levy_period.sh new file mode 100644 index 000000000..dc4d72a31 --- /dev/null +++ b/x/derivatives/keeper/test/04_pool_levy_period.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +## before run this script, change params scripts/setup/init.sh +## Line 88 levy_period_required_seconds under block speed + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------opened position------------" +ununifid q derivatives positions $user2_address + +sleep $sleep + +echo "------------levy tx------------" +ununifid tx derivatives report-levy-period 1 $user1_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------levied position------------" +ununifid q derivatives positions $user2_address + +echo "------------udlp rate check------------" +rate=$(ununifid q derivatives delp-token-rate -o json | jq .rates[0].amount | tr -d '"') + +if [ "$rate" = "1000000" ]; then + echo "pass: delp token rate is correct: $rate" +else + echo "error: delp token rate is incorrect:" + echo "expected: 1000000 actual: $rate" +fi + +echo "------------pool amount check------------" +pool_amount=$(ununifid q derivatives pool -o json | jq .pool_market_cap.asset_info[0].amount | tr -d '"') + +if [ "$pool_amount" = "100000000" ]; then + echo "pass: pool amount is correct: $pool_amount" +else + echo "error: pool market cap is incorrect:" + echo "expected: 100000000, actual: $pool_amount" +fi diff --git a/x/derivatives/keeper/test/05_pool_withdraw_opened_position.sh b/x/derivatives/keeper/test/05_pool_withdraw_opened_position.sh new file mode 100644 index 000000000..65064e321 --- /dev/null +++ b/x/derivatives/keeper/test/05_pool_withdraw_opened_position.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------opened position------------" +ununifid q derivatives positions $user2_address + +echo "------------withdraw from pool (error)------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user1_udlp_balance_after=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +if [ "$user1_udlp_balance_after" = "$user1_udlp_balance" ]; then + echo "pass: depositer udlp balance is correct: $user1_udlp_balance_after" +else + echo "error: depositer udlp balance is incorrect" + echo "expexted: $user1_udlp_balance actual: $user1_udlp_balance_after" +fi diff --git a/x/derivatives/keeper/test/06_position_close_price_up.sh b/x/derivatives/keeper/test/06_position_close_price_up.sh new file mode 100644 index 000000000..9d14dc13c --- /dev/null +++ b/x/derivatives/keeper/test/06_position_close_price_up.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------opened position------------" +ununifid q derivatives positions $user2_address + +echo "------------price change------------" +ununifid tx pricefeed postprice ubtc:usd 0.030508410211260500 1200 \ +--from=pricefeed --keyring-backend test --chain-id test --yes + +sleep $sleep + +ununifid q derivatives positions $user2_address + +echo "------------close position------------" +ununifid tx derivatives close-position 1 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user1_ubtc_balance=$(ununifid q bank balances $user1_address --denom ubtc -o json | jq .amount | tr -d '"') +user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') +user1_loss=$(( $init_ubtc_balance - $user1_ubtc_balance)) +user2_profit=$(( $user2_ubtc_balance - $init_user2_ubtc_balance)) + +if [ "$user1_ubtc_balance" -lt "$init_ubtc_balance" ]; then + echo "pass: depositer ubtc balance is correct: $user1_ubtc_balance" + echo "loss $user1_loss" +else + echo "error: depositor ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user1_ubtc_balance" +fi + +if [ "$user2_ubtc_balance" -gt "$init_user2_ubtc_balance" ]; then + echo "pass: trader ubtc balance is correct: $user2_ubtc_balance" + echo "profit $user2_profit" +else + echo "error: ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user2_ubtc_balance" +fi \ No newline at end of file diff --git a/x/derivatives/keeper/test/07_position_close_price_down.sh b/x/derivatives/keeper/test/07_position_close_price_down.sh new file mode 100644 index 000000000..291aa9615 --- /dev/null +++ b/x/derivatives/keeper/test/07_position_close_price_down.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------opened position------------" +ununifid q derivatives positions $user2_address + +echo "------------price change------------" +ununifid tx pricefeed postprice ubtc:usd 0.022508410211260500 1200 \ +--from=pricefeed --keyring-backend test --chain-id test --yes + +sleep $sleep + +ununifid q derivatives positions $user2_address + +echo "------------close position------------" +ununifid tx derivatives close-position 1 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------closed position------------" +ununifid q derivatives positions $user2_address + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user1_ubtc_balance=$(ununifid q bank balances $user1_address --denom ubtc -o json | jq .amount | tr -d '"') +user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') +user1_profit=$(($user1_ubtc_balance - $init_ubtc_balance)) +user2_loss=$(($init_user2_ubtc_balance - $user2_ubtc_balance)) + +if [ "$user1_ubtc_balance" -gt "$init_ubtc_balance" ]; then + echo "pass: depositer ubtc balance is correct: $user1_ubtc_balance" + echo "profit: $user1_profit" +else + echo "error: depositor ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user1_ubtc_balance" +fi + +if [ "$user2_ubtc_balance" -lt "$init_user2_ubtc_balance" ]; then + echo "pass: trader ubtc balance is correct: $user2_ubtc_balance" + echo "loss: $user2_loss" +else + echo "error: ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user2_ubtc_balance" +fi \ No newline at end of file diff --git a/x/derivatives/keeper/test/08_position_send_nft.sh b/x/derivatives/keeper/test/08_position_send_nft.sh new file mode 100644 index 000000000..7ba5e474f --- /dev/null +++ b/x/derivatives/keeper/test/08_position_send_nft.sh @@ -0,0 +1,93 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +user3_address=ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6 +init_ubtc_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom ubtc -o json | jq .amount | tr -d '"') +init_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') +init_user3_ubtc_balance=$(ununifid q bank balances $user3_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------check nft------------" +ununifid q nft nft derivatives/perpetual_futures/positions 1 + +echo "------------position opened user------------" +ununifid q derivatives positions $user2_address + +echo "------------nft send------------" +ununifid tx nft send derivatives/perpetual_futures/positions 1 $user3_address \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------position nft owner------------" +ununifid q derivatives positions $user3_address + +sleep $sleep + +echo "------------close position------------" +ununifid tx derivatives close-position 1 \ +--from user3 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------closed position nft owner------------" +ununifid q derivatives positions $user3_address + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user1_ubtc_balance=$(ununifid q bank balances $user1_address --denom ubtc -o json | jq .amount | tr -d '"') +user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') +user3_ubtc_balance=$(ununifid q bank balances $user3_address --denom ubtc -o json | jq .amount | tr -d '"') +user1_profit=$(($user1_ubtc_balance - $init_ubtc_balance)) +user2_loss=$(($init_user2_ubtc_balance - $user2_ubtc_balance)) +user3_profit=$(($user3_ubtc_balance - $init_ubtc_balance)) + +if [ "$user1_ubtc_balance" -gt "$init_ubtc_balance" ]; then + echo "pass: depositer ubtc balance is correct: $user1_ubtc_balance" + echo "loss $user1_loss" +else + echo "error: depositor ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user1_ubtc_balance" +fi + +if [ "$user2_ubtc_balance" -lt "$init_user2_ubtc_balance" ]; then + echo "pass: trader ubtc balance is correct: $user2_ubtc_balance" + echo "profit $user2_profit" +else + echo "error: trader ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user2_ubtc_balance" +fi + +if [ "$user3_ubtc_balance" -gt "$init_user3_ubtc_balance" ]; then + echo "pass: nft owner ubtc balance is correct: $user3_ubtc_balance" + echo "profit $user3_profit" +else + echo "error: nft owner ubtc balance is incorrect" + echo "initial: $init_ubtc_balance actual: $user3_ubtc_balance" +fi + +echo "------------check nft not exist------------" +ununifid q nft nft derivatives/perpetual_futures/positions 1 \ No newline at end of file diff --git a/x/derivatives/keeper/test/09_position_pending_payment.sh b/x/derivatives/keeper/test/09_position_pending_payment.sh new file mode 100644 index 000000000..8576d6d1c --- /dev/null +++ b/x/derivatives/keeper/test/09_position_pending_payment.sh @@ -0,0 +1,99 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla +init_user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------deposit to pool 1st------------" +ununifid tx derivatives deposit-to-pool 100000000ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user1_udlp_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom udlp -o json | jq .amount | tr -d '"') + +ununifid tx pricefeed postprice ubtc:usd 0.024508410211260500 1200 \ +--from=pricefeed --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------open position------------" +ununifid tx derivatives open-position perpetual-futures 10000000ubtc ubtc uusdc long 40 4 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------position opened user------------" +ununifid q derivatives positions $user2_address + +echo "------------nft listing------------" +ununifid tx nftbackedloan list derivatives/perpetual_futures/positions 1 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------check nft send disabled------------" +ununifid q nft nft derivatives/perpetual_futures/positions 1 + +echo "------------price change------------" +ununifid tx pricefeed postprice ubtc:usd 0.020508410211260500 1200 \ +--from=pricefeed --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------report liquidation------------" +ununifid tx derivatives report-liquidation 1 $user1_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------liquidated position------------" +ununifid q derivatives positions $user2_address + +echo "------------withdraw from pool------------" +ununifid tx derivatives withdraw-from-pool $user1_udlp_balance ubtc \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------ubtc balance check------------" +user2_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') +expected_user2_ubtc_balance=$(($init_user2_ubtc_balance - 10000000)) + +if [ "$user2_ubtc_balance" = "$expected_user2_ubtc_balance" ]; then + echo "pass: trader ubtc balance is correct: $user2_ubtc_balance" +else + echo "error: trader ubtc balance is incorrect" + echo "expected: $expected_user2_ubtc_balance actual: $user2_ubtc_balance" +fi + +echo "------------nft cancel listing------------" +ununifid tx nftbackedloan cancel-listing derivatives/perpetual_futures/positions 1 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------check nft send enabled------------" +ununifid q nft nft derivatives/perpetual_futures/positions 1 + +echo "------------close position------------" +ununifid tx derivatives close-position 1 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +user2_closed_ubtc_balance=$(ununifid q bank balances $user2_address --denom ubtc -o json | jq .amount | tr -d '"') + +echo "------------ubtc balance check------------" +if [ "$user2_closed_ubtc_balance" -gt "$user2_ubtc_balance" ]; then + echo "pass: trader ubtc balance is correct: $user2_closed_ubtc_balance" +else + echo "error: trader ubtc balance is incorrect" + echo "before closed: $user2_ubtc_balance after closed: $user2_closed_ubtc_balance" +fi + +echo "------------check nft not exist------------" +ununifid q nft nft derivatives/perpetual_futures/positions 1 diff --git a/x/derivatives/keeper/test/README.md b/x/derivatives/keeper/test/README.md new file mode 100644 index 000000000..a0e3bcf29 --- /dev/null +++ b/x/derivatives/keeper/test/README.md @@ -0,0 +1,60 @@ +# NFT Backed Loan Keeper Test + +Before run debug `build then launch` + +The chain must be initialized before each test is run. +When re-run same script, chain needs to be initialized. + +Test DLP exchanges at Pool and token transfers in perpetual-futures positions + +## Pool + +### 01_pool_all_withdraw + +Test token transfers and changes in DLP prices when all DLP are burned. + +- If all DLPs are burned, the rate returns to 0 and the initial rate (1:1 regardless of tokens) is applied to the next deposit +- After everything is burned, depositor will get back all tokens but the fee. + +### 02_selling_decision_no_paid + +Test token transfers and DLP price if 1udlp is left and the other is burned. + +- When 1udlp remains, the pool has 1 token, thus maintaining the initial rate of 1:1. + +### 03_pool_liquidation + +Test token transfers when position is happened Levy Period. + +- Traders suffer losses from falling prices. +- Fees and losses go into the pool. + +### 04_pool_levy_period + +Test token transfers when Levy Period occurs and swap fees are taken from positions. + +- Traders lose swap fees. +- The reporter gets a portion of the fee. Under the current spec, the module account (Pool). +- The NFT return to lister + +### 05_pool_withdraw_opened_position + +Test that the Pool balance used to open a position cannot be withdrawn by the depositor. + +- Pool balance is locked and the depositor's withdrawal fails. + +## Perpetual Futures Position + +### 06_position_close_price_up + +Test token transfers when closing a position during a price increase + +- Traders get profits from price increases. +- Pool loses for that. + +### 07_position_close_price_down + +Test token transfers when closing a position during a price decrease + +- Traders suffer losses from falling prices. +- Pool benefits from that. diff --git a/x/derivatives/keeper/yield.go b/x/derivatives/keeper/yield.go index b974cde3d..b45efab72 100644 --- a/x/derivatives/keeper/yield.go +++ b/x/derivatives/keeper/yield.go @@ -28,7 +28,6 @@ func (k Keeper) GetBlockTimestamp(ctx sdk.Context, height int64) time.Time { func (k Keeper) GetLPTPriceFromSnapshot(ctx sdk.Context, height int64) sdk.Dec { poolMarketCap := k.GetPoolMarketCapSnapshot(ctx, height) lptSupply := k.GetLPTokenSupplySnapshot(ctx, height) - lptPrice := poolMarketCap.CalculateLPTokenPrice(lptSupply) return lptPrice } @@ -38,7 +37,6 @@ func (k Keeper) GetLPNominalYieldRate(ctx sdk.Context, beforeHeight int64, after if lptPriceBefore.IsZero() { return sdk.ZeroDec() } - lptPriceAfter := sdk.ZeroDec() if afterHeight > ctx.BlockHeight() { return sdk.ZeroDec() @@ -49,7 +47,6 @@ func (k Keeper) GetLPNominalYieldRate(ctx sdk.Context, beforeHeight int64, after } diff := lptPriceAfter.Sub(lptPriceBefore) - return diff.Quo(lptPriceBefore) } @@ -103,7 +100,6 @@ func (k Keeper) GetLPRealYieldRate(ctx sdk.Context, beforeHeight int64, afterHei func (k Keeper) AnnualizeYieldRate(ctx sdk.Context, yieldRate sdk.Dec, beforeHeight int64, afterHeight int64) sdk.Dec { beforeBlockTimestamp := k.GetBlockTimestamp(ctx, beforeHeight).Unix() afterBlockTimestamp := k.GetBlockTimestamp(ctx, afterHeight).Unix() - if beforeBlockTimestamp == afterBlockTimestamp { return sdk.ZeroDec() } diff --git a/x/derivatives/keeper/yield_test.go b/x/derivatives/keeper/yield_test.go index 3880c8ea9..ebde92358 100644 --- a/x/derivatives/keeper/yield_test.go +++ b/x/derivatives/keeper/yield_test.go @@ -9,7 +9,6 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" "github.com/UnUniFi/chain/x/derivatives/types" pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" ) @@ -80,7 +79,7 @@ func (suite *KeeperTestSuite) TestGetLPNominalYieldRate() { suite.Require().NoError(err) params := suite.app.PricefeedKeeper.GetParams(suite.ctx) params.Markets = []pricefeedtypes.Market{ - {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []ununifitypes.StringAccAddress{}, Active: true}, + {MarketId: "uatom:uusdc", BaseAsset: "uatom", QuoteAsset: "uusdc", Oracles: []string{}, Active: true}, } suite.app.PricefeedKeeper.SetParams(suite.ctx, params) err = suite.app.PricefeedKeeper.SetCurrentPrices(suite.ctx, "uatom:uusdc") @@ -93,10 +92,26 @@ func (suite *KeeperTestSuite) TestGetLPNominalYieldRate() { // check current height rate pastLptPrice := suite.keeper.GetLPTPriceFromSnapshot(suite.ctx, 1) suite.Require().Equal(pastLptPrice.String(), "100.000000000000000000") + + //set market cap - uatom_balance: 1000000 + err = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{sdk.NewInt64Coin("uatom", 1000000)}) + suite.Require().NoError(err) + + //lptoken supply 1000000 + //uatom_balance: 1000000 + //set uatom:usd price: 0.00001 in keeper_test.go + //total in marketcap = uatom_balance * price = 10 + //lpTokenPrice = total/lptoken_supply = 10/1000000 = 0.00001 currLptPrice := suite.keeper.GetLPTokenPrice(suite.ctx) - suite.Require().Equal(currLptPrice.String(), "0.000015280000000000") + suite.Require().Equal(currLptPrice.String(), "0.000010000000000000") + + //blockHeight: 20 + //lptoken_price in height 1 is 100 + //current lptoken_price is 0.00001 + //diff = current_lptoken_price - old_lptoken_price_in_snapshot + //currentRate = diff/before_price ( (0.00001 - 100)/ 100 ) currentRate := suite.keeper.GetLPNominalYieldRate(suite.ctx, 1, suite.ctx.BlockHeight()) - suite.Require().Equal(currentRate.String(), "-0.999999847200000000") + suite.Require().Equal(currentRate.String(), "-0.999999900000000000") } func (suite *KeeperTestSuite) TestGetInflationRateOfAssetsInPool() { diff --git a/x/derivatives/simulation/genesis.go b/x/derivatives/simulation/genesis.go index 3f8feeb63..de79b0db0 100644 --- a/x/derivatives/simulation/genesis.go +++ b/x/derivatives/simulation/genesis.go @@ -39,6 +39,7 @@ func RandomizedGenState(simState *module.SimulationState) { TargetWeight: sdk.NewDecWithPrec(1, 3), }, }, + LevyPeriodRequiredSeconds: 28800, }, PerpetualFutures: types.PerpetualFuturesParams{ CommissionRate: sdk.NewDecWithPrec(1, 3), diff --git a/x/derivatives/simulation/genesis_test.go b/x/derivatives/simulation/genesis_test.go index e8e9c27c3..e9ec4d956 100644 --- a/x/derivatives/simulation/genesis_test.go +++ b/x/derivatives/simulation/genesis_test.go @@ -47,6 +47,7 @@ func TestRandomizedGenState(t *testing.T) { assert.Equal(t, derivativesGenesis.Params.PoolParams.BorrowingFeeRatePerHour, sdk.NewDecWithPrec(1, 6)) assert.Equal(t, derivativesGenesis.Params.PoolParams.ReportLiquidationRewardRate, sdk.NewDecWithPrec(3, 1)) assert.Equal(t, derivativesGenesis.Params.PoolParams.ReportLevyPeriodRewardRate, sdk.NewDecWithPrec(3, 1)) + assert.Equal(t, derivativesGenesis.Params.PoolParams.LevyPeriodRequiredSeconds, uint64(28800)) assert.Equal(t, derivativesGenesis.Params.PerpetualFutures.CommissionRate, sdk.NewDecWithPrec(1, 3)) assert.Equal(t, derivativesGenesis.Params.PerpetualFutures.MarginMaintenanceRate, sdk.NewDecWithPrec(5, 1)) assert.Equal(t, derivativesGenesis.Params.PerpetualFutures.ImaginaryFundingRateProportionalCoefficient, sdk.NewDecWithPrec(5, 4)) diff --git a/x/derivatives/types/codec.go b/x/derivatives/types/codec.go index ca2458536..5822d4636 100644 --- a/x/derivatives/types/codec.go +++ b/x/derivatives/types/codec.go @@ -22,6 +22,8 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgClosePosition{}, &MsgReportLiquidation{}, &MsgReportLevyPeriod{}, + &MsgAddMargin{}, + &MsgRemoveMargin{}, ) registry.RegisterImplementations((*PositionInstance)(nil), &PerpetualFuturesPositionInstance{}, diff --git a/x/derivatives/types/derivatives.pb.go b/x/derivatives/types/derivatives.pb.go index 1466c7c90..7c22eeb77 100644 --- a/x/derivatives/types/derivatives.pb.go +++ b/x/derivatives/types/derivatives.pb.go @@ -88,16 +88,18 @@ func (MarketType) EnumDescriptor() ([]byte, []int) { } type Position struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` - Market Market `protobuf:"bytes,2,opt,name=market,proto3" json:"market" yaml:"market"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` - OpenedAt time.Time `protobuf:"bytes,4,opt,name=opened_at,json=openedAt,proto3,stdtime" json:"opened_at" yaml:"opened_at"` - OpenedHeight uint64 `protobuf:"varint,5,opt,name=opened_height,json=openedHeight,proto3" json:"opened_height,omitempty" yaml:"opened_height"` - OpenedBaseRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=opened_base_rate,json=openedBaseRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_base_rate" yaml:"opened_base_rate"` - OpenedQuoteRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=opened_quote_rate,json=openedQuoteRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_quote_rate" yaml:"opened_quote_rate"` - RemainingMargin types.Coin `protobuf:"bytes,8,opt,name=remaining_margin,json=remainingMargin,proto3" json:"remaining_margin" yaml:"remaining_margin"` - LastLeviedAt time.Time `protobuf:"bytes,9,opt,name=last_levied_at,json=lastLeviedAt,proto3,stdtime" json:"last_levied_at" yaml:"last_levied_at"` - PositionInstance types1.Any `protobuf:"bytes,10,opt,name=position_instance,json=positionInstance,proto3" json:"position_instance" yaml:"position_instance"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` + Market Market `protobuf:"bytes,2,opt,name=market,proto3" json:"market" yaml:"market"` + OpenerAddress string `protobuf:"bytes,3,opt,name=opener_address,json=openerAddress,proto3" json:"opener_address,omitempty" yaml:"opener_address"` + OpenedAt time.Time `protobuf:"bytes,4,opt,name=opened_at,json=openedAt,proto3,stdtime" json:"opened_at" yaml:"opened_at"` + OpenedHeight uint64 `protobuf:"varint,5,opt,name=opened_height,json=openedHeight,proto3" json:"opened_height,omitempty" yaml:"opened_height"` + OpenedBaseRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=opened_base_rate,json=openedBaseRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_base_rate" yaml:"opened_base_rate"` + OpenedQuoteRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=opened_quote_rate,json=openedQuoteRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_quote_rate" yaml:"opened_quote_rate"` + RemainingMargin types.Coin `protobuf:"bytes,8,opt,name=remaining_margin,json=remainingMargin,proto3" json:"remaining_margin" yaml:"remaining_margin"` + LeviedAmount types.Coin `protobuf:"bytes,9,opt,name=levied_amount,json=leviedAmount,proto3" json:"levied_amount" yaml:"levied_amount"` + LeviedAmountNegative bool `protobuf:"varint,10,opt,name=levied_amount_negative,json=leviedAmountNegative,proto3" json:"levied_amount_negative,omitempty" yaml:"levied_amount_negative"` + LastLeviedAt time.Time `protobuf:"bytes,11,opt,name=last_levied_at,json=lastLeviedAt,proto3,stdtime" json:"last_levied_at" yaml:"last_levied_at"` + PositionInstance types1.Any `protobuf:"bytes,12,opt,name=position_instance,json=positionInstance,proto3" json:"position_instance" yaml:"position_instance"` } func (m *Position) Reset() { *m = Position{} } @@ -147,9 +149,9 @@ func (m *Position) GetMarket() Market { return Market{} } -func (m *Position) GetAddress() string { +func (m *Position) GetOpenerAddress() string { if m != nil { - return m.Address + return m.OpenerAddress } return "" } @@ -175,6 +177,20 @@ func (m *Position) GetRemainingMargin() types.Coin { return types.Coin{} } +func (m *Position) GetLeviedAmount() types.Coin { + if m != nil { + return m.LeviedAmount + } + return types.Coin{} +} + +func (m *Position) GetLeviedAmountNegative() bool { + if m != nil { + return m.LeviedAmountNegative + } + return false +} + func (m *Position) GetLastLeviedAt() time.Time { if m != nil { return m.LastLeviedAt @@ -189,6 +205,74 @@ func (m *Position) GetPositionInstance() types1.Any { return types1.Any{} } +type PendingPaymentPosition struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` + RefundableAmount types.Coin `protobuf:"bytes,2,opt,name=refundable_amount,json=refundableAmount,proto3" json:"refundable_amount" yaml:"refundable_amount"` + CreatedAt time.Time `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at" yaml:"created_at"` + CreatedHeight uint64 `protobuf:"varint,4,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty" yaml:"created_height"` +} + +func (m *PendingPaymentPosition) Reset() { *m = PendingPaymentPosition{} } +func (m *PendingPaymentPosition) String() string { return proto.CompactTextString(m) } +func (*PendingPaymentPosition) ProtoMessage() {} +func (*PendingPaymentPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{1} +} +func (m *PendingPaymentPosition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingPaymentPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingPaymentPosition.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PendingPaymentPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingPaymentPosition.Merge(m, src) +} +func (m *PendingPaymentPosition) XXX_Size() int { + return m.Size() +} +func (m *PendingPaymentPosition) XXX_DiscardUnknown() { + xxx_messageInfo_PendingPaymentPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingPaymentPosition proto.InternalMessageInfo + +func (m *PendingPaymentPosition) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *PendingPaymentPosition) GetRefundableAmount() types.Coin { + if m != nil { + return m.RefundableAmount + } + return types.Coin{} +} + +func (m *PendingPaymentPosition) GetCreatedAt() time.Time { + if m != nil { + return m.CreatedAt + } + return time.Time{} +} + +func (m *PendingPaymentPosition) GetCreatedHeight() uint64 { + if m != nil { + return m.CreatedHeight + } + return 0 +} + type QueriedPosition struct { Position Position `protobuf:"bytes,1,opt,name=position,proto3" json:"position" yaml:"position"` ValuationProfit types.Coin `protobuf:"bytes,2,opt,name=valuation_profit,json=valuationProfit,proto3" json:"valuation_profit" yaml:"valuation_profit"` @@ -201,7 +285,7 @@ func (m *QueriedPosition) Reset() { *m = QueriedPosition{} } func (m *QueriedPosition) String() string { return proto.CompactTextString(m) } func (*QueriedPosition) ProtoMessage() {} func (*QueriedPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{1} + return fileDescriptor_5a25a5cf1b44b970, []int{2} } func (m *QueriedPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -260,7 +344,7 @@ func (m *PoolAssetConf) Reset() { *m = PoolAssetConf{} } func (m *PoolAssetConf) String() string { return proto.CompactTextString(m) } func (*PoolAssetConf) ProtoMessage() {} func (*PoolAssetConf) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{2} + return fileDescriptor_5a25a5cf1b44b970, []int{3} } func (m *PoolAssetConf) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -304,13 +388,14 @@ type PoolParams struct { ReportLiquidationRewardRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=report_liquidation_reward_rate,json=reportLiquidationRewardRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"report_liquidation_reward_rate" yaml:"report_liquidation_reward_rate"` ReportLevyPeriodRewardRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=report_levy_period_reward_rate,json=reportLevyPeriodRewardRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"report_levy_period_reward_rate" yaml:"report_levy_period_reward_rate"` AcceptedAssetsConf []PoolAssetConf `protobuf:"bytes,7,rep,name=accepted_assets_conf,json=acceptedAssetsConf,proto3" json:"accepted_assets_conf" yaml:"accepted_assets_conf"` + LevyPeriodRequiredSeconds uint64 `protobuf:"varint,8,opt,name=levy_period_required_seconds,json=levyPeriodRequiredSeconds,proto3" json:"levy_period_required_seconds,omitempty" yaml:"levy_period_required_seconds"` } func (m *PoolParams) Reset() { *m = PoolParams{} } func (m *PoolParams) String() string { return proto.CompactTextString(m) } func (*PoolParams) ProtoMessage() {} func (*PoolParams) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{3} + return fileDescriptor_5a25a5cf1b44b970, []int{4} } func (m *PoolParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -353,6 +438,13 @@ func (m *PoolParams) GetAcceptedAssetsConf() []PoolAssetConf { return nil } +func (m *PoolParams) GetLevyPeriodRequiredSeconds() uint64 { + if m != nil { + return m.LevyPeriodRequiredSeconds + } + return 0 +} + type PoolMarketCap struct { QuoteTicker string `protobuf:"bytes,1,opt,name=quote_ticker,json=quoteTicker,proto3" json:"quote_ticker,omitempty" yaml:"quote_ticker"` Total github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=total,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total" yaml:"total"` @@ -363,7 +455,7 @@ func (m *PoolMarketCap) Reset() { *m = PoolMarketCap{} } func (m *PoolMarketCap) String() string { return proto.CompactTextString(m) } func (*PoolMarketCap) ProtoMessage() {} func (*PoolMarketCap) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{4} + return fileDescriptor_5a25a5cf1b44b970, []int{5} } func (m *PoolMarketCap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -417,7 +509,7 @@ func (m *PoolMarketCap_AssetInfo) Reset() { *m = PoolMarketCap_AssetInfo func (m *PoolMarketCap_AssetInfo) String() string { return proto.CompactTextString(m) } func (*PoolMarketCap_AssetInfo) ProtoMessage() {} func (*PoolMarketCap_AssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{4, 0} + return fileDescriptor_5a25a5cf1b44b970, []int{5, 0} } func (m *PoolMarketCap_AssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -462,7 +554,7 @@ func (m *Market) Reset() { *m = Market{} } func (m *Market) String() string { return proto.CompactTextString(m) } func (*Market) ProtoMessage() {} func (*Market) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{5} + return fileDescriptor_5a25a5cf1b44b970, []int{6} } func (m *Market) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -505,22 +597,74 @@ func (m *Market) GetQuoteDenom() string { return "" } -type EventPriceIsNotFeeded struct { +type Reserve struct { + MarketType MarketType `protobuf:"varint,1,opt,name=market_type,json=marketType,proto3,enum=ununifi.derivatives.MarketType" json:"market_type,omitempty" yaml:"market_type"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` +} + +func (m *Reserve) Reset() { *m = Reserve{} } +func (m *Reserve) String() string { return proto.CompactTextString(m) } +func (*Reserve) ProtoMessage() {} +func (*Reserve) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{7} +} +func (m *Reserve) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Reserve) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Reserve.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Reserve) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reserve.Merge(m, src) +} +func (m *Reserve) XXX_Size() int { + return m.Size() +} +func (m *Reserve) XXX_DiscardUnknown() { + xxx_messageInfo_Reserve.DiscardUnknown(m) +} + +var xxx_messageInfo_Reserve proto.InternalMessageInfo + +func (m *Reserve) GetMarketType() MarketType { + if m != nil { + return m.MarketType + } + return MarketType_UNKNOWN +} + +func (m *Reserve) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +type EventPriceIsNotFed struct { Asset string `protobuf:"bytes,1,opt,name=asset,proto3" json:"asset,omitempty" yaml:"asset"` } -func (m *EventPriceIsNotFeeded) Reset() { *m = EventPriceIsNotFeeded{} } -func (m *EventPriceIsNotFeeded) String() string { return proto.CompactTextString(m) } -func (*EventPriceIsNotFeeded) ProtoMessage() {} -func (*EventPriceIsNotFeeded) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{6} +func (m *EventPriceIsNotFed) Reset() { *m = EventPriceIsNotFed{} } +func (m *EventPriceIsNotFed) String() string { return proto.CompactTextString(m) } +func (*EventPriceIsNotFed) ProtoMessage() {} +func (*EventPriceIsNotFed) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{8} } -func (m *EventPriceIsNotFeeded) XXX_Unmarshal(b []byte) error { +func (m *EventPriceIsNotFed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventPriceIsNotFeeded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventPriceIsNotFed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventPriceIsNotFeeded.Marshal(b, m, deterministic) + return xxx_messageInfo_EventPriceIsNotFed.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -530,42 +674,42 @@ func (m *EventPriceIsNotFeeded) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *EventPriceIsNotFeeded) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPriceIsNotFeeded.Merge(m, src) +func (m *EventPriceIsNotFed) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPriceIsNotFed.Merge(m, src) } -func (m *EventPriceIsNotFeeded) XXX_Size() int { +func (m *EventPriceIsNotFed) XXX_Size() int { return m.Size() } -func (m *EventPriceIsNotFeeded) XXX_DiscardUnknown() { - xxx_messageInfo_EventPriceIsNotFeeded.DiscardUnknown(m) +func (m *EventPriceIsNotFed) XXX_DiscardUnknown() { + xxx_messageInfo_EventPriceIsNotFed.DiscardUnknown(m) } -var xxx_messageInfo_EventPriceIsNotFeeded proto.InternalMessageInfo +var xxx_messageInfo_EventPriceIsNotFed proto.InternalMessageInfo -func (m *EventPriceIsNotFeeded) GetAsset() string { +func (m *EventPriceIsNotFed) GetAsset() string { if m != nil { return m.Asset } return "" } -type Reserve struct { - MarketType MarketType `protobuf:"varint,1,opt,name=market_type,json=marketType,proto3,enum=ununifi.derivatives.MarketType" json:"market_type,omitempty" yaml:"market_type"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` +type EventPerpetualFuturesLevyFee struct { + Fee types.Coin `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee" yaml:"fee"` + PositionId string `protobuf:"bytes,2,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty" yaml:"position_id"` } -func (m *Reserve) Reset() { *m = Reserve{} } -func (m *Reserve) String() string { return proto.CompactTextString(m) } -func (*Reserve) ProtoMessage() {} -func (*Reserve) Descriptor() ([]byte, []int) { - return fileDescriptor_5a25a5cf1b44b970, []int{7} +func (m *EventPerpetualFuturesLevyFee) Reset() { *m = EventPerpetualFuturesLevyFee{} } +func (m *EventPerpetualFuturesLevyFee) String() string { return proto.CompactTextString(m) } +func (*EventPerpetualFuturesLevyFee) ProtoMessage() {} +func (*EventPerpetualFuturesLevyFee) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{9} } -func (m *Reserve) XXX_Unmarshal(b []byte) error { +func (m *EventPerpetualFuturesLevyFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Reserve) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventPerpetualFuturesLevyFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Reserve.Marshal(b, m, deterministic) + return xxx_messageInfo_EventPerpetualFuturesLevyFee.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -575,44 +719,207 @@ func (m *Reserve) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Reserve) XXX_Merge(src proto.Message) { - xxx_messageInfo_Reserve.Merge(m, src) +func (m *EventPerpetualFuturesLevyFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPerpetualFuturesLevyFee.Merge(m, src) } -func (m *Reserve) XXX_Size() int { +func (m *EventPerpetualFuturesLevyFee) XXX_Size() int { return m.Size() } -func (m *Reserve) XXX_DiscardUnknown() { - xxx_messageInfo_Reserve.DiscardUnknown(m) +func (m *EventPerpetualFuturesLevyFee) XXX_DiscardUnknown() { + xxx_messageInfo_EventPerpetualFuturesLevyFee.DiscardUnknown(m) } -var xxx_messageInfo_Reserve proto.InternalMessageInfo +var xxx_messageInfo_EventPerpetualFuturesLevyFee proto.InternalMessageInfo -func (m *Reserve) GetMarketType() MarketType { +func (m *EventPerpetualFuturesLevyFee) GetFee() types.Coin { if m != nil { - return m.MarketType + return m.Fee } - return MarketType_UNKNOWN + return types.Coin{} } -func (m *Reserve) GetAmount() types.Coin { +func (m *EventPerpetualFuturesLevyFee) GetPositionId() string { if m != nil { - return m.Amount + return m.PositionId + } + return "" +} + +type EventPerpetualFuturesImaginaryFundingFee struct { + Fee types.Coin `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee" yaml:"fee"` + FeeNegative bool `protobuf:"varint,3,opt,name=fee_negative,json=feeNegative,proto3" json:"fee_negative,omitempty" yaml:"fee_negative"` + PositionId string `protobuf:"bytes,2,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty" yaml:"position_id"` +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) Reset() { + *m = EventPerpetualFuturesImaginaryFundingFee{} +} +func (m *EventPerpetualFuturesImaginaryFundingFee) String() string { return proto.CompactTextString(m) } +func (*EventPerpetualFuturesImaginaryFundingFee) ProtoMessage() {} +func (*EventPerpetualFuturesImaginaryFundingFee) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{10} +} +func (m *EventPerpetualFuturesImaginaryFundingFee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPerpetualFuturesImaginaryFundingFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPerpetualFuturesImaginaryFundingFee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPerpetualFuturesImaginaryFundingFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPerpetualFuturesImaginaryFundingFee.Merge(m, src) +} +func (m *EventPerpetualFuturesImaginaryFundingFee) XXX_Size() int { + return m.Size() +} +func (m *EventPerpetualFuturesImaginaryFundingFee) XXX_DiscardUnknown() { + xxx_messageInfo_EventPerpetualFuturesImaginaryFundingFee.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPerpetualFuturesImaginaryFundingFee proto.InternalMessageInfo + +func (m *EventPerpetualFuturesImaginaryFundingFee) GetFee() types.Coin { + if m != nil { + return m.Fee + } + return types.Coin{} +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) GetFeeNegative() bool { + if m != nil { + return m.FeeNegative + } + return false +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) GetPositionId() string { + if m != nil { + return m.PositionId + } + return "" +} + +type EventPerpetualFuturesLiquidationFee struct { + Fee types.Coin `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee" yaml:"fee"` + PositionId string `protobuf:"bytes,2,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty" yaml:"position_id"` +} + +func (m *EventPerpetualFuturesLiquidationFee) Reset() { *m = EventPerpetualFuturesLiquidationFee{} } +func (m *EventPerpetualFuturesLiquidationFee) String() string { return proto.CompactTextString(m) } +func (*EventPerpetualFuturesLiquidationFee) ProtoMessage() {} +func (*EventPerpetualFuturesLiquidationFee) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{11} +} +func (m *EventPerpetualFuturesLiquidationFee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPerpetualFuturesLiquidationFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPerpetualFuturesLiquidationFee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPerpetualFuturesLiquidationFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPerpetualFuturesLiquidationFee.Merge(m, src) +} +func (m *EventPerpetualFuturesLiquidationFee) XXX_Size() int { + return m.Size() +} +func (m *EventPerpetualFuturesLiquidationFee) XXX_DiscardUnknown() { + xxx_messageInfo_EventPerpetualFuturesLiquidationFee.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPerpetualFuturesLiquidationFee proto.InternalMessageInfo + +func (m *EventPerpetualFuturesLiquidationFee) GetFee() types.Coin { + if m != nil { + return m.Fee } return types.Coin{} } +func (m *EventPerpetualFuturesLiquidationFee) GetPositionId() string { + if m != nil { + return m.PositionId + } + return "" +} + +type EventLiquidationNeeded struct { + PositionId string `protobuf:"bytes,1,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty" yaml:"position_id"` +} + +func (m *EventLiquidationNeeded) Reset() { *m = EventLiquidationNeeded{} } +func (m *EventLiquidationNeeded) String() string { return proto.CompactTextString(m) } +func (*EventLiquidationNeeded) ProtoMessage() {} +func (*EventLiquidationNeeded) Descriptor() ([]byte, []int) { + return fileDescriptor_5a25a5cf1b44b970, []int{12} +} +func (m *EventLiquidationNeeded) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventLiquidationNeeded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventLiquidationNeeded.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventLiquidationNeeded) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventLiquidationNeeded.Merge(m, src) +} +func (m *EventLiquidationNeeded) XXX_Size() int { + return m.Size() +} +func (m *EventLiquidationNeeded) XXX_DiscardUnknown() { + xxx_messageInfo_EventLiquidationNeeded.DiscardUnknown(m) +} + +var xxx_messageInfo_EventLiquidationNeeded proto.InternalMessageInfo + +func (m *EventLiquidationNeeded) GetPositionId() string { + if m != nil { + return m.PositionId + } + return "" +} + func init() { proto.RegisterEnum("ununifi.derivatives.PositionType", PositionType_name, PositionType_value) proto.RegisterEnum("ununifi.derivatives.MarketType", MarketType_name, MarketType_value) proto.RegisterType((*Position)(nil), "ununifi.derivatives.Position") + proto.RegisterType((*PendingPaymentPosition)(nil), "ununifi.derivatives.PendingPaymentPosition") proto.RegisterType((*QueriedPosition)(nil), "ununifi.derivatives.QueriedPosition") proto.RegisterType((*PoolAssetConf)(nil), "ununifi.derivatives.PoolAssetConf") proto.RegisterType((*PoolParams)(nil), "ununifi.derivatives.PoolParams") proto.RegisterType((*PoolMarketCap)(nil), "ununifi.derivatives.PoolMarketCap") proto.RegisterType((*PoolMarketCap_AssetInfo)(nil), "ununifi.derivatives.PoolMarketCap.AssetInfo") proto.RegisterType((*Market)(nil), "ununifi.derivatives.Market") - proto.RegisterType((*EventPriceIsNotFeeded)(nil), "ununifi.derivatives.EventPriceIsNotFeeded") proto.RegisterType((*Reserve)(nil), "ununifi.derivatives.Reserve") + proto.RegisterType((*EventPriceIsNotFed)(nil), "ununifi.derivatives.EventPriceIsNotFed") + proto.RegisterType((*EventPerpetualFuturesLevyFee)(nil), "ununifi.derivatives.EventPerpetualFuturesLevyFee") + proto.RegisterType((*EventPerpetualFuturesImaginaryFundingFee)(nil), "ununifi.derivatives.EventPerpetualFuturesImaginaryFundingFee") + proto.RegisterType((*EventPerpetualFuturesLiquidationFee)(nil), "ununifi.derivatives.EventPerpetualFuturesLiquidationFee") + proto.RegisterType((*EventLiquidationNeeded)(nil), "ununifi.derivatives.EventLiquidationNeeded") } func init() { @@ -620,97 +927,118 @@ func init() { } var fileDescriptor_5a25a5cf1b44b970 = []byte{ - // 1440 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5b, 0x4f, 0x1b, 0xc7, - 0x1e, 0x67, 0x09, 0x37, 0x0f, 0x37, 0x33, 0x81, 0x60, 0xe0, 0xc4, 0xe6, 0xcc, 0x51, 0x22, 0x14, - 0xe5, 0xd8, 0x0a, 0x39, 0xd2, 0x51, 0x23, 0xb5, 0x11, 0x4e, 0x42, 0x21, 0x05, 0xec, 0x0c, 0xa6, - 0x54, 0x95, 0xaa, 0xd5, 0xb0, 0x3b, 0x36, 0x23, 0xbc, 0x3b, 0x9b, 0xdd, 0xb1, 0xa9, 0xd5, 0xe7, - 0x4a, 0xed, 0x5b, 0xd4, 0xd7, 0xf6, 0xb1, 0xaf, 0xfd, 0x10, 0x7d, 0xa9, 0xf2, 0x52, 0x29, 0x6f, - 0xad, 0xfa, 0xe0, 0x56, 0xc9, 0x37, 0xf0, 0x27, 0xa8, 0xe6, 0xb2, 0xeb, 0x0b, 0x24, 0x8d, 0xd3, - 0x3e, 0xe1, 0xff, 0xed, 0xf7, 0xbf, 0xff, 0x99, 0x05, 0x37, 0x1a, 0x7e, 0xc3, 0x67, 0x55, 0x56, - 0x70, 0x69, 0xc8, 0x9a, 0x44, 0xb0, 0x26, 0x8d, 0x7a, 0x7f, 0xe7, 0x83, 0x90, 0x0b, 0x0e, 0xaf, - 0x1a, 0xb5, 0x7c, 0x8f, 0x68, 0x75, 0xa5, 0xc6, 0x79, 0xad, 0x4e, 0x0b, 0x4a, 0xe5, 0xa4, 0x51, - 0x2d, 0x10, 0xbf, 0xa5, 0xf5, 0x57, 0x17, 0x6b, 0xbc, 0xc6, 0xd5, 0xcf, 0x82, 0xfc, 0x65, 0xb8, - 0xb9, 0x41, 0x03, 0xc1, 0x3c, 0x1a, 0x09, 0xe2, 0x05, 0x46, 0x21, 0xeb, 0xf0, 0xc8, 0xe3, 0x51, - 0xe1, 0x84, 0x44, 0xb4, 0xd0, 0xbc, 0x73, 0x42, 0x05, 0xb9, 0x53, 0x70, 0x38, 0xf3, 0x8d, 0x7c, - 0x45, 0xcb, 0x6d, 0x8d, 0xac, 0x09, 0x2d, 0x42, 0xbf, 0x4c, 0x80, 0xa9, 0x32, 0x8f, 0x98, 0x60, - 0xdc, 0x87, 0xd7, 0xc1, 0x28, 0x73, 0x33, 0xd6, 0xba, 0xb5, 0x91, 0x2a, 0xce, 0x76, 0xda, 0xb9, - 0x54, 0x8b, 0x78, 0xf5, 0x7b, 0x88, 0xb9, 0x08, 0x8f, 0x32, 0x17, 0x3e, 0x06, 0x13, 0x1e, 0x09, - 0xcf, 0xa8, 0xc8, 0x8c, 0xae, 0x5b, 0x1b, 0xd3, 0x9b, 0x6b, 0xf9, 0x4b, 0xd2, 0xcb, 0xef, 0x2b, - 0x95, 0xe2, 0xd2, 0xf3, 0x76, 0x6e, 0xa4, 0xd3, 0xce, 0xcd, 0x6a, 0x0c, 0x6d, 0x88, 0xb0, 0x41, - 0x80, 0xb7, 0xc1, 0x24, 0x71, 0xdd, 0x90, 0x46, 0x51, 0xe6, 0x8a, 0xf2, 0x07, 0x3b, 0xed, 0xdc, - 0x9c, 0xd6, 0x35, 0x02, 0x84, 0x63, 0x15, 0x78, 0x04, 0x52, 0x3c, 0xa0, 0x3e, 0x75, 0x6d, 0x22, - 0x32, 0x63, 0xca, 0xf9, 0x6a, 0x5e, 0x57, 0x25, 0x1f, 0x57, 0x25, 0x5f, 0x89, 0xab, 0x52, 0xfc, - 0x97, 0xf1, 0x9d, 0xd6, 0x78, 0x89, 0x29, 0x7a, 0xf6, 0x7b, 0xce, 0xc2, 0x53, 0x9a, 0xde, 0x12, - 0xf0, 0x7d, 0x30, 0x6b, 0x64, 0xa7, 0x94, 0xd5, 0x4e, 0x45, 0x66, 0x7c, 0xdd, 0xda, 0x18, 0x2b, - 0x66, 0x3a, 0xed, 0xdc, 0x62, 0x9f, 0xa9, 0x16, 0x23, 0x3c, 0xa3, 0xe9, 0x1d, 0x45, 0xc2, 0x08, - 0xa4, 0x8d, 0x5c, 0x16, 0xde, 0x0e, 0x89, 0xa0, 0x99, 0x09, 0x95, 0xcc, 0xae, 0x0c, 0xe0, 0xb7, - 0x76, 0xee, 0x66, 0x8d, 0x89, 0xd3, 0xc6, 0x49, 0xde, 0xe1, 0x9e, 0x29, 0xbb, 0xf9, 0xf3, 0xdf, - 0xc8, 0x3d, 0x2b, 0x88, 0x56, 0x40, 0xa3, 0xfc, 0x43, 0xea, 0x74, 0xda, 0xb9, 0xe5, 0x3e, 0x7f, - 0x09, 0x1e, 0xc2, 0x73, 0x9a, 0x55, 0x24, 0x11, 0xc5, 0x44, 0x50, 0xd8, 0x04, 0x0b, 0x46, 0xe9, - 0x69, 0x83, 0x0b, 0xe3, 0x75, 0x52, 0x79, 0x7d, 0x3c, 0xb4, 0xd7, 0x4c, 0x9f, 0xd7, 0x2e, 0x20, - 0xc2, 0xf3, 0x9a, 0xf7, 0x44, 0xb2, 0x94, 0x5f, 0x0a, 0xd2, 0x21, 0xf5, 0x08, 0xf3, 0x99, 0x5f, - 0xb3, 0x3d, 0x12, 0xd6, 0x98, 0x9f, 0x99, 0x52, 0x9d, 0x58, 0xc9, 0x9b, 0x89, 0x92, 0x51, 0xe7, - 0xcd, 0xf8, 0xe5, 0x1f, 0x70, 0xe6, 0x17, 0x73, 0xa6, 0x11, 0x26, 0xbb, 0x41, 0x00, 0x84, 0xe7, - 0x13, 0xd6, 0xbe, 0xe2, 0x40, 0x07, 0xcc, 0xd5, 0x49, 0x24, 0xec, 0x3a, 0x6d, 0x32, 0xdd, 0xee, - 0xd4, 0x5f, 0xb6, 0xfb, 0xdf, 0xc6, 0xcb, 0x92, 0xf6, 0xd2, 0x6f, 0xaf, 0x7b, 0x3e, 0x23, 0x99, - 0x7b, 0x8a, 0xb7, 0x25, 0xa0, 0x03, 0x16, 0x02, 0x33, 0xf3, 0x36, 0xf3, 0x23, 0x41, 0x7c, 0x87, - 0x66, 0x80, 0xf2, 0xb3, 0x78, 0xc1, 0xcf, 0x96, 0xdf, 0x2a, 0xae, 0x1b, 0x0f, 0xa6, 0x5e, 0x17, - 0x8c, 0x11, 0x4e, 0xc7, 0xbc, 0xdd, 0x98, 0xf5, 0xd3, 0x18, 0x98, 0x7f, 0xd2, 0xa0, 0x21, 0xa3, - 0x6e, 0xb2, 0x60, 0x18, 0x4c, 0xc5, 0x7a, 0x6a, 0xcd, 0xa6, 0x37, 0xaf, 0x5f, 0xba, 0x43, 0xb1, - 0x41, 0x71, 0xd9, 0x38, 0x9e, 0xef, 0x77, 0x8c, 0x70, 0x82, 0x23, 0x1b, 0xd3, 0x24, 0xf5, 0x06, - 0x51, 0x01, 0x05, 0x21, 0xaf, 0xb2, 0x78, 0x3f, 0xdf, 0xbe, 0x31, 0x83, 0x00, 0x08, 0xcf, 0x27, - 0xac, 0xb2, 0xe2, 0xc0, 0x2f, 0x2d, 0x70, 0x6d, 0xb0, 0x7f, 0xb6, 0x54, 0xa2, 0x66, 0x81, 0x4b, - 0x43, 0x4f, 0xdf, 0xf5, 0xcb, 0xa7, 0x42, 0xa3, 0x22, 0xbc, 0x38, 0x30, 0x1b, 0x1f, 0x4b, 0xb6, - 0x4c, 0x97, 0x56, 0xab, 0xd4, 0x91, 0x85, 0x8a, 0xe7, 0x70, 0x6c, 0xc8, 0x74, 0x07, 0x01, 0x10, - 0x9e, 0x4f, 0x58, 0x66, 0x0e, 0xbf, 0xb2, 0xc0, 0xb2, 0x09, 0x47, 0x06, 0x21, 0xa8, 0x2f, 0x9b, - 0xaa, 0xb7, 0x6d, 0x5c, 0xe5, 0x5b, 0x1e, 0x3a, 0xdf, 0x6c, 0x72, 0x0a, 0x2f, 0x83, 0x45, 0x78, - 0x49, 0x4b, 0xf6, 0xbb, 0x02, 0xb9, 0x79, 0xe8, 0x7b, 0x0b, 0xcc, 0x96, 0x39, 0xaf, 0x6f, 0x45, - 0x11, 0x15, 0x0f, 0xb8, 0x5f, 0x85, 0x37, 0xc1, 0xb8, 0x4b, 0x7d, 0xee, 0x99, 0x53, 0x9d, 0xee, - 0xb4, 0x73, 0x33, 0x1a, 0x5b, 0xb1, 0x11, 0xd6, 0x62, 0x78, 0x06, 0x66, 0x05, 0x09, 0x6b, 0x54, - 0xd8, 0xe7, 0xfa, 0xbe, 0x8d, 0x2a, 0xfd, 0xed, 0xa1, 0x23, 0x37, 0xd7, 0xb0, 0x0f, 0x0c, 0xe1, - 0x19, 0x4d, 0x1f, 0x6b, 0xf2, 0xeb, 0x49, 0x00, 0x64, 0x98, 0x65, 0x12, 0x12, 0x2f, 0x82, 0xf7, - 0xc0, 0x8c, 0xbe, 0x27, 0x82, 0x39, 0x67, 0x34, 0x34, 0xa1, 0x2e, 0x77, 0xda, 0xb9, 0xab, 0x1a, - 0xac, 0x57, 0x8a, 0xf0, 0xb4, 0x22, 0x2b, 0x8a, 0x82, 0x0d, 0xb0, 0xa0, 0x2e, 0x60, 0x3d, 0x10, - 0xb6, 0xc7, 0x7c, 0x61, 0x57, 0x29, 0x35, 0xb1, 0xbf, 0xf3, 0x8d, 0xbb, 0x00, 0x88, 0xf0, 0x9c, - 0xe4, 0xed, 0x05, 0x62, 0x9f, 0xf9, 0x62, 0x9b, 0x52, 0xf8, 0x05, 0xb8, 0x9a, 0x68, 0x85, 0xd4, - 0xa5, 0xd4, 0x53, 0x8e, 0xf5, 0x78, 0xef, 0x0d, 0xed, 0x78, 0x75, 0xc0, 0x71, 0x17, 0x12, 0xe1, - 0xb4, 0x71, 0x8d, 0x15, 0x4f, 0x3a, 0xff, 0xc6, 0x02, 0x6b, 0x27, 0x3c, 0x0c, 0xf9, 0xb9, 0xdc, - 0x84, 0x2a, 0xd5, 0x43, 0x61, 0x07, 0x34, 0xb4, 0x4f, 0x79, 0x23, 0x54, 0x33, 0x9e, 0x2a, 0x56, - 0x86, 0x8e, 0x02, 0x99, 0x28, 0x5e, 0x0f, 0x8d, 0xf0, 0x72, 0x22, 0xdd, 0xa6, 0x6a, 0xe6, 0xca, - 0x34, 0xdc, 0xe1, 0x8d, 0x10, 0x7e, 0x67, 0x81, 0x6c, 0x48, 0x03, 0x1e, 0x0a, 0xbb, 0xce, 0x9e, - 0x36, 0x98, 0xab, 0x8f, 0x44, 0x48, 0xcf, 0x49, 0xe8, 0xf6, 0x2e, 0xc3, 0xf1, 0xd0, 0x71, 0xdd, - 0x88, 0x97, 0xff, 0x4d, 0xe8, 0x08, 0xaf, 0x69, 0x85, 0xbd, 0xae, 0x1c, 0x2b, 0xb1, 0xfa, 0x9f, - 0xf4, 0x6d, 0x4f, 0x78, 0xb4, 0xd9, 0x92, 0x19, 0x31, 0xee, 0xf6, 0x85, 0x37, 0xf1, 0xcf, 0x84, - 0x77, 0x39, 0x3a, 0xc2, 0xab, 0x26, 0x3c, 0xda, 0x6c, 0x95, 0x95, 0xb8, 0x27, 0xba, 0x16, 0x58, - 0x24, 0x8e, 0x43, 0x03, 0x21, 0xff, 0x0f, 0xc9, 0xdd, 0x8d, 0x6c, 0x87, 0xfb, 0xd5, 0xcc, 0xe4, - 0xfa, 0x95, 0x8d, 0xe9, 0x4d, 0xf4, 0x9a, 0xc3, 0xdf, 0xb3, 0xe7, 0xc5, 0xff, 0x98, 0xb3, 0xb5, - 0x66, 0xde, 0x45, 0x97, 0xa0, 0x21, 0x0c, 0x63, 0xb6, 0xb2, 0x8b, 0xa4, 0x21, 0xfa, 0x79, 0x4c, - 0x9f, 0x0c, 0xfd, 0x16, 0x7b, 0x40, 0x82, 0xbf, 0xb5, 0x8e, 0x15, 0x30, 0x2e, 0xb8, 0x20, 0x75, - 0xb3, 0x82, 0x1f, 0x0c, 0x5d, 0x4c, 0x73, 0x9c, 0x14, 0x08, 0xc2, 0x1a, 0x0c, 0x56, 0x01, 0x50, - 0x79, 0xd8, 0xcc, 0xaf, 0xf2, 0xcc, 0x15, 0x55, 0x94, 0xdb, 0xaf, 0x2d, 0x4a, 0x92, 0x49, 0x5e, - 0xa5, 0xb9, 0xeb, 0x57, 0x79, 0x71, 0xc5, 0x94, 0x67, 0xc1, 0x94, 0x27, 0x41, 0x43, 0x38, 0x45, - 0x62, 0xad, 0xd5, 0x1f, 0x47, 0x41, 0x2a, 0xb1, 0x79, 0xeb, 0xd3, 0x79, 0x0c, 0x26, 0x88, 0xc7, - 0x1b, 0x7e, 0x7c, 0x33, 0xef, 0x0f, 0x91, 0xf4, 0xae, 0x2f, 0xba, 0x0f, 0x5f, 0x8d, 0x82, 0xb0, - 0x81, 0x93, 0xc5, 0x0c, 0x42, 0xe6, 0xc4, 0x67, 0xe5, 0x9d, 0x8b, 0xa9, 0x40, 0x10, 0xd6, 0x60, - 0xf0, 0x33, 0x30, 0x15, 0xd2, 0x88, 0x86, 0x4d, 0xea, 0x9a, 0x4b, 0xb1, 0x35, 0x74, 0xc0, 0xf3, - 0xf1, 0xc8, 0x6b, 0x1c, 0x84, 0x13, 0x48, 0x74, 0x0e, 0x26, 0x74, 0x03, 0xe0, 0xff, 0x00, 0x50, - 0x07, 0xad, 0xb7, 0x88, 0x4b, 0xdd, 0x1e, 0x74, 0x65, 0x08, 0xa7, 0x24, 0xf1, 0x50, 0x55, 0xf3, - 0xff, 0x40, 0x0f, 0x94, 0x31, 0xd3, 0x25, 0xbd, 0xd6, 0x69, 0xe7, 0x60, 0xef, 0xf0, 0x19, 0x3b, - 0xa0, 0x28, 0x65, 0x88, 0xee, 0x83, 0xa5, 0x47, 0x4d, 0xea, 0x8b, 0xb2, 0xcc, 0x72, 0x37, 0x3a, - 0xe0, 0xf2, 0x50, 0xbb, 0xd4, 0x95, 0x7d, 0x54, 0x2d, 0xbe, 0xd8, 0x47, 0xc5, 0x46, 0x58, 0x8b, - 0xd1, 0x0f, 0x16, 0x98, 0xc4, 0x3a, 0x0d, 0xf8, 0x09, 0x98, 0xd6, 0x5f, 0x1f, 0xb6, 0x4c, 0x5b, - 0x59, 0xce, 0x6d, 0xe6, 0xde, 0xf0, 0x11, 0x53, 0x69, 0x05, 0xb4, 0x37, 0xcc, 0x1e, 0x6b, 0x84, - 0x81, 0x97, 0xe8, 0xc0, 0x9d, 0xbe, 0x69, 0x79, 0xe3, 0x53, 0x64, 0xe0, 0xbb, 0x68, 0x60, 0x3c, - 0x6e, 0xbd, 0x07, 0x66, 0xe2, 0xc7, 0x9f, 0x42, 0x5e, 0x04, 0xe9, 0x72, 0xe9, 0x70, 0xb7, 0xb2, - 0x5b, 0x3a, 0xb0, 0x8f, 0x0e, 0x3e, 0x3a, 0x28, 0x1d, 0x1f, 0xa4, 0x47, 0xe0, 0x14, 0x18, 0xdb, - 0x2b, 0x1d, 0x7c, 0x98, 0xb6, 0x60, 0x0a, 0x8c, 0x1f, 0xee, 0x94, 0x70, 0x25, 0x3d, 0x7a, 0xeb, - 0x2e, 0x00, 0xdd, 0xb0, 0xe1, 0x34, 0x98, 0xec, 0xea, 0x4f, 0x83, 0xc9, 0xed, 0xa3, 0xca, 0x11, - 0x7e, 0x74, 0x98, 0xb6, 0x24, 0x51, 0x2a, 0x4b, 0xc0, 0xc3, 0xf4, 0x68, 0x71, 0xfb, 0xf9, 0xcb, - 0xac, 0xf5, 0xe2, 0x65, 0xd6, 0xfa, 0xe3, 0x65, 0xd6, 0x7a, 0xf6, 0x2a, 0x3b, 0xf2, 0xe2, 0x55, - 0x76, 0xe4, 0xd7, 0x57, 0xd9, 0x91, 0x4f, 0x6f, 0xf7, 0x0c, 0xce, 0x91, 0x7f, 0xe4, 0xb3, 0x6d, - 0x56, 0x70, 0x4e, 0x09, 0xf3, 0x0b, 0x9f, 0xf7, 0x7d, 0xf5, 0xaa, 0x11, 0x3a, 0x99, 0x50, 0xef, - 0xe5, 0xbb, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x44, 0xa1, 0xe8, 0x4d, 0x19, 0x0f, 0x00, 0x00, + // 1773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x5f, 0x6f, 0x1b, 0x59, + 0x15, 0xcf, 0x38, 0x7f, 0x7d, 0xec, 0x34, 0xce, 0x34, 0x4d, 0x9c, 0xb4, 0xb1, 0xb3, 0xb7, 0xda, + 0x25, 0x5a, 0x2d, 0xb6, 0xb6, 0x8b, 0x84, 0xa8, 0x80, 0x25, 0xee, 0xae, 0x69, 0x96, 0x34, 0x71, + 0x6f, 0x1c, 0xb2, 0x42, 0xa0, 0xd1, 0xc4, 0x73, 0xec, 0x5c, 0xd5, 0x9e, 0x71, 0x67, 0xee, 0xb8, + 0x58, 0x3c, 0x23, 0xf1, 0xb8, 0xe2, 0x09, 0x09, 0x24, 0x24, 0xc4, 0x2b, 0x1f, 0x81, 0x07, 0x5e, + 0xd0, 0xbe, 0x20, 0xed, 0x23, 0xe2, 0xc1, 0xac, 0xda, 0x6f, 0x60, 0xbe, 0x00, 0xba, 0x7f, 0x66, + 0x3c, 0x76, 0xdc, 0x26, 0x2e, 0x2b, 0xf1, 0x14, 0xdf, 0x73, 0xee, 0xf9, 0x9d, 0xdf, 0x3d, 0xff, + 0xee, 0xdc, 0xc0, 0xbb, 0xa1, 0x1b, 0xba, 0xac, 0xc9, 0xca, 0x0e, 0xfa, 0xac, 0x67, 0x73, 0xd6, + 0xc3, 0x20, 0xf9, 0xbb, 0xd4, 0xf5, 0x3d, 0xee, 0x99, 0xb7, 0xf5, 0xb6, 0x52, 0x42, 0xb5, 0xb3, + 0xdd, 0xf2, 0xbc, 0x56, 0x1b, 0xcb, 0x72, 0xcb, 0x45, 0xd8, 0x2c, 0xdb, 0x6e, 0x5f, 0xed, 0xdf, + 0xd9, 0x68, 0x79, 0x2d, 0x4f, 0xfe, 0x2c, 0x8b, 0x5f, 0x5a, 0x5a, 0x9c, 0x34, 0xe0, 0xac, 0x83, + 0x01, 0xb7, 0x3b, 0x5d, 0xbd, 0xa1, 0xd0, 0xf0, 0x82, 0x8e, 0x17, 0x94, 0x2f, 0xec, 0x00, 0xcb, + 0xbd, 0x0f, 0x2f, 0x90, 0xdb, 0x1f, 0x96, 0x1b, 0x1e, 0x73, 0xb5, 0x7e, 0x5b, 0xe9, 0x2d, 0x85, + 0xac, 0x16, 0x4a, 0x45, 0xfe, 0xb4, 0x02, 0x2b, 0x35, 0x2f, 0x60, 0x9c, 0x79, 0xae, 0xb9, 0x0b, + 0x29, 0xe6, 0xe4, 0x8d, 0x3d, 0x63, 0x3f, 0x5d, 0x59, 0x1d, 0x0e, 0x8a, 0xe9, 0xbe, 0xdd, 0x69, + 0x3f, 0x24, 0xcc, 0x21, 0x34, 0xc5, 0x1c, 0xf3, 0x33, 0x58, 0xea, 0xd8, 0xfe, 0x33, 0xe4, 0xf9, + 0xd4, 0x9e, 0xb1, 0x9f, 0x79, 0x70, 0xb7, 0x34, 0xe5, 0x78, 0xa5, 0x27, 0x72, 0x4b, 0xe5, 0xce, + 0x97, 0x83, 0xe2, 0xdc, 0x70, 0x50, 0x5c, 0x55, 0x18, 0xca, 0x90, 0x50, 0x8d, 0x60, 0xfe, 0x08, + 0x6e, 0x79, 0x5d, 0x74, 0xd1, 0xb7, 0x6c, 0xc7, 0xf1, 0x31, 0x08, 0xf2, 0xf3, 0xd2, 0xed, 0xf6, + 0x70, 0x50, 0xbc, 0xa3, 0x4c, 0xc6, 0xf5, 0x84, 0xae, 0x2a, 0xc1, 0x81, 0x5a, 0x9b, 0x67, 0x90, + 0x96, 0x02, 0xc7, 0xb2, 0x79, 0x7e, 0x41, 0x12, 0xda, 0x29, 0xa9, 0x48, 0x95, 0xa2, 0x48, 0x95, + 0xea, 0x51, 0xa4, 0x2a, 0xf7, 0x34, 0x9f, 0x5c, 0x02, 0x5c, 0x98, 0x92, 0x2f, 0xfe, 0x5d, 0x34, + 0xe8, 0x8a, 0x5a, 0x1f, 0x70, 0xf3, 0x07, 0xb0, 0xaa, 0x75, 0x97, 0xc8, 0x5a, 0x97, 0x3c, 0xbf, + 0xb8, 0x67, 0xec, 0x2f, 0x54, 0xf2, 0xc3, 0x41, 0x71, 0x63, 0xcc, 0x54, 0xa9, 0x09, 0xcd, 0xaa, + 0xf5, 0x63, 0xb9, 0x34, 0x03, 0xc8, 0x69, 0xbd, 0x48, 0x86, 0xe5, 0xdb, 0x1c, 0xf3, 0x4b, 0xf2, + 0x64, 0x87, 0x82, 0xc0, 0xbf, 0x06, 0xc5, 0xf7, 0x5a, 0x8c, 0x5f, 0x86, 0x17, 0xa5, 0x86, 0xd7, + 0xd1, 0xa9, 0xd0, 0x7f, 0xbe, 0x1d, 0x38, 0xcf, 0xca, 0xbc, 0xdf, 0xc5, 0xa0, 0xf4, 0x09, 0x36, + 0x86, 0x83, 0xe2, 0xd6, 0x98, 0xbf, 0x18, 0x8f, 0x50, 0x15, 0x3a, 0xa7, 0x62, 0x07, 0x48, 0x6d, + 0x8e, 0x66, 0x0f, 0xd6, 0xf5, 0xa6, 0xe7, 0xa1, 0xc7, 0xb5, 0xd7, 0x65, 0xe9, 0xf5, 0xb3, 0x99, + 0xbd, 0xe6, 0xc7, 0xbc, 0x8e, 0x00, 0x09, 0x5d, 0x53, 0xb2, 0xa7, 0x42, 0x24, 0xfd, 0x22, 0xe4, + 0x7c, 0xec, 0xd8, 0xcc, 0x65, 0x6e, 0xcb, 0xea, 0xd8, 0x7e, 0x8b, 0xb9, 0xf9, 0x15, 0x99, 0x89, + 0xed, 0x92, 0xae, 0x32, 0xc1, 0xba, 0xa4, 0x4b, 0xb2, 0xf4, 0xc8, 0x63, 0x6e, 0xa5, 0xa8, 0x13, + 0xa1, 0x4f, 0x37, 0x09, 0x40, 0xe8, 0x5a, 0x2c, 0x7a, 0x22, 0x25, 0xe6, 0xcf, 0x61, 0xb5, 0x8d, + 0x3d, 0x26, 0xd2, 0xd5, 0xf1, 0x42, 0x97, 0xe7, 0xd3, 0xd7, 0xf9, 0x88, 0x92, 0xad, 0x33, 0x36, + 0x66, 0x4d, 0x68, 0x56, 0xad, 0x0f, 0xe4, 0xd2, 0x3c, 0x87, 0xcd, 0x31, 0xbd, 0xe5, 0x62, 0x4b, + 0x96, 0x72, 0x1e, 0xf6, 0x8c, 0xfd, 0x95, 0xca, 0x3b, 0xc3, 0x41, 0x71, 0x77, 0x0a, 0x4e, 0xbc, + 0x8f, 0xd0, 0x8d, 0x24, 0xe0, 0xb1, 0x16, 0x9b, 0x0d, 0xb8, 0xd5, 0xb6, 0x03, 0x6e, 0x45, 0x56, + 0x3c, 0x9f, 0xb9, 0xb6, 0x4a, 0xdf, 0xd1, 0xc4, 0x75, 0x0b, 0x8c, 0xdb, 0xab, 0x52, 0xcd, 0x0a, + 0xe1, 0x91, 0x72, 0xc8, 0xcd, 0x06, 0xac, 0x77, 0x75, 0xfb, 0x5a, 0xcc, 0x0d, 0xb8, 0xed, 0x36, + 0x30, 0x9f, 0x95, 0x7e, 0x36, 0xae, 0xf8, 0x39, 0x70, 0xfb, 0x95, 0x3d, 0xed, 0x41, 0xa7, 0xf9, + 0x8a, 0x31, 0xa1, 0xb9, 0x48, 0x76, 0x18, 0x89, 0xfe, 0x9a, 0x82, 0xcd, 0x1a, 0xba, 0x0e, 0x73, + 0x5b, 0x35, 0xbb, 0xdf, 0x41, 0x97, 0xdf, 0x74, 0x64, 0x5c, 0xc2, 0xba, 0x8f, 0xcd, 0xd0, 0x75, + 0xec, 0x8b, 0x36, 0x46, 0xe9, 0x4b, 0x5d, 0x97, 0xbe, 0x09, 0x8e, 0x57, 0x10, 0x08, 0xcd, 0x8d, + 0x64, 0x3a, 0x8d, 0x9f, 0x03, 0x34, 0x7c, 0xb4, 0xb9, 0x8a, 0xf4, 0xfc, 0xb5, 0x91, 0xde, 0xd5, + 0x3e, 0xd6, 0x95, 0x8f, 0x91, 0xad, 0x8a, 0x72, 0x5a, 0x0b, 0x0e, 0xe4, 0xa8, 0x8a, 0xb4, 0x7a, + 0x24, 0x2c, 0xc8, 0x91, 0x90, 0x18, 0x55, 0xe3, 0x7a, 0x42, 0x57, 0xb5, 0x40, 0x0d, 0x05, 0xf2, + 0xf7, 0x05, 0x58, 0x7b, 0x1a, 0xa2, 0xcf, 0xd0, 0x89, 0x03, 0x47, 0x61, 0x25, 0x8a, 0xb3, 0x0c, + 0x5f, 0xe6, 0xc1, 0xee, 0xd4, 0x71, 0x1a, 0x19, 0x54, 0xb6, 0x34, 0xe1, 0xb5, 0xf1, 0xc4, 0x11, + 0x1a, 0xe3, 0x88, 0x7e, 0xec, 0xd9, 0xed, 0xd0, 0x96, 0x09, 0xed, 0xfa, 0x5e, 0x93, 0xdd, 0x20, + 0xd8, 0x13, 0xfd, 0x38, 0x09, 0x40, 0xe8, 0x5a, 0x2c, 0xaa, 0x49, 0x89, 0xf9, 0x6b, 0x03, 0x36, + 0x27, 0xdb, 0xd6, 0x12, 0x9b, 0x50, 0x0f, 0xf1, 0x93, 0x99, 0x87, 0xce, 0xee, 0xf4, 0x61, 0xa0, + 0x50, 0x09, 0xdd, 0x98, 0x18, 0x09, 0x3f, 0x15, 0x62, 0x71, 0x5c, 0x6c, 0x36, 0xb1, 0x21, 0x02, + 0x15, 0x8d, 0x9f, 0x85, 0x19, 0x8f, 0x3b, 0x09, 0x40, 0xe8, 0x5a, 0x2c, 0xd2, 0xe3, 0xe7, 0x37, + 0x06, 0x6c, 0x69, 0x3a, 0x82, 0x04, 0x47, 0x57, 0x34, 0x85, 0x1a, 0xb2, 0x8b, 0xf2, 0xbc, 0xb5, + 0x99, 0xcf, 0x5b, 0x88, 0x6f, 0xc5, 0x69, 0xb0, 0x84, 0xde, 0x51, 0x9a, 0x27, 0x23, 0x85, 0x18, + 0xb8, 0xe4, 0xcf, 0x06, 0xac, 0xd6, 0x3c, 0xaf, 0x7d, 0x10, 0x04, 0xc8, 0x1f, 0x79, 0x6e, 0xd3, + 0x7c, 0x0f, 0x16, 0x1d, 0x74, 0xbd, 0x8e, 0x6e, 0xc1, 0xdc, 0x70, 0x50, 0xcc, 0x2a, 0x6c, 0x29, + 0x26, 0x54, 0xa9, 0xcd, 0x67, 0xb0, 0xca, 0x6d, 0xbf, 0x85, 0xdc, 0x7a, 0xa1, 0x6a, 0x38, 0x25, + 0xf7, 0x57, 0x67, 0x66, 0xae, 0x47, 0xea, 0x18, 0x18, 0xa1, 0x59, 0xb5, 0x3e, 0x57, 0xcb, 0xff, + 0x2c, 0x03, 0x08, 0x9a, 0x35, 0xdb, 0xb7, 0x3b, 0x81, 0xf9, 0x10, 0xb2, 0xea, 0x1a, 0xe1, 0xac, + 0xf1, 0x0c, 0x7d, 0x4d, 0x75, 0x6b, 0x38, 0x28, 0xde, 0x56, 0x60, 0x49, 0x2d, 0xa1, 0x19, 0xb9, + 0xac, 0xcb, 0x95, 0x19, 0xc2, 0xba, 0xbc, 0xf8, 0xda, 0x5d, 0x6e, 0x75, 0x98, 0xcb, 0xad, 0x26, + 0xa2, 0xe6, 0xfe, 0xd6, 0x57, 0xdb, 0x15, 0x40, 0x42, 0x6f, 0x09, 0xd9, 0x51, 0x97, 0x3f, 0x61, + 0x2e, 0xaf, 0x22, 0x9a, 0xbf, 0x82, 0xdb, 0xf1, 0x2e, 0x1f, 0x1d, 0xc4, 0x8e, 0x74, 0xac, 0xca, + 0xfb, 0x68, 0x66, 0xc7, 0x3b, 0x13, 0x8e, 0x47, 0x90, 0x84, 0xe6, 0xb4, 0x6b, 0x2a, 0x65, 0xc2, + 0xf9, 0x6f, 0x0d, 0xb8, 0x7b, 0xe1, 0xf9, 0xbe, 0xf7, 0x42, 0x74, 0x42, 0x13, 0x55, 0x51, 0x58, + 0x5d, 0xf4, 0xad, 0x4b, 0x2f, 0xf4, 0x65, 0x8d, 0xa7, 0x2b, 0xf5, 0x99, 0x59, 0x10, 0xcd, 0xe2, + 0xf5, 0xd0, 0x84, 0x6e, 0xc5, 0xda, 0x2a, 0xca, 0x9a, 0xab, 0xa1, 0xff, 0xd8, 0x0b, 0x7d, 0xf3, + 0x0f, 0x06, 0x14, 0x7c, 0xec, 0x7a, 0x3e, 0xb7, 0xda, 0xec, 0x79, 0xc8, 0x1c, 0x35, 0x24, 0x7c, + 0x7c, 0x61, 0xfb, 0x4e, 0xb2, 0x19, 0xce, 0x67, 0xe6, 0xf5, 0x6e, 0xd4, 0xfc, 0x6f, 0x42, 0x27, + 0xf4, 0xae, 0xda, 0x70, 0x34, 0xd2, 0x53, 0xa9, 0x96, 0x9f, 0x22, 0xbf, 0x4f, 0xd0, 0xc3, 0x5e, + 0x5f, 0x9c, 0x88, 0x79, 0xce, 0x18, 0xbd, 0xa5, 0x6f, 0x86, 0xde, 0x74, 0x74, 0x42, 0x77, 0x34, + 0x3d, 0xec, 0xf5, 0x6b, 0x52, 0x9d, 0x60, 0xd7, 0x87, 0x0d, 0xbb, 0xd1, 0xc0, 0xae, 0xbc, 0x61, + 0x44, 0xef, 0x06, 0x56, 0xc3, 0x73, 0x9b, 0xf9, 0xe5, 0xbd, 0xf9, 0xfd, 0xcc, 0x03, 0xf2, 0x9a, + 0xc1, 0x9f, 0xe8, 0xf3, 0xca, 0x7d, 0x3d, 0xb6, 0xee, 0x2a, 0x32, 0xd3, 0xd0, 0x08, 0x35, 0x23, + 0xb1, 0xb4, 0x0b, 0xe4, 0x80, 0xb8, 0x84, 0x7b, 0xe3, 0x94, 0x9f, 0x87, 0xcc, 0x47, 0xc7, 0x0a, + 0xb0, 0xe1, 0xb9, 0x4e, 0x20, 0xbf, 0xd7, 0x16, 0x2a, 0xdf, 0x1a, 0x0e, 0x8a, 0xf7, 0xe3, 0x8f, + 0x9c, 0xd7, 0xee, 0x26, 0x74, 0xbb, 0x9d, 0x38, 0x9f, 0x52, 0x9e, 0x6a, 0xdd, 0x3f, 0x16, 0xd4, + 0x70, 0x52, 0x0f, 0x80, 0x47, 0x76, 0xf7, 0x7f, 0x6a, 0xfc, 0x3a, 0x2c, 0x72, 0x8f, 0xdb, 0x6d, + 0xdd, 0xec, 0x3f, 0x9c, 0x39, 0x6d, 0x7a, 0x0c, 0x4a, 0x10, 0x42, 0x15, 0x98, 0xd9, 0x04, 0x90, + 0x11, 0xb3, 0x98, 0xdb, 0xf4, 0xf2, 0xf3, 0x32, 0xfc, 0x1f, 0xbc, 0x36, 0xfc, 0xf1, 0x49, 0x4a, + 0x32, 0xa0, 0x87, 0x6e, 0xd3, 0xab, 0x6c, 0x8f, 0x7f, 0x37, 0x8c, 0xd0, 0x08, 0x4d, 0xdb, 0xd1, + 0xae, 0x9d, 0xbf, 0xa5, 0x20, 0x1d, 0xdb, 0xdc, 0x78, 0x48, 0x9f, 0xc3, 0x52, 0xe2, 0x13, 0x29, + 0x5d, 0xf9, 0x78, 0x86, 0x43, 0x1f, 0xba, 0x7c, 0xf4, 0xda, 0x8a, 0x3e, 0x93, 0x34, 0x9c, 0x08, + 0x66, 0xd7, 0x67, 0x8d, 0x68, 0x80, 0xbd, 0x75, 0x30, 0x25, 0x08, 0xa1, 0x0a, 0xcc, 0xfc, 0x05, + 0xac, 0xf8, 0x18, 0xa0, 0xdf, 0x43, 0x47, 0xcf, 0xa4, 0x83, 0x99, 0x09, 0xaf, 0x45, 0xcd, 0xa5, + 0x70, 0x08, 0x8d, 0x21, 0xc9, 0x0b, 0x58, 0x52, 0x09, 0x30, 0xbf, 0x03, 0x20, 0x47, 0x67, 0x32, + 0x88, 0x77, 0x46, 0x39, 0x18, 0xe9, 0x08, 0x4d, 0x8b, 0xc5, 0x27, 0x32, 0x9a, 0xdf, 0x05, 0x55, + 0x50, 0xda, 0x4c, 0x85, 0x74, 0x73, 0x38, 0x28, 0x9a, 0xc9, 0xe2, 0xd3, 0x76, 0x20, 0x57, 0xd2, + 0x90, 0xfc, 0xc5, 0x80, 0x65, 0xaa, 0x58, 0x98, 0x9f, 0x43, 0x46, 0xbd, 0x58, 0x2d, 0xc1, 0x5a, + 0xfa, 0xbe, 0xf5, 0xa0, 0xf8, 0x86, 0x87, 0x6f, 0xbd, 0xdf, 0xc5, 0xa4, 0x97, 0x84, 0x35, 0xa1, + 0xd0, 0x89, 0xf7, 0x98, 0x8f, 0xc7, 0x92, 0xfd, 0xc6, 0x6f, 0x96, 0x89, 0xb7, 0xf4, 0x44, 0x76, + 0xc9, 0xf7, 0xc1, 0xfc, 0xb4, 0x27, 0x3e, 0xca, 0x45, 0x56, 0x0e, 0x83, 0x63, 0x8f, 0x57, 0xd1, + 0x11, 0x45, 0x27, 0xeb, 0xf1, 0x6a, 0xd1, 0x49, 0x31, 0xa1, 0x4a, 0x4d, 0x7e, 0x67, 0xc0, 0x3d, + 0x65, 0x8e, 0x7e, 0x17, 0x79, 0x68, 0xb7, 0xab, 0x21, 0x0f, 0x7d, 0x0c, 0xc4, 0x24, 0x13, 0xd7, + 0xd1, 0xc7, 0x30, 0x2f, 0xee, 0x3e, 0xe3, 0x3a, 0x96, 0xa6, 0x66, 0x09, 0xca, 0x8b, 0xbc, 0xdc, + 0x84, 0xa5, 0x48, 0xc4, 0xe8, 0x99, 0xe1, 0x5c, 0x4d, 0x44, 0x42, 0x49, 0x28, 0xc4, 0xaf, 0x0f, + 0x87, 0x7c, 0x6d, 0xc0, 0xfe, 0x54, 0x6a, 0x87, 0x1d, 0xbb, 0xc5, 0x5c, 0xdb, 0xef, 0x57, 0x43, + 0xf9, 0x2a, 0xf9, 0x46, 0x68, 0x3e, 0x84, 0xac, 0xb8, 0x10, 0xe3, 0xe7, 0xdf, 0xbc, 0x7c, 0xfe, + 0x25, 0xa6, 0x55, 0x52, 0x4b, 0x68, 0xa6, 0x89, 0x18, 0xbf, 0xf5, 0xde, 0xfa, 0x88, 0x7f, 0x34, + 0xe0, 0xfe, 0xf4, 0xe8, 0x8f, 0xae, 0xb9, 0xff, 0x6f, 0x12, 0x9e, 0xc2, 0xa6, 0x24, 0x98, 0x20, + 0x74, 0x8c, 0xe8, 0xa0, 0x33, 0x09, 0x69, 0xdc, 0x14, 0xf2, 0xfd, 0xef, 0x41, 0x36, 0x7a, 0xd6, + 0xc8, 0x56, 0xd8, 0x80, 0x5c, 0xed, 0xe4, 0xf4, 0xb0, 0x7e, 0x78, 0x72, 0x6c, 0x9d, 0x1d, 0xff, + 0xe4, 0xf8, 0xe4, 0xfc, 0x38, 0x37, 0x67, 0xae, 0xc0, 0xc2, 0xd1, 0xc9, 0xf1, 0x8f, 0x73, 0x86, + 0x99, 0x86, 0xc5, 0xd3, 0xc7, 0x27, 0xb4, 0x9e, 0x4b, 0xbd, 0xff, 0x11, 0xc0, 0xa8, 0xcf, 0xcc, + 0x0c, 0x2c, 0x8f, 0xf6, 0x67, 0x60, 0xb9, 0x7a, 0x56, 0x3f, 0xa3, 0x9f, 0x9e, 0xe6, 0x0c, 0xb1, + 0x38, 0xa9, 0x09, 0xc0, 0xd3, 0x5c, 0xaa, 0x52, 0xfd, 0xf2, 0x65, 0xc1, 0xf8, 0xea, 0x65, 0xc1, + 0xf8, 0xfa, 0x65, 0xc1, 0xf8, 0xe2, 0x55, 0x61, 0xee, 0xab, 0x57, 0x85, 0xb9, 0x7f, 0xbe, 0x2a, + 0xcc, 0xfd, 0xec, 0x83, 0xc4, 0xa0, 0x3a, 0x73, 0xcf, 0x5c, 0x56, 0x65, 0xe5, 0xc6, 0xa5, 0xcd, + 0xdc, 0xf2, 0x2f, 0xc7, 0xfe, 0xb5, 0x27, 0x47, 0xd6, 0xc5, 0x92, 0x7c, 0x47, 0x7e, 0xf4, 0xdf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x83, 0xf6, 0x2e, 0xfe, 0x13, 0x00, 0x00, } func (m *Position) Marshal() (dAtA []byte, err error) { @@ -742,7 +1070,7 @@ func (m *Position) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintDerivatives(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x62 n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastLeviedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastLeviedAt):]) if err2 != nil { return 0, err2 @@ -750,6 +1078,26 @@ func (m *Position) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n2 i = encodeVarintDerivatives(dAtA, i, uint64(n2)) i-- + dAtA[i] = 0x5a + if m.LeviedAmountNegative { + i-- + if m.LeviedAmountNegative { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + { + size, err := m.LeviedAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDerivatives(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x4a { size, err := m.RemainingMargin.MarshalToSizedBuffer(dAtA[:i]) @@ -786,18 +1134,18 @@ func (m *Position) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.OpenedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.OpenedAt):]) - if err4 != nil { - return 0, err4 + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.OpenedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.OpenedAt):]) + if err5 != nil { + return 0, err5 } - i -= n4 - i = encodeVarintDerivatives(dAtA, i, uint64(n4)) + i -= n5 + i = encodeVarintDerivatives(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x22 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintDerivatives(dAtA, i, uint64(len(m.Address))) + if len(m.OpenerAddress) > 0 { + i -= len(m.OpenerAddress) + copy(dAtA[i:], m.OpenerAddress) + i = encodeVarintDerivatives(dAtA, i, uint64(len(m.OpenerAddress))) i-- dAtA[i] = 0x1a } @@ -821,7 +1169,7 @@ func (m *Position) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueriedPosition) Marshal() (dAtA []byte, err error) { +func (m *PendingPaymentPosition) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -831,12 +1179,65 @@ func (m *QueriedPosition) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueriedPosition) MarshalTo(dAtA []byte) (int, error) { +func (m *PendingPaymentPosition) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueriedPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PendingPaymentPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreatedHeight != 0 { + i = encodeVarintDerivatives(dAtA, i, uint64(m.CreatedHeight)) + i-- + dAtA[i] = 0x20 + } + n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreatedAt):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintDerivatives(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x1a + { + size, err := m.RefundableAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDerivatives(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintDerivatives(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueriedPosition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueriedPosition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueriedPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -954,6 +1355,11 @@ func (m *PoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.LevyPeriodRequiredSeconds != 0 { + i = encodeVarintDerivatives(dAtA, i, uint64(m.LevyPeriodRequiredSeconds)) + i-- + dAtA[i] = 0x40 + } if len(m.AcceptedAssetsConf) > 0 { for iNdEx := len(m.AcceptedAssetsConf) - 1; iNdEx >= 0; iNdEx-- { { @@ -1179,7 +1585,45 @@ func (m *Market) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventPriceIsNotFeeded) Marshal() (dAtA []byte, err error) { +func (m *Reserve) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Reserve) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Reserve) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDerivatives(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.MarketType != 0 { + i = encodeVarintDerivatives(dAtA, i, uint64(m.MarketType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventPriceIsNotFed) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1189,12 +1633,12 @@ func (m *EventPriceIsNotFeeded) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventPriceIsNotFeeded) MarshalTo(dAtA []byte) (int, error) { +func (m *EventPriceIsNotFed) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventPriceIsNotFeeded) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventPriceIsNotFed) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1209,7 +1653,7 @@ func (m *EventPriceIsNotFeeded) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Reserve) Marshal() (dAtA []byte, err error) { +func (m *EventPerpetualFuturesLevyFee) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1219,18 +1663,25 @@ func (m *Reserve) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Reserve) MarshalTo(dAtA []byte) (int, error) { +func (m *EventPerpetualFuturesLevyFee) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Reserve) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventPerpetualFuturesLevyFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintDerivatives(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0x12 + } { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1238,11 +1689,126 @@ func (m *Reserve) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintDerivatives(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.MarketType != 0 { - i = encodeVarintDerivatives(dAtA, i, uint64(m.MarketType)) + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.FeeNegative { i-- - dAtA[i] = 0x8 + if m.FeeNegative { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintDerivatives(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDerivatives(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventPerpetualFuturesLiquidationFee) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPerpetualFuturesLiquidationFee) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPerpetualFuturesLiquidationFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintDerivatives(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDerivatives(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventLiquidationNeeded) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventLiquidationNeeded) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventLiquidationNeeded) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintDerivatives(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1270,7 +1836,7 @@ func (m *Position) Size() (n int) { } l = m.Market.Size() n += 1 + l + sovDerivatives(uint64(l)) - l = len(m.Address) + l = len(m.OpenerAddress) if l > 0 { n += 1 + l + sovDerivatives(uint64(l)) } @@ -1285,6 +1851,11 @@ func (m *Position) Size() (n int) { n += 1 + l + sovDerivatives(uint64(l)) l = m.RemainingMargin.Size() n += 1 + l + sovDerivatives(uint64(l)) + l = m.LeviedAmount.Size() + n += 1 + l + sovDerivatives(uint64(l)) + if m.LeviedAmountNegative { + n += 2 + } l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastLeviedAt) n += 1 + l + sovDerivatives(uint64(l)) l = m.PositionInstance.Size() @@ -1292,6 +1863,26 @@ func (m *Position) Size() (n int) { return n } +func (m *PendingPaymentPosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovDerivatives(uint64(l)) + } + l = m.RefundableAmount.Size() + n += 1 + l + sovDerivatives(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovDerivatives(uint64(l)) + if m.CreatedHeight != 0 { + n += 1 + sovDerivatives(uint64(m.CreatedHeight)) + } + return n +} + func (m *QueriedPosition) Size() (n int) { if m == nil { return 0 @@ -1352,6 +1943,9 @@ func (m *PoolParams) Size() (n int) { n += 1 + l + sovDerivatives(uint64(l)) } } + if m.LevyPeriodRequiredSeconds != 0 { + n += 1 + sovDerivatives(uint64(m.LevyPeriodRequiredSeconds)) + } return n } @@ -1412,7 +2006,21 @@ func (m *Market) Size() (n int) { return n } -func (m *EventPriceIsNotFeeded) Size() (n int) { +func (m *Reserve) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MarketType != 0 { + n += 1 + sovDerivatives(uint64(m.MarketType)) + } + l = m.Amount.Size() + n += 1 + l + sovDerivatives(uint64(l)) + return n +} + +func (m *EventPriceIsNotFed) Size() (n int) { if m == nil { return 0 } @@ -1425,17 +2033,64 @@ func (m *EventPriceIsNotFeeded) Size() (n int) { return n } -func (m *Reserve) Size() (n int) { +func (m *EventPerpetualFuturesLevyFee) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MarketType != 0 { - n += 1 + sovDerivatives(uint64(m.MarketType)) + l = m.Fee.Size() + n += 1 + l + sovDerivatives(uint64(l)) + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovDerivatives(uint64(l)) } - l = m.Amount.Size() + return n +} + +func (m *EventPerpetualFuturesImaginaryFundingFee) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovDerivatives(uint64(l)) + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovDerivatives(uint64(l)) + } + if m.FeeNegative { + n += 2 + } + return n +} + +func (m *EventPerpetualFuturesLiquidationFee) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() n += 1 + l + sovDerivatives(uint64(l)) + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovDerivatives(uint64(l)) + } + return n +} + +func (m *EventLiquidationNeeded) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovDerivatives(uint64(l)) + } return n } @@ -1541,7 +2196,7 @@ func (m *Position) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OpenerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1569,7 +2224,7 @@ func (m *Position) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.OpenerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -1726,7 +2381,7 @@ func (m *Position) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastLeviedAt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LeviedAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1753,11 +2408,64 @@ func (m *Position) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastLeviedAt, dAtA[iNdEx:postIndex]); err != nil { + if err := m.LeviedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LeviedAmountNegative", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LeviedAmountNegative = bool(v != 0) + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastLeviedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastLeviedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PositionInstance", wireType) } @@ -1811,6 +2519,173 @@ func (m *Position) Unmarshal(dAtA []byte) error { } return nil } +func (m *PendingPaymentPosition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PendingPaymentPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingPaymentPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RefundableAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RefundableAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedHeight", wireType) + } + m.CreatedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDerivatives(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDerivatives + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueriedPosition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2409,6 +3284,25 @@ func (m *PoolParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LevyPeriodRequiredSeconds", wireType) + } + m.LevyPeriodRequiredSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LevyPeriodRequiredSeconds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipDerivatives(dAtA[iNdEx:]) @@ -2878,7 +3772,7 @@ func (m *Market) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventPriceIsNotFeeded) Unmarshal(dAtA []byte) error { +func (m *Reserve) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2901,17 +3795,36 @@ func (m *EventPriceIsNotFeeded) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventPriceIsNotFeeded: wiretype end group for non-group") + return fmt.Errorf("proto: Reserve: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventPriceIsNotFeeded: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Reserve: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketType", wireType) + } + m.MarketType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketType |= MarketType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDerivatives @@ -2921,25 +3834,26 @@ func (m *EventPriceIsNotFeeded) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthDerivatives } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDerivatives } if postIndex > l { return io.ErrUnexpectedEOF } - m.Asset = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: iNdEx = preIndex skippy, err := skipDerivatives(dAtA[iNdEx:]) if err != nil { @@ -2960,7 +3874,7 @@ func (m *EventPriceIsNotFeeded) Unmarshal(dAtA []byte) error { } return nil } -func (m *Reserve) Unmarshal(dAtA []byte) error { +func (m *EventPriceIsNotFed) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2983,17 +3897,17 @@ func (m *Reserve) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Reserve: wiretype end group for non-group") + return fmt.Errorf("proto: EventPriceIsNotFed: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Reserve: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventPriceIsNotFed: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketType", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType) } - m.MarketType = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDerivatives @@ -3003,14 +3917,192 @@ func (m *Reserve) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MarketType |= MarketType(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Asset = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDerivatives(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDerivatives + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPerpetualFuturesLevyFee) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPerpetualFuturesLevyFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPerpetualFuturesLevyFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PositionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDerivatives(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDerivatives + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPerpetualFuturesImaginaryFundingFee) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPerpetualFuturesImaginaryFundingFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPerpetualFuturesImaginaryFundingFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3037,10 +4129,259 @@ func (m *Reserve) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PositionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeNegative", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.FeeNegative = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDerivatives(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDerivatives + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPerpetualFuturesLiquidationFee) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPerpetualFuturesLiquidationFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPerpetualFuturesLiquidationFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PositionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDerivatives(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDerivatives + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventLiquidationNeeded) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventLiquidationNeeded: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventLiquidationNeeded: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDerivatives + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDerivatives + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDerivatives + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PositionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDerivatives(dAtA[iNdEx:]) diff --git a/x/derivatives/types/errors.go b/x/derivatives/types/errors.go index b78b2d17f..f2ef4ef7f 100644 --- a/x/derivatives/types/errors.go +++ b/x/derivatives/types/errors.go @@ -8,18 +8,29 @@ import ( // x/derivatives module sentinel errors var ( - ErrInvalidRedeemAmount = sdkerrors.Register(ModuleName, 1, "redeem amount exceeds user balance") - ErrNoLiquidityProviderToken = sdkerrors.Register(ModuleName, 2, "no liquidity provider token") - ErrInvalidCoins = sdkerrors.Register(ModuleName, 3, "invalid coins") - ErrZeroLpTokenPrice = sdkerrors.Register(ModuleName, 4, "zero lp token price") - ErrorMarginNotEnough = sdkerrors.Register(ModuleName, 5, "margin is not enough") - ErrorInvalidPositionParams = sdkerrors.Register(ModuleName, 6, "invalid param for position") - ErrInsufficientAssetBalance = sdkerrors.Register(ModuleName, 7, "insufficient asset balance") - ErrMarginAssetNotValid = sdkerrors.Register(ModuleName, 8, "margin asset is not valid") - ErrNegativeMargin = sdkerrors.Register(ModuleName, 9, "remaining margin must be positive") - ErrInvalidLeverage = sdkerrors.Register(ModuleName, 10, "invalid leverage") - ErrInvalidPositionSize = sdkerrors.Register(ModuleName, 11, "invalid position size") - ErrInsufficientPoolFund = sdkerrors.Register(ModuleName, 12, "insufficient pool fund") - ErrInvalidPositionInstance = sdkerrors.Register(ModuleName, 13, "invalid position instance") - ErrNotImplemented = sdkerrors.Register(ModuleName, 14, "not implemented") + ErrInvalidRedeemAmount = sdkerrors.Register(ModuleName, 1, "redeem amount exceeds user balance") + ErrNoLiquidityProviderToken = sdkerrors.Register(ModuleName, 2, "no liquidity provider token") + ErrInvalidCoins = sdkerrors.Register(ModuleName, 3, "invalid coins") + ErrZeroLpTokenPrice = sdkerrors.Register(ModuleName, 4, "zero lp token price") + ErrorMarginNotEnough = sdkerrors.Register(ModuleName, 5, "margin is not enough") + ErrorInvalidPositionParams = sdkerrors.Register(ModuleName, 6, "invalid param for position") + ErrInsufficientAssetBalance = sdkerrors.Register(ModuleName, 7, "insufficient asset balance") + ErrMarginAssetNotValid = sdkerrors.Register(ModuleName, 8, "margin asset is not valid") + ErrNegativeMargin = sdkerrors.Register(ModuleName, 9, "remaining margin must be positive") + ErrInvalidLeverage = sdkerrors.Register(ModuleName, 10, "invalid leverage") + ErrInvalidPositionSize = sdkerrors.Register(ModuleName, 11, "invalid position size") + ErrInsufficientPoolFund = sdkerrors.Register(ModuleName, 12, "insufficient pool fund") + ErrInvalidPositionInstance = sdkerrors.Register(ModuleName, 13, "invalid position instance") + ErrNotImplemented = sdkerrors.Register(ModuleName, 14, "not implemented") + ErrInsufficientAmount = sdkerrors.Register(ModuleName, 15, "insufficient amount") + ErrPositionDoesNotExist = sdkerrors.Register(ModuleName, 16, "position does not exist") + ErrLiquidationNotNeeded = sdkerrors.Register(ModuleName, 17, "liquidation is not needed") + ErrLiquidationNeeded = sdkerrors.Register(ModuleName, 18, "liquidation is needed") + ErrUnauthorized = sdkerrors.Register(ModuleName, 19, "unauthorized") + ErrTooMuchMarginToWithdraw = sdkerrors.Register(ModuleName, 20, "too much margin to withdraw") + ErrInsufficientAvailablePoolBalance = sdkerrors.Register(ModuleName, 21, "insufficient available pool balance") + ErrPositionNFTNotFound = sdkerrors.Register(ModuleName, 22, "position NFT not found") + ErrNotPositionNFTOwner = sdkerrors.Register(ModuleName, 23, "not position NFT owner") + ErrPositionNFTSendDisabled = sdkerrors.Register(ModuleName, 24, "position NFT send disabled") + ErrNoPendingPaymentManager = sdkerrors.Register(ModuleName, 25, "no pending payment manager") ) diff --git a/x/derivatives/types/expected_keepers.go b/x/derivatives/types/expected_keepers.go index 952db1fd8..7228c5287 100644 --- a/x/derivatives/types/expected_keepers.go +++ b/x/derivatives/types/expected_keepers.go @@ -2,10 +2,20 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + nfttypes "github.com/cosmos/cosmos-sdk/x/nft" + + ununifinfttypes "github.com/UnUniFi/chain/x/nft/types" pftypes "github.com/UnUniFi/chain/x/pricefeed/types" ) +// AccountKeeper expected interface for the account keeper (noalias) +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI +} + // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin @@ -29,3 +39,27 @@ type PricefeedKeeper interface { // These are used for testing TODO replace mockApp with keeper in tests to remove these SetParams(sdk.Context, pftypes.Params) } + +type NftKeeper interface { + SaveClass(ctx sdk.Context, class nfttypes.Class) error + + Mint(ctx sdk.Context, token nfttypes.NFT, receiver sdk.AccAddress) error + Burn(ctx sdk.Context, classID string, nftID string) error + Update(ctx sdk.Context, token nfttypes.NFT) error + Transfer(ctx sdk.Context, classID string, nftID string, receiver sdk.AccAddress) error + + GetClass(ctx sdk.Context, classID string) (nfttypes.Class, bool) + GetClasses(ctx sdk.Context) (classes []*nfttypes.Class) + HasClass(ctx sdk.Context, classId string) bool + + GetNFT(ctx sdk.Context, classID, nftID string) (nfttypes.NFT, bool) + GetNFTsOfClassByOwner(ctx sdk.Context, classID string, owner sdk.AccAddress) (nfts []nfttypes.NFT) + GetNFTsOfClass(ctx sdk.Context, classID string) (nfts []nfttypes.NFT) + HasNFT(ctx sdk.Context, classID, nftID string) bool + + GetOwner(ctx sdk.Context, classID string, nftID string) sdk.AccAddress + GetBalance(ctx sdk.Context, classID string, owner sdk.AccAddress) uint64 + GetTotalSupply(ctx sdk.Context, classID string) uint64 + GetNftData(ctx sdk.Context, classId string, id string) (ununifinfttypes.NftData, bool) + SetNftData(ctx sdk.Context, classId string, id string, data ununifinfttypes.NftData) error +} diff --git a/x/derivatives/types/genesis.go b/x/derivatives/types/genesis.go index c41be0742..5fc01180d 100644 --- a/x/derivatives/types/genesis.go +++ b/x/derivatives/types/genesis.go @@ -1,7 +1,9 @@ package types import ( -// this line is used by starport scaffolding # genesis/types/import + "fmt" + // this line is used by starport scaffolding # genesis/types/import + sdk "github.com/cosmos/cosmos-sdk/types" ) // DefaultIndex is the default global index @@ -10,15 +12,24 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), } } // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - + // this line is used by starport scaffolding # genesis/types/validate + positionIdMap := make(map[string]bool) + for _, elem := range gs.Positions { + if _, ok := positionIdMap[elem.Id]; ok { + return fmt.Errorf("duplicated id for position") + } + if _, err := sdk.AccAddressFromBech32(elem.OpenerAddress); err != nil { + return fmt.Errorf("invalid address") + } + positionIdMap[elem.Id] = true + } return gs.Params.Validate() } diff --git a/x/derivatives/types/genesis_test.go b/x/derivatives/types/genesis_test.go index ced0033cd..d50452652 100644 --- a/x/derivatives/types/genesis_test.go +++ b/x/derivatives/types/genesis_test.go @@ -2,9 +2,12 @@ package types_test import ( "testing" + "time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/UnUniFi/chain/testutil/sample" "github.com/UnUniFi/chain/x/derivatives/types" ) @@ -19,6 +22,103 @@ func TestGenesisState_Validate(t *testing.T) { genState: types.DefaultGenesis(), valid: true, }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + Params: types.Params{ + PoolParams: types.PoolParams{ + QuoteTicker: "123", + BaseLptMintFee: sdk.MustNewDecFromStr("0.001"), + BaseLptRedeemFee: sdk.MustNewDecFromStr("0.001"), + BorrowingFeeRatePerHour: sdk.MustNewDecFromStr("0.001"), + ReportLiquidationRewardRate: sdk.MustNewDecFromStr("0.001"), + ReportLevyPeriodRewardRate: sdk.MustNewDecFromStr("0.001"), + AcceptedAssetsConf: []types.PoolAssetConf{ + { + Denom: "uatom", + TargetWeight: sdk.MustNewDecFromStr("0.001"), + }, + }, + LevyPeriodRequiredSeconds: 3600, + }, + PerpetualFutures: types.PerpetualFuturesParams{ + CommissionRate: sdk.MustNewDecFromStr("0.001"), + MarginMaintenanceRate: sdk.MustNewDecFromStr("0.001"), + ImaginaryFundingRateProportionalCoefficient: sdk.MustNewDecFromStr("0.001"), + Markets: []*types.Market{ + { + BaseDenom: "uatom", + QuoteDenom: "uusdc", + }, + }, + MaxLeverage: 1, + }, + PerpetualOptions: types.PerpetualOptionsParams{ + PremiumCommissionRate: sdk.MustNewDecFromStr("0.001"), + StrikeCommissionRate: sdk.MustNewDecFromStr("0.001"), + MarginMaintenanceRate: sdk.MustNewDecFromStr("0.001"), + ImaginaryFundingRateProportionalCoefficient: sdk.MustNewDecFromStr("0.001"), + Markets: []*types.Market{ + { + BaseDenom: "uatom", + QuoteDenom: "uusdc", + }, + }, + }, + }, + Positions: []types.Position{ + { + Id: "1", + Market: types.Market{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + }, + OpenerAddress: sample.AccAddress(), + OpenedAt: time.Now().UTC(), + OpenedHeight: 10, + OpenedBaseRate: sdk.MustNewDecFromStr("0.001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.001"), + RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000)), + }, + { + Id: "2", + Market: types.Market{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + }, + OpenerAddress: sample.AccAddress(), + OpenedAt: time.Now().UTC(), + OpenedHeight: 10, + OpenedBaseRate: sdk.MustNewDecFromStr("0.001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.001"), + RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000)), + }, + }, + PoolMarketCap: types.PoolMarketCap{ + QuoteTicker: "ticker", + Total: sdk.MustNewDecFromStr("0.111"), + AssetInfo: []types.PoolMarketCap_AssetInfo{ + { + Denom: "denom", + Amount: sdk.NewInt(1000), + Price: sdk.MustNewDecFromStr("0.001"), + Reserved: sdk.NewInt(1000), + }, + }, + }, + PerpetualFuturesGrossPositionOfMarket: []types.PerpetualFuturesGrossPositionOfMarket{ + { + Market: types.Market{ + BaseDenom: "uatom", + QuoteDenom: "uusdc", + }, + PositionType: types.PositionType_LONG, + PositionSizeInDenomExponent: sdk.NewInt(1000), + }, + }, + }, + valid: true, + }, // this line is used by starport scaffolding # types/genesis/testcase } { t.Run(tc.desc, func(t *testing.T) { diff --git a/x/derivatives/types/keys.go b/x/derivatives/types/keys.go index 4c93ad276..719c488ba 100644 --- a/x/derivatives/types/keys.go +++ b/x/derivatives/types/keys.go @@ -27,6 +27,15 @@ const ( // MarginManager defines the margin manager for derivatives module MarginManager = "margin_manager" + + // perpetual future position nft class id + PerpFuturePositionNFTClassId = "derivatives/perpetual_futures/positions" + + // perpetual option position nft class id + PerpOptionPositionNFTClassId = "derivatives/perpetual_options/positions" + + // PendingPaymentManager defines the pending payment manager for derivatives module + PendingPaymentManager = "pending_payment_manager" ) const ( @@ -35,6 +44,7 @@ const ( KeyPrefixDerivativesSubpoolAssets = "subpool_assets" KeyPrefixPosition = "position" KeyPrefixUserPosition = "user_position" + KeyPrefixPendingPaymentPosition = "pending_payment_position" KeyPrefixPerpetualFutures = "perpetual_futures" KeyPrefixPerpetualOptions = "perpetual_options" KeyPrefixGrossPositionAmount = "gross_position_amount" @@ -89,6 +99,10 @@ func PositionWithIdKeyPrefix(posId string) []byte { return append([]byte(KeyPrefixPosition), GetPositionIdByteFromString(posId)...) } +func PendingPaymentPositionWithIdKeyPrefix(posId string) []byte { + return append([]byte(KeyPrefixPendingPaymentPosition), GetPositionIdByteFromString(posId)...) +} + func AddressPositionKeyPrefix(sender sdk.AccAddress) []byte { return append([]byte(KeyPrefixUserPosition), address.MustLengthPrefix(sender)...) } diff --git a/x/derivatives/types/msgs.go b/x/derivatives/types/msgs.go index 5c2dba0f9..986785fc5 100644 --- a/x/derivatives/types/msgs.go +++ b/x/derivatives/types/msgs.go @@ -16,21 +16,17 @@ func NewMsgDepositToPool(sender string, amount sdk.Coin) MsgDepositToPool { } } -// Route return the message type used for routing the message. -func (msg MsgDepositToPool) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgDepositToPool) Type() string { return "deposit_to_pool" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgDepositToPool) ValidateBasic() error { - return nil -} + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgDepositToPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) + if msg.Amount.Amount.LT(sdk.NewInt(1)) { + return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "insufficient funds", "") + } + return nil } // GetSigners returns the addresses of signers that must sign. @@ -50,26 +46,17 @@ func NewMsgWithdrawFromPool(sender string, lptAmount sdk.Int, denom string) MsgW } } -// Route return the message type used for routing the message. -func (msg MsgWithdrawFromPool) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgWithdrawFromPool) Type() string { return "withdraw_from_pool" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgWithdrawFromPool) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") } - + if msg.LptAmount.LT(sdk.NewInt(1)) { + return sdkerrors.Wrapf(ErrInsufficientAmount, "insufficient funds") + } return nil -} -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgWithdrawFromPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) } // GetSigners returns the addresses of signers that must sign. @@ -90,28 +77,19 @@ func NewMsgOpenPosition(sender string, margin sdk.Coin, market Market, positionI } } -// Route return the message type used for routing the message. -func (msg MsgOpenPosition) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgOpenPosition) Type() string { return "open_position" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgOpenPosition) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") } - + _, err1 := UnpackPositionInstance(msg.PositionInstance) + if err1 != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "positionInstance is not valid") + } return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgOpenPosition) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgOpenPosition) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -128,12 +106,6 @@ func NewMsgClosePosition(sender string, positionId string) MsgClosePosition { } } -// Route return the message type used for routing the message. -func (msg MsgClosePosition) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgClosePosition) Type() string { return "close_position" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgClosePosition) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) @@ -144,12 +116,6 @@ func (msg MsgClosePosition) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgClosePosition) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgClosePosition) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -167,23 +133,18 @@ func NewMsgReportLiquidation(sender string, positionId string, rewardRecipient s } } -// Route return the message type used for routing the message. -func (msg MsgReportLiquidation) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgReportLiquidation) Type() string { - return "report_liquidation" -} - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgReportLiquidation) ValidateBasic() error { - return nil -} + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") + } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgReportLiquidation) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) + _, err1 := sdk.AccAddressFromBech32(msg.RewardRecipient) + if err1 != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "recipient address is not valid") + } + return nil } // GetSigners returns the addresses of signers that must sign. @@ -194,20 +155,47 @@ func (msg MsgReportLiquidation) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgReportLevyPeriod{} -func NewMsgReportLevyPeriod() MsgReportLevyPeriod { - return MsgReportLevyPeriod{} +func NewMsgReportLevyPeriod(sender string, positionId string, rewardRecipient string) MsgReportLevyPeriod { + return MsgReportLevyPeriod{ + Sender: sender, + PositionId: positionId, + RewardRecipient: rewardRecipient, + } } -// Route return the message type used for routing the message. -func (msg MsgReportLevyPeriod) Route() string { return RouterKey } +// ValidateBasic does a simple validation check that doesn't require access to state. +func (msg MsgReportLevyPeriod) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") + } + + _, err = sdk.AccAddressFromBech32(msg.RewardRecipient) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "recipient address is not valid") + } -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgReportLevyPeriod) Type() string { - return "report_levy_period" + return nil +} + +// GetSigners returns the addresses of signers that must sign. +func (msg MsgReportLevyPeriod) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Sender) + return []sdk.AccAddress{addr} +} + +var _ sdk.Msg = &MsgAddMargin{} + +func NewMsgAddMargin(sender string, positionId string, amount sdk.Coin) MsgAddMargin { + return MsgAddMargin{ + Sender: sender, + PositionId: positionId, + Amount: amount, + } } // ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgReportLevyPeriod) ValidateBasic() error { +func (msg MsgAddMargin) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") @@ -216,13 +204,34 @@ func (msg MsgReportLevyPeriod) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgReportLevyPeriod) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) +// GetSigners returns the addresses of signers that must sign. +func (msg MsgAddMargin) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Sender) + return []sdk.AccAddress{addr} +} + +var _ sdk.Msg = &MsgRemoveMargin{} + +func NewMsgRemoveMargin(sender string, positionId string, amount sdk.Coin) MsgRemoveMargin { + return MsgRemoveMargin{ + Sender: sender, + PositionId: positionId, + Amount: amount, + } +} + +// ValidateBasic does a simple validation check that doesn't require access to state. +func (msg MsgRemoveMargin) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") + } + + return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgReportLevyPeriod) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{} +func (msg MsgRemoveMargin) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Sender) + return []sdk.AccAddress{addr} } diff --git a/x/derivatives/types/msgs_test.go b/x/derivatives/types/msgs_test.go new file mode 100644 index 000000000..549d494f6 --- /dev/null +++ b/x/derivatives/types/msgs_test.go @@ -0,0 +1,274 @@ +package types + +import ( + "testing" + + codecType "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + + "github.com/UnUniFi/chain/testutil/sample" +) + +func TestMsgDepositToPool_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgDepositToPool + err error + }{ + { + name: "invalid address", + msg: MsgDepositToPool{ + Sender: "invalid_address", + Amount: sdk.NewCoin("uusdc", sdk.NewInt(1)), + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "insufficient amount", + msg: MsgDepositToPool{ + Sender: sample.AccAddress(), + Amount: sdk.NewCoin("uusdc", sdk.NewInt(0)), + }, + err: sdkerrors.ErrInsufficientFunds, + }, + { + name: "valid msg", + msg: MsgDepositToPool{ + Sender: sample.AccAddress(), + Amount: sdk.NewCoin("uusdc", sdk.NewInt(1)), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgWithdrawFromPool_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgWithdrawFromPool + err error + }{ + { + name: "invalid address", + msg: MsgWithdrawFromPool{ + Sender: "invalid_address", + LptAmount: sdk.NewInt(1), + RedeemDenom: "uusdc", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "insufficient amount", + msg: MsgWithdrawFromPool{ + Sender: sample.AccAddress(), + LptAmount: sdk.NewInt(0), + RedeemDenom: "uusdc", + }, + err: ErrInsufficientAmount, + }, + { + name: "valid msg", + msg: MsgWithdrawFromPool{ + Sender: sample.AccAddress(), + LptAmount: sdk.NewInt(1), + RedeemDenom: "uusdc", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgOpenPosition_ValidateBasic(t *testing.T) { + positionInstVal := PerpetualFuturesPositionInstance{ + PositionType: PositionType_LONG, + Size_: sdk.MustNewDecFromStr("0.001"), + Leverage: uint32(1), + } + + piAny, _ := codecType.NewAnyWithValue(&positionInstVal) + tests := []struct { + name string + msg MsgOpenPosition + err error + }{ + { + name: "invalid address", + msg: MsgOpenPosition{ + Sender: "invalid_address", + Margin: sdk.NewCoin("uusdc", sdk.NewInt(1)), + Market: Market{ + BaseDenom: "uusdc", + QuoteDenom: "atom", + }, + PositionInstance: *piAny, + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "valid msg", + msg: MsgOpenPosition{ + Sender: sample.AccAddress(), + Margin: sdk.NewCoin("uusdc", sdk.NewInt(1)), + Market: Market{ + BaseDenom: "uusdc", + QuoteDenom: "atom", + }, + PositionInstance: *piAny, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgClosePosition_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgClosePosition + err error + }{ + { + name: "invalid address", + msg: MsgClosePosition{ + Sender: "invalid_address", + PositionId: "1", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "valid msg", + msg: MsgClosePosition{ + Sender: sample.AccAddress(), + PositionId: "1", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgReportLiquidation_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgReportLiquidation + err error + }{ + { + name: "invalid address", + msg: MsgReportLiquidation{ + Sender: "invalid_address", + PositionId: "1", + RewardRecipient: sample.AccAddress(), + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid reward recipient", + msg: MsgReportLiquidation{ + Sender: sample.AccAddress(), + PositionId: "1", + RewardRecipient: "invalid address", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "valid msg", + msg: MsgReportLiquidation{ + Sender: sample.AccAddress(), + PositionId: "1", + RewardRecipient: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgReportLevyPeriod_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgReportLevyPeriod + err error + }{ + { + name: "invalid address", + msg: MsgReportLevyPeriod{ + Sender: "invalid_address", + PositionId: "1", + RewardRecipient: sample.AccAddress(), + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid reward recipient", + msg: MsgReportLevyPeriod{ + Sender: sample.AccAddress(), + PositionId: "1", + RewardRecipient: "invalid address", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "valid msg", + msg: MsgReportLevyPeriod{ + Sender: sample.AccAddress(), + PositionId: "1", + RewardRecipient: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/derivatives/types/params.go b/x/derivatives/types/params.go index 99372c7b8..d55db1f62 100644 --- a/x/derivatives/types/params.go +++ b/x/derivatives/types/params.go @@ -24,7 +24,8 @@ func DefaultPoolParams() PoolParams { BorrowingFeeRatePerHour: sdk.MustNewDecFromStr("0.000001"), ReportLiquidationRewardRate: sdk.MustNewDecFromStr("0.3"), ReportLevyPeriodRewardRate: sdk.MustNewDecFromStr("0.3"), - AcceptedAssetsConf: []PoolAssetConf{}, + AcceptedAssetsConf: []PoolAssetConf(nil), + LevyPeriodRequiredSeconds: 28800, } } @@ -33,7 +34,7 @@ func DefaultPerpetualFuturesParams() PerpetualFuturesParams { CommissionRate: sdk.MustNewDecFromStr("0.001"), MarginMaintenanceRate: sdk.MustNewDecFromStr("0.5"), ImaginaryFundingRateProportionalCoefficient: sdk.MustNewDecFromStr("0.0005"), - Markets: []*Market{}, + Markets: []*Market(nil), MaxLeverage: 30, } } @@ -44,7 +45,7 @@ func DefaultPerpetualOptionsParams() PerpetualOptionsParams { StrikeCommissionRate: sdk.MustNewDecFromStr("0.001"), MarginMaintenanceRate: sdk.ZeroDec(), ImaginaryFundingRateProportionalCoefficient: sdk.ZeroDec(), - Markets: []*Market{}, + Markets: []*Market(nil), } } @@ -120,6 +121,10 @@ func validatePoolParams(i interface{}) error { return fmt.Errorf("invalid liquidation needed report reward rate: %s", pool.ReportLevyPeriodRewardRate) } + if pool.LevyPeriodRequiredSeconds <= 0 { + return fmt.Errorf("invalid levy period required seconds: %d", pool.LevyPeriodRequiredSeconds) + } + return nil } @@ -151,6 +156,5 @@ func validatePerpetualOptions(i interface{}) error { if !ok { return fmt.Errorf("invalid paramter type: %T", i) } - return nil } diff --git a/x/derivatives/types/perpetual_futures.pb.go b/x/derivatives/types/perpetual_futures.pb.go index 739401fbe..73b39c71a 100644 --- a/x/derivatives/types/perpetual_futures.pb.go +++ b/x/derivatives/types/perpetual_futures.pb.go @@ -86,16 +86,18 @@ func (m *PerpetualFuturesParams) GetMaxLeverage() uint32 { } type PerpetualFuturesPosition struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` - Market Market `protobuf:"bytes,2,opt,name=market,proto3" json:"market" yaml:"market"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` - OpenedAt time.Time `protobuf:"bytes,4,opt,name=opened_at,json=openedAt,proto3,stdtime" json:"opened_at" yaml:"opened_at"` - OpenedHeight uint64 `protobuf:"varint,5,opt,name=opened_height,json=openedHeight,proto3" json:"opened_height,omitempty" yaml:"opened_height"` - OpenedBaseRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=opened_base_rate,json=openedBaseRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_base_rate" yaml:"opened_base_rate"` - OpenedQuoteRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=opened_quote_rate,json=openedQuoteRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_quote_rate" yaml:"opened_quote_rate"` - RemainingMargin types.Coin `protobuf:"bytes,8,opt,name=remaining_margin,json=remainingMargin,proto3" json:"remaining_margin" yaml:"remaining_margin"` - LastLeviedAt time.Time `protobuf:"bytes,9,opt,name=last_levied_at,json=lastLeviedAt,proto3,stdtime" json:"last_levied_at" yaml:"last_levied_at"` - PositionInstance PerpetualFuturesPositionInstance `protobuf:"bytes,10,opt,name=position_instance,json=positionInstance,proto3" json:"position_instance" yaml:"position_instance"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` + Market Market `protobuf:"bytes,2,opt,name=market,proto3" json:"market" yaml:"market"` + OpenerAddress string `protobuf:"bytes,3,opt,name=opener_address,json=openerAddress,proto3" json:"opener_address,omitempty" yaml:"opener_address"` + OpenedAt time.Time `protobuf:"bytes,4,opt,name=opened_at,json=openedAt,proto3,stdtime" json:"opened_at" yaml:"opened_at"` + OpenedHeight uint64 `protobuf:"varint,5,opt,name=opened_height,json=openedHeight,proto3" json:"opened_height,omitempty" yaml:"opened_height"` + OpenedBaseRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=opened_base_rate,json=openedBaseRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_base_rate" yaml:"opened_base_rate"` + OpenedQuoteRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=opened_quote_rate,json=openedQuoteRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"opened_quote_rate" yaml:"opened_quote_rate"` + RemainingMargin types.Coin `protobuf:"bytes,8,opt,name=remaining_margin,json=remainingMargin,proto3" json:"remaining_margin" yaml:"remaining_margin"` + LeviedAmount types.Coin `protobuf:"bytes,9,opt,name=levied_amount,json=leviedAmount,proto3" json:"levied_amount" yaml:"levied_amount"` + LeviedAmountNegative bool `protobuf:"varint,10,opt,name=levied_amount_negative,json=leviedAmountNegative,proto3" json:"levied_amount_negative,omitempty" yaml:"levied_amount_negative"` + LastLeviedAt time.Time `protobuf:"bytes,11,opt,name=last_levied_at,json=lastLeviedAt,proto3,stdtime" json:"last_levied_at" yaml:"last_levied_at"` + PositionInstance PerpetualFuturesPositionInstance `protobuf:"bytes,12,opt,name=position_instance,json=positionInstance,proto3" json:"position_instance" yaml:"position_instance"` } func (m *PerpetualFuturesPosition) Reset() { *m = PerpetualFuturesPosition{} } @@ -145,9 +147,9 @@ func (m *PerpetualFuturesPosition) GetMarket() Market { return Market{} } -func (m *PerpetualFuturesPosition) GetAddress() string { +func (m *PerpetualFuturesPosition) GetOpenerAddress() string { if m != nil { - return m.Address + return m.OpenerAddress } return "" } @@ -173,6 +175,20 @@ func (m *PerpetualFuturesPosition) GetRemainingMargin() types.Coin { return types.Coin{} } +func (m *PerpetualFuturesPosition) GetLeviedAmount() types.Coin { + if m != nil { + return m.LeviedAmount + } + return types.Coin{} +} + +func (m *PerpetualFuturesPosition) GetLeviedAmountNegative() bool { + if m != nil { + return m.LeviedAmountNegative + } + return false +} + func (m *PerpetualFuturesPosition) GetLastLeviedAt() time.Time { if m != nil { return m.LastLeviedAt @@ -348,8 +364,8 @@ func (m *EventPerpetualFuturesPositionOpened) GetPositionId() string { type EventPerpetualFuturesPositionClosed struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` PositionId string `protobuf:"bytes,2,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"` - FeeAmount string `protobuf:"bytes,3,opt,name=fee_amount,json=feeAmount,proto3" json:"fee_amount,omitempty"` - TradeAmount string `protobuf:"bytes,4,opt,name=trade_amount,json=tradeAmount,proto3" json:"trade_amount,omitempty"` + PositionSize string `protobuf:"bytes,3,opt,name=position_size,json=positionSize,proto3" json:"position_size,omitempty"` + PnlAmount string `protobuf:"bytes,4,opt,name=pnl_amount,json=pnlAmount,proto3" json:"pnl_amount,omitempty"` ReturningAmount string `protobuf:"bytes,5,opt,name=returning_amount,json=returningAmount,proto3" json:"returning_amount,omitempty"` } @@ -400,16 +416,16 @@ func (m *EventPerpetualFuturesPositionClosed) GetPositionId() string { return "" } -func (m *EventPerpetualFuturesPositionClosed) GetFeeAmount() string { +func (m *EventPerpetualFuturesPositionClosed) GetPositionSize() string { if m != nil { - return m.FeeAmount + return m.PositionSize } return "" } -func (m *EventPerpetualFuturesPositionClosed) GetTradeAmount() string { +func (m *EventPerpetualFuturesPositionClosed) GetPnlAmount() string { if m != nil { - return m.TradeAmount + return m.PnlAmount } return "" } @@ -426,6 +442,7 @@ type EventPerpetualFuturesPositionLiquidated struct { PositionId string `protobuf:"bytes,2,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"` RemainingMargin string `protobuf:"bytes,3,opt,name=remaining_margin,json=remainingMargin,proto3" json:"remaining_margin,omitempty"` RewardAmount string `protobuf:"bytes,4,opt,name=reward_amount,json=rewardAmount,proto3" json:"reward_amount,omitempty"` + LeviedAmount string `protobuf:"bytes,5,opt,name=levied_amount,json=leviedAmount,proto3" json:"levied_amount,omitempty"` } func (m *EventPerpetualFuturesPositionLiquidated) Reset() { @@ -491,11 +508,19 @@ func (m *EventPerpetualFuturesPositionLiquidated) GetRewardAmount() string { return "" } +func (m *EventPerpetualFuturesPositionLiquidated) GetLeviedAmount() string { + if m != nil { + return m.LeviedAmount + } + return "" +} + type EventPerpetualFuturesPositionLevied struct { RewardRecipient string `protobuf:"bytes,1,opt,name=reward_recipient,json=rewardRecipient,proto3" json:"reward_recipient,omitempty"` PositionId string `protobuf:"bytes,2,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"` RemainingMargin string `protobuf:"bytes,3,opt,name=remaining_margin,json=remainingMargin,proto3" json:"remaining_margin,omitempty"` RewardAmount string `protobuf:"bytes,4,opt,name=reward_amount,json=rewardAmount,proto3" json:"reward_amount,omitempty"` + LeviedAmount string `protobuf:"bytes,5,opt,name=levied_amount,json=leviedAmount,proto3" json:"levied_amount,omitempty"` } func (m *EventPerpetualFuturesPositionLevied) Reset() { *m = EventPerpetualFuturesPositionLevied{} } @@ -559,6 +584,13 @@ func (m *EventPerpetualFuturesPositionLevied) GetRewardAmount() string { return "" } +func (m *EventPerpetualFuturesPositionLevied) GetLeviedAmount() string { + if m != nil { + return m.LeviedAmount + } + return "" +} + type EventLossToLP struct { PositionId string `protobuf:"bytes,1,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"` LossAmount string `protobuf:"bytes,2,opt,name=loss_amount,json=lossAmount,proto3" json:"loss_amount,omitempty"` @@ -628,81 +660,86 @@ func init() { } var fileDescriptor_7a8566c220d595b9 = []byte{ - // 1178 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0xdb, 0xc6, - 0x13, 0x35, 0x65, 0xc5, 0x8e, 0x57, 0x92, 0xed, 0x30, 0x89, 0xad, 0x38, 0xbf, 0x88, 0xf6, 0x06, - 0xc9, 0xcf, 0x41, 0x52, 0x12, 0x49, 0x91, 0x4b, 0x80, 0x1c, 0x2c, 0x27, 0x6e, 0x1c, 0xd8, 0x88, - 0xcd, 0xda, 0x40, 0xd1, 0x43, 0xd9, 0xb5, 0xb8, 0x92, 0x17, 0x11, 0x77, 0x69, 0xee, 0x52, 0xb5, - 0x73, 0xee, 0x21, 0xbd, 0xe5, 0x13, 0xf4, 0xbb, 0xf4, 0x50, 0x20, 0x40, 0x51, 0x20, 0xc7, 0xa2, - 0x07, 0xb5, 0xb0, 0xcf, 0xbd, 0xe8, 0xd0, 0x73, 0xc1, 0xdd, 0x25, 0xf5, 0xc7, 0x72, 0x04, 0x21, - 0x3d, 0xf4, 0x24, 0x72, 0xf6, 0xcd, 0x7b, 0x33, 0xb3, 0x33, 0x43, 0x81, 0xfb, 0x31, 0x8d, 0x29, - 0xa9, 0x13, 0xc7, 0xc7, 0x11, 0x69, 0x21, 0x41, 0x5a, 0x98, 0x3b, 0x21, 0x8e, 0x42, 0x2c, 0x62, - 0xd4, 0xf4, 0xea, 0xb1, 0x88, 0x23, 0xcc, 0xed, 0x30, 0x62, 0x82, 0x99, 0x57, 0x35, 0xd8, 0xee, - 0x01, 0x2f, 0xdd, 0x68, 0x30, 0xd6, 0x68, 0x62, 0x47, 0x42, 0x0e, 0xe2, 0xba, 0x83, 0xe8, 0x89, - 0xc2, 0x2f, 0x5d, 0x6b, 0xb0, 0x06, 0x93, 0x8f, 0x4e, 0xf2, 0xa4, 0xad, 0xd6, 0xa0, 0x83, 0x20, - 0x01, 0xe6, 0x02, 0x05, 0xa1, 0x06, 0x54, 0x6a, 0x8c, 0x07, 0x8c, 0x3b, 0x07, 0x88, 0x63, 0xa7, - 0xf5, 0xf0, 0x00, 0x0b, 0xf4, 0xd0, 0xa9, 0x31, 0x42, 0xf5, 0xf9, 0x9d, 0x61, 0x31, 0xf7, 0x3c, - 0x2b, 0x18, 0xfc, 0x2b, 0x0f, 0x16, 0x76, 0xd2, 0x4c, 0x36, 0x54, 0x22, 0x3b, 0x28, 0x42, 0x01, - 0x37, 0x8f, 0xc0, 0x5c, 0x8d, 0x05, 0x01, 0xe1, 0x9c, 0x30, 0xea, 0x45, 0x48, 0xe0, 0xb2, 0xb1, - 0x6c, 0xac, 0xce, 0x54, 0x5f, 0xbc, 0x6f, 0x5b, 0x13, 0xbf, 0xb7, 0xad, 0xbb, 0x0d, 0x22, 0x0e, - 0xe3, 0x03, 0xbb, 0xc6, 0x02, 0x47, 0x47, 0xa3, 0x7e, 0x3e, 0xe3, 0xfe, 0x6b, 0x47, 0x9c, 0x84, - 0x98, 0xdb, 0xcf, 0x70, 0xad, 0xd3, 0xb6, 0x16, 0x4e, 0x50, 0xd0, 0x7c, 0x02, 0x07, 0xe8, 0xa0, - 0x3b, 0xdb, 0xb5, 0xb8, 0x48, 0x60, 0xf3, 0xad, 0x01, 0x16, 0x03, 0x14, 0x35, 0x08, 0xf5, 0x02, - 0x44, 0xa8, 0xc0, 0x14, 0xd1, 0x1a, 0x56, 0xda, 0x39, 0xa9, 0xbd, 0x33, 0xb6, 0x76, 0x45, 0x69, - 0x5f, 0x40, 0x0b, 0xdd, 0xeb, 0xea, 0x64, 0xbb, 0x7b, 0x20, 0x43, 0xf9, 0xd5, 0x00, 0x0e, 0x09, - 0x50, 0x83, 0x50, 0x14, 0x9d, 0x78, 0xf5, 0x98, 0xfa, 0x84, 0x36, 0xa4, 0x8b, 0x17, 0x46, 0x2c, - 0x64, 0x91, 0x20, 0x8c, 0xa2, 0xa6, 0x57, 0x63, 0xb8, 0x5e, 0x27, 0x35, 0x82, 0xa9, 0x28, 0x4f, - 0xca, 0x10, 0x1b, 0x63, 0x87, 0xf8, 0x58, 0x85, 0xf8, 0x71, 0xb9, 0x41, 0x35, 0xe8, 0xde, 0xcf, - 0x1c, 0x36, 0x14, 0x3e, 0x09, 0x7c, 0xa7, 0x27, 0xb8, 0xf5, 0x2e, 0xda, 0xdc, 0x04, 0xd3, 0x01, - 0x8a, 0x5e, 0x63, 0xc1, 0xcb, 0xf9, 0xe5, 0xc9, 0xd5, 0xc2, 0xa3, 0x9b, 0xf6, 0x90, 0x46, 0xb5, - 0xb7, 0x25, 0xa6, 0x6a, 0x76, 0xda, 0xd6, 0x6c, 0x56, 0xb8, 0xc4, 0x0b, 0xba, 0xa9, 0xbf, 0xf9, - 0x04, 0x14, 0x03, 0x74, 0xec, 0x35, 0x71, 0x0b, 0x47, 0xa8, 0x81, 0xcb, 0x97, 0x96, 0x8d, 0xd5, - 0x52, 0x75, 0xb1, 0xd3, 0xb6, 0xae, 0xa6, 0x2e, 0xdd, 0x53, 0xe8, 0x16, 0x02, 0x74, 0xbc, 0x95, - 0xbe, 0xfd, 0x30, 0x0d, 0xca, 0xe7, 0xfa, 0x8d, 0x71, 0x92, 0x04, 0x6c, 0xde, 0x02, 0x39, 0xe2, - 0xeb, 0x26, 0x2b, 0x75, 0xda, 0xd6, 0x8c, 0xae, 0x8b, 0x0f, 0xdd, 0x1c, 0xf1, 0xcd, 0x97, 0x60, - 0x4a, 0x85, 0x20, 0x7b, 0x61, 0x44, 0x06, 0xd7, 0x93, 0x5b, 0xe8, 0xb4, 0xad, 0x52, 0x6f, 0x16, - 0xd0, 0xd5, 0x0c, 0xe6, 0x03, 0x30, 0x8d, 0x7c, 0x3f, 0xc2, 0x9c, 0xeb, 0x5b, 0xeb, 0xc9, 0x58, - 0x1f, 0x40, 0x37, 0x85, 0x98, 0xfb, 0x60, 0x86, 0x85, 0x98, 0x62, 0xdf, 0x43, 0xa2, 0x9c, 0x97, - 0xe2, 0x4b, 0xb6, 0x9a, 0x50, 0x3b, 0x9d, 0x50, 0x7b, 0x2f, 0x9d, 0xd0, 0xea, 0xff, 0xb4, 0xf6, - 0xbc, 0xe2, 0xcb, 0x5c, 0xe1, 0xbb, 0x3f, 0x2c, 0xc3, 0xbd, 0xac, 0xde, 0xd7, 0x84, 0xf9, 0x14, - 0x94, 0xf4, 0xd9, 0x21, 0x26, 0x8d, 0x43, 0x21, 0x2b, 0x99, 0xaf, 0x96, 0x3b, 0x6d, 0xeb, 0x5a, - 0x9f, 0xab, 0x3a, 0x86, 0x6e, 0x51, 0xbd, 0xbf, 0x90, 0xaf, 0x26, 0x07, 0xf3, 0xfa, 0x3c, 0x59, - 0x02, 0x6a, 0x4a, 0xa6, 0x64, 0x32, 0x9b, 0x63, 0xb7, 0xe0, 0x62, 0x9f, 0x5e, 0xc6, 0x07, 0xdd, - 0x59, 0x65, 0xaa, 0x22, 0xae, 0xe6, 0xa2, 0x05, 0xae, 0x68, 0xd0, 0x51, 0xcc, 0x84, 0x56, 0x9d, - 0x96, 0xaa, 0x2f, 0xc7, 0x56, 0x2d, 0xf7, 0xa9, 0x76, 0x09, 0xa1, 0x3b, 0xa7, 0x6c, 0xbb, 0x89, - 0x49, 0xea, 0x62, 0x30, 0x1f, 0xe1, 0x64, 0x7a, 0x93, 0xb9, 0x50, 0x23, 0x5b, 0xbe, 0x2c, 0x6f, - 0xe2, 0x86, 0xad, 0xd8, 0xed, 0x24, 0x6a, 0x5b, 0xaf, 0x42, 0x7b, 0x9d, 0x11, 0x5a, 0xb5, 0xf4, - 0x45, 0xe8, 0xec, 0x06, 0x09, 0xa0, 0x3b, 0x97, 0x99, 0xb6, 0xa5, 0xc5, 0xac, 0x81, 0xd9, 0x26, - 0xe2, 0x22, 0x69, 0x5f, 0xa2, 0xae, 0x7b, 0x66, 0xe4, 0x75, 0xaf, 0x68, 0x95, 0xeb, 0x4a, 0xa5, - 0xdf, 0x5f, 0xdd, 0x79, 0x31, 0x31, 0x6e, 0x49, 0xdb, 0x9a, 0x30, 0xbf, 0x37, 0xc0, 0x95, 0x50, - 0x37, 0xbd, 0x47, 0x28, 0x17, 0xc9, 0xd6, 0x29, 0x03, 0x29, 0xf4, 0x78, 0x68, 0x53, 0x5f, 0x34, - 0x32, 0x9b, 0xda, 0xb9, 0xba, 0xac, 0x63, 0xd0, 0x15, 0x3d, 0xc7, 0x0e, 0xdd, 0xf9, 0x70, 0xc0, - 0x07, 0xbe, 0xcd, 0x81, 0xe5, 0x51, 0xc4, 0xe6, 0xb7, 0xa0, 0x94, 0x91, 0x25, 0x57, 0x27, 0xc7, - 0x73, 0xf6, 0xd1, 0xca, 0xf0, 0x30, 0x35, 0x72, 0xef, 0x24, 0xc4, 0xbd, 0x6d, 0xdc, 0xc7, 0x00, - 0xdd, 0x62, 0xd8, 0x83, 0x33, 0x77, 0x41, 0x9e, 0x93, 0x37, 0xe9, 0x82, 0x7f, 0x3a, 0x76, 0x13, - 0x15, 0x94, 0x46, 0xc2, 0x01, 0x5d, 0x49, 0x65, 0x3a, 0xe0, 0x72, 0xb6, 0x9d, 0x26, 0xe5, 0x76, - 0xba, 0xda, 0x69, 0x5b, 0x73, 0xfa, 0x7e, 0xb2, 0xcd, 0x94, 0x81, 0xe0, 0xdf, 0x39, 0x70, 0x67, - 0xb0, 0x14, 0x5f, 0x44, 0x8c, 0x67, 0xf5, 0x78, 0x55, 0x57, 0x7b, 0xa5, 0x67, 0x09, 0x19, 0x9f, - 0xbc, 0x84, 0xce, 0xd5, 0x36, 0xf7, 0x6f, 0xd7, 0xf6, 0x47, 0x03, 0x58, 0x19, 0x20, 0x29, 0x8d, - 0x47, 0xa8, 0xe7, 0x63, 0xca, 0x02, 0x0f, 0x1f, 0x87, 0x8c, 0x76, 0xbf, 0x5a, 0x5f, 0x8d, 0x51, - 0xf7, 0x4d, 0x2a, 0x3a, 0x6d, 0xeb, 0xee, 0x80, 0xfe, 0x70, 0x7a, 0xe8, 0xde, 0x4c, 0x11, 0x5f, - 0x92, 0x37, 0x78, 0x93, 0x3e, 0x4b, 0x8e, 0x9f, 0xa7, 0xa7, 0xdf, 0x80, 0xdb, 0xcf, 0x5b, 0x98, - 0x8a, 0x8b, 0xfa, 0xf0, 0x95, 0x5c, 0x03, 0xe6, 0x02, 0x98, 0xe2, 0x98, 0xfa, 0x38, 0x52, 0x5f, - 0x07, 0x57, 0xbf, 0x99, 0x16, 0x28, 0x74, 0x5b, 0xdd, 0x57, 0x2d, 0xe4, 0x82, 0xac, 0xd3, 0x7d, - 0xf8, 0x8b, 0x31, 0x42, 0x60, 0xbd, 0xc9, 0xf8, 0x27, 0x08, 0x98, 0xb7, 0x00, 0xa8, 0x63, 0xec, - 0xa1, 0x80, 0xc5, 0x69, 0x2d, 0xdd, 0x99, 0x3a, 0xc6, 0x6b, 0xd2, 0x60, 0xae, 0x80, 0xa2, 0x88, - 0x90, 0x9f, 0x01, 0xf2, 0x12, 0x50, 0x90, 0x36, 0x0d, 0xb9, 0x97, 0x6c, 0x36, 0x11, 0x47, 0x72, - 0x31, 0x69, 0xd8, 0x25, 0x09, 0x9b, 0xcb, 0xec, 0x0a, 0x0a, 0x7f, 0x36, 0xc0, 0xff, 0x3f, 0x9a, - 0xcd, 0x16, 0x39, 0x8a, 0x89, 0x8f, 0x04, 0xf6, 0x15, 0xed, 0x77, 0x28, 0xf2, 0xbd, 0x08, 0xd7, - 0x48, 0x28, 0xff, 0xa0, 0x18, 0x29, 0x6d, 0x62, 0x77, 0x53, 0xf3, 0xe8, 0x24, 0xef, 0x0d, 0x59, - 0xbe, 0x93, 0x29, 0x57, 0xff, 0x02, 0xbd, 0x0d, 0x4a, 0x5a, 0xb6, 0x2f, 0xe3, 0xa2, 0x32, 0xea, - 0x3c, 0x7e, 0x1a, 0x75, 0x2b, 0x6a, 0x55, 0xfe, 0xa7, 0x73, 0xd8, 0x05, 0x25, 0x99, 0xc2, 0x16, - 0xe3, 0x7c, 0x8f, 0x6d, 0xed, 0x0c, 0x46, 0x60, 0x9c, 0x8b, 0xc0, 0x02, 0x85, 0x26, 0xe3, 0x3c, - 0x25, 0xd5, 0x21, 0x26, 0x26, 0x45, 0x59, 0xdd, 0x78, 0x7f, 0x5a, 0x31, 0x3e, 0x9c, 0x56, 0x8c, - 0x3f, 0x4f, 0x2b, 0xc6, 0xbb, 0xb3, 0xca, 0xc4, 0x87, 0xb3, 0xca, 0xc4, 0x6f, 0x67, 0x95, 0x89, - 0xaf, 0x1f, 0xf4, 0x4c, 0xe5, 0x3e, 0xdd, 0xa7, 0x64, 0x83, 0x38, 0xb5, 0x43, 0x44, 0xa8, 0x73, - 0xdc, 0xf7, 0x07, 0x5f, 0xce, 0xe7, 0xc1, 0x94, 0xfc, 0x48, 0x7d, 0xfe, 0x4f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xd5, 0x54, 0xdb, 0x76, 0xb8, 0x0c, 0x00, 0x00, + // 1253 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0xd4, 0x46, + 0x14, 0x8f, 0x93, 0x10, 0x92, 0xc9, 0x6e, 0x12, 0x0c, 0x04, 0x03, 0x65, 0x1d, 0x26, 0x82, 0x06, + 0xd1, 0xda, 0x82, 0x8a, 0x0b, 0x12, 0x52, 0x59, 0x20, 0x25, 0x28, 0x94, 0xe0, 0x82, 0x5a, 0x55, + 0x55, 0xdd, 0xc9, 0x7a, 0xd6, 0x19, 0xb1, 0x9e, 0x31, 0x9e, 0xf1, 0x36, 0xe1, 0xdc, 0x03, 0x47, + 0x3e, 0x41, 0x3f, 0x0f, 0x17, 0x24, 0x0e, 0x3d, 0x54, 0x3d, 0xb8, 0x15, 0x48, 0x3d, 0x54, 0xea, + 0x65, 0x0f, 0x3d, 0x57, 0x9e, 0x19, 0x7b, 0xd7, 0x9b, 0x85, 0xd5, 0x8a, 0x5e, 0x7a, 0x8a, 0xe7, + 0xfd, 0xf9, 0xfd, 0xde, 0x7b, 0xf3, 0xde, 0x9b, 0x2c, 0xb8, 0x9c, 0xd2, 0x94, 0x92, 0x36, 0x71, + 0x03, 0x9c, 0x90, 0x2e, 0x12, 0xa4, 0x8b, 0xb9, 0x1b, 0xe3, 0x24, 0xc6, 0x22, 0x45, 0x1d, 0xbf, + 0x9d, 0x8a, 0x34, 0xc1, 0xdc, 0x89, 0x13, 0x26, 0x98, 0x79, 0x5c, 0x1b, 0x3b, 0x03, 0xc6, 0x67, + 0x4e, 0x87, 0x8c, 0x85, 0x1d, 0xec, 0x4a, 0x93, 0xdd, 0xb4, 0xed, 0x22, 0x7a, 0xa0, 0xec, 0xcf, + 0x9c, 0x08, 0x59, 0xc8, 0xe4, 0xa7, 0x9b, 0x7f, 0x69, 0xa9, 0x3d, 0xec, 0x20, 0x48, 0x84, 0xb9, + 0x40, 0x51, 0xac, 0x0d, 0x1a, 0x2d, 0xc6, 0x23, 0xc6, 0xdd, 0x5d, 0xc4, 0xb1, 0xdb, 0xbd, 0xb2, + 0x8b, 0x05, 0xba, 0xe2, 0xb6, 0x18, 0xa1, 0x5a, 0x7f, 0x61, 0x54, 0xcc, 0x03, 0xdf, 0xca, 0x0c, + 0xfe, 0x3d, 0x0b, 0x56, 0x77, 0x8a, 0x4c, 0x36, 0x55, 0x22, 0x3b, 0x28, 0x41, 0x11, 0x37, 0x9f, + 0x82, 0xe5, 0x16, 0x8b, 0x22, 0xc2, 0x39, 0x61, 0xd4, 0x4f, 0x90, 0xc0, 0x96, 0xb1, 0x66, 0x6c, + 0x2c, 0x34, 0xef, 0xbe, 0xcc, 0xec, 0xa9, 0xdf, 0x32, 0xfb, 0x62, 0x48, 0xc4, 0x5e, 0xba, 0xeb, + 0xb4, 0x58, 0xe4, 0xea, 0x68, 0xd4, 0x9f, 0x4f, 0x79, 0xf0, 0xc4, 0x15, 0x07, 0x31, 0xe6, 0xce, + 0x6d, 0xdc, 0xea, 0x65, 0xf6, 0xea, 0x01, 0x8a, 0x3a, 0xd7, 0xe1, 0x10, 0x1c, 0xf4, 0x96, 0xfa, + 0x12, 0x0f, 0x09, 0x6c, 0x3e, 0x37, 0xc0, 0xa9, 0x08, 0x25, 0x21, 0xa1, 0x7e, 0x84, 0x08, 0x15, + 0x98, 0x22, 0xda, 0xc2, 0x8a, 0x7b, 0x5a, 0x72, 0xef, 0x4c, 0xcc, 0xdd, 0x50, 0xdc, 0xef, 0x80, + 0x85, 0xde, 0x49, 0xa5, 0xb9, 0xdf, 0x57, 0xc8, 0x50, 0x5e, 0x19, 0xc0, 0x25, 0x11, 0x0a, 0x09, + 0x45, 0xc9, 0x81, 0xdf, 0x4e, 0x69, 0x40, 0x68, 0x28, 0x5d, 0xfc, 0x38, 0x61, 0x31, 0x4b, 0x04, + 0x61, 0x14, 0x75, 0xfc, 0x16, 0xc3, 0xed, 0x36, 0x69, 0x11, 0x4c, 0x85, 0x35, 0x23, 0x43, 0x0c, + 0x27, 0x0e, 0xf1, 0x9a, 0x0a, 0xf1, 0xfd, 0x74, 0xc3, 0x6c, 0xd0, 0xbb, 0x5c, 0x3a, 0x6c, 0x2a, + 0xfb, 0x3c, 0xf0, 0x9d, 0x81, 0xe0, 0x6e, 0xf5, 0xad, 0xcd, 0x2d, 0x70, 0x34, 0x42, 0xc9, 0x13, + 0x2c, 0xb8, 0x35, 0xbb, 0x36, 0xb3, 0xb1, 0x78, 0xf5, 0xac, 0x33, 0xa2, 0x51, 0x9d, 0xfb, 0xd2, + 0xa6, 0x69, 0xf6, 0x32, 0x7b, 0xa9, 0x2c, 0x5c, 0xee, 0x05, 0xbd, 0xc2, 0xdf, 0xbc, 0x0e, 0x6a, + 0x11, 0xda, 0xf7, 0x3b, 0xb8, 0x8b, 0x13, 0x14, 0x62, 0xeb, 0xc8, 0x9a, 0xb1, 0x51, 0x6f, 0x9e, + 0xea, 0x65, 0xf6, 0xf1, 0xc2, 0xa5, 0xaf, 0x85, 0xde, 0x62, 0x84, 0xf6, 0xb7, 0x8b, 0xd3, 0x2f, + 0xf3, 0xc0, 0x3a, 0xd4, 0x6f, 0x8c, 0x93, 0x3c, 0x60, 0xf3, 0x1c, 0x98, 0x26, 0x81, 0x6e, 0xb2, + 0x7a, 0x2f, 0xb3, 0x17, 0x74, 0x5d, 0x02, 0xe8, 0x4d, 0x93, 0xc0, 0xbc, 0x07, 0xe6, 0x54, 0x08, + 0xb2, 0x17, 0xc6, 0x64, 0x70, 0x32, 0xbf, 0x85, 0x5e, 0x66, 0xd7, 0x07, 0xb3, 0x80, 0x9e, 0x46, + 0x30, 0x3f, 0x07, 0x4b, 0x2c, 0xc6, 0x14, 0x27, 0x3e, 0x0a, 0x82, 0x04, 0x73, 0xae, 0x2f, 0xef, + 0x74, 0x2f, 0xb3, 0x4f, 0x2a, 0x97, 0xaa, 0x1e, 0x7a, 0x75, 0x25, 0xb8, 0xa9, 0xce, 0xe6, 0x63, + 0xb0, 0x20, 0x05, 0x81, 0x8f, 0x84, 0x35, 0x2b, 0x03, 0x3a, 0xe3, 0xa8, 0xa9, 0x75, 0x8a, 0xa9, + 0x75, 0x1e, 0x15, 0x53, 0xdb, 0xfc, 0x48, 0xc7, 0xb3, 0x32, 0x00, 0x9e, 0xbb, 0xc2, 0x17, 0xbf, + 0xdb, 0x86, 0x37, 0xaf, 0xce, 0x37, 0x85, 0x79, 0x03, 0xd4, 0xb5, 0x6e, 0x0f, 0x93, 0x70, 0x4f, + 0xc8, 0xea, 0xce, 0x36, 0xad, 0x5e, 0x66, 0x9f, 0xa8, 0xb8, 0x2a, 0x35, 0xf4, 0x6a, 0xea, 0x7c, + 0x57, 0x1e, 0x4d, 0x0e, 0x56, 0xb4, 0x3e, 0x5f, 0x0c, 0x6a, 0x72, 0xe6, 0x64, 0x66, 0x5b, 0x13, + 0xb7, 0xe5, 0xa9, 0x0a, 0x5f, 0x89, 0x07, 0x3d, 0x55, 0xba, 0xa0, 0x89, 0xb8, 0x9a, 0x95, 0x2e, + 0x38, 0xa6, 0x8d, 0x9e, 0xa6, 0x4c, 0x68, 0xd6, 0xa3, 0x92, 0xf5, 0xde, 0xc4, 0xac, 0x56, 0x85, + 0xb5, 0x0f, 0x08, 0xbd, 0x65, 0x25, 0x7b, 0x98, 0x8b, 0x24, 0x2f, 0x06, 0x2b, 0x09, 0xce, 0x27, + 0x3a, 0x9f, 0x15, 0x35, 0xc6, 0xd6, 0xbc, 0xbc, 0x89, 0xd3, 0x8e, 0x42, 0x77, 0xf2, 0xa8, 0x1d, + 0xbd, 0x1e, 0x9d, 0x5b, 0x8c, 0xd0, 0xa6, 0xad, 0x2f, 0x42, 0x67, 0x37, 0x0c, 0x00, 0xbd, 0xe5, + 0x52, 0x74, 0x5f, 0x4a, 0xcc, 0xef, 0x40, 0xbd, 0x83, 0xbb, 0x24, 0xbf, 0xae, 0x88, 0xa5, 0x54, + 0x58, 0x0b, 0xe3, 0x38, 0x8a, 0xcb, 0xd6, 0x37, 0x56, 0xf1, 0x86, 0x5e, 0x4d, 0x9d, 0x6f, 0xca, + 0xa3, 0xf9, 0x35, 0x58, 0xad, 0xe8, 0x7d, 0x8a, 0x43, 0xd9, 0xca, 0x16, 0x58, 0x33, 0x36, 0xe6, + 0x9b, 0xe7, 0x7b, 0x99, 0x7d, 0x6e, 0x04, 0x4e, 0x69, 0x07, 0xbd, 0x13, 0x83, 0x80, 0x5f, 0x6a, + 0xb1, 0xd9, 0x02, 0x4b, 0x1d, 0xc4, 0x85, 0x5f, 0x78, 0x09, 0x6b, 0x71, 0x6c, 0x97, 0x9e, 0xd7, + 0x81, 0xeb, 0x11, 0xa8, 0xfa, 0xab, 0x56, 0xad, 0xe5, 0xc2, 0x6d, 0x45, 0x28, 0xcc, 0x9f, 0x0c, + 0x70, 0x2c, 0xd6, 0xf3, 0xeb, 0x13, 0xca, 0x45, 0xbe, 0x40, 0xad, 0x9a, 0x24, 0xba, 0x36, 0x72, + 0x3e, 0xdf, 0x35, 0xfd, 0x5b, 0xda, 0xb9, 0xb9, 0xa6, 0x63, 0xd0, 0x8d, 0x70, 0x08, 0x1d, 0x7a, + 0x2b, 0xf1, 0x90, 0x0f, 0x7c, 0x3e, 0x0d, 0xd6, 0xc6, 0x01, 0x9b, 0x3f, 0x80, 0x7a, 0x09, 0x96, + 0x77, 0x9c, 0xdc, 0x34, 0x4b, 0x57, 0xcf, 0x8f, 0x0e, 0x53, 0x5b, 0x3e, 0x3a, 0x88, 0xf1, 0xe0, + 0xf4, 0x55, 0x10, 0xa0, 0x57, 0x8b, 0x07, 0xec, 0xcc, 0x87, 0x60, 0x96, 0x93, 0x67, 0xc5, 0x5b, + 0x75, 0x63, 0xe2, 0xde, 0x5f, 0x54, 0x1c, 0x39, 0x06, 0xf4, 0x24, 0x94, 0xe9, 0x82, 0xf9, 0x72, + 0xd1, 0xce, 0xc8, 0x45, 0x7b, 0xbc, 0x97, 0xd9, 0xcb, 0x65, 0x43, 0xe8, 0x25, 0x5b, 0x1a, 0xc1, + 0x7f, 0xa6, 0xc1, 0x85, 0xe1, 0x52, 0x7c, 0x91, 0x30, 0x5e, 0xd6, 0xe3, 0x41, 0x5b, 0xad, 0xc8, + 0x81, 0x7d, 0x6a, 0x7c, 0xf0, 0x3e, 0x3d, 0x54, 0xdb, 0xe9, 0xff, 0xba, 0xb6, 0x3f, 0x1b, 0xc0, + 0x2e, 0x0d, 0xf2, 0xd2, 0xf8, 0x84, 0xfa, 0x01, 0xa6, 0x2c, 0xf2, 0xf1, 0x7e, 0xcc, 0x68, 0xff, + 0x01, 0xfe, 0x66, 0x82, 0xba, 0x6f, 0x51, 0xd1, 0xcb, 0xec, 0x8b, 0x43, 0xfc, 0xa3, 0xe1, 0xa1, + 0x77, 0xb6, 0xb0, 0xf8, 0x8a, 0x3c, 0xc3, 0x5b, 0xf4, 0x76, 0xae, 0xbe, 0x53, 0x68, 0xbf, 0x07, + 0xeb, 0x77, 0xba, 0x98, 0x8a, 0x77, 0xf5, 0xe1, 0x03, 0xb9, 0xbd, 0xcc, 0x55, 0x30, 0xc7, 0x31, + 0x0d, 0x70, 0xa2, 0x1e, 0x3a, 0x4f, 0x9f, 0x4c, 0x1b, 0x2c, 0xf6, 0x5b, 0x3d, 0x50, 0x2d, 0xe4, + 0x81, 0xb2, 0xd3, 0x03, 0xf8, 0xca, 0x18, 0x43, 0x70, 0xab, 0xc3, 0xf8, 0x07, 0x10, 0x98, 0xeb, + 0x03, 0x77, 0x28, 0xdb, 0x58, 0x96, 0xb3, 0x7f, 0x0d, 0x79, 0xd2, 0xe6, 0x39, 0x00, 0x62, 0xda, + 0x29, 0x36, 0xe1, 0xac, 0xb4, 0x58, 0x88, 0x69, 0x47, 0x6f, 0xb3, 0x4b, 0xf9, 0x4a, 0x16, 0x69, + 0x22, 0x37, 0xaa, 0x36, 0x3a, 0x22, 0x8d, 0x96, 0x4b, 0xb9, 0x32, 0x85, 0x7f, 0x19, 0xe0, 0xe3, + 0xf7, 0xe6, 0xb3, 0x4d, 0x9e, 0xa6, 0x24, 0x40, 0x02, 0x07, 0x0a, 0xf6, 0x47, 0x94, 0x04, 0x7e, + 0x82, 0x5b, 0x24, 0x96, 0xff, 0x6d, 0x19, 0x05, 0x6c, 0x2e, 0xf7, 0x0a, 0xf1, 0xf8, 0x34, 0x2f, + 0x8d, 0x78, 0x35, 0x66, 0x0a, 0xac, 0xea, 0xe6, 0x5f, 0x07, 0x75, 0x4d, 0x5b, 0xc9, 0xb7, 0xa6, + 0x84, 0x3a, 0xe5, 0xf5, 0xe1, 0xe7, 0x41, 0xe5, 0x5b, 0xd9, 0xf2, 0xf0, 0xcf, 0x71, 0x97, 0xa7, + 0x36, 0xea, 0xff, 0x3f, 0xd1, 0x87, 0xa0, 0x2e, 0xf3, 0xdc, 0x66, 0x9c, 0x3f, 0x62, 0xdb, 0x3b, + 0xc3, 0x61, 0x1a, 0x87, 0xc2, 0xb4, 0xc1, 0x62, 0x87, 0x71, 0x5e, 0x80, 0xea, 0x3c, 0x72, 0x91, + 0x82, 0x6c, 0x6e, 0xbe, 0x7c, 0xd3, 0x30, 0x5e, 0xbf, 0x69, 0x18, 0x7f, 0xbc, 0x69, 0x18, 0x2f, + 0xde, 0x36, 0xa6, 0x5e, 0xbf, 0x6d, 0x4c, 0xfd, 0xfa, 0xb6, 0x31, 0xf5, 0xed, 0x27, 0x03, 0x13, + 0xfe, 0x98, 0x3e, 0xa6, 0x64, 0x93, 0xb8, 0xad, 0x3d, 0x44, 0xa8, 0xbb, 0x5f, 0xf9, 0xdd, 0x23, + 0x67, 0x7d, 0x77, 0x4e, 0x3e, 0x78, 0x9f, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x10, 0x39, 0xe1, + 0x76, 0xcf, 0x0d, 0x00, 0x00, } func (m *PerpetualFuturesParams) Marshal() (dAtA []byte, err error) { @@ -806,7 +843,7 @@ func (m *PerpetualFuturesPosition) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintPerpetualFutures(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x62 n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastLeviedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastLeviedAt):]) if err2 != nil { return 0, err2 @@ -814,6 +851,26 @@ func (m *PerpetualFuturesPosition) MarshalToSizedBuffer(dAtA []byte) (int, error i -= n2 i = encodeVarintPerpetualFutures(dAtA, i, uint64(n2)) i-- + dAtA[i] = 0x5a + if m.LeviedAmountNegative { + i-- + if m.LeviedAmountNegative { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + { + size, err := m.LeviedAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPerpetualFutures(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x4a { size, err := m.RemainingMargin.MarshalToSizedBuffer(dAtA[:i]) @@ -850,18 +907,18 @@ func (m *PerpetualFuturesPosition) MarshalToSizedBuffer(dAtA []byte) (int, error i-- dAtA[i] = 0x28 } - n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.OpenedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.OpenedAt):]) - if err4 != nil { - return 0, err4 + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.OpenedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.OpenedAt):]) + if err5 != nil { + return 0, err5 } - i -= n4 - i = encodeVarintPerpetualFutures(dAtA, i, uint64(n4)) + i -= n5 + i = encodeVarintPerpetualFutures(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x22 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.Address))) + if len(m.OpenerAddress) > 0 { + i -= len(m.OpenerAddress) + copy(dAtA[i:], m.OpenerAddress) + i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.OpenerAddress))) i-- dAtA[i] = 0x1a } @@ -1040,17 +1097,17 @@ func (m *EventPerpetualFuturesPositionClosed) MarshalToSizedBuffer(dAtA []byte) i-- dAtA[i] = 0x2a } - if len(m.TradeAmount) > 0 { - i -= len(m.TradeAmount) - copy(dAtA[i:], m.TradeAmount) - i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.TradeAmount))) + if len(m.PnlAmount) > 0 { + i -= len(m.PnlAmount) + copy(dAtA[i:], m.PnlAmount) + i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.PnlAmount))) i-- dAtA[i] = 0x22 } - if len(m.FeeAmount) > 0 { - i -= len(m.FeeAmount) - copy(dAtA[i:], m.FeeAmount) - i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.FeeAmount))) + if len(m.PositionSize) > 0 { + i -= len(m.PositionSize) + copy(dAtA[i:], m.PositionSize) + i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.PositionSize))) i-- dAtA[i] = 0x1a } @@ -1091,6 +1148,13 @@ func (m *EventPerpetualFuturesPositionLiquidated) MarshalToSizedBuffer(dAtA []by _ = i var l int _ = l + if len(m.LeviedAmount) > 0 { + i -= len(m.LeviedAmount) + copy(dAtA[i:], m.LeviedAmount) + i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.LeviedAmount))) + i-- + dAtA[i] = 0x2a + } if len(m.RewardAmount) > 0 { i -= len(m.RewardAmount) copy(dAtA[i:], m.RewardAmount) @@ -1142,6 +1206,13 @@ func (m *EventPerpetualFuturesPositionLevied) MarshalToSizedBuffer(dAtA []byte) _ = i var l int _ = l + if len(m.LeviedAmount) > 0 { + i -= len(m.LeviedAmount) + copy(dAtA[i:], m.LeviedAmount) + i = encodeVarintPerpetualFutures(dAtA, i, uint64(len(m.LeviedAmount))) + i-- + dAtA[i] = 0x2a + } if len(m.RewardAmount) > 0 { i -= len(m.RewardAmount) copy(dAtA[i:], m.RewardAmount) @@ -1257,7 +1328,7 @@ func (m *PerpetualFuturesPosition) Size() (n int) { } l = m.Market.Size() n += 1 + l + sovPerpetualFutures(uint64(l)) - l = len(m.Address) + l = len(m.OpenerAddress) if l > 0 { n += 1 + l + sovPerpetualFutures(uint64(l)) } @@ -1272,6 +1343,11 @@ func (m *PerpetualFuturesPosition) Size() (n int) { n += 1 + l + sovPerpetualFutures(uint64(l)) l = m.RemainingMargin.Size() n += 1 + l + sovPerpetualFutures(uint64(l)) + l = m.LeviedAmount.Size() + n += 1 + l + sovPerpetualFutures(uint64(l)) + if m.LeviedAmountNegative { + n += 2 + } l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastLeviedAt) n += 1 + l + sovPerpetualFutures(uint64(l)) l = m.PositionInstance.Size() @@ -1343,11 +1419,11 @@ func (m *EventPerpetualFuturesPositionClosed) Size() (n int) { if l > 0 { n += 1 + l + sovPerpetualFutures(uint64(l)) } - l = len(m.FeeAmount) + l = len(m.PositionSize) if l > 0 { n += 1 + l + sovPerpetualFutures(uint64(l)) } - l = len(m.TradeAmount) + l = len(m.PnlAmount) if l > 0 { n += 1 + l + sovPerpetualFutures(uint64(l)) } @@ -1380,6 +1456,10 @@ func (m *EventPerpetualFuturesPositionLiquidated) Size() (n int) { if l > 0 { n += 1 + l + sovPerpetualFutures(uint64(l)) } + l = len(m.LeviedAmount) + if l > 0 { + n += 1 + l + sovPerpetualFutures(uint64(l)) + } return n } @@ -1405,6 +1485,10 @@ func (m *EventPerpetualFuturesPositionLevied) Size() (n int) { if l > 0 { n += 1 + l + sovPerpetualFutures(uint64(l)) } + l = len(m.LeviedAmount) + if l > 0 { + n += 1 + l + sovPerpetualFutures(uint64(l)) + } return n } @@ -1732,7 +1816,7 @@ func (m *PerpetualFuturesPosition) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OpenerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1760,7 +1844,7 @@ func (m *PerpetualFuturesPosition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.OpenerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -1916,6 +2000,59 @@ func (m *PerpetualFuturesPosition) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeviedAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetualFutures + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPerpetualFutures + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPerpetualFutures + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LeviedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LeviedAmountNegative", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetualFutures + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LeviedAmountNegative = bool(v != 0) + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastLeviedAt", wireType) } @@ -1948,7 +2085,7 @@ func (m *PerpetualFuturesPosition) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PositionInstance", wireType) } @@ -2469,7 +2606,7 @@ func (m *EventPerpetualFuturesPositionClosed) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionSize", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2497,11 +2634,11 @@ func (m *EventPerpetualFuturesPositionClosed) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FeeAmount = string(dAtA[iNdEx:postIndex]) + m.PositionSize = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TradeAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PnlAmount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2529,7 +2666,7 @@ func (m *EventPerpetualFuturesPositionClosed) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TradeAmount = string(dAtA[iNdEx:postIndex]) + m.PnlAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { @@ -2741,6 +2878,38 @@ func (m *EventPerpetualFuturesPositionLiquidated) Unmarshal(dAtA []byte) error { } m.RewardAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeviedAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetualFutures + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPerpetualFutures + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPerpetualFutures + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LeviedAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPerpetualFutures(dAtA[iNdEx:]) @@ -2919,6 +3088,38 @@ func (m *EventPerpetualFuturesPositionLevied) Unmarshal(dAtA []byte) error { } m.RewardAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeviedAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetualFutures + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPerpetualFutures + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPerpetualFutures + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LeviedAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPerpetualFutures(dAtA[iNdEx:]) diff --git a/x/derivatives/types/pool.go b/x/derivatives/types/pool.go index 3e5e1726e..991b633cd 100644 --- a/x/derivatives/types/pool.go +++ b/x/derivatives/types/pool.go @@ -31,6 +31,10 @@ func (p PoolParams) Validate() error { return fmt.Errorf("ReportLevyPeriodRewardRate should be between 0-1") } + if p.LevyPeriodRequiredSeconds <= 0 { + return fmt.Errorf("LevyPeriodRequiredSeconds should be positive") + } + if len(p.AcceptedAssetsConf) == 0 { return fmt.Errorf("Empty AcceptedAssets") } diff --git a/x/derivatives/types/positions.go b/x/derivatives/types/positions.go index 5640b3200..61ba8dd4f 100644 --- a/x/derivatives/types/positions.go +++ b/x/derivatives/types/positions.go @@ -1,6 +1,6 @@ // InMetrics represents the profit/loss amount in the metrics asset of the market. // In the most cases, it means it's in "usd". -// And IMPORTANTLY, it means it's not calcualted in micro case. +// And IMPORTANTLY, it means it's not calculated in micro case. package types @@ -107,16 +107,18 @@ func (m Position) NeedLiquidation(MarginMaintenanceRate sdk.Dec, currentBaseMetr func NewPerpetualFuturesPosition(position Position, ins PerpetualFuturesPositionInstance) PerpetualFuturesPosition { return PerpetualFuturesPosition{ - Id: position.Id, - Market: position.Market, - Address: position.Address, - OpenedAt: position.OpenedAt, - OpenedBaseRate: position.OpenedBaseRate, - OpenedQuoteRate: position.OpenedQuoteRate, - OpenedHeight: position.OpenedHeight, - RemainingMargin: position.RemainingMargin, - LastLeviedAt: position.LastLeviedAt, - PositionInstance: ins, + Id: position.Id, + Market: position.Market, + OpenerAddress: position.OpenerAddress, + OpenedAt: position.OpenedAt, + OpenedBaseRate: position.OpenedBaseRate, + OpenedQuoteRate: position.OpenedQuoteRate, + OpenedHeight: position.OpenedHeight, + RemainingMargin: position.RemainingMargin, + LeviedAmount: position.LeviedAmount, + LeviedAmountNegative: position.LeviedAmountNegative, + LastLeviedAt: position.LastLeviedAt, + PositionInstance: ins, } } @@ -128,16 +130,18 @@ func NewPerpetualFuturesPositionFromPosition(position Position) (PerpetualFuture switch positionInstance := ins.(type) { case *PerpetualFuturesPositionInstance: return PerpetualFuturesPosition{ - Id: position.Id, - Market: position.Market, - Address: position.Address, - OpenedAt: position.OpenedAt, - OpenedBaseRate: position.OpenedBaseRate, - OpenedQuoteRate: position.OpenedQuoteRate, - OpenedHeight: position.OpenedHeight, - RemainingMargin: position.RemainingMargin, - LastLeviedAt: position.LastLeviedAt, - PositionInstance: *positionInstance, + Id: position.Id, + Market: position.Market, + OpenerAddress: position.OpenerAddress, + OpenedAt: position.OpenedAt, + OpenedBaseRate: position.OpenedBaseRate, + OpenedQuoteRate: position.OpenedQuoteRate, + OpenedHeight: position.OpenedHeight, + RemainingMargin: position.RemainingMargin, + LeviedAmount: position.LeviedAmount, + LeviedAmountNegative: position.LeviedAmountNegative, + LastLeviedAt: position.LastLeviedAt, + PositionInstance: *positionInstance, }, nil default: return PerpetualFuturesPosition{}, ErrInvalidPositionInstance @@ -171,6 +175,10 @@ func NormalToMicroDec(amount sdk.Dec) sdk.Dec { return amount.Mul(sdk.MustNewDecFromStr(OneMillionString)) } +func MicroToNormalDec(amount sdk.Int) sdk.Dec { + return sdk.NewDecFromInt(amount).Quo(sdk.MustNewDecFromStr(OneMillionString)) +} + // todo make test func (m Positions) EvaluatePositions(posType PositionType, quoteTicker string, getCurrentPriceF func(denom string) (sdk.Dec, error)) (sdk.Dec, error) { usdMap := map[string]sdk.Dec{} @@ -230,18 +238,18 @@ func (positionInstance PerpetualFuturesPositionInstance) MarginRequirement(curre } func (m PerpetualFuturesPosition) RequiredMarginInQuote(baseQuoteRate sdk.Dec) sdk.Int { - // 必要証拠金(quote単位) = 現在のbase/quoteレート * ポジションサイズ(base単位) ÷ レバレッジ + // Required Margin (in quote units) = Current base/quote rate * Position size (in base units) ÷ Leverage return m.PositionInstance.MarginRequirement(baseQuoteRate) } func (m PerpetualFuturesPosition) RequiredMarginInBase() sdk.Int { - // 必要証拠金(base単位) = ポジションサイズ(base単位) ÷ レバレッジ // レートでの変動なし + // Required Margin (in base units) = Position size (in base units) ÷ Leverage // No change in rate return m.PositionInstance.MarginRequirement(sdk.MustNewDecFromStr("1")) } func (m PerpetualFuturesPosition) RequiredMarginInMetrics(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { - // 必要証拠金(USD単位) = 必要証拠金(quote単位) * 現在のquote/USDレート - // = 必要証拠金(base単位) * 現在のbase/USDレート + // Required Margin (in USD units) = Required Margin (in quote units) * Current quote/USD rate + // = Required Margin (in base units) * Current base/USD rate if m.RemainingMargin.Denom == m.Market.QuoteDenom { baseQuoteRate := baseMetricsRate.Amount.Amount.Quo(quoteMetricsRate.Amount.Amount) return sdk.NewDecFromInt(m.RequiredMarginInQuote(baseQuoteRate)).Mul(quoteMetricsRate.Amount.Amount) @@ -297,9 +305,9 @@ func (m PerpetualFuturesPosition) ProfitAndLoss(baseMetricsRate, quoteMetricsRat } func (m PerpetualFuturesPosition) ProfitAndLossInQuote(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { - // 損益(quote単位) = (longなら*1,shortなら*-1) * (現在のbase/quoteレート - ポジション開設時base/quoteレート) * ポジションサイズ(base単位) + // Profit/Loss (in quote units) = (1 for long, -1 for short) * (Current base/quote rate - Base/quote rate at position opening) * Position size (in base units) baseQuoteRate := baseMetricsRate.Amount.Amount.Quo(quoteMetricsRate.Amount.Amount) - // FIXME: Don't use OneMillionInt derectly. issue #476 + // FIXME: Don't use OneMillionInt directly. issue #476 profitAndLoss := baseQuoteRate.Sub(m.OpenedPairRate()).Mul(sdk.NewDecFromInt(m.PositionInstance.SizeInDenomExponent(OneMillionInt))) if m.PositionInstance.PositionType == PositionType_LONG { return profitAndLoss @@ -309,19 +317,19 @@ func (m PerpetualFuturesPosition) ProfitAndLossInQuote(baseMetricsRate, quoteMet } func (m PerpetualFuturesPosition) ProfitAndLossInMetrics(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { - // 損益(USD単位) = 損益(quote単位) * 現在のquote/USDレート + // Profit/Loss (in USD units) = Profit/Loss (in quote units) * Current quote/USD rate return m.ProfitAndLossInQuote(baseMetricsRate, quoteMetricsRate).Mul(quoteMetricsRate.Amount.Amount) } // position size takes 0 decimal although price takes 6 decimal (micro unit) func (m PerpetualFuturesPosition) MarginMaintenanceRate(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { - // 証拠金維持率 = 有効証拠金(USD単位) ÷ 必要証拠金(USD単位) + // Maintenance Margin Ratio = Account Equity (in USD units) / Required Margin (in USD units) return m.EffectiveMarginInMetrics(baseMetricsRate, quoteMetricsRate).Quo(m.RequiredMarginInMetrics(baseMetricsRate, quoteMetricsRate)) } func (m PerpetualFuturesPosition) RemainingMarginInMetrics(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { - // 残存証拠金(USD単位) = 残存証拠金(base単位) * 現在のbase/USDレート - // = 残存証拠金(quote単位) * 現在のquote/USDレート + // Remaining Margin (in USD units) = Remaining Margin (in base units) * Current base/USD rate + // = Remaining Margin (in quote units) * Current quote/USD rate remainingMarginAmountInDec := sdk.NewDecFromInt(m.RemainingMargin.Amount) if m.RemainingMargin.Denom == m.Market.BaseDenom { return remainingMarginAmountInDec.Mul(baseMetricsRate.Amount.Amount) @@ -333,9 +341,30 @@ func (m PerpetualFuturesPosition) RemainingMarginInMetrics(baseMetricsRate, quot } } +func (m PerpetualFuturesPosition) LeviedAmountInMetrics(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { + // Levy Fee (in USD units) = Levy Fee (in base units) * Current base/USD rate + // = Levy Fee (in quote units) * Current quote/USD rate + if m.LeviedAmount.IsNil() { + return sdk.ZeroDec() + } + leviedAmountInDec := sdk.NewDecFromInt(m.LeviedAmount.Amount) + if m.LeviedAmount.Denom == m.Market.BaseDenom { + return leviedAmountInDec.Mul(baseMetricsRate.Amount.Amount) + } else if m.LeviedAmount.Denom == m.Market.QuoteDenom { + return leviedAmountInDec.Mul(quoteMetricsRate.Amount.Amount) + } else { + // not supported denom + return sdk.ZeroDec() + } +} + func (m PerpetualFuturesPosition) EffectiveMarginInMetrics(baseMetricsRate, quoteMetricsRate MetricsRateType) sdk.Dec { - // 有効証拠金(USD単位) = 残存証拠金(USD単位) + 損益(USD単位) - return m.RemainingMarginInMetrics(baseMetricsRate, quoteMetricsRate).Add(m.ProfitAndLossInMetrics(baseMetricsRate, quoteMetricsRate)) + // Effective Margin (in USD units) = Remaining Margin (in USD units) + Profit/Loss (in USD units) - Levy Fee (in USD units) + if m.LeviedAmountNegative { + return m.RemainingMarginInMetrics(baseMetricsRate, quoteMetricsRate).Add(m.ProfitAndLossInMetrics(baseMetricsRate, quoteMetricsRate)).Sub(m.LeviedAmountInMetrics(baseMetricsRate, quoteMetricsRate)) + } else { + return m.RemainingMarginInMetrics(baseMetricsRate, quoteMetricsRate).Add(m.ProfitAndLossInMetrics(baseMetricsRate, quoteMetricsRate)).Add(m.LeviedAmountInMetrics(baseMetricsRate, quoteMetricsRate)) + } } func NewMetricsRateType(unit string, denom string, amount sdk.Dec) MetricsRateType { diff --git a/x/derivatives/types/positions_test.go b/x/derivatives/types/positions_test.go index f3d60b123..5c7e73d6f 100644 --- a/x/derivatives/types/positions_test.go +++ b/x/derivatives/types/positions_test.go @@ -35,7 +35,9 @@ func TestPosition_IsValid(t *testing.T) { OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), // not market base or quote asset - RemainingMargin: sdk.NewCoin("ubtc", sdk.NewInt(1)), + RemainingMargin: sdk.NewCoin("ubtc", sdk.NewInt(1)), + LeviedAmount: sdk.NewInt64Coin("ubtc", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -52,9 +54,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(100000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(100000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -71,9 +75,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(1000)), + LeviedAmount: sdk.NewInt64Coin("uusdc", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -90,9 +96,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(0)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(0)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -109,9 +117,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -128,9 +138,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -147,9 +159,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -166,9 +180,11 @@ func TestPosition_IsValid(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -190,6 +206,7 @@ func TestPosition_IsValid(t *testing.T) { tc.position.PositionInstance = *any t.Run(tc.name, func(t *testing.T) { + fmt.Println("tcPosition", tc.position) err := tc.position.IsValid(params, tc.availableAsset) if tc.exp { if err != nil { @@ -204,8 +221,7 @@ func TestPosition_IsValid(t *testing.T) { } } -// TODO: impl TestRemaingMarginInMetrics -func TestRemaingMarginInMetrics(t *testing.T) { +func TestRemainingMarginInMetrics(t *testing.T) { testCases := []struct { name string position types.Position @@ -351,9 +367,11 @@ func TestEffectiveMarginInMetrics(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uatom", sdk.NewInt(1000000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_LONG, @@ -373,9 +391,11 @@ func TestEffectiveMarginInMetrics(t *testing.T) { BaseDenom: "uatom", QuoteDenom: "uusdc", }, - OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), - OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), - RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + OpenedBaseRate: sdk.MustNewDecFromStr("0.00001"), + OpenedQuoteRate: sdk.MustNewDecFromStr("0.000001"), + RemainingMargin: sdk.NewCoin("uusdc", sdk.NewInt(10000000)), + LeviedAmount: sdk.NewInt64Coin("uatom", 0), + LeviedAmountNegative: true, }, instance: types.PerpetualFuturesPositionInstance{ PositionType: types.PositionType_SHORT, diff --git a/x/derivatives/types/query.pb.go b/x/derivatives/types/query.pb.go index 67ac67b31..cc016eeea 100644 --- a/x/derivatives/types/query.pb.go +++ b/x/derivatives/types/query.pb.go @@ -155,10 +155,8 @@ func (m *QueryPoolRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPoolRequest proto.InternalMessageInfo type QueryPoolResponse struct { - MetricsQuoteTicker string `protobuf:"bytes,1,opt,name=metrics_quote_ticker,json=metricsQuoteTicker,proto3" json:"metrics_quote_ticker,omitempty" yaml:"metrics_quote_ticker"` - PoolMarketCap *PoolMarketCap `protobuf:"bytes,2,opt,name=pool_market_cap,json=poolMarketCap,proto3" json:"pool_market_cap,omitempty" yaml:"pool_market_cap"` - Volume_24Hours *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=volume_24hours,json=volume24hours,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"volume_24hours,omitempty" yaml:"volume_24hours"` - Fees_24Hours *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=fees_24hours,json=fees24hours,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fees_24hours,omitempty" yaml:"fees_24hours"` + MetricsQuoteTicker string `protobuf:"bytes,1,opt,name=metrics_quote_ticker,json=metricsQuoteTicker,proto3" json:"metrics_quote_ticker,omitempty" yaml:"metrics_quote_ticker"` + PoolMarketCap *PoolMarketCap `protobuf:"bytes,2,opt,name=pool_market_cap,json=poolMarketCap,proto3" json:"pool_market_cap,omitempty" yaml:"pool_market_cap"` } func (m *QueryPoolResponse) Reset() { *m = QueryPoolResponse{} } @@ -439,11 +437,9 @@ func (m *QueryPerpetualFuturesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPerpetualFuturesRequest proto.InternalMessageInfo type QueryPerpetualFuturesResponse struct { - MetricsQuoteTicker string `protobuf:"bytes,2,opt,name=metrics_quote_ticker,json=metricsQuoteTicker,proto3" json:"metrics_quote_ticker,omitempty" yaml:"metrics_quote_ticker"` - Volume_24Hours *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=volume_24hours,json=volume24hours,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"volume_24hours,omitempty" yaml:"volume_24hours"` - Fees_24Hours *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=fees_24hours,json=fees24hours,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fees_24hours,omitempty" yaml:"fees_24hours"` - LongPositions types.Coin `protobuf:"bytes,5,opt,name=long_positions,json=longPositions,proto3" json:"long_positions" yaml:"long_positions"` - ShortPositions types.Coin `protobuf:"bytes,6,opt,name=short_positions,json=shortPositions,proto3" json:"short_positions" yaml:"short_positions"` + MetricsQuoteTicker string `protobuf:"bytes,1,opt,name=metrics_quote_ticker,json=metricsQuoteTicker,proto3" json:"metrics_quote_ticker,omitempty" yaml:"metrics_quote_ticker"` + LongPositions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=long_positions,json=longPositions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"long_positions" yaml:"long_positions"` + ShortPositions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=short_positions,json=shortPositions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"short_positions" yaml:"short_positions"` } func (m *QueryPerpetualFuturesResponse) Reset() { *m = QueryPerpetualFuturesResponse{} } @@ -486,20 +482,6 @@ func (m *QueryPerpetualFuturesResponse) GetMetricsQuoteTicker() string { return "" } -func (m *QueryPerpetualFuturesResponse) GetLongPositions() types.Coin { - if m != nil { - return m.LongPositions - } - return types.Coin{} -} - -func (m *QueryPerpetualFuturesResponse) GetShortPositions() types.Coin { - if m != nil { - return m.ShortPositions - } - return types.Coin{} -} - type QueryPerpetualFuturesMarketRequest struct { BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty" yaml:"base_denom"` QuoteDenom string `protobuf:"bytes,2,opt,name=quote_denom,json=quoteDenom,proto3" json:"quote_denom,omitempty" yaml:"quote_denom"` @@ -555,10 +537,8 @@ func (m *QueryPerpetualFuturesMarketRequest) GetQuoteDenom() string { type QueryPerpetualFuturesMarketResponse struct { Price *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price,omitempty" yaml:"price"` MetricsQuoteTicker string `protobuf:"bytes,2,opt,name=metrics_quote_ticker,json=metricsQuoteTicker,proto3" json:"metrics_quote_ticker,omitempty" yaml:"metrics_quote_ticker"` - Volume_24Hours *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=volume_24hours,json=volume24hours,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"volume_24hours,omitempty" yaml:"volume_24hours"` - Fees_24Hours *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=fees_24hours,json=fees24hours,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fees_24hours,omitempty" yaml:"fees_24hours"` - LongPositions *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=long_positions,json=longPositions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"long_positions,omitempty" yaml:"long_positions"` - ShortPositions *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=short_positions,json=shortPositions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"short_positions,omitempty" yaml:"short_positions"` + LongPositions *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=long_positions,json=longPositions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"long_positions,omitempty" yaml:"long_positions"` + ShortPositions *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=short_positions,json=shortPositions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"short_positions,omitempty" yaml:"short_positions"` } func (m *QueryPerpetualFuturesMarketResponse) Reset() { *m = QueryPerpetualFuturesMarketResponse{} } @@ -1152,6 +1132,178 @@ func (m *QueryAddressPositionsResponse) GetPositions() []QueriedPosition { return nil } +type QueryAllPendingPaymentPositionsRequest struct { +} + +func (m *QueryAllPendingPaymentPositionsRequest) Reset() { + *m = QueryAllPendingPaymentPositionsRequest{} +} +func (m *QueryAllPendingPaymentPositionsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllPendingPaymentPositionsRequest) ProtoMessage() {} +func (*QueryAllPendingPaymentPositionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_70653932d804dff0, []int{24} +} +func (m *QueryAllPendingPaymentPositionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllPendingPaymentPositionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllPendingPaymentPositionsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllPendingPaymentPositionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPendingPaymentPositionsRequest.Merge(m, src) +} +func (m *QueryAllPendingPaymentPositionsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllPendingPaymentPositionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPendingPaymentPositionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllPendingPaymentPositionsRequest proto.InternalMessageInfo + +type QueryAllPendingPaymentPositionsResponse struct { + PendingPaymentPositions []*PendingPaymentPosition `protobuf:"bytes,1,rep,name=pending_payment_positions,json=pendingPaymentPositions,proto3" json:"pending_payment_positions,omitempty" yaml:"pending_payment_positions"` +} + +func (m *QueryAllPendingPaymentPositionsResponse) Reset() { + *m = QueryAllPendingPaymentPositionsResponse{} +} +func (m *QueryAllPendingPaymentPositionsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllPendingPaymentPositionsResponse) ProtoMessage() {} +func (*QueryAllPendingPaymentPositionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_70653932d804dff0, []int{25} +} +func (m *QueryAllPendingPaymentPositionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllPendingPaymentPositionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllPendingPaymentPositionsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllPendingPaymentPositionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPendingPaymentPositionsResponse.Merge(m, src) +} +func (m *QueryAllPendingPaymentPositionsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllPendingPaymentPositionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPendingPaymentPositionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllPendingPaymentPositionsResponse proto.InternalMessageInfo + +func (m *QueryAllPendingPaymentPositionsResponse) GetPendingPaymentPositions() []*PendingPaymentPosition { + if m != nil { + return m.PendingPaymentPositions + } + return nil +} + +type QueryPendingPaymentPositionRequest struct { + PositionId string `protobuf:"bytes,1,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"` +} + +func (m *QueryPendingPaymentPositionRequest) Reset() { *m = QueryPendingPaymentPositionRequest{} } +func (m *QueryPendingPaymentPositionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPaymentPositionRequest) ProtoMessage() {} +func (*QueryPendingPaymentPositionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_70653932d804dff0, []int{26} +} +func (m *QueryPendingPaymentPositionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPaymentPositionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPaymentPositionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPendingPaymentPositionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPaymentPositionRequest.Merge(m, src) +} +func (m *QueryPendingPaymentPositionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPaymentPositionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPaymentPositionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPaymentPositionRequest proto.InternalMessageInfo + +func (m *QueryPendingPaymentPositionRequest) GetPositionId() string { + if m != nil { + return m.PositionId + } + return "" +} + +type QueryPendingPaymentPositionResponse struct { + PendingPaymentPosition *PendingPaymentPosition `protobuf:"bytes,1,opt,name=pending_payment_position,json=pendingPaymentPosition,proto3" json:"pending_payment_position,omitempty" yaml:"pending_payment_position"` +} + +func (m *QueryPendingPaymentPositionResponse) Reset() { *m = QueryPendingPaymentPositionResponse{} } +func (m *QueryPendingPaymentPositionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPaymentPositionResponse) ProtoMessage() {} +func (*QueryPendingPaymentPositionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_70653932d804dff0, []int{27} +} +func (m *QueryPendingPaymentPositionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPaymentPositionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPaymentPositionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPendingPaymentPositionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPaymentPositionResponse.Merge(m, src) +} +func (m *QueryPendingPaymentPositionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPaymentPositionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPaymentPositionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPaymentPositionResponse proto.InternalMessageInfo + +func (m *QueryPendingPaymentPositionResponse) GetPendingPaymentPosition() *PendingPaymentPosition { + if m != nil { + return m.PendingPaymentPosition + } + return nil +} + type QueryDLPTokenRateRequest struct { } @@ -1159,7 +1311,7 @@ func (m *QueryDLPTokenRateRequest) Reset() { *m = QueryDLPTokenRateReque func (m *QueryDLPTokenRateRequest) String() string { return proto.CompactTextString(m) } func (*QueryDLPTokenRateRequest) ProtoMessage() {} func (*QueryDLPTokenRateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{24} + return fileDescriptor_70653932d804dff0, []int{28} } func (m *QueryDLPTokenRateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1197,7 +1349,7 @@ func (m *QueryDLPTokenRateResponse) Reset() { *m = QueryDLPTokenRateResp func (m *QueryDLPTokenRateResponse) String() string { return proto.CompactTextString(m) } func (*QueryDLPTokenRateResponse) ProtoMessage() {} func (*QueryDLPTokenRateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{25} + return fileDescriptor_70653932d804dff0, []int{29} } func (m *QueryDLPTokenRateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1249,7 +1401,7 @@ func (m *QueryEstimateDLPTokenAmountRequest) Reset() { *m = QueryEstimat func (m *QueryEstimateDLPTokenAmountRequest) String() string { return proto.CompactTextString(m) } func (*QueryEstimateDLPTokenAmountRequest) ProtoMessage() {} func (*QueryEstimateDLPTokenAmountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{26} + return fileDescriptor_70653932d804dff0, []int{30} } func (m *QueryEstimateDLPTokenAmountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1301,7 +1453,7 @@ func (m *QueryEstimateDLPTokenAmountResponse) Reset() { *m = QueryEstima func (m *QueryEstimateDLPTokenAmountResponse) String() string { return proto.CompactTextString(m) } func (*QueryEstimateDLPTokenAmountResponse) ProtoMessage() {} func (*QueryEstimateDLPTokenAmountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{27} + return fileDescriptor_70653932d804dff0, []int{31} } func (m *QueryEstimateDLPTokenAmountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1353,7 +1505,7 @@ func (m *QueryEstimateRedeemTokenAmountRequest) Reset() { *m = QueryEsti func (m *QueryEstimateRedeemTokenAmountRequest) String() string { return proto.CompactTextString(m) } func (*QueryEstimateRedeemTokenAmountRequest) ProtoMessage() {} func (*QueryEstimateRedeemTokenAmountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{28} + return fileDescriptor_70653932d804dff0, []int{32} } func (m *QueryEstimateRedeemTokenAmountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1407,7 +1559,7 @@ func (m *QueryEstimateRedeemTokenAmountResponse) Reset() { func (m *QueryEstimateRedeemTokenAmountResponse) String() string { return proto.CompactTextString(m) } func (*QueryEstimateRedeemTokenAmountResponse) ProtoMessage() {} func (*QueryEstimateRedeemTokenAmountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{29} + return fileDescriptor_70653932d804dff0, []int{33} } func (m *QueryEstimateRedeemTokenAmountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1460,7 +1612,7 @@ func (m *QueryAvailableAssetInPoolByDenomRequest) Reset() { func (m *QueryAvailableAssetInPoolByDenomRequest) String() string { return proto.CompactTextString(m) } func (*QueryAvailableAssetInPoolByDenomRequest) ProtoMessage() {} func (*QueryAvailableAssetInPoolByDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{30} + return fileDescriptor_70653932d804dff0, []int{34} } func (m *QueryAvailableAssetInPoolByDenomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1506,7 +1658,7 @@ func (m *QueryAvailableAssetInPoolByDenomResponse) Reset() { func (m *QueryAvailableAssetInPoolByDenomResponse) String() string { return proto.CompactTextString(m) } func (*QueryAvailableAssetInPoolByDenomResponse) ProtoMessage() {} func (*QueryAvailableAssetInPoolByDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{31} + return fileDescriptor_70653932d804dff0, []int{35} } func (m *QueryAvailableAssetInPoolByDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1549,7 +1701,7 @@ func (m *QueryAvailableAssetsInPoolRequest) Reset() { *m = QueryAvailabl func (m *QueryAvailableAssetsInPoolRequest) String() string { return proto.CompactTextString(m) } func (*QueryAvailableAssetsInPoolRequest) ProtoMessage() {} func (*QueryAvailableAssetsInPoolRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{32} + return fileDescriptor_70653932d804dff0, []int{36} } func (m *QueryAvailableAssetsInPoolRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1586,7 +1738,7 @@ func (m *QueryAvailableAssetsInPoolResponse) Reset() { *m = QueryAvailab func (m *QueryAvailableAssetsInPoolResponse) String() string { return proto.CompactTextString(m) } func (*QueryAvailableAssetsInPoolResponse) ProtoMessage() {} func (*QueryAvailableAssetsInPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_70653932d804dff0, []int{33} + return fileDescriptor_70653932d804dff0, []int{37} } func (m *QueryAvailableAssetsInPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1647,6 +1799,10 @@ func init() { proto.RegisterType((*QueryPerpetualFuturesPositionSizeResponse)(nil), "ununifi.derivatives.QueryPerpetualFuturesPositionSizeResponse") proto.RegisterType((*QueryAddressPositionsRequest)(nil), "ununifi.derivatives.QueryAddressPositionsRequest") proto.RegisterType((*QueryAddressPositionsResponse)(nil), "ununifi.derivatives.QueryAddressPositionsResponse") + proto.RegisterType((*QueryAllPendingPaymentPositionsRequest)(nil), "ununifi.derivatives.QueryAllPendingPaymentPositionsRequest") + proto.RegisterType((*QueryAllPendingPaymentPositionsResponse)(nil), "ununifi.derivatives.QueryAllPendingPaymentPositionsResponse") + proto.RegisterType((*QueryPendingPaymentPositionRequest)(nil), "ununifi.derivatives.QueryPendingPaymentPositionRequest") + proto.RegisterType((*QueryPendingPaymentPositionResponse)(nil), "ununifi.derivatives.QueryPendingPaymentPositionResponse") proto.RegisterType((*QueryDLPTokenRateRequest)(nil), "ununifi.derivatives.QueryDLPTokenRateRequest") proto.RegisterType((*QueryDLPTokenRateResponse)(nil), "ununifi.derivatives.QueryDLPTokenRateResponse") proto.RegisterType((*QueryEstimateDLPTokenAmountRequest)(nil), "ununifi.derivatives.QueryEstimateDLPTokenAmountRequest") @@ -1662,148 +1818,155 @@ func init() { func init() { proto.RegisterFile("ununifi/derivatives/query.proto", fileDescriptor_70653932d804dff0) } var fileDescriptor_70653932d804dff0 = []byte{ - // 2251 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0x5f, 0x6c, 0x1b, 0x49, - 0x19, 0xef, 0x36, 0x6d, 0xb8, 0x4c, 0xfe, 0x76, 0x9a, 0xb4, 0x89, 0xdb, 0xd8, 0xe9, 0x94, 0xa6, - 0x69, 0xa9, 0xbd, 0x34, 0x8d, 0xae, 0x77, 0xe1, 0x7a, 0xa7, 0xb8, 0x21, 0x77, 0x39, 0xa5, 0x9c, - 0xbb, 0xb4, 0x48, 0x20, 0xa4, 0x65, 0xed, 0x1d, 0x3b, 0x7b, 0x5d, 0xef, 0x6c, 0x77, 0xd7, 0x51, - 0x7d, 0x51, 0x10, 0x42, 0x42, 0x02, 0x21, 0x21, 0xa4, 0x13, 0x20, 0xde, 0xee, 0x05, 0xa4, 0x13, - 0x8f, 0x3c, 0x20, 0x21, 0xf1, 0xc6, 0x43, 0x1f, 0x4f, 0x42, 0x42, 0xfc, 0x91, 0x2c, 0x68, 0x41, - 0x3c, 0xe3, 0x17, 0x5e, 0xd1, 0xce, 0x7c, 0xbb, 0xde, 0x75, 0xd6, 0xeb, 0x75, 0x10, 0x02, 0x21, - 0x9e, 0xe2, 0x99, 0xef, 0xdf, 0xef, 0xfb, 0x33, 0xdf, 0xcc, 0xb7, 0x0a, 0x2a, 0xb4, 0xac, 0x96, - 0x65, 0xd4, 0x0d, 0x59, 0xa7, 0x8e, 0x71, 0xa0, 0x79, 0xc6, 0x01, 0x75, 0xe5, 0xa7, 0x2d, 0xea, - 0xb4, 0x4b, 0xb6, 0xc3, 0x3c, 0x86, 0xcf, 0x03, 0x43, 0x29, 0xc2, 0x90, 0x9b, 0x6f, 0xb0, 0x06, - 0xe3, 0x74, 0xd9, 0xff, 0x25, 0x58, 0x73, 0x97, 0x1b, 0x8c, 0x35, 0x4c, 0x2a, 0x6b, 0xb6, 0x21, - 0x6b, 0x96, 0xc5, 0x3c, 0xcd, 0x33, 0x98, 0xe5, 0x02, 0x75, 0x09, 0xa8, 0x7c, 0x55, 0x6d, 0xd5, - 0x65, 0xcd, 0x02, 0x1b, 0xb9, 0x9b, 0x35, 0xe6, 0x36, 0x99, 0x2b, 0x57, 0x35, 0x97, 0x0a, 0xe3, - 0xf2, 0xc1, 0xed, 0x2a, 0xf5, 0xb4, 0xdb, 0xb2, 0xad, 0x35, 0x0c, 0x8b, 0xeb, 0x01, 0xde, 0x7c, - 0x94, 0x37, 0xe0, 0xaa, 0x31, 0x23, 0xa0, 0x2f, 0x09, 0xba, 0x2a, 0xd0, 0x89, 0x05, 0x90, 0xae, - 0x25, 0xf9, 0x1a, 0xf9, 0x0d, 0x6c, 0x2b, 0x49, 0x6c, 0xb6, 0xe6, 0x68, 0x4d, 0xe0, 0x20, 0xf3, - 0x08, 0x3f, 0xf4, 0x51, 0x56, 0xf8, 0xa6, 0x42, 0x9f, 0xb6, 0xa8, 0xeb, 0x91, 0x0a, 0x3a, 0x1f, - 0xdb, 0x75, 0x6d, 0x66, 0xb9, 0x14, 0xbf, 0x8e, 0xc6, 0x85, 0xf0, 0xa2, 0xb4, 0x22, 0xad, 0x4d, - 0xae, 0x5f, 0x2a, 0x25, 0x44, 0xb4, 0x24, 0x84, 0xca, 0x67, 0x9e, 0x77, 0x0a, 0xa7, 0x14, 0x10, - 0x20, 0x18, 0xcd, 0x09, 0x8d, 0x8c, 0x99, 0x81, 0x95, 0x8f, 0xc6, 0xd0, 0xb9, 0xc8, 0x26, 0x18, - 0x79, 0x88, 0xe6, 0x9b, 0xd4, 0x73, 0x8c, 0x9a, 0xab, 0x3e, 0x6d, 0x31, 0x8f, 0xaa, 0x9e, 0x51, - 0x7b, 0x42, 0x1d, 0x6e, 0x72, 0xa2, 0x5c, 0xe8, 0x76, 0x0a, 0x97, 0xda, 0x5a, 0xd3, 0xdc, 0x24, - 0x49, 0x5c, 0x44, 0xc1, 0xb0, 0xfd, 0xd0, 0xdf, 0x7d, 0xc4, 0x37, 0x71, 0x1d, 0xcd, 0xda, 0x8c, - 0x99, 0x6a, 0x53, 0x73, 0x9e, 0x50, 0x4f, 0xad, 0x69, 0xf6, 0xe2, 0x69, 0xee, 0x00, 0x49, 0x76, - 0x80, 0x31, 0xf3, 0x01, 0x67, 0xbd, 0xaf, 0xd9, 0xe5, 0x5c, 0xb7, 0x53, 0xb8, 0x20, 0x2c, 0xf6, - 0x29, 0x21, 0xca, 0xb4, 0x1d, 0x65, 0xc5, 0xef, 0xa3, 0x99, 0x03, 0x66, 0xb6, 0x9a, 0x54, 0x5d, - 0xdf, 0xd8, 0x67, 0x2d, 0xc7, 0x5d, 0x1c, 0xe3, 0xa0, 0xef, 0xff, 0xa1, 0x53, 0x58, 0x6d, 0x18, - 0xde, 0x7e, 0xab, 0x5a, 0xaa, 0xb1, 0x26, 0xa4, 0x12, 0xfe, 0x14, 0x5d, 0xfd, 0x89, 0xec, 0xb5, - 0x6d, 0xea, 0x96, 0xb6, 0x69, 0xad, 0xdb, 0x29, 0x2c, 0x08, 0x63, 0x71, 0x4d, 0x44, 0x99, 0x16, - 0x1b, 0xb0, 0xc6, 0x3a, 0x9a, 0xaa, 0x53, 0xea, 0x86, 0x96, 0xce, 0x70, 0x4b, 0x5b, 0x23, 0x59, - 0x3a, 0x2f, 0x2c, 0x45, 0xf5, 0x10, 0x65, 0xd2, 0x5f, 0x06, 0xab, 0x9f, 0x4a, 0xe8, 0x06, 0x4f, - 0xd1, 0x9e, 0xf1, 0xb4, 0x65, 0xe8, 0x86, 0xd7, 0xae, 0x38, 0xec, 0xc0, 0xd0, 0xa9, 0xf3, 0x88, - 0x3d, 0xa1, 0x96, 0x42, 0x35, 0x73, 0xab, 0xf2, 0x65, 0x48, 0x28, 0xbe, 0x87, 0xa6, 0xab, 0xb4, - 0xce, 0x1c, 0xaa, 0xee, 0x53, 0xa3, 0xb1, 0xef, 0xf1, 0x9c, 0x8d, 0x95, 0x17, 0xbb, 0x9d, 0xc2, - 0xbc, 0x30, 0x15, 0x23, 0x13, 0x65, 0x4a, 0xac, 0xdf, 0xe1, 0x4b, 0xbc, 0x89, 0xa6, 0xb4, 0xba, - 0x47, 0x9d, 0x40, 0xfa, 0x34, 0x97, 0xbe, 0xd8, 0x03, 0x1a, 0xa5, 0x12, 0x65, 0x92, 0x2f, 0x85, - 0x2c, 0x79, 0x86, 0x6e, 0x66, 0xc1, 0x09, 0x35, 0xf6, 0x2e, 0x1a, 0xd3, 0xec, 0x36, 0x94, 0xd4, - 0x6b, 0x23, 0xc5, 0x0c, 0x01, 0x14, 0xbb, 0x4d, 0x14, 0x5f, 0x09, 0xf9, 0x58, 0x42, 0xb7, 0x52, - 0x4c, 0x7f, 0x81, 0x35, 0x0d, 0xeb, 0xbf, 0x25, 0x4a, 0x87, 0xa8, 0x98, 0x11, 0xea, 0xbf, 0x21, - 0x50, 0x79, 0x74, 0x59, 0x9c, 0x76, 0xea, 0xd8, 0xd4, 0x6b, 0x69, 0xe6, 0x4e, 0xcb, 0x6b, 0x39, - 0x34, 0x6c, 0x3a, 0xdf, 0x39, 0x83, 0x96, 0x07, 0x30, 0x0c, 0x69, 0x0d, 0xa7, 0x4f, 0xde, 0x1a, - 0xfe, 0xe7, 0x8e, 0x2c, 0x56, 0xd1, 0x8c, 0xc9, 0xac, 0x86, 0x6a, 0x33, 0xd7, 0xe0, 0x97, 0xd6, - 0xe2, 0x59, 0xde, 0xeb, 0x96, 0x4a, 0x70, 0x83, 0xf8, 0xd7, 0x4d, 0x09, 0xae, 0x9b, 0xd2, 0x7d, - 0x66, 0x58, 0xe5, 0x65, 0xbf, 0x55, 0xf7, 0xdc, 0x88, 0x8b, 0x13, 0x65, 0xda, 0xdf, 0xa8, 0x04, - 0x6b, 0x5c, 0x45, 0xb3, 0xee, 0x3e, 0x73, 0xbc, 0x88, 0x85, 0xf1, 0x61, 0x16, 0xf2, 0x60, 0x01, - 0x1a, 0x69, 0x9f, 0x3c, 0x51, 0x66, 0xf8, 0x4e, 0x68, 0x83, 0x7c, 0x28, 0x21, 0x92, 0x58, 0x0b, - 0xa2, 0xd9, 0x06, 0x47, 0x69, 0x03, 0x21, 0xdf, 0x96, 0xaa, 0x53, 0x8b, 0x35, 0xa1, 0x4a, 0x17, - 0xba, 0x9d, 0xc2, 0x39, 0x38, 0x47, 0x21, 0x8d, 0x28, 0x13, 0xfe, 0x62, 0xdb, 0xff, 0x8d, 0xef, - 0xa2, 0x49, 0x51, 0x18, 0x42, 0x4c, 0x54, 0xcf, 0x85, 0x6e, 0xa7, 0x80, 0x85, 0x58, 0x84, 0x48, - 0x14, 0xc4, 0x57, 0x5c, 0x90, 0xfc, 0xe3, 0x0c, 0xba, 0x9a, 0x8a, 0x0a, 0xea, 0xb4, 0x82, 0xce, - 0xda, 0x8e, 0x51, 0xa3, 0x80, 0x68, 0x73, 0xa4, 0x0c, 0x4f, 0xc1, 0x5d, 0xe3, 0x2b, 0x20, 0x8a, - 0x50, 0xf4, 0xff, 0xca, 0xcf, 0x52, 0xf9, 0xef, 0x27, 0x56, 0xfe, 0x09, 0x3d, 0x1a, 0x72, 0x08, - 0x9a, 0xc9, 0x87, 0x60, 0xa2, 0xbc, 0x3d, 0x92, 0xb1, 0xac, 0xe7, 0xe1, 0x58, 0xef, 0x7c, 0xcf, - 0xe6, 0x84, 0xa0, 0x77, 0x16, 0xfa, 0x5b, 0x67, 0x48, 0x17, 0x25, 0x99, 0x70, 0xa0, 0x80, 0xe3, - 0x3f, 0x7a, 0xa0, 0xae, 0xf5, 0x9f, 0xa7, 0x3e, 0x50, 0x00, 0xbe, 0x8a, 0x16, 0x39, 0xdb, 0x96, - 0x69, 0x86, 0x21, 0x09, 0x10, 0xef, 0x20, 0xd4, 0x7b, 0x58, 0xc3, 0xbb, 0x74, 0x35, 0xd6, 0x88, - 0xc4, 0x08, 0x10, 0xb4, 0xa3, 0x8a, 0xd6, 0xa0, 0x20, 0xab, 0x44, 0x24, 0xc9, 0x2f, 0x24, 0xb4, - 0x94, 0x60, 0x24, 0xbc, 0x79, 0x26, 0x7a, 0x89, 0x96, 0x56, 0xc6, 0xd6, 0x26, 0xd7, 0x97, 0x07, - 0xbc, 0x1d, 0x05, 0x57, 0x79, 0xbe, 0xdb, 0x29, 0xcc, 0x05, 0xcf, 0xc6, 0x30, 0xaf, 0x3d, 0x2d, - 0xf8, 0xed, 0x18, 0x70, 0xf1, 0x1e, 0xbd, 0x3e, 0x14, 0xb8, 0xc0, 0x13, 0x43, 0x7e, 0x17, 0xcd, - 0xc3, 0x2b, 0x5a, 0xa8, 0x0e, 0x22, 0x53, 0x40, 0x93, 0x81, 0x35, 0xd5, 0xd0, 0x45, 0x32, 0x15, - 0x14, 0x6c, 0xed, 0xea, 0xe4, 0xd7, 0x63, 0x68, 0xa1, 0x4f, 0x12, 0xdc, 0x55, 0xd0, 0x2b, 0x01, - 0x1f, 0x84, 0x74, 0x88, 0xb7, 0x17, 0x9f, 0x77, 0x0a, 0x52, 0xb7, 0x53, 0x98, 0x8d, 0x7b, 0x4c, - 0x94, 0x50, 0x0f, 0xa6, 0x68, 0xee, 0x40, 0x33, 0x5b, 0x1c, 0xb3, 0x3f, 0xd2, 0xd4, 0x0d, 0x0f, - 0xbc, 0x4e, 0xb9, 0x37, 0x0a, 0x70, 0x6f, 0x5c, 0x84, 0x36, 0xd3, 0xa7, 0x80, 0x28, 0xb3, 0xe1, - 0x56, 0x85, 0xef, 0xe0, 0x6f, 0x4b, 0xe8, 0x62, 0x53, 0x73, 0x1a, 0x86, 0xa5, 0x36, 0x35, 0xc3, - 0xf2, 0xa8, 0xa5, 0x59, 0x35, 0xaa, 0x3a, 0x9a, 0x47, 0xa1, 0xc1, 0x55, 0x7c, 0x9d, 0x23, 0x9d, - 0xd2, 0x3c, 0xf4, 0xd6, 0x64, 0xb5, 0x44, 0x59, 0x10, 0x94, 0x07, 0x3d, 0x82, 0xa2, 0x79, 0xd4, - 0xf7, 0x98, 0xd6, 0xeb, 0xb4, 0xe6, 0xc7, 0x4a, 0x15, 0x2c, 0xbc, 0xf3, 0x8d, 0xe2, 0x71, 0xbf, - 0x02, 0xa2, 0xcc, 0x86, 0x5b, 0x0f, 0xc4, 0xce, 0x2f, 0x25, 0xb4, 0x96, 0x78, 0x2b, 0x05, 0xd9, - 0xf9, 0xa2, 0xf1, 0x41, 0x50, 0xf2, 0xf8, 0x6b, 0x68, 0x3a, 0x2c, 0x0a, 0xdf, 0x45, 0x9e, 0xde, - 0x99, 0xf5, 0x2b, 0xa9, 0xe9, 0x7d, 0xd4, 0xb6, 0x69, 0xf4, 0x7d, 0x1a, 0xd3, 0x40, 0x94, 0x29, - 0x3b, 0xc2, 0x87, 0x6f, 0xa1, 0x4f, 0x69, 0xba, 0xee, 0x50, 0xd7, 0x85, 0x46, 0x80, 0xbb, 0x9d, - 0xc2, 0x0c, 0x3c, 0x06, 0x05, 0x81, 0x28, 0x01, 0x0b, 0xf9, 0x49, 0x30, 0x60, 0xa4, 0x83, 0x87, - 0xba, 0x7c, 0x86, 0x2e, 0x7a, 0xcc, 0xd3, 0xcc, 0xb0, 0x55, 0xaa, 0xae, 0xf1, 0x01, 0x55, 0x5b, - 0xae, 0x0e, 0x65, 0x9a, 0x12, 0xd8, 0x55, 0x08, 0x2c, 0x24, 0xb3, 0x4f, 0x4f, 0xcb, 0xd5, 0xb9, - 0x2e, 0xa2, 0xcc, 0x73, 0x4a, 0xd4, 0xfc, 0x63, 0x57, 0x27, 0x7b, 0xd0, 0x80, 0xb7, 0x04, 0xee, - 0x63, 0x6d, 0x28, 0xe2, 0xb5, 0x34, 0xdc, 0xeb, 0x23, 0x68, 0xd7, 0xc7, 0xb5, 0x81, 0xa3, 0x5f, - 0x3d, 0xde, 0x6f, 0x3e, 0x9d, 0x98, 0x22, 0x5f, 0x8d, 0x41, 0xf5, 0xf0, 0x20, 0x2e, 0x82, 0x97, - 0x69, 0xad, 0x87, 0xe4, 0xa0, 0x9f, 0x6e, 0xef, 0x55, 0xc4, 0x78, 0xa4, 0x79, 0x41, 0x81, 0x90, - 0xaf, 0x43, 0x1b, 0x8c, 0xd3, 0x00, 0xd6, 0x05, 0x34, 0xee, 0xb6, 0x9b, 0x55, 0x66, 0x42, 0x37, - 0x81, 0x15, 0xde, 0x45, 0x67, 0xfd, 0x93, 0xe0, 0x67, 0x7c, 0x2c, 0x3d, 0x0b, 0x7d, 0xf8, 0x74, - 0xd3, 0xe6, 0x67, 0xc8, 0x25, 0x8a, 0xd0, 0x40, 0xbe, 0x15, 0x5c, 0x54, 0x9f, 0x77, 0x3d, 0xa3, - 0xa9, 0x79, 0x34, 0x00, 0xb2, 0xd5, 0x64, 0x2d, 0x2b, 0x7a, 0x51, 0x35, 0x0d, 0xcb, 0x1b, 0x74, - 0x51, 0xf5, 0x68, 0x44, 0x99, 0xf0, 0x17, 0xe2, 0xa2, 0xba, 0x81, 0xc6, 0x35, 0xae, 0x06, 0x4a, - 0xf3, 0x5c, 0xb7, 0x53, 0x98, 0x86, 0x24, 0xf1, 0x7d, 0xa2, 0x00, 0x03, 0xf9, 0xb3, 0x04, 0x77, - 0xd3, 0x20, 0x1c, 0x10, 0x92, 0x2a, 0x9a, 0xa7, 0xc0, 0xa1, 0xab, 0xbe, 0x3b, 0x60, 0x60, 0x68, - 0x3d, 0x2e, 0x40, 0x24, 0xfa, 0xec, 0xe3, 0x50, 0xdb, 0xb6, 0x69, 0x0b, 0x5b, 0xf8, 0x4b, 0x68, - 0x52, 0xa7, 0x3c, 0x7d, 0x6a, 0x9d, 0xd2, 0xe1, 0x5d, 0x33, 0x07, 0xaa, 0xe1, 0xfa, 0x8d, 0xc8, - 0x12, 0x05, 0xc1, 0x6a, 0x87, 0x52, 0xf2, 0x63, 0x09, 0x5d, 0x8b, 0xf9, 0xa8, 0x50, 0x9d, 0xd2, - 0x66, 0x42, 0xb8, 0x37, 0xd1, 0x94, 0xc3, 0x69, 0xb1, 0x80, 0x47, 0x86, 0xce, 0x28, 0x95, 0x28, - 0x93, 0x62, 0x29, 0x82, 0xbe, 0x81, 0x90, 0x69, 0x7b, 0x6a, 0x2c, 0xf0, 0x91, 0x54, 0xf5, 0x68, - 0x44, 0x99, 0x30, 0x6d, 0x4f, 0x18, 0x26, 0x3f, 0x97, 0xd0, 0xea, 0x30, 0x6c, 0x90, 0x82, 0x77, - 0xc2, 0xac, 0x9e, 0x34, 0xe8, 0x20, 0x8f, 0xdf, 0x42, 0x63, 0x99, 0x02, 0x8c, 0x41, 0x0d, 0x0a, - 0xdf, 0xa4, 0x44, 0xf1, 0x25, 0xc9, 0x43, 0x74, 0x5d, 0x1c, 0xec, 0x03, 0xcd, 0x30, 0xb5, 0xaa, - 0x49, 0xb7, 0x5c, 0x97, 0x7a, 0xbb, 0x56, 0x85, 0x31, 0xb3, 0xdc, 0xe6, 0xf1, 0x08, 0x42, 0xba, - 0x8a, 0xce, 0x46, 0x63, 0x39, 0xd7, 0x7b, 0xfa, 0x43, 0x10, 0x05, 0x99, 0x7c, 0x2f, 0x68, 0xef, - 0xa9, 0x3a, 0xc3, 0x6a, 0x9c, 0xd5, 0x02, 0x36, 0x55, 0xf3, 0xf9, 0x86, 0xc7, 0xa4, 0x6f, 0x36, - 0xeb, 0x93, 0x27, 0xca, 0x8c, 0x16, 0x33, 0x4c, 0xae, 0xa2, 0x2b, 0x09, 0x78, 0x5c, 0x01, 0x28, - 0x68, 0x23, 0xdf, 0x0d, 0x8e, 0xf1, 0x00, 0x2e, 0xc0, 0x4b, 0xd1, 0x5c, 0x9f, 0xbd, 0xa0, 0xdd, - 0x65, 0xbf, 0x22, 0xfb, 0x15, 0x10, 0x65, 0x36, 0x8e, 0xd8, 0x5d, 0xff, 0x68, 0x09, 0x9d, 0xe5, - 0x68, 0xf0, 0x37, 0x24, 0x34, 0x2e, 0x3e, 0x50, 0xe2, 0xeb, 0x03, 0x1b, 0x6a, 0xfc, 0x6b, 0x68, - 0x6e, 0x6d, 0x38, 0x23, 0x3c, 0x54, 0xaf, 0x7e, 0xf3, 0x37, 0x7f, 0xf9, 0xf0, 0xf4, 0x32, 0xbe, - 0x24, 0x0f, 0xfe, 0xf0, 0x8a, 0x9f, 0xa1, 0x33, 0x7e, 0x0c, 0xf0, 0xb5, 0x14, 0xb5, 0xbd, 0x48, - 0xe6, 0x56, 0x87, 0xb1, 0x81, 0xed, 0x2b, 0xdc, 0xf6, 0x25, 0xbc, 0x94, 0x6c, 0xdb, 0xb7, 0xf8, - 0x47, 0x09, 0x2d, 0xa7, 0x7e, 0x20, 0xc3, 0x6f, 0x0e, 0x36, 0x96, 0xe5, 0x0b, 0x60, 0xee, 0xad, - 0x13, 0xcb, 0x83, 0x17, 0xaf, 0x73, 0x2f, 0xee, 0xe0, 0xdb, 0x89, 0x5e, 0x98, 0x81, 0x8e, 0xa2, - 0x0d, 0x4a, 0x5c, 0xd9, 0xa1, 0x9a, 0x59, 0xd4, 0xec, 0x36, 0xfe, 0x9b, 0x84, 0x56, 0x86, 0x7d, - 0xd8, 0xc2, 0x5b, 0xa3, 0x02, 0x3c, 0xf6, 0xfd, 0x2e, 0x57, 0xfe, 0x57, 0x54, 0x80, 0x9b, 0x6f, - 0x70, 0x37, 0x5f, 0xc5, 0x1b, 0x99, 0xdd, 0xb4, 0x84, 0x12, 0xee, 0xe9, 0xc7, 0x12, 0x9a, 0xeb, - 0x7f, 0x2f, 0xe1, 0xdb, 0x29, 0x75, 0x92, 0xfc, 0xc5, 0x2d, 0xb7, 0x3e, 0x8a, 0x08, 0x20, 0x2f, - 0x71, 0xe4, 0x6b, 0x78, 0x35, 0xb9, 0xcc, 0x02, 0xb1, 0x62, 0x1d, 0x60, 0xfd, 0x56, 0x42, 0x17, - 0x92, 0x3f, 0x97, 0xe0, 0xbb, 0xd9, 0xcd, 0xc7, 0xa6, 0xd4, 0xdc, 0x6b, 0xa3, 0x0b, 0x02, 0xfa, - 0x5d, 0x8e, 0xfe, 0x3e, 0xde, 0xca, 0x86, 0x5e, 0x3e, 0xec, 0x4d, 0xbc, 0x47, 0xf2, 0x61, 0x64, - 0x8e, 0x3d, 0x8a, 0x27, 0x01, 0xe6, 0xd6, 0x4c, 0x49, 0x88, 0x8f, 0xee, 0x99, 0x92, 0xd0, 0x3f, - 0xcd, 0x67, 0x4d, 0x02, 0x03, 0x58, 0xb1, 0x24, 0xc4, 0x66, 0xec, 0x4c, 0x49, 0x48, 0xfa, 0x54, - 0x90, 0x29, 0x09, 0xc9, 0xe3, 0x7c, 0xd6, 0x24, 0x00, 0xfa, 0xb4, 0x24, 0xfc, 0x40, 0x42, 0x53, - 0xd1, 0x81, 0x1d, 0x17, 0x07, 0xa3, 0x4a, 0xf8, 0x7a, 0x90, 0x2b, 0x65, 0x65, 0x07, 0xe8, 0xab, - 0x1c, 0xfa, 0x0a, 0xce, 0x0f, 0x68, 0xb2, 0x01, 0x8c, 0x1f, 0x49, 0xe8, 0x95, 0x40, 0x1a, 0xdf, - 0x48, 0xeb, 0xe0, 0xb1, 0x99, 0x3d, 0x77, 0x33, 0x0b, 0x2b, 0x60, 0xd9, 0xe0, 0x58, 0x4a, 0xf8, - 0x56, 0x3a, 0x16, 0xf9, 0x30, 0xf2, 0x15, 0xe0, 0x08, 0xff, 0x5d, 0x42, 0x97, 0xd3, 0x66, 0x2d, - 0x7c, 0x2f, 0xfb, 0xe1, 0x4a, 0x18, 0x30, 0x73, 0x6f, 0x9e, 0x54, 0x1c, 0xbc, 0x52, 0xb8, 0x57, - 0x7b, 0xf8, 0xdd, 0x21, 0x5e, 0x25, 0x9c, 0xd5, 0xd8, 0x58, 0x7a, 0x24, 0x1f, 0xc2, 0xb4, 0x75, - 0x84, 0x7f, 0x26, 0xa1, 0xb9, 0xfe, 0x51, 0x2b, 0xed, 0xa8, 0x0e, 0x18, 0xf2, 0xd2, 0x8e, 0xea, - 0xa0, 0x49, 0x8e, 0x7c, 0x96, 0xfb, 0x73, 0x13, 0xaf, 0x25, 0xfa, 0x13, 0x62, 0x8c, 0xd4, 0xce, - 0x0f, 0x25, 0x34, 0x1d, 0x9d, 0xbe, 0x52, 0x8b, 0x3a, 0x61, 0x84, 0x4b, 0x2b, 0xea, 0xa4, 0xa9, - 0x6e, 0x68, 0x51, 0x33, 0xd3, 0x95, 0x75, 0xd3, 0xc6, 0xbf, 0x97, 0xd0, 0x85, 0xe4, 0x69, 0x28, - 0xad, 0x8b, 0xa4, 0xce, 0x71, 0x69, 0x5d, 0x24, 0x7d, 0xf0, 0x22, 0x7b, 0x1c, 0xf5, 0x0e, 0xde, - 0x4e, 0x44, 0x1d, 0x4c, 0x51, 0x45, 0xdd, 0xb4, 0x8b, 0x9e, 0x2f, 0x5e, 0x14, 0x6f, 0x7c, 0xf9, - 0xb0, 0x37, 0x1b, 0xfa, 0x35, 0xc2, 0x37, 0x8f, 0xf0, 0x5f, 0x25, 0xb4, 0x34, 0x70, 0xd2, 0xc0, - 0x9b, 0xc3, 0x51, 0x0e, 0x1a, 0x9d, 0x72, 0x9f, 0x3b, 0x91, 0x2c, 0x38, 0xf9, 0x1e, 0x77, 0x72, - 0x17, 0xbf, 0x9d, 0xee, 0xa4, 0x18, 0xb7, 0x42, 0x0f, 0xa3, 0xc3, 0xd8, 0x91, 0x7c, 0xd8, 0x9b, - 0xb0, 0x8e, 0xfc, 0x9b, 0xe0, 0x52, 0xca, 0x20, 0x81, 0xdf, 0x48, 0x29, 0xf1, 0xa1, 0x33, 0x4d, - 0xee, 0xde, 0x09, 0xa5, 0xc1, 0xdb, 0x4d, 0xee, 0xed, 0x06, 0x5e, 0x4f, 0x29, 0xc4, 0xf0, 0x69, - 0x5f, 0xe4, 0xaf, 0x7d, 0xf9, 0x10, 0x6e, 0x82, 0x5f, 0x49, 0x68, 0x21, 0x71, 0xd6, 0xc0, 0xaf, - 0x66, 0x05, 0x15, 0x1f, 0x61, 0x72, 0x77, 0x47, 0x96, 0x03, 0x37, 0xee, 0x70, 0x37, 0x8a, 0xf8, - 0x33, 0xd9, 0xdd, 0x70, 0xcb, 0x3b, 0xcf, 0x5f, 0xe4, 0xa5, 0x4f, 0x5e, 0xe4, 0xa5, 0x3f, 0xbd, - 0xc8, 0x4b, 0xdf, 0x7f, 0x99, 0x3f, 0xf5, 0xc9, 0xcb, 0xfc, 0xa9, 0xdf, 0xbd, 0xcc, 0x9f, 0xfa, - 0xca, 0xad, 0xc8, 0x77, 0xca, 0xc7, 0xd6, 0x63, 0xcb, 0xd8, 0x31, 0xe4, 0xda, 0xbe, 0x66, 0x58, - 0xf2, 0xb3, 0x98, 0x62, 0xfe, 0xc5, 0xb2, 0x3a, 0xce, 0xff, 0xaf, 0xe3, 0xce, 0x3f, 0x03, 0x00, - 0x00, 0xff, 0xff, 0x06, 0xf6, 0xf2, 0xf8, 0x0e, 0x23, 0x00, 0x00, + // 2356 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xef, 0x6f, 0xdc, 0x48, + 0xf9, 0xaf, 0x9b, 0xb6, 0xdf, 0xcb, 0x24, 0x69, 0xd2, 0x69, 0x7e, 0xba, 0xed, 0x3a, 0x9d, 0x5e, + 0xd3, 0xb4, 0xd7, 0x5d, 0x5f, 0xd3, 0xaa, 0xbd, 0xcb, 0xb5, 0x3d, 0x65, 0x9b, 0x4b, 0xdb, 0x53, + 0xfb, 0xbd, 0xad, 0x69, 0x91, 0x40, 0x48, 0xc6, 0x59, 0x4f, 0xb6, 0xa6, 0x5e, 0xdb, 0xb5, 0xbd, + 0x51, 0xf7, 0xa2, 0x20, 0x84, 0x84, 0x84, 0x84, 0x38, 0x21, 0x9d, 0x00, 0xf1, 0x07, 0x1c, 0xd2, + 0x89, 0x97, 0x48, 0x20, 0x90, 0x78, 0x87, 0x50, 0x5f, 0xc1, 0x21, 0x04, 0xe2, 0x87, 0xb4, 0x82, + 0x16, 0xc4, 0x6b, 0xf6, 0x2f, 0x40, 0x9e, 0x79, 0xec, 0xb5, 0x1d, 0xaf, 0xd7, 0x1b, 0x54, 0xc1, + 0xab, 0xae, 0x67, 0x9e, 0x1f, 0x9f, 0xcf, 0xf3, 0xcc, 0x3c, 0x33, 0xcf, 0xa4, 0x48, 0x6a, 0x59, + 0x2d, 0xcb, 0xd8, 0x32, 0x64, 0x9d, 0xba, 0xc6, 0xb6, 0xe6, 0x1b, 0xdb, 0xd4, 0x93, 0x9f, 0xb6, + 0xa8, 0xdb, 0xae, 0x38, 0xae, 0xed, 0xdb, 0xf8, 0x38, 0x08, 0x54, 0x62, 0x02, 0xe2, 0x74, 0xc3, + 0x6e, 0xd8, 0x6c, 0x5e, 0x0e, 0x7e, 0x71, 0x51, 0xf1, 0x64, 0xc3, 0xb6, 0x1b, 0x26, 0x95, 0x35, + 0xc7, 0x90, 0x35, 0xcb, 0xb2, 0x7d, 0xcd, 0x37, 0x6c, 0xcb, 0x83, 0xd9, 0x05, 0x98, 0x65, 0x5f, + 0x9b, 0xad, 0x2d, 0x59, 0xb3, 0xc0, 0x87, 0x78, 0xa1, 0x6e, 0x7b, 0x4d, 0xdb, 0x93, 0x37, 0x35, + 0x8f, 0x72, 0xe7, 0xf2, 0xf6, 0xa5, 0x4d, 0xea, 0x6b, 0x97, 0x64, 0x47, 0x6b, 0x18, 0x16, 0xb3, + 0x03, 0xb2, 0xa5, 0xb8, 0x6c, 0x28, 0x55, 0xb7, 0x8d, 0x70, 0x7e, 0x81, 0xcf, 0xab, 0x1c, 0x1d, + 0xff, 0x80, 0xa9, 0xb3, 0x59, 0x5c, 0x63, 0xbf, 0x41, 0x6c, 0x31, 0x4b, 0xcc, 0xd1, 0x5c, 0xad, + 0x09, 0x12, 0x64, 0x1a, 0xe1, 0x07, 0x01, 0xca, 0x1a, 0x1b, 0x54, 0xe8, 0xd3, 0x16, 0xf5, 0x7c, + 0x52, 0x43, 0xc7, 0x13, 0xa3, 0x9e, 0x63, 0x5b, 0x1e, 0xc5, 0x6f, 0xa3, 0x23, 0x5c, 0x79, 0x5e, + 0x58, 0x14, 0x96, 0xc7, 0x56, 0x4e, 0x54, 0x32, 0x22, 0x5a, 0xe1, 0x4a, 0xd5, 0x43, 0xcf, 0x3b, + 0xd2, 0x01, 0x05, 0x14, 0x08, 0x46, 0x53, 0xdc, 0xa2, 0x6d, 0x9b, 0xa1, 0x97, 0x5f, 0x0b, 0xe8, + 0x58, 0x6c, 0x10, 0x9c, 0x3c, 0x40, 0xd3, 0x4d, 0xea, 0xbb, 0x46, 0xdd, 0x53, 0x9f, 0xb6, 0x6c, + 0x9f, 0xaa, 0xbe, 0x51, 0x7f, 0x42, 0x5d, 0xe6, 0x72, 0xb4, 0x2a, 0x75, 0x3b, 0xd2, 0x89, 0xb6, + 0xd6, 0x34, 0x57, 0x49, 0x96, 0x14, 0x51, 0x30, 0x0c, 0x3f, 0x08, 0x46, 0x1f, 0xb2, 0x41, 0xbc, + 0x85, 0x26, 0x1d, 0xdb, 0x36, 0xd5, 0xa6, 0xe6, 0x3e, 0xa1, 0xbe, 0x5a, 0xd7, 0x9c, 0xf9, 0x83, + 0x8c, 0x00, 0xc9, 0x26, 0x60, 0xdb, 0xe6, 0x7d, 0x26, 0x7a, 0x4b, 0x73, 0xaa, 0x62, 0xb7, 0x23, + 0xcd, 0x72, 0x8f, 0x29, 0x23, 0x44, 0x99, 0x70, 0xe2, 0xa2, 0xe4, 0x87, 0x02, 0x3a, 0xcf, 0x08, + 0xdd, 0x33, 0x9e, 0xb6, 0x0c, 0xdd, 0xf0, 0xdb, 0x35, 0xd7, 0xde, 0x36, 0x74, 0xea, 0x3e, 0xb4, + 0x9f, 0x50, 0x4b, 0xa1, 0x9a, 0xb9, 0x56, 0xfb, 0x02, 0xd0, 0xc7, 0x37, 0xd0, 0xc4, 0x26, 0xdd, + 0xb2, 0x5d, 0xaa, 0x3e, 0xa6, 0x46, 0xe3, 0xb1, 0xcf, 0x18, 0x8e, 0x54, 0xe7, 0xbb, 0x1d, 0x69, + 0x9a, 0xfb, 0x4b, 0x4c, 0x13, 0x65, 0x9c, 0x7f, 0xdf, 0x61, 0x9f, 0x78, 0x15, 0x8d, 0x6b, 0x5b, + 0x3e, 0x75, 0x43, 0xed, 0x83, 0x4c, 0x7b, 0xae, 0xdb, 0x91, 0x8e, 0x73, 0xed, 0xf8, 0x2c, 0x51, + 0xc6, 0xd8, 0x27, 0xd7, 0x25, 0xcf, 0xd0, 0x85, 0x22, 0x38, 0x21, 0x23, 0xef, 0xa3, 0x11, 0xcd, + 0x69, 0x43, 0x02, 0xde, 0xfa, 0x73, 0x47, 0x5a, 0x6a, 0x18, 0xfe, 0xe3, 0xd6, 0x66, 0xa5, 0x6e, + 0x37, 0x61, 0x59, 0xc2, 0x3f, 0x65, 0x4f, 0x7f, 0x22, 0xfb, 0x6d, 0x87, 0x7a, 0x95, 0x75, 0x5a, + 0xef, 0x76, 0x24, 0x04, 0x50, 0x9c, 0x36, 0x51, 0x02, 0x23, 0xe4, 0x53, 0x01, 0x5d, 0xcc, 0x71, + 0xfd, 0xff, 0x76, 0xd3, 0xb0, 0xfe, 0x57, 0xa2, 0xb4, 0x83, 0xca, 0x05, 0xa1, 0xbe, 0x82, 0x40, + 0x95, 0xd0, 0x49, 0xbe, 0x37, 0xa8, 0xeb, 0x50, 0xbf, 0xa5, 0x99, 0x1b, 0x2d, 0xbf, 0xe5, 0xd2, + 0x68, 0x8b, 0xfe, 0xfe, 0x20, 0x3a, 0xd5, 0x47, 0xe0, 0xd5, 0x6d, 0x24, 0x0b, 0x1d, 0x35, 0x6d, + 0xab, 0xa1, 0x3a, 0xb6, 0x67, 0xb0, 0x82, 0xc8, 0xe2, 0x39, 0x5a, 0xbd, 0x1d, 0xec, 0xf5, 0xa1, + 0xf8, 0xce, 0x70, 0xd7, 0x49, 0x6b, 0x44, 0x99, 0x08, 0x06, 0x6a, 0xe1, 0x37, 0x7e, 0x8a, 0x26, + 0xbd, 0xc7, 0xb6, 0xeb, 0xc7, 0x1c, 0x8e, 0x30, 0x87, 0x77, 0x86, 0x76, 0x08, 0x5b, 0x38, 0x65, + 0x8e, 0x28, 0x47, 0xd9, 0x48, 0xe4, 0x92, 0x7c, 0x2c, 0x20, 0x92, 0x19, 0x57, 0xbe, 0xcd, 0xc3, + 0x65, 0x79, 0x05, 0xa1, 0xa0, 0x6c, 0xab, 0x3a, 0xb5, 0xec, 0x26, 0x84, 0x74, 0xa6, 0xdb, 0x91, + 0x8e, 0xc1, 0x9a, 0x8c, 0xe6, 0x88, 0x32, 0x1a, 0x7c, 0xac, 0x07, 0xbf, 0xf1, 0x35, 0x34, 0xc6, + 0x83, 0xcc, 0xd5, 0x78, 0xf0, 0x66, 0xbb, 0x1d, 0x09, 0x73, 0xb5, 0xd8, 0x24, 0x51, 0x10, 0xfb, + 0x62, 0x8a, 0xe4, 0x93, 0x11, 0x74, 0x26, 0x17, 0x15, 0xe4, 0xbc, 0x86, 0x0e, 0x3b, 0xae, 0x51, + 0xa7, 0x80, 0x68, 0x75, 0xa8, 0x10, 0x8d, 0x43, 0x95, 0x0b, 0x0c, 0x10, 0x85, 0x1b, 0xea, 0xbb, + 0x8a, 0x0e, 0xee, 0x7f, 0x15, 0x7d, 0x65, 0xcf, 0x2a, 0xe2, 0x49, 0xbd, 0xf5, 0x0a, 0x56, 0x50, + 0x73, 0xef, 0x0a, 0x3a, 0xc4, 0x9c, 0xad, 0xbf, 0x92, 0xd5, 0xb3, 0x67, 0xd7, 0x7e, 0xe0, 0xb0, + 0x89, 0x70, 0xd7, 0x4a, 0xe9, 0x4d, 0x1b, 0xcd, 0xf3, 0x04, 0x66, 0x2c, 0x3f, 0x90, 0xf8, 0xaf, + 0x2e, 0xbf, 0xb3, 0xe9, 0xd5, 0x97, 0x02, 0x05, 0xe0, 0x37, 0xd1, 0x3c, 0x13, 0x5b, 0x33, 0xcd, + 0x28, 0x24, 0x21, 0xe2, 0x0d, 0x84, 0x7a, 0x17, 0x20, 0xb8, 0x3f, 0x2c, 0x55, 0xe0, 0x52, 0x13, + 0x40, 0xac, 0xf0, 0xab, 0x1a, 0xdc, 0x83, 0x2a, 0x35, 0xad, 0x41, 0x41, 0x57, 0x89, 0x69, 0x92, + 0x9f, 0x0a, 0x68, 0x21, 0xc3, 0x49, 0x54, 0xf3, 0x46, 0x7b, 0x89, 0x16, 0x16, 0x47, 0x96, 0xc7, + 0x56, 0x4e, 0xf5, 0x39, 0xe3, 0xb9, 0x54, 0x75, 0xba, 0xdb, 0x91, 0xa6, 0xc2, 0xe3, 0x3d, 0xca, + 0x6b, 0xcf, 0x0a, 0xbe, 0x9d, 0x00, 0xce, 0xef, 0x0d, 0xe7, 0x06, 0x02, 0xe7, 0x78, 0x12, 0xc8, + 0xaf, 0xa1, 0x69, 0xb8, 0xed, 0x70, 0xd3, 0x61, 0x64, 0x24, 0x34, 0x16, 0x7a, 0x53, 0x0d, 0x9d, + 0x27, 0x53, 0x41, 0xe1, 0xd0, 0x5d, 0x9d, 0xfc, 0x72, 0x04, 0xcd, 0xa4, 0x34, 0x81, 0xae, 0x82, + 0x5e, 0x0b, 0xe5, 0x20, 0xa4, 0x03, 0xd8, 0xce, 0x3d, 0xef, 0x48, 0x42, 0xb7, 0x23, 0x4d, 0x26, + 0x19, 0x13, 0x25, 0xb2, 0x83, 0x29, 0x9a, 0xda, 0xd6, 0xcc, 0x16, 0xc3, 0x1c, 0x5c, 0x3d, 0xb7, + 0x0c, 0x1f, 0x58, 0x2f, 0x24, 0x58, 0x87, 0x7c, 0x6f, 0xd9, 0x86, 0x55, 0x95, 0x82, 0x7a, 0xdc, + 0xed, 0x48, 0x73, 0xdc, 0x6e, 0xda, 0x00, 0x51, 0x26, 0xa3, 0xa1, 0x1a, 0x1b, 0xc1, 0xdf, 0x14, + 0xd0, 0x5c, 0x53, 0x73, 0x1b, 0x86, 0xa5, 0x36, 0x35, 0xc3, 0xf2, 0xa9, 0xa5, 0x59, 0x75, 0xaa, + 0xba, 0x9a, 0x4f, 0xa1, 0x1c, 0xd4, 0x86, 0xae, 0xf1, 0x25, 0xa8, 0x44, 0xd9, 0x66, 0x89, 0x32, + 0xc3, 0x67, 0xee, 0xf7, 0x26, 0x14, 0xcd, 0xa7, 0x01, 0x63, 0xba, 0xb5, 0x45, 0xeb, 0x41, 0xac, + 0x54, 0x2e, 0xc2, 0x8a, 0xc4, 0x30, 0x8c, 0xd3, 0x06, 0x88, 0x32, 0x19, 0x0d, 0xdd, 0xe7, 0x23, + 0x3f, 0x17, 0xd0, 0x72, 0x66, 0x0d, 0x0f, 0xb3, 0xf3, 0x39, 0xe3, 0xc3, 0x70, 0xc9, 0xe3, 0x2f, + 0xa3, 0x89, 0x68, 0x51, 0x04, 0x14, 0x59, 0x7a, 0x8f, 0xae, 0x9c, 0xce, 0x4d, 0xef, 0xc3, 0xb6, + 0x43, 0xe3, 0x37, 0xa3, 0x84, 0x05, 0xa2, 0x8c, 0x3b, 0x31, 0x39, 0x7c, 0x11, 0xfd, 0x9f, 0xa6, + 0xeb, 0x2e, 0xf5, 0xc2, 0x43, 0x1c, 0x77, 0x3b, 0xd2, 0x51, 0xb8, 0x86, 0xf0, 0x09, 0xa2, 0x84, + 0x22, 0xe4, 0x93, 0xf0, 0x6a, 0x9b, 0x0f, 0x1e, 0xd6, 0xe5, 0x33, 0x34, 0xe7, 0xdb, 0xbe, 0x66, + 0x46, 0xa5, 0x52, 0xf5, 0x8c, 0x0f, 0xa9, 0xda, 0xf2, 0x74, 0x58, 0xa6, 0x39, 0x81, 0x5d, 0x82, + 0xc0, 0x42, 0x32, 0x53, 0x76, 0x5a, 0x9e, 0xce, 0x6c, 0x11, 0x65, 0x9a, 0xcd, 0xc4, 0xdd, 0x3f, + 0xf2, 0x74, 0x72, 0x0f, 0x0a, 0xf0, 0x1a, 0xc7, 0xbd, 0xa7, 0x0c, 0xc5, 0x58, 0x0b, 0x83, 0x59, + 0xef, 0x42, 0xb9, 0xde, 0x6b, 0x0d, 0x88, 0x7e, 0x69, 0x6f, 0xbd, 0x79, 0x3d, 0x33, 0x45, 0x81, + 0x19, 0x83, 0xea, 0xd1, 0x46, 0x9c, 0x07, 0x96, 0x79, 0xa5, 0x87, 0x2c, 0xa3, 0xa5, 0xa8, 0xd4, + 0x51, 0x4b, 0x37, 0xac, 0x46, 0x4d, 0x6b, 0x37, 0xa9, 0xe5, 0xa7, 0x69, 0x91, 0x9f, 0x09, 0xe8, + 0xdc, 0x40, 0x51, 0xc0, 0xfc, 0x6d, 0x01, 0x2d, 0x38, 0x5c, 0x46, 0x75, 0xb8, 0x90, 0x9a, 0x26, + 0xf1, 0x46, 0xf6, 0x3a, 0xcb, 0xb4, 0x5c, 0x7d, 0xbd, 0xdb, 0x91, 0x16, 0x81, 0x47, 0x3f, 0xbb, + 0x44, 0x99, 0x73, 0xb2, 0x71, 0x91, 0xf7, 0xa2, 0x13, 0x2f, 0x6b, 0xbe, 0x70, 0x95, 0xfc, 0x89, + 0x10, 0x1d, 0x52, 0xd9, 0x76, 0x80, 0xfe, 0x47, 0x02, 0x9a, 0xef, 0x07, 0x13, 0x56, 0xe7, 0x50, + 0xec, 0xcf, 0x41, 0x49, 0x95, 0xf2, 0x23, 0x40, 0x94, 0xd9, 0xec, 0x00, 0x10, 0x11, 0x4e, 0xcd, + 0xf5, 0x7b, 0x35, 0xde, 0x7e, 0x69, 0x7e, 0x58, 0x06, 0xc8, 0x57, 0xe1, 0xb0, 0x4b, 0xce, 0x01, + 0x93, 0x59, 0x74, 0xc4, 0x6b, 0x37, 0x37, 0x6d, 0x13, 0xa2, 0x01, 0x5f, 0xf8, 0x2e, 0x3a, 0x1c, + 0xd4, 0xbb, 0x60, 0x5f, 0x8f, 0xe4, 0xef, 0xb5, 0xd4, 0x2a, 0xd4, 0x4d, 0x87, 0x55, 0x4a, 0x8f, + 0x28, 0xdc, 0x02, 0xf9, 0x46, 0x78, 0x1d, 0x79, 0xcf, 0xf3, 0x8d, 0xa6, 0xe6, 0xd3, 0x10, 0xc8, + 0x5a, 0xd3, 0x6e, 0x59, 0xf1, 0xeb, 0x48, 0xd3, 0xb0, 0xfc, 0x7e, 0xd7, 0x91, 0xde, 0x1c, 0x51, + 0x46, 0x83, 0x0f, 0x7e, 0x1d, 0x39, 0x8f, 0x8e, 0x68, 0xcc, 0x0c, 0x14, 0xa0, 0x63, 0xdd, 0x8e, + 0x34, 0x01, 0x5b, 0x91, 0x8d, 0x13, 0x05, 0x04, 0xc8, 0xdf, 0xc2, 0xe4, 0xf6, 0xc3, 0x01, 0x21, + 0xd9, 0x44, 0xd3, 0x14, 0x24, 0x74, 0x35, 0xa0, 0x03, 0x0e, 0x06, 0x56, 0x9d, 0x19, 0x88, 0x44, + 0xca, 0x3f, 0x8e, 0xac, 0xad, 0x9b, 0x0e, 0xf7, 0x85, 0x3f, 0x8f, 0xc6, 0x74, 0xca, 0xd2, 0xaa, + 0x6e, 0x51, 0x3a, 0xf8, 0x6c, 0x14, 0xc1, 0x34, 0x5c, 0xb2, 0x62, 0xba, 0x44, 0x41, 0xf0, 0xb5, + 0x41, 0x29, 0xf9, 0x81, 0x80, 0xce, 0x26, 0x38, 0x2a, 0x54, 0xa7, 0xb4, 0x99, 0x11, 0xee, 0x55, + 0x34, 0xee, 0xb2, 0xb9, 0x44, 0xc0, 0x63, 0x4d, 0x6d, 0x7c, 0x96, 0x28, 0x63, 0xfc, 0x93, 0x07, + 0xfd, 0x0a, 0x42, 0xa6, 0xe3, 0xab, 0x89, 0xc0, 0xc7, 0x52, 0xd5, 0x9b, 0x23, 0xca, 0xa8, 0xe9, + 0xf8, 0xdc, 0x31, 0xf9, 0xb1, 0x00, 0xa5, 0x28, 0x07, 0x1b, 0xa4, 0xe0, 0x4e, 0x94, 0xd5, 0xfd, + 0x06, 0x1d, 0xf4, 0xf1, 0xbb, 0x68, 0xa4, 0x50, 0x80, 0x31, 0x98, 0x81, 0x1e, 0x9a, 0x05, 0x36, + 0xd0, 0x24, 0x0f, 0xc2, 0xa2, 0xb8, 0xad, 0x19, 0xa6, 0xb6, 0x69, 0xd2, 0x35, 0xcf, 0xa3, 0xfe, + 0x5d, 0xab, 0x66, 0xdb, 0x66, 0xb5, 0xcd, 0xe2, 0x11, 0x86, 0x74, 0x09, 0x1d, 0x8e, 0xc7, 0x72, + 0xaa, 0xd7, 0x0e, 0x41, 0x10, 0xf9, 0x34, 0xf9, 0x28, 0x3c, 0xc4, 0x73, 0x6d, 0x46, 0xab, 0x71, + 0x52, 0x0b, 0xc5, 0x54, 0x2d, 0x90, 0x1b, 0x1c, 0x93, 0x12, 0x90, 0x81, 0x8e, 0x23, 0xa5, 0x4f, + 0x94, 0xa3, 0x5a, 0xc2, 0x31, 0x39, 0x83, 0x4e, 0x67, 0xe0, 0xf1, 0x38, 0xa0, 0xb0, 0x8c, 0x7c, + 0x2b, 0xdc, 0xc6, 0x7d, 0xa4, 0x00, 0x2f, 0x45, 0x53, 0x29, 0x7f, 0xe1, 0x79, 0x50, 0xfc, 0x22, + 0x94, 0x36, 0x40, 0x94, 0xc9, 0x24, 0x62, 0x6f, 0xe5, 0x57, 0x27, 0xd1, 0x61, 0x86, 0x06, 0x7f, + 0x4d, 0x40, 0x47, 0xf8, 0x73, 0x21, 0x3e, 0xd7, 0xf7, 0xd8, 0x4c, 0xbe, 0x4d, 0x8a, 0xcb, 0x83, + 0x05, 0xa1, 0x1d, 0x39, 0xf3, 0xf5, 0xdf, 0xfd, 0xfd, 0xe3, 0x83, 0xa7, 0xf0, 0x09, 0xb9, 0xff, + 0x33, 0x28, 0x7e, 0x86, 0x0e, 0x05, 0x31, 0xc0, 0x67, 0x73, 0xcc, 0xf6, 0x22, 0x29, 0x2e, 0x0d, + 0x12, 0x03, 0xdf, 0xa7, 0x99, 0xef, 0x13, 0x78, 0x21, 0xdb, 0x77, 0xe0, 0xf1, 0x2f, 0x02, 0x3a, + 0x95, 0xfb, 0x00, 0x87, 0x6f, 0xf6, 0x77, 0x56, 0xe4, 0x85, 0x51, 0x7c, 0x77, 0xdf, 0xfa, 0xc0, + 0xe2, 0x6d, 0xc6, 0xe2, 0x32, 0xbe, 0x94, 0xc9, 0xc2, 0x0c, 0x6d, 0x94, 0x1d, 0x30, 0xe2, 0xc9, + 0x2e, 0xd5, 0xcc, 0xb2, 0xe6, 0xb4, 0xf1, 0x3f, 0x05, 0xb4, 0x38, 0xe8, 0xe1, 0x0c, 0xaf, 0x0d, + 0x0b, 0x70, 0xcf, 0xfb, 0xa0, 0x58, 0xfd, 0x4f, 0x4c, 0x00, 0xcd, 0xeb, 0x8c, 0xe6, 0x55, 0x7c, + 0xa5, 0x30, 0x4d, 0x8b, 0x1b, 0x61, 0x4c, 0x3f, 0x15, 0xd0, 0x54, 0xfa, 0x56, 0x8c, 0x2f, 0xe5, + 0xac, 0x93, 0xec, 0x17, 0x3d, 0x71, 0x65, 0x18, 0x15, 0x40, 0x5e, 0x61, 0xc8, 0x97, 0xf1, 0x52, + 0xf6, 0x32, 0x0b, 0xd5, 0xca, 0x5b, 0x00, 0xeb, 0x0f, 0x02, 0x9a, 0xcd, 0x7e, 0x42, 0xc2, 0xd7, + 0x8a, 0xbb, 0x4f, 0xbc, 0x45, 0x88, 0x6f, 0x0d, 0xaf, 0x08, 0xe8, 0xef, 0x32, 0xf4, 0xb7, 0xf0, + 0x5a, 0x31, 0xf4, 0xf2, 0x4e, 0xef, 0x5d, 0x63, 0x57, 0xde, 0x89, 0xbd, 0x56, 0xec, 0x26, 0x93, + 0x00, 0xaf, 0x13, 0x85, 0x92, 0x90, 0x7c, 0xa0, 0x29, 0x94, 0x84, 0xf4, 0x9b, 0x4d, 0xd1, 0x24, + 0xd8, 0x00, 0x2b, 0x91, 0x84, 0xc4, 0x4b, 0x4a, 0xa1, 0x24, 0x64, 0x3d, 0x08, 0x15, 0x4a, 0x42, + 0xf6, 0xa3, 0x4d, 0xd1, 0x24, 0x00, 0xfa, 0xbc, 0x24, 0x7c, 0x57, 0x40, 0xe3, 0xf1, 0x67, 0x19, + 0x5c, 0xee, 0x8f, 0x2a, 0xe3, 0x8d, 0x48, 0xac, 0x14, 0x15, 0x07, 0xe8, 0x4b, 0x0c, 0xfa, 0x22, + 0x2e, 0xf5, 0x29, 0xb2, 0x21, 0x8c, 0xef, 0x0b, 0xe8, 0xb5, 0x50, 0x1b, 0x9f, 0xcf, 0xab, 0xe0, + 0x89, 0x9e, 0x43, 0xbc, 0x50, 0x44, 0x14, 0xb0, 0x5c, 0x61, 0x58, 0x2a, 0xf8, 0x62, 0x3e, 0x16, + 0x79, 0x27, 0xd6, 0xc5, 0xec, 0xe2, 0x7f, 0x09, 0xe8, 0x64, 0x5e, 0x47, 0x8d, 0x6f, 0x14, 0xdf, + 0x5c, 0x19, 0xcf, 0x08, 0xe2, 0xcd, 0xfd, 0xaa, 0x03, 0x2b, 0x85, 0xb1, 0xba, 0x87, 0xdf, 0x1f, + 0xc0, 0x2a, 0x63, 0xaf, 0x26, 0x1e, 0x1f, 0x76, 0xe5, 0x1d, 0xe8, 0xa9, 0x77, 0xf1, 0x8f, 0x04, + 0x34, 0x95, 0x6e, 0xa8, 0xf3, 0xb6, 0x6a, 0x9f, 0x56, 0x3e, 0x6f, 0xab, 0xf6, 0xeb, 0xd7, 0xc9, + 0x9b, 0x8c, 0xcf, 0x05, 0xbc, 0x9c, 0xc9, 0x27, 0xc2, 0x18, 0x5b, 0x3b, 0xbf, 0x11, 0x90, 0xd8, + 0xbf, 0xa9, 0xc6, 0xef, 0xe4, 0x2f, 0xd9, 0xdc, 0xae, 0x5d, 0xbc, 0xbe, 0x3f, 0x65, 0xe0, 0x72, + 0x95, 0x71, 0x79, 0x13, 0x57, 0xfa, 0x6c, 0x5c, 0xa6, 0x5d, 0x86, 0x3e, 0xb4, 0xdc, 0x63, 0xf4, + 0x5b, 0x56, 0x7e, 0xb2, 0x6c, 0xe7, 0x97, 0x9f, 0x9c, 0xee, 0x3c, 0xbf, 0xfc, 0xe4, 0xb5, 0xe3, + 0x64, 0x9d, 0xb1, 0xb8, 0x89, 0xaf, 0x0f, 0xc7, 0x22, 0xb5, 0x8f, 0xbe, 0x27, 0xa0, 0x89, 0x78, + 0x8f, 0x9c, 0x5b, 0x7a, 0x32, 0x1a, 0xed, 0xbc, 0xd2, 0x93, 0xd5, 0x7b, 0x0f, 0x2c, 0x3d, 0xb6, + 0xe9, 0xc9, 0xba, 0xe9, 0xe0, 0x3f, 0x09, 0x68, 0x36, 0xbb, 0x67, 0xcd, 0x0b, 0x76, 0x6e, 0xb7, + 0x9d, 0x17, 0xec, 0xfc, 0xf6, 0x98, 0xdc, 0x63, 0xa8, 0x37, 0xf0, 0x7a, 0x26, 0xea, 0xb0, 0xd7, + 0x2d, 0xeb, 0xa6, 0x53, 0xf6, 0x03, 0xf5, 0x32, 0xef, 0xc4, 0xe4, 0x9d, 0x5e, 0x07, 0x1f, 0xec, + 0x64, 0x36, 0xb8, 0x8b, 0xff, 0x21, 0xa0, 0x85, 0xbe, 0xfd, 0x20, 0x5e, 0x1d, 0x8c, 0xb2, 0x5f, + 0x83, 0x2b, 0xbe, 0xb3, 0x2f, 0x5d, 0x20, 0xf9, 0x01, 0x23, 0x79, 0x17, 0xdf, 0xce, 0x27, 0xc9, + 0x9b, 0xe2, 0x88, 0x61, 0xbc, 0x65, 0xde, 0x95, 0x77, 0x7a, 0x7d, 0xf0, 0x6e, 0x70, 0x5e, 0x9f, + 0xc8, 0x69, 0xf7, 0x70, 0xde, 0x36, 0x1e, 0xd8, 0x79, 0x8a, 0x37, 0xf6, 0xa9, 0x0d, 0x6c, 0x57, + 0x19, 0xdb, 0x2b, 0x78, 0x25, 0x67, 0x21, 0x46, 0x0d, 0x58, 0x99, 0xf5, 0x64, 0xf2, 0x0e, 0x9c, + 0xd7, 0xbf, 0x10, 0xd0, 0x4c, 0x66, 0x47, 0x88, 0xaf, 0x16, 0x05, 0x95, 0x6c, 0x34, 0xc5, 0x6b, + 0x43, 0xeb, 0x01, 0x8d, 0xcb, 0x8c, 0x46, 0x19, 0xbf, 0x51, 0x9c, 0x86, 0x57, 0xdd, 0x78, 0xfe, + 0xa2, 0x24, 0x7c, 0xf6, 0xa2, 0x24, 0xfc, 0xf5, 0x45, 0x49, 0xf8, 0xce, 0xcb, 0xd2, 0x81, 0xcf, + 0x5e, 0x96, 0x0e, 0xfc, 0xf1, 0x65, 0xe9, 0xc0, 0x17, 0x2f, 0xc6, 0xfe, 0x66, 0xf0, 0xc8, 0x7a, + 0x64, 0x19, 0x1b, 0x86, 0x5c, 0x7f, 0xac, 0x19, 0x96, 0xfc, 0x2c, 0x61, 0x98, 0xfd, 0xf5, 0x60, + 0xf3, 0x08, 0xfb, 0xbf, 0x30, 0x97, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xdd, 0xda, 0x20, 0x0d, + 0x42, 0x24, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1832,6 +1995,8 @@ type QueryClient interface { Position(ctx context.Context, in *QueryPositionRequest, opts ...grpc.CallOption) (*QueryPositionResponse, error) PerpetualFuturesPositionSize(ctx context.Context, in *QueryPerpetualFuturesPositionSizeRequest, opts ...grpc.CallOption) (*QueryPerpetualFuturesPositionSizeResponse, error) AddressPositions(ctx context.Context, in *QueryAddressPositionsRequest, opts ...grpc.CallOption) (*QueryAddressPositionsResponse, error) + AllPendingPaymentPositions(ctx context.Context, in *QueryAllPendingPaymentPositionsRequest, opts ...grpc.CallOption) (*QueryAllPendingPaymentPositionsResponse, error) + PendingPaymentPosition(ctx context.Context, in *QueryPendingPaymentPositionRequest, opts ...grpc.CallOption) (*QueryPendingPaymentPositionResponse, error) DLPTokenRates(ctx context.Context, in *QueryDLPTokenRateRequest, opts ...grpc.CallOption) (*QueryDLPTokenRateResponse, error) EstimateDLPTokenAmount(ctx context.Context, in *QueryEstimateDLPTokenAmountRequest, opts ...grpc.CallOption) (*QueryEstimateDLPTokenAmountResponse, error) EstimateRedeemTokenAmount(ctx context.Context, in *QueryEstimateRedeemTokenAmountRequest, opts ...grpc.CallOption) (*QueryEstimateRedeemTokenAmountResponse, error) @@ -1955,6 +2120,24 @@ func (c *queryClient) AddressPositions(ctx context.Context, in *QueryAddressPosi return out, nil } +func (c *queryClient) AllPendingPaymentPositions(ctx context.Context, in *QueryAllPendingPaymentPositionsRequest, opts ...grpc.CallOption) (*QueryAllPendingPaymentPositionsResponse, error) { + out := new(QueryAllPendingPaymentPositionsResponse) + err := c.cc.Invoke(ctx, "/ununifi.derivatives.Query/AllPendingPaymentPositions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PendingPaymentPosition(ctx context.Context, in *QueryPendingPaymentPositionRequest, opts ...grpc.CallOption) (*QueryPendingPaymentPositionResponse, error) { + out := new(QueryPendingPaymentPositionResponse) + err := c.cc.Invoke(ctx, "/ununifi.derivatives.Query/PendingPaymentPosition", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) DLPTokenRates(ctx context.Context, in *QueryDLPTokenRateRequest, opts ...grpc.CallOption) (*QueryDLPTokenRateResponse, error) { out := new(QueryDLPTokenRateResponse) err := c.cc.Invoke(ctx, "/ununifi.derivatives.Query/DLPTokenRates", in, out, opts...) @@ -2016,6 +2199,8 @@ type QueryServer interface { Position(context.Context, *QueryPositionRequest) (*QueryPositionResponse, error) PerpetualFuturesPositionSize(context.Context, *QueryPerpetualFuturesPositionSizeRequest) (*QueryPerpetualFuturesPositionSizeResponse, error) AddressPositions(context.Context, *QueryAddressPositionsRequest) (*QueryAddressPositionsResponse, error) + AllPendingPaymentPositions(context.Context, *QueryAllPendingPaymentPositionsRequest) (*QueryAllPendingPaymentPositionsResponse, error) + PendingPaymentPosition(context.Context, *QueryPendingPaymentPositionRequest) (*QueryPendingPaymentPositionResponse, error) DLPTokenRates(context.Context, *QueryDLPTokenRateRequest) (*QueryDLPTokenRateResponse, error) EstimateDLPTokenAmount(context.Context, *QueryEstimateDLPTokenAmountRequest) (*QueryEstimateDLPTokenAmountResponse, error) EstimateRedeemTokenAmount(context.Context, *QueryEstimateRedeemTokenAmountRequest) (*QueryEstimateRedeemTokenAmountResponse, error) @@ -2063,6 +2248,12 @@ func (*UnimplementedQueryServer) PerpetualFuturesPositionSize(ctx context.Contex func (*UnimplementedQueryServer) AddressPositions(ctx context.Context, req *QueryAddressPositionsRequest) (*QueryAddressPositionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddressPositions not implemented") } +func (*UnimplementedQueryServer) AllPendingPaymentPositions(ctx context.Context, req *QueryAllPendingPaymentPositionsRequest) (*QueryAllPendingPaymentPositionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllPendingPaymentPositions not implemented") +} +func (*UnimplementedQueryServer) PendingPaymentPosition(ctx context.Context, req *QueryPendingPaymentPositionRequest) (*QueryPendingPaymentPositionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingPaymentPosition not implemented") +} func (*UnimplementedQueryServer) DLPTokenRates(ctx context.Context, req *QueryDLPTokenRateRequest) (*QueryDLPTokenRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DLPTokenRates not implemented") } @@ -2299,6 +2490,42 @@ func _Query_AddressPositions_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Query_AllPendingPaymentPositions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllPendingPaymentPositionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllPendingPaymentPositions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ununifi.derivatives.Query/AllPendingPaymentPositions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllPendingPaymentPositions(ctx, req.(*QueryAllPendingPaymentPositionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PendingPaymentPosition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingPaymentPositionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PendingPaymentPosition(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ununifi.derivatives.Query/PendingPaymentPosition", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingPaymentPosition(ctx, req.(*QueryPendingPaymentPositionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_DLPTokenRates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDLPTokenRateRequest) if err := dec(in); err != nil { @@ -2441,6 +2668,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AddressPositions", Handler: _Query_AddressPositions_Handler, }, + { + MethodName: "AllPendingPaymentPositions", + Handler: _Query_AllPendingPaymentPositions_Handler, + }, + { + MethodName: "PendingPaymentPosition", + Handler: _Query_PendingPaymentPosition_Handler, + }, { MethodName: "DLPTokenRates", Handler: _Query_DLPTokenRates_Handler, @@ -2565,30 +2800,6 @@ func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Fees_24Hours != nil { - { - size := m.Fees_24Hours.Size() - i -= size - if _, err := m.Fees_24Hours.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Volume_24Hours != nil { - { - size := m.Volume_24Hours.Size() - i -= size - if _, err := m.Volume_24Hours.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } if m.PoolMarketCap != nil { { size, err := m.PoolMarketCap.MarshalToSizedBuffer(dAtA[:i]) @@ -2791,55 +3002,31 @@ func (m *QueryPerpetualFuturesResponse) MarshalToSizedBuffer(dAtA []byte) (int, var l int _ = l { - size, err := m.ShortPositions.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.ShortPositions.Size() + i -= size + if _, err := m.ShortPositions.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x1a { - size, err := m.LongPositions.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.LongPositions.Size() + i -= size + if _, err := m.LongPositions.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - if m.Fees_24Hours != nil { - { - size := m.Fees_24Hours.Size() - i -= size - if _, err := m.Fees_24Hours.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Volume_24Hours != nil { - { - size := m.Volume_24Hours.Size() - i -= size - if _, err := m.Volume_24Hours.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } + dAtA[i] = 0x12 if len(m.MetricsQuoteTicker) > 0 { i -= len(m.MetricsQuoteTicker) copy(dAtA[i:], m.MetricsQuoteTicker) i = encodeVarintQuery(dAtA, i, uint64(len(m.MetricsQuoteTicker))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2911,7 +3098,7 @@ func (m *QueryPerpetualFuturesMarketResponse) MarshalToSizedBuffer(dAtA []byte) i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x22 } if m.LongPositions != nil { { @@ -2923,30 +3110,6 @@ func (m *QueryPerpetualFuturesMarketResponse) MarshalToSizedBuffer(dAtA []byte) i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - } - if m.Fees_24Hours != nil { - { - size := m.Fees_24Hours.Size() - i -= size - if _, err := m.Fees_24Hours.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Volume_24Hours != nil { - { - size := m.Volume_24Hours.Size() - i -= size - if _, err := m.Volume_24Hours.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x1a } if len(m.MetricsQuoteTicker) > 0 { @@ -3391,7 +3554,7 @@ func (m *QueryAddressPositionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryDLPTokenRateRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllPendingPaymentPositionsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3401,12 +3564,12 @@ func (m *QueryDLPTokenRateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDLPTokenRateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllPendingPaymentPositionsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDLPTokenRateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllPendingPaymentPositionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3414,7 +3577,7 @@ func (m *QueryDLPTokenRateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryDLPTokenRateResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllPendingPaymentPositionsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3424,20 +3587,20 @@ func (m *QueryDLPTokenRateResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDLPTokenRateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllPendingPaymentPositionsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDLPTokenRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllPendingPaymentPositionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Rates) > 0 { - for iNdEx := len(m.Rates) - 1; iNdEx >= 0; iNdEx-- { + if len(m.PendingPaymentPositions) > 0 { + for iNdEx := len(m.PendingPaymentPositions) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Rates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PendingPaymentPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3445,12 +3608,137 @@ func (m *QueryDLPTokenRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) + return len(dAtA) - i, nil +} + +func (m *QueryPendingPaymentPositionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPendingPaymentPositionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPaymentPositionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPendingPaymentPositionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPendingPaymentPositionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPaymentPositionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PendingPaymentPosition != nil { + { + size, err := m.PendingPaymentPosition.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDLPTokenRateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDLPTokenRateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDLPTokenRateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryDLPTokenRateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDLPTokenRateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDLPTokenRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rates) > 0 { + for iNdEx := len(m.Rates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) i = encodeVarintQuery(dAtA, i, uint64(len(m.Symbol))) i-- dAtA[i] = 0xa @@ -3795,14 +4083,6 @@ func (m *QueryPoolResponse) Size() (n int) { l = m.PoolMarketCap.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.Volume_24Hours != nil { - l = m.Volume_24Hours.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.Fees_24Hours != nil { - l = m.Fees_24Hours.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -3881,14 +4161,6 @@ func (m *QueryPerpetualFuturesResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.Volume_24Hours != nil { - l = m.Volume_24Hours.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.Fees_24Hours != nil { - l = m.Fees_24Hours.Size() - n += 1 + l + sovQuery(uint64(l)) - } l = m.LongPositions.Size() n += 1 + l + sovQuery(uint64(l)) l = m.ShortPositions.Size() @@ -3927,14 +4199,6 @@ func (m *QueryPerpetualFuturesMarketResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.Volume_24Hours != nil { - l = m.Volume_24Hours.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.Fees_24Hours != nil { - l = m.Fees_24Hours.Size() - n += 1 + l + sovQuery(uint64(l)) - } if m.LongPositions != nil { l = m.LongPositions.Size() n += 1 + l + sovQuery(uint64(l)) @@ -4109,6 +4373,56 @@ func (m *QueryAddressPositionsResponse) Size() (n int) { return n } +func (m *QueryAllPendingPaymentPositionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllPendingPaymentPositionsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PendingPaymentPositions) > 0 { + for _, e := range m.PendingPaymentPositions { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryPendingPaymentPositionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPendingPaymentPositionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PendingPaymentPosition != nil { + l = m.PendingPaymentPosition.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryDLPTokenRateRequest) Size() (n int) { if m == nil { return 0 @@ -4531,78 +4845,6 @@ func (m *QueryPoolResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Volume_24Hours", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Volume_24Hours = &v - if err := m.Volume_24Hours.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fees_24Hours", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Fees_24Hours = &v - if err := m.Fees_24Hours.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5051,7 +5293,7 @@ func (m *QueryPerpetualFuturesResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryPerpetualFuturesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MetricsQuoteTicker", wireType) } @@ -5083,9 +5325,9 @@ func (m *QueryPerpetualFuturesResponse) Unmarshal(dAtA []byte) error { } m.MetricsQuoteTicker = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Volume_24Hours", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LongPositions", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5113,15 +5355,13 @@ func (m *QueryPerpetualFuturesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Volume_24Hours = &v - if err := m.Volume_24Hours.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LongPositions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fees_24Hours", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ShortPositions", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5149,75 +5389,7 @@ func (m *QueryPerpetualFuturesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Fees_24Hours = &v - if err := m.Fees_24Hours.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LongPositions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LongPositions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShortPositions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ShortPositions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ShortPositions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5454,78 +5626,6 @@ func (m *QueryPerpetualFuturesMarketResponse) Unmarshal(dAtA []byte) error { m.MetricsQuoteTicker = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Volume_24Hours", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Volume_24Hours = &v - if err := m.Volume_24Hours.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fees_24Hours", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Fees_24Hours = &v - if err := m.Fees_24Hours.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LongPositions", wireType) } @@ -5561,7 +5661,7 @@ func (m *QueryPerpetualFuturesMarketResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ShortPositions", wireType) } @@ -6706,6 +6806,308 @@ func (m *QueryAddressPositionsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryAllPendingPaymentPositionsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllPendingPaymentPositionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPendingPaymentPositionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllPendingPaymentPositionsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllPendingPaymentPositionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPendingPaymentPositionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingPaymentPositions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PendingPaymentPositions = append(m.PendingPaymentPositions, &PendingPaymentPosition{}) + if err := m.PendingPaymentPositions[len(m.PendingPaymentPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPendingPaymentPositionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingPaymentPositionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingPaymentPositionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PositionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPendingPaymentPositionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingPaymentPositionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingPaymentPositionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingPaymentPosition", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PendingPaymentPosition == nil { + m.PendingPaymentPosition = &PendingPaymentPosition{} + } + if err := m.PendingPaymentPosition.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryDLPTokenRateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/derivatives/types/query.pb.gw.go b/x/derivatives/types/query.pb.gw.go index ab90512b0..2ffac3375 100644 --- a/x/derivatives/types/query.pb.gw.go +++ b/x/derivatives/types/query.pb.gw.go @@ -555,6 +555,78 @@ func local_request_Query_AddressPositions_0(ctx context.Context, marshaler runti } +func request_Query_AllPendingPaymentPositions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPendingPaymentPositionsRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllPendingPaymentPositions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllPendingPaymentPositions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPendingPaymentPositionsRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllPendingPaymentPositions(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_PendingPaymentPosition_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPaymentPositionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["position_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "position_id") + } + + protoReq.PositionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "position_id", err) + } + + msg, err := client.PendingPaymentPosition(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PendingPaymentPosition_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPaymentPositionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["position_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "position_id") + } + + protoReq.PositionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "position_id", err) + } + + msg, err := server.PendingPaymentPosition(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_DLPTokenRates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDLPTokenRateRequest var metadata runtime.ServerMetadata @@ -1079,6 +1151,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_AllPendingPaymentPositions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllPendingPaymentPositions_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllPendingPaymentPositions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PendingPaymentPosition_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PendingPaymentPosition_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PendingPaymentPosition_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_DLPTokenRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1475,6 +1593,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_AllPendingPaymentPositions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AllPendingPaymentPositions_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllPendingPaymentPositions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PendingPaymentPosition_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_PendingPaymentPosition_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PendingPaymentPosition_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_DLPTokenRates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1603,6 +1761,10 @@ var ( pattern_Query_AddressPositions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"ununifi", "derivatives", "address", "positions"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_AllPendingPaymentPositions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "derivatives", "pending-payment-positions"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_PendingPaymentPosition_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "derivatives", "pending-payment-positions", "position_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_DLPTokenRates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ununifi", "derivatives", "pools", "dlp"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_EstimateDLPTokenAmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "derivatives", "estimate-dlp-token-amount", "mint_denom", "amount"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1639,6 +1801,10 @@ var ( forward_Query_AddressPositions_0 = runtime.ForwardResponseMessage + forward_Query_AllPendingPaymentPositions_0 = runtime.ForwardResponseMessage + + forward_Query_PendingPaymentPosition_0 = runtime.ForwardResponseMessage + forward_Query_DLPTokenRates_0 = runtime.ForwardResponseMessage forward_Query_EstimateDLPTokenAmount_0 = runtime.ForwardResponseMessage diff --git a/x/derivatives/types/tx.pb.go b/x/derivatives/types/tx.pb.go index 1c4a8429d..b379628d5 100644 --- a/x/derivatives/types/tx.pb.go +++ b/x/derivatives/types/tx.pb.go @@ -593,6 +593,198 @@ func (m *MsgReportLevyPeriodResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgReportLevyPeriodResponse proto.InternalMessageInfo +type MsgAddMargin struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + PositionId string `protobuf:"bytes,3,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty" yaml:"position_id"` +} + +func (m *MsgAddMargin) Reset() { *m = MsgAddMargin{} } +func (m *MsgAddMargin) String() string { return proto.CompactTextString(m) } +func (*MsgAddMargin) ProtoMessage() {} +func (*MsgAddMargin) Descriptor() ([]byte, []int) { + return fileDescriptor_0ece79e09138dc54, []int{12} +} +func (m *MsgAddMargin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddMargin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddMargin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddMargin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddMargin.Merge(m, src) +} +func (m *MsgAddMargin) XXX_Size() int { + return m.Size() +} +func (m *MsgAddMargin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddMargin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddMargin proto.InternalMessageInfo + +func (m *MsgAddMargin) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgAddMargin) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *MsgAddMargin) GetPositionId() string { + if m != nil { + return m.PositionId + } + return "" +} + +type MsgAddMarginResponse struct { +} + +func (m *MsgAddMarginResponse) Reset() { *m = MsgAddMarginResponse{} } +func (m *MsgAddMarginResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddMarginResponse) ProtoMessage() {} +func (*MsgAddMarginResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0ece79e09138dc54, []int{13} +} +func (m *MsgAddMarginResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddMarginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddMarginResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddMarginResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddMarginResponse.Merge(m, src) +} +func (m *MsgAddMarginResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddMarginResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddMarginResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddMarginResponse proto.InternalMessageInfo + +type MsgRemoveMargin struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + PositionId string `protobuf:"bytes,3,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty" yaml:"position_id"` +} + +func (m *MsgRemoveMargin) Reset() { *m = MsgRemoveMargin{} } +func (m *MsgRemoveMargin) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMargin) ProtoMessage() {} +func (*MsgRemoveMargin) Descriptor() ([]byte, []int) { + return fileDescriptor_0ece79e09138dc54, []int{14} +} +func (m *MsgRemoveMargin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveMargin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveMargin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveMargin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMargin.Merge(m, src) +} +func (m *MsgRemoveMargin) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveMargin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMargin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveMargin proto.InternalMessageInfo + +func (m *MsgRemoveMargin) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgRemoveMargin) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *MsgRemoveMargin) GetPositionId() string { + if m != nil { + return m.PositionId + } + return "" +} + +type MsgRemoveMarginResponse struct { +} + +func (m *MsgRemoveMarginResponse) Reset() { *m = MsgRemoveMarginResponse{} } +func (m *MsgRemoveMarginResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMarginResponse) ProtoMessage() {} +func (*MsgRemoveMarginResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0ece79e09138dc54, []int{15} +} +func (m *MsgRemoveMarginResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveMarginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveMarginResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveMarginResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMarginResponse.Merge(m, src) +} +func (m *MsgRemoveMarginResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveMarginResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMarginResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveMarginResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgDepositToPool)(nil), "ununifi.derivatives.MsgDepositToPool") proto.RegisterType((*MsgDepositToPoolResponse)(nil), "ununifi.derivatives.MsgDepositToPoolResponse") @@ -606,60 +798,69 @@ func init() { proto.RegisterType((*MsgReportLiquidationResponse)(nil), "ununifi.derivatives.MsgReportLiquidationResponse") proto.RegisterType((*MsgReportLevyPeriod)(nil), "ununifi.derivatives.MsgReportLevyPeriod") proto.RegisterType((*MsgReportLevyPeriodResponse)(nil), "ununifi.derivatives.MsgReportLevyPeriodResponse") + proto.RegisterType((*MsgAddMargin)(nil), "ununifi.derivatives.MsgAddMargin") + proto.RegisterType((*MsgAddMarginResponse)(nil), "ununifi.derivatives.MsgAddMarginResponse") + proto.RegisterType((*MsgRemoveMargin)(nil), "ununifi.derivatives.MsgRemoveMargin") + proto.RegisterType((*MsgRemoveMarginResponse)(nil), "ununifi.derivatives.MsgRemoveMarginResponse") } func init() { proto.RegisterFile("ununifi/derivatives/tx.proto", fileDescriptor_0ece79e09138dc54) } var fileDescriptor_0ece79e09138dc54 = []byte{ - // 757 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x51, 0x4b, 0x1b, 0x4b, - 0x14, 0xce, 0xea, 0xbd, 0x82, 0x13, 0xc5, 0xb8, 0x7a, 0xaf, 0x31, 0x7a, 0x37, 0xb2, 0x5c, 0x4b, - 0x0a, 0xba, 0x5b, 0xed, 0x43, 0x41, 0x0a, 0xc5, 0x28, 0x52, 0x4b, 0x43, 0x65, 0xa9, 0x14, 0xfa, - 0xd0, 0xb0, 0xc9, 0x1e, 0xd7, 0x21, 0xd9, 0x99, 0x75, 0x67, 0x12, 0xcd, 0x2f, 0x28, 0xf4, 0xa9, - 0xff, 0xa6, 0xfd, 0x09, 0x3e, 0xfa, 0x58, 0x4a, 0x09, 0x45, 0xff, 0x81, 0xbf, 0xa0, 0x64, 0x67, - 0x12, 0x37, 0x9b, 0x5d, 0x1a, 0xfb, 0x50, 0xe8, 0x53, 0x66, 0xe6, 0x7c, 0xe7, 0x3b, 0xdf, 0x39, - 0x73, 0xce, 0x6c, 0xd0, 0x6a, 0x8b, 0xb4, 0x08, 0x3e, 0xc1, 0xa6, 0x03, 0x01, 0x6e, 0xdb, 0x1c, - 0xb7, 0x81, 0x99, 0xfc, 0xc2, 0xf0, 0x03, 0xca, 0xa9, 0xba, 0x20, 0xad, 0x46, 0xc4, 0x5a, 0x58, - 0x74, 0xa9, 0x4b, 0x43, 0xbb, 0xd9, 0x5b, 0x09, 0x68, 0xa1, 0xe8, 0x52, 0xea, 0x36, 0xc1, 0x0c, - 0x77, 0xb5, 0xd6, 0x89, 0xc9, 0xb1, 0x07, 0x8c, 0xdb, 0x9e, 0x2f, 0x01, 0xcb, 0x71, 0x80, 0x4d, - 0x3a, 0xd2, 0xa4, 0xd5, 0x29, 0xf3, 0x28, 0x33, 0x6b, 0x36, 0x03, 0xb3, 0xbd, 0x55, 0x03, 0x6e, - 0x6f, 0x99, 0x75, 0x8a, 0x89, 0xb4, 0xaf, 0x27, 0x89, 0x8c, 0xac, 0x05, 0x4c, 0x7f, 0xaf, 0xa0, - 0x5c, 0x85, 0xb9, 0xfb, 0xe0, 0x53, 0x86, 0xf9, 0x6b, 0x7a, 0x44, 0x69, 0x53, 0x7d, 0x88, 0xa6, - 0x18, 0x10, 0x07, 0x82, 0xbc, 0xb2, 0xa6, 0x94, 0xa6, 0xcb, 0xf3, 0xb7, 0xdd, 0xe2, 0x6c, 0xc7, - 0xf6, 0x9a, 0x3b, 0xba, 0x38, 0xd7, 0x2d, 0x09, 0x50, 0x9f, 0xa3, 0x29, 0xdb, 0xa3, 0x2d, 0xc2, - 0xf3, 0x13, 0x6b, 0x4a, 0x29, 0xbb, 0xbd, 0x6c, 0x08, 0x5d, 0x46, 0x4f, 0x97, 0x21, 0x75, 0x19, - 0x7b, 0x14, 0x93, 0xf2, 0x3f, 0x97, 0xdd, 0x62, 0xe6, 0x8e, 0x49, 0xb8, 0xe9, 0x96, 0xf4, 0xd7, - 0x0b, 0x28, 0x1f, 0x17, 0x62, 0x01, 0xf3, 0x29, 0x61, 0xa0, 0x7f, 0x53, 0xd0, 0x42, 0x85, 0xb9, - 0x6f, 0x30, 0x3f, 0x75, 0x02, 0xfb, 0xfc, 0x20, 0xa0, 0xde, 0x7d, 0x85, 0xbe, 0x43, 0xa8, 0xe9, - 0xf3, 0x6a, 0x44, 0xec, 0x74, 0xf9, 0x59, 0x4f, 0xd1, 0xd7, 0x6e, 0xf1, 0x81, 0x8b, 0xf9, 0x69, - 0xab, 0x66, 0xd4, 0xa9, 0x67, 0xca, 0xb2, 0x8a, 0x9f, 0x4d, 0xe6, 0x34, 0x4c, 0xde, 0xf1, 0x81, - 0x19, 0x87, 0x84, 0x8f, 0x6a, 0x9f, 0x6e, 0xfa, 0x7c, 0x37, 0x5c, 0xab, 0x3b, 0x68, 0x26, 0x00, - 0x07, 0xc0, 0xab, 0x3a, 0x40, 0xa8, 0x97, 0x9f, 0x0c, 0x23, 0x2c, 0xdd, 0x76, 0x8b, 0x0b, 0xc2, - 0x27, 0x6a, 0xd5, 0xad, 0xac, 0xd8, 0xee, 0x87, 0xbb, 0xff, 0xd0, 0x4a, 0x42, 0x76, 0x83, 0xec, - 0x3f, 0x4d, 0xa0, 0xb9, 0x0a, 0x73, 0x5f, 0xf9, 0x40, 0x8e, 0x7a, 0xc5, 0xc1, 0x94, 0xdc, 0xf3, - 0x8a, 0x3c, 0x3b, 0x70, 0x31, 0xb9, 0xf7, 0x15, 0x09, 0x37, 0xdd, 0x92, 0xfe, 0xea, 0x8b, 0x90, - 0xa9, 0x01, 0x3c, 0xcc, 0x2e, 0xbb, 0xbd, 0x62, 0x24, 0xf4, 0xba, 0x51, 0x09, 0x21, 0x09, 0x5c, - 0x0d, 0xe0, 0x82, 0xab, 0x01, 0x5c, 0xad, 0xa3, 0x79, 0x5f, 0x26, 0x53, 0xc5, 0x84, 0x71, 0x9b, - 0xd4, 0x21, 0xff, 0x57, 0x48, 0xbb, 0x68, 0x88, 0xb6, 0x37, 0xfa, 0x6d, 0x6f, 0xec, 0x92, 0x4e, - 0x79, 0x4d, 0xf2, 0xe5, 0x05, 0xdf, 0x88, 0xb3, 0x6e, 0xe5, 0xfa, 0x67, 0x87, 0xfd, 0xa3, 0x65, - 0xb4, 0x14, 0x2b, 0xdc, 0xa0, 0xa8, 0xed, 0xb0, 0xef, 0xf7, 0x9a, 0x94, 0xc1, 0xaf, 0x14, 0xf5, - 0x09, 0xca, 0xde, 0x29, 0x70, 0x64, 0x3f, 0xfd, 0x7b, 0xdb, 0x2d, 0xaa, 0x71, 0x79, 0x8e, 0x6e, - 0xa1, 0x81, 0x30, 0x47, 0xb6, 0xf9, 0x50, 0xdc, 0x81, 0xa6, 0xcf, 0x0a, 0x5a, 0xac, 0x30, 0xd7, - 0x02, 0x9f, 0x06, 0xfc, 0x25, 0x3e, 0x6b, 0x61, 0xc7, 0xfe, 0x5d, 0xc2, 0xd4, 0xa7, 0x28, 0x17, - 0xc0, 0xb9, 0x1d, 0x38, 0xd5, 0x00, 0xea, 0xd8, 0xc7, 0x40, 0xb8, 0x6c, 0xe2, 0x84, 0x68, 0x73, - 0x02, 0x6a, 0xf5, 0x91, 0xba, 0x86, 0x56, 0x93, 0x94, 0xdf, 0xf5, 0xb0, 0x98, 0x60, 0x09, 0x80, - 0x76, 0xe7, 0x08, 0x02, 0x4c, 0x9d, 0x3f, 0x20, 0x33, 0x31, 0x9c, 0x71, 0xe1, 0xfd, 0xc4, 0xb6, - 0x3f, 0xfc, 0x8d, 0x26, 0x2b, 0xcc, 0x55, 0x01, 0xcd, 0x0e, 0x3f, 0xa2, 0xeb, 0xc9, 0xc3, 0x11, - 0x7b, 0xe2, 0x0a, 0x9b, 0x63, 0xc1, 0xfa, 0xe1, 0x54, 0x82, 0x72, 0x23, 0xaf, 0x60, 0x29, 0x8d, - 0x22, 0x8e, 0x2c, 0x3c, 0x1a, 0x17, 0x39, 0x88, 0x57, 0x43, 0x33, 0x43, 0xef, 0xce, 0xff, 0x69, - 0x0c, 0x51, 0x54, 0x61, 0x63, 0x1c, 0xd4, 0x20, 0x06, 0xa0, 0xd9, 0xe1, 0x39, 0x4c, 0x2d, 0xdd, - 0x10, 0x2c, 0xbd, 0x74, 0x89, 0xd3, 0xa5, 0x9e, 0xa1, 0xf9, 0x84, 0xc9, 0x4a, 0xe3, 0x18, 0x81, - 0x16, 0xb6, 0xc6, 0x86, 0x46, 0x6f, 0x6b, 0xa4, 0xe3, 0x4b, 0x3f, 0xa1, 0x19, 0x20, 0xd3, 0x6f, - 0x2b, 0xad, 0x19, 0xcb, 0x07, 0x97, 0xd7, 0x9a, 0x72, 0x75, 0xad, 0x29, 0xdf, 0xaf, 0x35, 0xe5, - 0xe3, 0x8d, 0x96, 0xb9, 0xba, 0xd1, 0x32, 0x5f, 0x6e, 0xb4, 0xcc, 0xdb, 0x8d, 0xc8, 0x27, 0xee, - 0x98, 0x1c, 0x13, 0x7c, 0x80, 0xcd, 0xfa, 0xa9, 0x8d, 0x89, 0x79, 0x31, 0xfc, 0x37, 0xa6, 0xf7, - 0xb1, 0xab, 0x4d, 0x85, 0x2f, 0xef, 0xe3, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x09, 0xb4, 0xcd, - 0x70, 0xea, 0x08, 0x00, 0x00, + // 836 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x4f, 0xeb, 0x46, + 0x10, 0x8f, 0x1f, 0x55, 0xa4, 0x6c, 0x40, 0x2f, 0x18, 0xfa, 0x5e, 0xf0, 0xa3, 0x0e, 0xb5, 0xa0, + 0x0a, 0x12, 0xd8, 0x85, 0x1e, 0x2a, 0xa1, 0x4a, 0x15, 0x01, 0xa1, 0x52, 0xd5, 0x2a, 0xb2, 0x8a, + 0xaa, 0xf6, 0xd0, 0xc8, 0x89, 0x07, 0xb3, 0x4a, 0xbc, 0x6b, 0xbc, 0x9b, 0x40, 0x3e, 0x41, 0xaf, + 0xfd, 0x36, 0xed, 0xa1, 0x52, 0xaf, 0xf4, 0xc6, 0xb1, 0xaa, 0xaa, 0xa8, 0x82, 0x6f, 0xc0, 0x27, + 0xa8, 0xe2, 0x75, 0x1c, 0xc7, 0xb1, 0x45, 0xe8, 0xa1, 0x15, 0x27, 0xff, 0xd9, 0xdf, 0xcc, 0xfc, + 0x66, 0xf6, 0x37, 0xb3, 0x8b, 0xd6, 0x7b, 0xa4, 0x47, 0xf0, 0x05, 0x36, 0x1c, 0x08, 0x70, 0xdf, + 0xe6, 0xb8, 0x0f, 0xcc, 0xe0, 0x37, 0xba, 0x1f, 0x50, 0x4e, 0xe5, 0x95, 0x68, 0x55, 0x4f, 0xac, + 0x2a, 0xab, 0x2e, 0x75, 0x69, 0xb8, 0x6e, 0x8c, 0xde, 0x04, 0x54, 0xa9, 0xb9, 0x94, 0xba, 0x5d, + 0x30, 0xc2, 0xaf, 0x56, 0xef, 0xc2, 0xe0, 0xd8, 0x03, 0xc6, 0x6d, 0xcf, 0x8f, 0x00, 0x6b, 0x69, + 0x80, 0x4d, 0x06, 0xd1, 0x92, 0xda, 0xa6, 0xcc, 0xa3, 0xcc, 0x68, 0xd9, 0x0c, 0x8c, 0xfe, 0x5e, + 0x0b, 0xb8, 0xbd, 0x67, 0xb4, 0x29, 0x26, 0xd1, 0xfa, 0x56, 0x16, 0xc9, 0xc4, 0xbb, 0x80, 0x69, + 0x3f, 0x4a, 0xa8, 0x62, 0x32, 0xf7, 0x18, 0x7c, 0xca, 0x30, 0xff, 0x86, 0x9e, 0x51, 0xda, 0x95, + 0xb7, 0x51, 0x91, 0x01, 0x71, 0x20, 0xa8, 0x4a, 0x1b, 0x52, 0xbd, 0xd4, 0x58, 0x7e, 0x1c, 0xd6, + 0x96, 0x06, 0xb6, 0xd7, 0x3d, 0xd0, 0xc4, 0x7f, 0xcd, 0x8a, 0x00, 0xf2, 0x17, 0xa8, 0x68, 0x7b, + 0xb4, 0x47, 0x78, 0xf5, 0xd5, 0x86, 0x54, 0x2f, 0xef, 0xaf, 0xe9, 0x82, 0x97, 0x3e, 0xe2, 0xa5, + 0x47, 0xbc, 0xf4, 0x23, 0x8a, 0x49, 0xe3, 0xfd, 0xdb, 0x61, 0xad, 0x30, 0xf1, 0x24, 0xcc, 0x34, + 0x2b, 0xb2, 0xd7, 0x14, 0x54, 0x4d, 0x13, 0xb1, 0x80, 0xf9, 0x94, 0x30, 0xd0, 0xfe, 0x92, 0xd0, + 0x8a, 0xc9, 0xdc, 0x6f, 0x31, 0xbf, 0x74, 0x02, 0xfb, 0xfa, 0x24, 0xa0, 0xde, 0x73, 0x89, 0xfe, + 0x80, 0x50, 0xd7, 0xe7, 0xcd, 0x04, 0xd9, 0x52, 0xe3, 0xf3, 0x11, 0xa3, 0x3f, 0x87, 0xb5, 0x8f, + 0x5c, 0xcc, 0x2f, 0x7b, 0x2d, 0xbd, 0x4d, 0x3d, 0x23, 0x2a, 0xab, 0x78, 0xec, 0x32, 0xa7, 0x63, + 0xf0, 0x81, 0x0f, 0x4c, 0x3f, 0x25, 0x7c, 0x96, 0x7b, 0xa9, 0xeb, 0xf3, 0xc3, 0xf0, 0x5d, 0x3e, + 0x40, 0x8b, 0x01, 0x38, 0x00, 0x5e, 0xd3, 0x01, 0x42, 0xbd, 0xea, 0x42, 0x18, 0xe1, 0xed, 0xe3, + 0xb0, 0xb6, 0x22, 0x6c, 0x92, 0xab, 0x9a, 0x55, 0x16, 0x9f, 0xc7, 0xe1, 0xd7, 0x07, 0xe8, 0x5d, + 0x46, 0x76, 0x71, 0xf6, 0x3f, 0xbf, 0x42, 0xaf, 0x4d, 0xe6, 0x7e, 0xed, 0x03, 0x39, 0x1b, 0x15, + 0x07, 0x53, 0xf2, 0xcc, 0x2d, 0xf2, 0xec, 0xc0, 0xc5, 0xe4, 0xd9, 0x5b, 0x24, 0xcc, 0x34, 0x2b, + 0xb2, 0x97, 0xbf, 0x0c, 0x3d, 0x75, 0x80, 0x87, 0xd9, 0x95, 0xf7, 0xdf, 0xe9, 0x19, 0x5a, 0xd7, + 0xcd, 0x10, 0x92, 0xe1, 0xab, 0x03, 0x5c, 0xf8, 0xea, 0x00, 0x97, 0xdb, 0x68, 0xd9, 0x8f, 0x92, + 0x69, 0x62, 0xc2, 0xb8, 0x4d, 0xda, 0x50, 0x7d, 0x2f, 0x74, 0xbb, 0xaa, 0x0b, 0xd9, 0xeb, 0x63, + 0xd9, 0xeb, 0x87, 0x64, 0xd0, 0xd8, 0x88, 0xfc, 0x55, 0x85, 0xbf, 0x19, 0x63, 0xcd, 0xaa, 0x8c, + 0xff, 0x9d, 0x8e, 0x7f, 0xad, 0xa1, 0xb7, 0xa9, 0xc2, 0xc5, 0x45, 0xed, 0x87, 0xba, 0x3f, 0xea, + 0x52, 0x06, 0xff, 0xa6, 0xa8, 0x9f, 0xa2, 0xf2, 0x84, 0x81, 0x13, 0xe9, 0xe9, 0xcd, 0xe3, 0xb0, + 0x26, 0xa7, 0xe9, 0x39, 0x9a, 0x85, 0x62, 0x62, 0x4e, 0x24, 0xf3, 0xa9, 0xb8, 0x31, 0xa7, 0x5f, + 0x24, 0xb4, 0x6a, 0x32, 0xd7, 0x02, 0x9f, 0x06, 0xfc, 0x2b, 0x7c, 0xd5, 0xc3, 0x8e, 0xfd, 0x5f, + 0x11, 0x93, 0x3f, 0x43, 0x95, 0x00, 0xae, 0xed, 0xc0, 0x69, 0x06, 0xd0, 0xc6, 0x3e, 0x06, 0xc2, + 0x23, 0x11, 0x67, 0x44, 0x7b, 0x2d, 0xa0, 0xd6, 0x18, 0xa9, 0xa9, 0x68, 0x3d, 0x8b, 0xf9, 0x44, + 0xc3, 0xa2, 0x83, 0x23, 0x00, 0xf4, 0x07, 0x67, 0x10, 0x60, 0xea, 0xbc, 0x80, 0xcc, 0x44, 0x73, + 0xa6, 0x89, 0xc7, 0x89, 0xfd, 0x2a, 0xa1, 0x45, 0x93, 0xb9, 0x87, 0x8e, 0x63, 0x8a, 0x26, 0xf9, + 0x3f, 0x86, 0x67, 0xba, 0x36, 0x0b, 0x73, 0xcb, 0xf1, 0x4d, 0xa8, 0xb8, 0x98, 0x7d, 0x9c, 0xd6, + 0x6f, 0x52, 0x38, 0x73, 0x2c, 0xf0, 0x68, 0x1f, 0x5e, 0x64, 0x66, 0xa2, 0xf7, 0x93, 0x09, 0x8c, + 0x93, 0xdb, 0xff, 0xbd, 0x88, 0x16, 0x4c, 0xe6, 0xca, 0x80, 0x96, 0xa6, 0x0f, 0xbe, 0xad, 0xec, + 0x81, 0x96, 0x3a, 0x96, 0x94, 0xdd, 0xb9, 0x60, 0xe3, 0x70, 0x32, 0x41, 0x95, 0x99, 0x93, 0xab, + 0x9e, 0xe7, 0x22, 0x8d, 0x54, 0x3e, 0x9e, 0x17, 0x19, 0xc7, 0x6b, 0xa1, 0xc5, 0xa9, 0xb3, 0x62, + 0x33, 0xcf, 0x43, 0x12, 0xa5, 0xec, 0xcc, 0x83, 0x8a, 0x63, 0x00, 0x5a, 0x9a, 0x9e, 0x9d, 0xb9, + 0xa5, 0x9b, 0x82, 0xe5, 0x97, 0x2e, 0x73, 0x22, 0xca, 0x57, 0x68, 0x39, 0x63, 0x1a, 0xe6, 0xf9, + 0x98, 0x81, 0x2a, 0x7b, 0x73, 0x43, 0x93, 0xbb, 0x35, 0x33, 0xa5, 0xea, 0x4f, 0xb8, 0x89, 0x91, + 0xf9, 0xbb, 0x95, 0x37, 0x40, 0xe4, 0xef, 0x50, 0x69, 0x32, 0x3c, 0x3e, 0xcc, 0x33, 0x8f, 0x21, + 0xca, 0xf6, 0x93, 0x90, 0xa4, 0x10, 0xa6, 0x1a, 0x78, 0x33, 0x9f, 0xdc, 0x04, 0x95, 0x2f, 0x84, + 0xac, 0x5e, 0x6a, 0x9c, 0xdc, 0xde, 0xab, 0xd2, 0xdd, 0xbd, 0x2a, 0xfd, 0x7d, 0xaf, 0x4a, 0x3f, + 0x3d, 0xa8, 0x85, 0xbb, 0x07, 0xb5, 0xf0, 0xc7, 0x83, 0x5a, 0xf8, 0x7e, 0x27, 0x71, 0xab, 0x3a, + 0x27, 0xe7, 0x04, 0x9f, 0x60, 0xa3, 0x7d, 0x69, 0x63, 0x62, 0xdc, 0x4c, 0xdf, 0x9c, 0x47, 0xf7, + 0xab, 0x56, 0x31, 0x3c, 0xec, 0x3f, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x65, 0x54, 0xd1, 0x16, + 0x5d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -680,6 +881,8 @@ type MsgClient interface { ClosePosition(ctx context.Context, in *MsgClosePosition, opts ...grpc.CallOption) (*MsgClosePositionResponse, error) ReportLiquidation(ctx context.Context, in *MsgReportLiquidation, opts ...grpc.CallOption) (*MsgReportLiquidationResponse, error) ReportLevyPeriod(ctx context.Context, in *MsgReportLevyPeriod, opts ...grpc.CallOption) (*MsgReportLevyPeriodResponse, error) + AddMargin(ctx context.Context, in *MsgAddMargin, opts ...grpc.CallOption) (*MsgAddMarginResponse, error) + RemoveMargin(ctx context.Context, in *MsgRemoveMargin, opts ...grpc.CallOption) (*MsgRemoveMarginResponse, error) } type msgClient struct { @@ -744,6 +947,24 @@ func (c *msgClient) ReportLevyPeriod(ctx context.Context, in *MsgReportLevyPerio return out, nil } +func (c *msgClient) AddMargin(ctx context.Context, in *MsgAddMargin, opts ...grpc.CallOption) (*MsgAddMarginResponse, error) { + out := new(MsgAddMarginResponse) + err := c.cc.Invoke(ctx, "/ununifi.derivatives.Msg/AddMargin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveMargin(ctx context.Context, in *MsgRemoveMargin, opts ...grpc.CallOption) (*MsgRemoveMarginResponse, error) { + out := new(MsgRemoveMarginResponse) + err := c.cc.Invoke(ctx, "/ununifi.derivatives.Msg/RemoveMargin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { DepositToPool(context.Context, *MsgDepositToPool) (*MsgDepositToPoolResponse, error) @@ -752,6 +973,8 @@ type MsgServer interface { ClosePosition(context.Context, *MsgClosePosition) (*MsgClosePositionResponse, error) ReportLiquidation(context.Context, *MsgReportLiquidation) (*MsgReportLiquidationResponse, error) ReportLevyPeriod(context.Context, *MsgReportLevyPeriod) (*MsgReportLevyPeriodResponse, error) + AddMargin(context.Context, *MsgAddMargin) (*MsgAddMarginResponse, error) + RemoveMargin(context.Context, *MsgRemoveMargin) (*MsgRemoveMarginResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -776,6 +999,12 @@ func (*UnimplementedMsgServer) ReportLiquidation(ctx context.Context, req *MsgRe func (*UnimplementedMsgServer) ReportLevyPeriod(ctx context.Context, req *MsgReportLevyPeriod) (*MsgReportLevyPeriodResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportLevyPeriod not implemented") } +func (*UnimplementedMsgServer) AddMargin(ctx context.Context, req *MsgAddMargin) (*MsgAddMarginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddMargin not implemented") +} +func (*UnimplementedMsgServer) RemoveMargin(ctx context.Context, req *MsgRemoveMargin) (*MsgRemoveMarginResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveMargin not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -889,6 +1118,42 @@ func _Msg_ReportLevyPeriod_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_AddMargin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddMargin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddMargin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ununifi.derivatives.Msg/AddMargin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddMargin(ctx, req.(*MsgAddMargin)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveMargin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveMargin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveMargin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ununifi.derivatives.Msg/RemoveMargin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveMargin(ctx, req.(*MsgRemoveMargin)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ununifi.derivatives.Msg", HandlerType: (*MsgServer)(nil), @@ -917,6 +1182,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ReportLevyPeriod", Handler: _Msg_ReportLevyPeriod_Handler, }, + { + MethodName: "AddMargin", + Handler: _Msg_AddMargin_Handler, + }, + { + MethodName: "RemoveMargin", + Handler: _Msg_RemoveMargin_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ununifi/derivatives/tx.proto", @@ -1332,44 +1605,184 @@ func (m *MsgReportLevyPeriodResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgAddMargin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgDepositToPool) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgAddMargin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddMargin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0x1a } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgDepositToPoolResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgAddMarginResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgAddMarginResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddMarginResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgWithdrawFromPool) Size() (n int) { - if m == nil { - return 0 +func (m *MsgRemoveMargin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveMargin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveMargin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PositionId) > 0 { + i -= len(m.PositionId) + copy(dAtA[i:], m.PositionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.PositionId))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveMarginResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveMarginResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveMarginResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgDepositToPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDepositToPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawFromPool) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -1509,6 +1922,62 @@ func (m *MsgReportLevyPeriodResponse) Size() (n int) { return n } +func (m *MsgAddMargin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddMarginResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveMargin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.PositionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveMarginResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1546,9 +2015,437 @@ func (m *MsgDepositToPool) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositToPoolResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDepositToPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositToPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawFromPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawFromPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawFromPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LptAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LptAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RedeemDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RedeemDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawFromPoolResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawFromPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawFromPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgOpenPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgOpenPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Margin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Margin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Market", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1558,27 +2455,28 @@ func (m *MsgDepositToPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + if err := m.Market.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionInstance", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1605,7 +2503,7 @@ func (m *MsgDepositToPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PositionInstance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1630,7 +2528,7 @@ func (m *MsgDepositToPool) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositToPoolResponse) Unmarshal(dAtA []byte) error { +func (m *MsgOpenPositionResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1653,10 +2551,10 @@ func (m *MsgDepositToPoolResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositToPoolResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgOpenPositionResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositToPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgOpenPositionResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1680,7 +2578,7 @@ func (m *MsgDepositToPoolResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawFromPool) Unmarshal(dAtA []byte) error { +func (m *MsgClosePosition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1703,10 +2601,10 @@ func (m *MsgWithdrawFromPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawFromPool: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClosePosition: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawFromPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClosePosition: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1743,41 +2641,7 @@ func (m *MsgWithdrawFromPool) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LptAmount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LptAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RedeemDenom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1805,7 +2669,7 @@ func (m *MsgWithdrawFromPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RedeemDenom = string(dAtA[iNdEx:postIndex]) + m.PositionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1828,7 +2692,7 @@ func (m *MsgWithdrawFromPool) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawFromPoolResponse) Unmarshal(dAtA []byte) error { +func (m *MsgClosePositionResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1851,10 +2715,10 @@ func (m *MsgWithdrawFromPoolResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawFromPoolResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClosePositionResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawFromPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClosePositionResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1878,7 +2742,7 @@ func (m *MsgWithdrawFromPoolResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { +func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1901,10 +2765,10 @@ func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgOpenPosition: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReportLiquidation: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgOpenPosition: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReportLiquidation: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1941,9 +2805,9 @@ func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Margin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1953,63 +2817,29 @@ func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Margin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.PositionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Market", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Market.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PositionInstance", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RewardRecipient", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2019,24 +2849,23 @@ func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PositionInstance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.RewardRecipient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2059,7 +2888,7 @@ func (m *MsgOpenPosition) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgOpenPositionResponse) Unmarshal(dAtA []byte) error { +func (m *MsgReportLiquidationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2082,10 +2911,10 @@ func (m *MsgOpenPositionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgOpenPositionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReportLiquidationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgOpenPositionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReportLiquidationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2109,7 +2938,7 @@ func (m *MsgOpenPositionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgClosePosition) Unmarshal(dAtA []byte) error { +func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2132,10 +2961,10 @@ func (m *MsgClosePosition) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgClosePosition: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReportLevyPeriod: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClosePosition: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReportLevyPeriod: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2202,6 +3031,38 @@ func (m *MsgClosePosition) Unmarshal(dAtA []byte) error { } m.PositionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardRecipient", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardRecipient = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2223,7 +3084,7 @@ func (m *MsgClosePosition) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgClosePositionResponse) Unmarshal(dAtA []byte) error { +func (m *MsgReportLevyPeriodResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2246,10 +3107,10 @@ func (m *MsgClosePositionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgClosePositionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReportLevyPeriodResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClosePositionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReportLevyPeriodResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2273,7 +3134,7 @@ func (m *MsgClosePositionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { +func (m *MsgAddMargin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2296,10 +3157,10 @@ func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgReportLiquidation: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddMargin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgReportLiquidation: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddMargin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2336,9 +3197,9 @@ func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2348,27 +3209,28 @@ func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.PositionId = string(dAtA[iNdEx:postIndex]) + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardRecipient", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2396,7 +3258,7 @@ func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RewardRecipient = string(dAtA[iNdEx:postIndex]) + m.PositionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2419,7 +3281,7 @@ func (m *MsgReportLiquidation) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgReportLiquidationResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddMarginResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2442,10 +3304,10 @@ func (m *MsgReportLiquidationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgReportLiquidationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddMarginResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgReportLiquidationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddMarginResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2469,7 +3331,7 @@ func (m *MsgReportLiquidationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveMargin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2492,10 +3354,10 @@ func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgReportLevyPeriod: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveMargin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgReportLevyPeriod: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveMargin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2532,9 +3394,9 @@ func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2544,27 +3406,28 @@ func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.PositionId = string(dAtA[iNdEx:postIndex]) + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardRecipient", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PositionId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2592,7 +3455,7 @@ func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RewardRecipient = string(dAtA[iNdEx:postIndex]) + m.PositionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2615,7 +3478,7 @@ func (m *MsgReportLevyPeriod) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgReportLevyPeriodResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveMarginResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2638,10 +3501,10 @@ func (m *MsgReportLevyPeriodResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgReportLevyPeriodResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveMarginResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgReportLevyPeriodResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveMarginResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/derivatives/types/types.go b/x/derivatives/types/types.go index 8e86187e1..0d0cbed4f 100644 --- a/x/derivatives/types/types.go +++ b/x/derivatives/types/types.go @@ -8,6 +8,5 @@ func (marketCap PoolMarketCap) CalculateLPTokenPrice(supply sdk.Int) sdk.Dec { if supply.IsZero() { return sdk.ZeroDec() } - return marketCap.Total.Quo(sdk.NewDecFromInt(supply)) } diff --git a/x/ecosystemincentive/README.md b/x/ecosystemincentive/README.md new file mode 100644 index 000000000..0e8866ec3 --- /dev/null +++ b/x/ecosystemincentive/README.md @@ -0,0 +1,496 @@ +# ecosystem Incentive + +## Abstract + +The `ecosystem-incentive` module provides the feature to incentivize the parties who bring value to our NFT market place users, especially frontend creator for the UnUniFi's NFTFi features by distributing certain rate of the NFT traded fee to the subjects. +The subjects put the required information in somewhare (current idea is memo field of the target message like MsgPayAuctionFee) and withdraw the accumulated rewards all at once or for one specific denom. + +## Contents + +TODO: contents + +# Concepts + +**NOTE: This is early draft.** + +This module aims to provide the incentive for the parties which especially bring value to our ecosystem like frontend service creator. +Fucosing on the case for the frontend service creator, any of them who creates UnUniFi NFT market and NFTFi frontend service are the subjects to recieve Ecosystem Incentive reward from the NFT trading fee in many denoms which are used in NFT market. + +## Joining Ecosystem Incentive + +Any subjects can send a register message `MsgIncentiveRegister` with the `incentive_id` and `subject_weight_map`. + +## Getting Ecosystem Incentive Reward + +This model of distribution reward could be applied to many use-cases. But, we write down only about the case for nftbackedloan Frontend model here for better explanation of the sense of this module. +First, the subjects must register to get incentive by sending `MsgIncentiveRegister`. +Once the `incentive_id` is registered, they insert that `incentive_id` in the target message which is `MsgListNft` memo field precisely to get the reward for the nftbackedloan Frontend incentive mode. +Once the `NftIdentifer` on the market is connected with `incentive_id`, `AfterNftPaymentWithCommission` hook function triggers methods to reflect the reward amount for according addresses in `incentive_id`. + +## Withdrawing Ecosystem Incentive Reward + +Any registered subjects can withdraw thier reward by sending a withdrawal message if they are there. +They can withdraw all rewards across all denoms by sending `MsgWithdrawAllRewards`. +In other way, they can withdraw specific denom reward by sending `MsgWithdrawSpecificDenomReward`. + +## The Reward Mechanism + +All the reward comes from the fees that UnUniFi protocol earned in addition to gas fee which is defined in protocol as glocal parameter. +There is nothing inflational effect or depletion by rewarding subjects. + +# State + +**NOTE: This is early draft.** + +## IncentiveUnit + +```protobuf +message IncentiveUnit { + string id = 1 [ + (gogoproto.moretags) = "yaml:\"id\"" + ]; + repeated SubjectInfo subject_info_list = 2 [ + (gogoproto.moretags) = "yaml:\"subject_info_lists\"", + (gogoproto.nullable) = false + ]; +} + +message SubjectInfo { + string address = 1 [ + (gogoproto.moretags) = "yaml:\"subject_addr\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + string weight = 2 [ + (gogoproto.moretags) = "yaml:\"weight\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} +``` + +- Incentive: `"incentive_id" -> format(IncentiveStore)` + +### incentive_id + +`incentive_id` is the unique identifier in the `incentive_store` for the subjects. Hence, it can't be duplicated. + +## SubjectInfo + +### weight + +The ratio of the reward distribution in a `incentive_store` unit. +`incentive_store` can contain several `subject`s and ratio for each. + + +## nftbackedloanFrontendIncentiveIdTable + +- nftbackedloan_frontend_incentive_id_table: `format(nft_id) -> format(incentive_id)` + +This KVStore manages what NFT is connected to which `incentive_id`. + +## RewardTable + +RewardTable is the record of the rewards for the subject of the `ecosystem-incentive`. + +```protobuf +message Reward { + string subject_addr = 1 [ + (gogoproto.moretags) = "yaml:\"subject_addr\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + repeated cosmos.base.v1beta1.Coin rewards = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"rewards\"", + (gogoproto.nullable) = false + ]; +} +``` + +- RewardTable: `format(address) -> format(reward)` + +## Params + +```protobuf +message Params { + repeated RewardParams reward_params = 1 [ (gogoproto.moretags) = "yaml:\"reward_params\"" ]; + uint64 max_incentive_unit_id_len = 2 [ (gogoproto.moretags) = "yaml:\"max_incentive_unit_id_len\"" ]; + uint64 max_subject_info_num_in_unit = 3 [ (gogoproto.moretags) = "yaml:\"max_subject_info_num_in_unit\"" ]; +} + +message RewardParams { + string module_name = 1 [(gogoproto.nullable) = false]; + repeated IncentiveUnit incentive_units = 2 [(gogoproto.nullable) = false]; + repeated RewardStore reward_stores = 3 [(gogoproto.nullable) = false]; + repeated IncentiveUnitIdsByAddr incentive_unit_ids_by_addr = 4 [(gogoproto.nullable) = false]; +} + +// RewardRate defines the ratio to take reward for a specific reward_type. +// The total sum of reward_rate in a module cannot be exceed 1 +message RewardRate { + RewardType reward_type = 1 [ (gogoproto.moretags) = "yaml:\"reward_type\"" ]; + string rate = 2 [ + (gogoproto.moretags) = "yaml:\"rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// nftbackedloan_FRONTEND type reward will be disributed for the creators of frontend of UnUniFi's services. +enum RewardType { + UNKNOWN = 0; + STAKERS = 1; + FRONTEND_DEVELOPERS = 2; +} +``` + +`Params` contains `RewardParams` as the configuration of this module parameters and `MaxIncentiveUnitIdLen` as to define the max length of the IncentiveUnitId. + +### RewardRate + +The factor to multipy the trading fee for the reward of this module. +e.g. If `reward_rate` is 80% and the trading fee that is made in a target message is 100GUU, the actual reward for target `incentive_id` subjects is `100GUU * 0.80 = 80GUU`. + +### RewardType + +The reward type manages the types of the reward for the various subject. +At first, we support frontend creator. But, the reward will be able to distributed for the different type of parties in our ecosystem. + +### MaxIncentiveUnitIdLen + +The length of `IncentiveUnitId` must be between `MaxIncentiveUnitIdLen` and 0. + +## IncentiveUnitIdsByAddr + +IncentiveUnitIdsByAddr is the collection of the incentive unit ids for each address. + +```protobuf +message IncentiveUnitIdsByAddr { + string address = 1 [ + (gogoproto.moretags) = "yaml:\"address\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + repeated string incentive_unit_ids = 2 [ + (gogoproto.moretags) = "yaml:\"incentive_unit_ids\"", + (gogoproto.nullable) = false + ]; +} +``` + +# Hooks + +**NOTE: This is early draft.** + +All rewards accumulation are executed when the according hooks function is called. + +The example hooks functions interfaces in x/nftbackedloan module: + +```go +type nftbackedloanHooks interface { + AfterNftListed(ctx sdk.Context, nftIdentifier NftIdentifier, txMemo string) + AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftIdentifier, fee sdk.Coin) + AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftIdentifier) +} +``` + +## AfterNftListed + +This hook function is called for the resistration for the `ecosystem-incentive` with the `txMemo` and `nftIdentifiler`. +To pass the `txMemo` from the memo data of `MsgListNft` requires a method to get memo data in the process of `MsgListNft` in `x/nftbackedloan` module. + +### Location to be inserted + +- `ListNft(ctx sdk.Context, msg *types.MsgListNft)` from x/nftbackedloan in nft_listing.go + +## AfterNftPaymentWithCommission + +This hook function is called for the accumulation of the reward for the subjects which are connected with the `nftIdentifiler` in the argument. +The calculation of the actual reward amount is executed in methods which this hook function calls in this module. + +### Location to be inserted + +- `ProcessPaymentWithCommissionFee(ctx sdk.Context, listingOwner sdk.AccAddress, denom string, amount sdk.Int)` from x/nftbackedloan in nft_listing.go + +## AfterNftUnlistedWithoutPayment + +This hook function is called when a nft is unlisted for some reason like liquidation. +The purpose is to remove the unlisted nft information from `nftbackedloanFrontendIncentiveIdTable` KVStore to keep the data consystent. + +### Location to be inserted + +- `CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing)` from x/nftbackedloan in nft_listing.go +- Case which bid's length for the listing is 0 in `SetLiquidation(ctx sdk.Context, msg *types.MsgEndNftListing)` from x/nftbackedloan in nft_listing.go + +# Data structure for the memo field + +We use tx memo field data to identify what incentive will be distributed to what `incentive-unit` by putting the correct formatted json data into that. + +The v1's formal data archtecture is: + +```json +{ + "version": "v1", + "incentive_unit_id": "incentive_unit-1" +} +``` + +NOTE: There's a lot of chances to be changed this structure with the change of the version. Please note it when to use. + +## Frontends + +We use memo field data to know which frontend a lisetd nft used in the case of frontend-incentive model. +So we have to use the organized data structure of memo field in a listing tx (MsgListNft) to distingush it as a legitimate entry or not. + +Even if you put the wrong formatted data in the memo of tx contains MsgListNft, the MsgListNft itself will still succeed. The registration of the information which nft-id relates to what `incentive-unit-id` will just fail. + + + +# Messages and Queries + +**NOTE: This is early draft.** + +## Messages + +All messages of `ecosystem-incentive`. + +### Register + +A message to register `incentive_unit` to take reward from `ecosystem-incentive`. + +```protobuf +message MsgRegister { + string sender = 1 [ + (gogoproto.moretags) = "yaml:\"sender\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + string incentive_unit_id = 2 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; + repeated string subject_addrs = 3 [ + (gogoproto.moretags) = "yaml:\"subject_addrs\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + repeated string weights = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.moretags) = "yaml:\"weights\"", + (gogoproto.nullable) = false + ]; +} +message MsgRegisterResponse {} +``` + +`weights` must be `1.000000000000000000` (just ok as long as it represent 1). +For example, +ok: [0.5, 0.5], [0.33, 0.33, 0.34] +not: [0.5, 0.1], [0.33, 0.33, 0.3333] + +And more importantly, don't forget how one `subject_addr` is associated with one `weight`. It's just order for those two lists. For example, in this case +```shell +subject_addrs = [ +"ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl", +"ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux" +] +weights = [ +"0.6", +"0.4 +] +``` + +`ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl`'s `weight` will be `0.6` and `ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux`'s will be `0.4`. + +#### CLI + +We receive a JSON file in CLI command for this message. +Example JSON file for CLI tx command: + +```Json +{ + "incentive_id": "incentive-unit1", + "subject_addrs": [ + "ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl", + "ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux" + ], + "weights": [ + "0.50", + "0.50" + ] +} +``` + +### WithdrawAllRewards + +A message to withdraw all accumulated rewards across all denoms. + +```protobuf +message MsgWithdrawAllRewards { + string sender = 1 [ + (gogoproto.moretags) = "yaml:\"sender\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; +} +``` + +### WithdrawReward + +A message to withdraw accumulated reward of specified denom. + +```protobuf +message MsgWithdrawReward { + string sender = 1 [ + (gogoproto.moretags) = "yaml:\"sender\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; +} +``` + +## Queries + +All queries of `ecosystem-incentive`. + +### IncentiveUnit + +```protobuf +message QueryIncentiveUnitRequest { + string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; +} + +message QueryIncentiveUnitResponse { + IncentiveUnit incentive_unit = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit\"" ]; +} +``` + +### AllRewards + +```protobuf +message QueryAllRewardsRequest { + string subject_addr = 1 [ (gogoproto.moretags) = "yaml:\"subject_addr\"" ]; +} + +message QueryAllRewardsResponse { + Reward rewards = 1 [ + (gogoproto.moretags) = "yaml:\"rewards\"", + (gogoproto.nullable) = false + ]; +} +``` + +### SpecificDenomReward + +```protobuf +message QueryRewardRequest { + string subject_addr = 1 [ (gogoproto.moretags) = "yaml:\"subject_addr\"" ]; + string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; +} + +message QueryRewardResponse { + cosmos.base.v1beta1.Coin reward = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", + (gogoproto.moretags) = "yaml:\"reward\"", + (gogoproto.nullable) = false + ]; +} +``` + +### IncentiveUnitIdsByAddr + +```protobuf +message QueryIncentiveUnitIdsByAddrRequest { + string address = 1 [ + (gogoproto.moretags) = "yaml:\"address\"" + ]; +} + +message QueryIncentiveUnitIdsByAddrResponse { + IncentiveUnitIdsByAddr incentive_unit_ids_by_addr = 1 [ + (gogoproto.moretags) = "yaml:\"incentive_unit_ids_by_addr\"", + (gogoproto.nullable) = false + ]; +} +``` + +# Events + +```protobuf +message EventRegister { + string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; + repeated SubjectInfo subject_info_lists = 2 [ + (gogoproto.moretags) = "yaml:\"subject_info_lists\"", + (gogoproto.nullable) = false + ]; +} + +message EventWithdrawAllRewards { + string sender = 1 [ + (gogoproto.moretags) = "yaml:\"sender\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + repeated cosmos.base.v1beta1.Coin all_withdrawn_rewards = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"all_withdrawn_rewards\"", + (gogoproto.nullable) = false + ]; +} + +message EventWithdrawReward { + string sender = 1 [ + (gogoproto.moretags) = "yaml:\"sender\"", + (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin withdrawn_reward = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", + (gogoproto.moretags) = "yaml:\"withdrawn_reward\"", + (gogoproto.nullable) = false + ]; +} + +message EventFailedParsingMemoInputs { + string class_id = 1 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string nft_id = 2 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; + string memo = 3 [ (gogoproto.moretags) = "yaml:\"memo\"" ]; +} + +message EventRecordedIncentiveUnitId { + string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; + string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; +} + +message EventDeletedNftIdRecordedForFrontendReward { + string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; + string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; +} + +message EventNotRegisteredIncentiveUnitId { + string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; + string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; +} + +message EventNotRecordedNftId { + string class_id = 1 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string nft_id = 2 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; +} + +message EventUpdatedReward { + string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; + cosmos.base.v1beta1.Coin earned_reward = 2 [ + (gogoproto.moretags) = "yaml:\"earned_reward\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", + (gogoproto.nullable) = false + ]; +} + +message EventVersionUnmatched { + string unmatched_version = 1 [ (gogoproto.moretags) = "yaml:\"unmatched_version\"" ]; + string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; + string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; +} +``` diff --git a/x/ecosystemincentive/ante/ante.go b/x/ecosystemincentive/ante/ante.go new file mode 100644 index 000000000..82fb60cef --- /dev/null +++ b/x/ecosystemincentive/ante/ante.go @@ -0,0 +1,31 @@ +package ante + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + ecosystemincentivekeeper "github.com/UnUniFi/chain/x/ecosystemincentive/keeper" +) + +type FrontendIncentiveDecorator struct { + keeper ecosystemincentivekeeper.Keeper +} + +func NewFrontendIncentiveDecorator(keeper ecosystemincentivekeeper.Keeper) FrontendIncentiveDecorator { + return FrontendIncentiveDecorator{ + keeper: keeper, + } +} + +func (decorator FrontendIncentiveDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + memoTx, ok := tx.(sdk.TxWithMemo) + if !ok { + return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + } + msgs := memoTx.GetMsgs() + memo := memoTx.GetMemo() + + decorator.keeper.MemoTxHandler(ctx, msgs, memo) + + return next(ctx, tx, simulate) +} diff --git a/x/ecosystemincentive/client/cli/query.go b/x/ecosystemincentive/client/cli/query.go index f5b118247..e3ff50792 100644 --- a/x/ecosystemincentive/client/cli/query.go +++ b/x/ecosystemincentive/client/cli/query.go @@ -25,39 +25,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand( CmdQueryParams(), - CmdQueryRecordedRecipientContainerId(), CmdQueryAllRewards(), - CmdQueryRecipientContainer(), - CmdQueryRecipientContainerIdsByAddr(), ) - - return cmd -} - -func CmdQueryRecordedRecipientContainerId() *cobra.Command { - cmd := &cobra.Command{ - Use: "recorded-incentive-unit-id [class-id] [nft-id]", - Short: "shows incentive-unit-id recorded with the class and nft ids", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - req := &types.QueryRecordedRecipientContainerIdRequest{ - ClassId: args[0], - NftId: args[1], - } - - res, err := queryClient.RecordedRecipientContainerId(context.Background(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) return cmd } @@ -86,55 +55,3 @@ func CmdQueryAllRewards() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } - -func CmdQueryRecipientContainer() *cobra.Command { - cmd := &cobra.Command{ - Use: "incentive-unit [incentive-unit-id]", - Short: "shows incentive-unit data", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - req := &types.QueryRecipientContainerRequest{ - Id: args[0], - } - - res, err := queryClient.RecipientContainer(context.Background(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -func CmdQueryRecipientContainerIdsByAddr() *cobra.Command { - cmd := &cobra.Command{ - Use: "incentive-unit-ids-by-addr [address]", - Short: "shows incentive-unit-ids to which the address belongs", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - req := &types.QueryBelongingRecipientContainerIdsByAddrRequest{ - Address: args[0], - } - - res, err := queryClient.BelongingRecipientContainerIdsByAddr(context.Background(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} diff --git a/x/ecosystemincentive/client/cli/tx.go b/x/ecosystemincentive/client/cli/tx.go index dafb68c19..ffd4dca02 100644 --- a/x/ecosystemincentive/client/cli/tx.go +++ b/x/ecosystemincentive/client/cli/tx.go @@ -26,63 +26,12 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand( - CmdRegister(), CmdWithdrawAllRewards(), CmdWithdrawReward(), ) return cmd } -func CmdRegister() *cobra.Command { - cmd := &cobra.Command{ - Use: "register [file-path] [flags]", - Args: cobra.ExactArgs(0), - Short: "register incentive-unit to get ecosystem-incentive reward", - Long: "Example command: $ %s tx %s register --register-file [json-file-path]", - Example: `Example of a json file to pass: -{ - "incentive-unit-id": "incentive-unit-1", - "subject-addrs": [ - "ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl", - "ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux" - ], - "weights": [ - "0.50", - "0.50" - ] -} -`, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - incentiveId, subjectAddrs, weights, err := BuildRegisterInputs(cmd.Flags()) - if err != nil { - return err - } - - msg := types.NewMsgRegister( - clientCtx.GetFromAddress().String(), - incentiveId, - subjectAddrs, - weights, - ) - - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagSetRegister()) - flags.AddTxFlagsToCmd(cmd) - return cmd -} - func BuildRegisterInputs(fs *pflag.FlagSet) (string, []string, []sdk.Dec, error) { registerInputs, err := parseRegisterFlags(fs) if err != nil { diff --git a/x/ecosystemincentive/genesis.go b/x/ecosystemincentive/genesis.go index 51f79db2f..9feee94be 100644 --- a/x/ecosystemincentive/genesis.go +++ b/x/ecosystemincentive/genesis.go @@ -10,25 +10,9 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { k.SetParams(ctx, genState.Params) - for _, container := range genState.RecipientContainers { - var subjectAddrs []string - var weights []sdk.Dec - for i := 0; i < len(container.WeightedAddresses); i++ { - subjectAddrs = append(subjectAddrs, container.WeightedAddresses[i].Address) - weights = append(weights, container.WeightedAddresses[i].Weight) - } - - if _, err := k.Register(ctx, &types.MsgRegister{ - RecipientContainerId: container.Id, - Addresses: subjectAddrs, - Weights: weights, - }); err != nil { - panic(err) - } - } - for _, rewardStore := range genState.RewardStores { - if err := k.SetRewardStore(ctx, rewardStore); err != nil { + for _, rewardStore := range genState.RewardRecords { + if err := k.SetRewardRecord(ctx, rewardStore); err != nil { panic(err) } } @@ -38,8 +22,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.RecipientContainers = k.GetAllRecipientContainers(ctx) - genesis.RewardStores = k.GetAllRewardStores(ctx) + genesis.RewardRecords = k.GetAllRewardRecords(ctx) return genesis } diff --git a/x/ecosystemincentive/keeper/community_pool_distribution.go b/x/ecosystemincentive/keeper/community_pool_distribution.go new file mode 100644 index 000000000..ee1e3fbe0 --- /dev/null +++ b/x/ecosystemincentive/keeper/community_pool_distribution.go @@ -0,0 +1,49 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/UnUniFi/chain/x/ecosystemincentive/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +// AllocateTokensToCommunityPool performs reward and fee distribution to the community pool +func (k Keeper) AllocateTokensToCommunityPool(ctx sdk.Context, rewardAmount sdk.Coin) error { + // transfer collected fees to the fee_collector module account eventually for the distribution module account + // NOTE: But, it's worth considering when to actually send tokens to the target module account in this case + // Because in this style that we send tokens every time the hook method is called, there's the possibility that the sending numbers gets too high to affects the perfomance of the + // node and app. + eiModuleAcc := authtypes.NewModuleAddress(types.ModuleName) + err := k.ckKeeper.FundCommunityPool(ctx, sdk.NewCoins(rewardAmount), eiModuleAcc) + if err != nil { + // TODO: we need better panic handling + panic(err) + } + + // emit Event for the distribution of the ecosystem-incentive reward to stakers + _ = ctx.EventManager().EmitTypedEvent(&types.EventDistributionForStakers{ + DistributedAmount: rewardAmount, + BlockHeight: ctx.BlockHeight(), + }) + return nil +} + +func (k Keeper) GetCommunityPoolRewardRate(ctx sdk.Context) sdk.Dec { + params := k.GetParams(ctx) + rewardParams := params.RewardParams + + for _, rewardParam := range rewardParams { + if rewardParam.ModuleName == nftbackedloantypes.ModuleName { + for _, rewardRate := range rewardParam.RewardRate { + if rewardRate.RewardType == types.RewardType_COMMUNITY_POOL { + return rewardRate.Rate + } + } + } + } + + // if target param wasn't found somehow, return zero dec + return sdk.ZeroDec() +} diff --git a/x/ecosystemincentive/keeper/community_pool_distribution_test.go b/x/ecosystemincentive/keeper/community_pool_distribution_test.go new file mode 100644 index 000000000..cc404f603 --- /dev/null +++ b/x/ecosystemincentive/keeper/community_pool_distribution_test.go @@ -0,0 +1,38 @@ +package keeper_test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + + "github.com/UnUniFi/chain/x/ecosystemincentive/types" +) + +func (suite *KeeperTestSuite) TestAllocateTokensToCommunityPool() { + testCases := []struct { + testCase string + rewardAmount sdk.Coin + expReward sdk.Coin + success bool + }{ + { + testCase: "success case", + rewardAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), + expReward: sdk.NewCoin("uguu", sdk.NewInt(10)), + success: true, + }, + } + + for _, tc := range testCases { + _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.rewardAmount}) + _ = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{tc.rewardAmount}) + + if tc.success { + err := suite.app.EcosystemincentiveKeeper.AllocateTokensToCommunityPool(suite.ctx, tc.rewardAmount) + suite.Require().NoError(err) + + communityPoolBalance := suite.app.DistrKeeper.GetFeePoolCommunityCoins(suite.ctx).AmountOf(tc.rewardAmount.Denom) + suite.Require().NoError(err) + suite.Require().Equal(tc.expReward, sdk.NewCoin(tc.rewardAmount.Denom, communityPoolBalance.TruncateInt())) + } + } +} diff --git a/x/ecosystemincentive/keeper/frontend_incentive.go b/x/ecosystemincentive/keeper/frontend_incentive.go new file mode 100644 index 000000000..ec3281062 --- /dev/null +++ b/x/ecosystemincentive/keeper/frontend_incentive.go @@ -0,0 +1,66 @@ +package keeper + +import ( + "encoding/json" + + sdk "github.com/cosmos/cosmos-sdk/types" + + types "github.com/UnUniFi/chain/x/ecosystemincentive/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +func (k Keeper) MemoTxHandler(ctx sdk.Context, msgs []sdk.Msg, memo string) { + if len(memo) == 0 { + return + } + + d := make(map[string]interface{}) + err := json.Unmarshal([]byte(memo), &d) + if err != nil || d["frontend"] == nil { + return + } + + metadata := types.FrontendMetadata{} + err = json.Unmarshal([]byte(memo), &metadata) + if err != nil { + return + } + + if err != nil { + // _ = ctx.EventManager().EmitTypedEvent(&types.EventFailedParsingTxMemoData{ + // ClassId: nftIdentifier.ClassId, + // NftId: nftIdentifier.NftId, + // Memo: memo, + // }) + return + } + + for _, msg := range msgs { + switch msg := msg.(type) { + case *nftbackedloantypes.MsgListNft: + k.HandleMemoTxWithMsgListNft(ctx, msg, metadata) + } + } +} + +func (k Keeper) HandleMemoTxWithMsgListNft(ctx sdk.Context, msg *nftbackedloantypes.MsgListNft, metadata types.FrontendMetadata) { + // guide the execution based on the version in the memo inputs + // switch by values of AvailableVersions which is defined in ../types/memo.go + //var AvailableVersions = []string{ + // "v1", + // } + switch metadata.Version { + // types.AvailableVersions[0] = 1 + case types.AvailableVersions[0]: + // Store the incentive-unit-id in NftIdForFrontend KVStore with nft-id as key + k.RecordRecipientWithNftId(ctx, msg.NftId, metadata.Recipient) + + // If the value doesn't match any cases, emit event and don't do anything + default: + _ = ctx.EventManager().EmitTypedEvent(&types.EventVersionUnmatched{ + UnmatchedVersion: metadata.Version, + ClassId: msg.NftId.ClassId, + NftId: msg.NftId.TokenId, + }) + } +} diff --git a/x/ecosystemincentive/keeper/grpc_query.go b/x/ecosystemincentive/keeper/grpc_query.go index be156ecb1..4d15baf45 100644 --- a/x/ecosystemincentive/keeper/grpc_query.go +++ b/x/ecosystemincentive/keeper/grpc_query.go @@ -4,12 +4,10 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) var _ types.QueryServer = Keeper{} @@ -35,12 +33,12 @@ func (k Keeper) AllRewards(c context.Context, req *types.QueryAllRewardsRequest) return nil, err } - allRewards, exists := k.GetRewardStore(ctx, accAddr) + record, exists := k.GetRewardRecord(ctx, accAddr) if !exists { return nil, types.ErrAddressNotHaveReward } - return &types.QueryAllRewardsResponse{Rewards: allRewards}, nil + return &types.QueryAllRewardsResponse{RewardRecord: record}, nil } func (k Keeper) Reward(c context.Context, req *types.QueryRewardRequest) (*types.QueryRewardResponse, error) { @@ -54,7 +52,7 @@ func (k Keeper) Reward(c context.Context, req *types.QueryRewardRequest) (*types return &types.QueryRewardResponse{Reward: sdk.Coin{}}, err } - allRewards, exists := k.GetRewardStore(ctx, accAddr) + allRewards, exists := k.GetRewardRecord(ctx, accAddr) if !exists { return &types.QueryRewardResponse{Reward: sdk.Coin{}}, types.ErrAddressNotHaveReward } @@ -66,54 +64,3 @@ func (k Keeper) Reward(c context.Context, req *types.QueryRewardRequest) (*types return &types.QueryRewardResponse{Reward: reward}, nil } - -func (k Keeper) RecipientContainer(c context.Context, req *types.QueryRecipientContainerRequest) (*types.QueryRecipientContainerResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - ctx := sdk.UnwrapSDKContext(c) - - recipientContainer, exists := k.GetRecipientContainer(ctx, req.Id) - if !exists { - return nil, types.ErrNotRegisteredRecipientContainerId - } - - return &types.QueryRecipientContainerResponse{RecipientContainer: &recipientContainer}, nil -} - -func (k Keeper) RecordedRecipientContainerId(c context.Context, req *types.QueryRecordedRecipientContainerIdRequest) (*types.QueryRecordedRecipientContainerIdResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - ctx := sdk.UnwrapSDKContext(c) - - nftIdentifier := nftmarkettypes.NftIdentifier{ - ClassId: req.ClassId, - NftId: req.NftId, - } - - recipientContainerid, exists := k.GetRecipientContainerIdByNftId(ctx, nftIdentifier) - if !exists { - return nil, sdkerrors.Wrapf(types.ErrRecipientContainerIdByNftIdDoesntExist, "class id: %s\nnft id: %s", req.ClassId, req.NftId) - } - return &types.QueryRecordedRecipientContainerIdResponse{RecipientContainerId: recipientContainerid}, nil -} - -func (k Keeper) BelongingRecipientContainerIdsByAddr(c context.Context, req *types.QueryBelongingRecipientContainerIdsByAddrRequest) (*types.QueryBelongingRecipientContainerIdsByAddrResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - ctx := sdk.UnwrapSDKContext(c) - - addr, err := sdk.AccAddressFromBech32(req.Address) - if err != nil { - return &types.QueryBelongingRecipientContainerIdsByAddrResponse{}, err - } - recipientContainerIdsByAddr := k.GetRecipientContainerIdsByAddr(ctx, addr) - - if len(recipientContainerIdsByAddr.RecipientContainerIds) == 0 { - return &types.QueryBelongingRecipientContainerIdsByAddrResponse{}, err - } - - return &types.QueryBelongingRecipientContainerIdsByAddrResponse{RecipientContainerIds: recipientContainerIdsByAddr.RecipientContainerIds}, nil -} diff --git a/x/ecosystemincentive/keeper/hooks.go b/x/ecosystemincentive/keeper/hooks.go index 03657d680..2bb1bac2c 100644 --- a/x/ecosystemincentive/keeper/hooks.go +++ b/x/ecosystemincentive/keeper/hooks.go @@ -3,67 +3,26 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) type Hooks struct { k Keeper } -var _ nftmarkettypes.NftmarketHooks = Hooks{} +var _ nftbackedloantypes.NftbackedloanHooks = Hooks{} // Hooks create new ecosystem-incentive hooks func (k Keeper) Hooks() Hooks { return Hooks{k} } -// ------------------- Nftmarket Module Hooks ------------------- +// ------------------- nftbackedloan Module Hooks ------------------- -func (h Hooks) AfterNftListed(ctx sdk.Context, nftIdentifier nftmarkettypes.NftIdentifier, txMemo string) { - if len(txMemo) == 0 { - return - } - - memoInputs, err := types.ParseMemo([]byte(txMemo)) - - // return immediately after emitting event to tell decoding failed - // if memo data cannot be decoded properly - // this doesn't mean MsgListNft fail. It succeeds anyway. - if err != nil { - _ = ctx.EventManager().EmitTypedEvent(&types.EventFailedParsingTxMemoData{ - ClassId: nftIdentifier.ClassId, - NftId: nftIdentifier.NftId, - Memo: txMemo, - }) - return - } - - // guide the execution based on the version in the memo inputs - // switch by values of AvailableVersions which is defined in ../types/memo.go - //var AvailableVersions = []string{ - // "v1", - // } - switch memoInputs.Version { - // types.AvailableVersions[0] = "v1" - case types.AvailableVersions[0]: - // Store the incentive-unit-id in NftIdForFrontend KVStore with nft-id as key - h.k.RecordRecipientContainerIdWithNftId(ctx, nftIdentifier, memoInputs.RecipientContainerId) - - // If the value doesn't match any cases, emit event and don't do anything - default: - _ = ctx.EventManager().EmitTypedEvent(&types.EventVersionUnmatched{ - UnmatchedVersion: memoInputs.Version, - ClassId: nftIdentifier.ClassId, - NftId: nftIdentifier.NftId, - }) - } -} - -func (h Hooks) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier nftmarkettypes.NftIdentifier, fee sdk.Coin) { +func (h Hooks) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier nftbackedloantypes.NftId, fee sdk.Coin) { // if there's no fee, return if !fee.IsZero() { - // call RewardDistributionOfNftmarket method to update reward information + // call RewardDistributionOfnftbackedloan method to update reward information // for all the subjects of the nftmarke reward - if err := h.k.RewardDistributionOfNftmarket(ctx, nftIdentifier, fee); err != nil { + if err := h.k.RewardDistributionOfnftbackedloan(ctx, nftIdentifier, fee); err != nil { panic(err) } } @@ -73,7 +32,7 @@ func (h Hooks) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier nftm } // AfterNftUnlistedWithoutPayment is called every time nft is unlisted without payment -func (h Hooks) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier nftmarkettypes.NftIdentifier) { +func (h Hooks) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier nftbackedloantypes.NftId) { // delete the recorded nft-id with incetive-unit-id h.k.DeleteFrontendRecord(ctx, nftIdentifier) } diff --git a/x/ecosystemincentive/keeper/hooks_test.go b/x/ecosystemincentive/keeper/hooks_test.go index 5930e8d78..3957c57dc 100644 --- a/x/ecosystemincentive/keeper/hooks_test.go +++ b/x/ecosystemincentive/keeper/hooks_test.go @@ -5,137 +5,13 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (suite *KeeperTestSuite) TestAfterNftListed() { - tests := []struct { - testCase string - nftId nftmarkettypes.NftIdentifier - recipientContainerId string - subjectAddrs []string - weights []sdk.Dec - txMemo string - registerBefore bool - expectPass bool - expectPanic bool - memoFormat bool - }{ - { - testCase: "ordinal success case", - nftId: nftmarkettypes.NftIdentifier{ - ClassId: "class1", - NftId: "nft1", - }, - recipientContainerId: "recipientContainerId1", - subjectAddrs: []string{ - suite.addrs[0].String(), - }, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1")}, - txMemo: `{"version":"v1","incentive_unit_id":"recipientContainerId1"}`, - registerBefore: true, - expectPass: true, - expectPanic: false, - memoFormat: true, - }, - { - testCase: "incentive unit id is not registered", - nftId: nftmarkettypes.NftIdentifier{ - ClassId: "class2", - NftId: "nft2", - }, - txMemo: `{"version":"v1","incentive_unit_id":"recipientContainerId2"}`, - registerBefore: false, - expectPass: false, - expectPanic: false, - memoFormat: true, - }, - { - testCase: "panic since incentive unit id is already recorded with nft id", - nftId: nftmarkettypes.NftIdentifier{ - ClassId: "class1", - NftId: "nft1", - }, - txMemo: `{"version":"v1","incentive_unit_id":"recipientContainerId2"}`, - registerBefore: false, - expectPass: false, - expectPanic: true, - memoFormat: true, - }, - { - testCase: "invalid memo format", - nftId: nftmarkettypes.NftIdentifier{ - ClassId: "class3", - NftId: "nft3", - }, - recipientContainerId: "recipientContainerId3", - subjectAddrs: []string{ - suite.addrs[0].String(), - }, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1")}, - txMemo: `{"error":true,"version":"v1","incentive_unit_id":"recipientContainerId3"}`, - registerBefore: true, - expectPass: false, - expectPanic: false, - memoFormat: false, - }, - { - testCase: "invalid memo format version", - nftId: nftmarkettypes.NftIdentifier{ - ClassId: "class4", - NftId: "nft4", - }, - recipientContainerId: "recipientContainerId4", - subjectAddrs: []string{ - suite.addrs[0].String(), - }, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1")}, - txMemo: `{"version":"v0","incentive_unit_id":"recipientContainerId4"}`, - registerBefore: true, - expectPass: false, - expectPanic: false, - memoFormat: false, - }, - } - - for _, tc := range tests { - if tc.registerBefore { - _, err := suite.app.EcosystemincentiveKeeper.Register(suite.ctx, &types.MsgRegister{ - Sender: tc.subjectAddrs[0], - RecipientContainerId: tc.recipientContainerId, - Addresses: tc.subjectAddrs, - Weights: tc.weights, - }) - suite.Require().NoError(err) - } - - if tc.expectPanic { - suite.Panics(func() { - suite.app.EcosystemincentiveKeeper.Hooks().AfterNftListed(suite.ctx, tc.nftId, tc.txMemo) - }) - } else { - suite.NotPanics(func() { - suite.app.EcosystemincentiveKeeper.Hooks().AfterNftListed(suite.ctx, tc.nftId, tc.txMemo) - }) - } - - recipientContainerId, exists := suite.app.EcosystemincentiveKeeper.GetRecipientContainerIdByNftId(suite.ctx, tc.nftId) - if tc.expectPass { - suite.Require().True(exists) - suite.Require().Equal(tc.recipientContainerId, recipientContainerId) - } else if tc.expectPanic { - suite.Require().True(exists) - suite.Require().NotEqual(tc.recipientContainerId, recipientContainerId) - } else { - suite.Require().False(exists) - } - } -} - func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { tests := []struct { testCase string - nftId nftmarkettypes.NftIdentifier + nftId nftbackedloantypes.NftId reward sdk.Coin recipientContainerId string subjectAddrs []string @@ -149,9 +25,9 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { }{ { testCase: "failure case since incentive unit id was not recorded with nft id", - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class1", - NftId: "nft1", + TokenId: "nft1", }, reward: sdk.Coin{"uguu", sdk.NewInt(100)}, recipientContainerId: "recipientContainerId1", @@ -164,9 +40,9 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { }, { testCase: "failure case since there's no fee to distribute", - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class2", - NftId: "nft2", + TokenId: "nft2", }, reward: sdk.Coin{"uguu", sdk.NewInt(0)}, recipientContainerId: "recipientContainerId1", @@ -179,9 +55,9 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { }, { testCase: "ordinal case", - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class3", - NftId: "nft3", + TokenId: "nft3", }, reward: sdk.Coin{"uguu", sdk.NewInt(100)}, recipientContainerId: "recipientContainerId3", @@ -196,9 +72,9 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { }, { testCase: "ordinal case", - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class4", - NftId: "nft4", + TokenId: "nft4", }, reward: sdk.Coin{"uguu", sdk.NewInt(100)}, recipientContainerId: "recipientContainerId4", @@ -215,15 +91,9 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { for _, tc := range tests { suite.SetupTest() - _, err := suite.app.EcosystemincentiveKeeper.Register(suite.ctx, &types.MsgRegister{ - Sender: tc.subjectAddrs[0], - RecipientContainerId: tc.recipientContainerId, - Addresses: tc.subjectAddrs, - Weights: tc.weights, - }) - suite.Require().NoError(err) + if tc.recordedBefore { - suite.app.EcosystemincentiveKeeper.RecordRecipientContainerIdWithNftId(suite.ctx, tc.nftId, tc.recipientContainerId) + suite.app.EcosystemincentiveKeeper.RecordRecipientWithNftId(suite.ctx, tc.nftId, tc.recipientContainerId) } _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.reward}) @@ -234,7 +104,7 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { if tc.expectPass { totalRewardForRecipientContainer := sdk.ZeroInt() for _, subject := range tc.subjectAddrs { - rewardStore, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(suite.ctx, sdk.AccAddress(subject)) + rewardStore, exists := suite.app.EcosystemincentiveKeeper.GetRewardRecord(suite.ctx, sdk.AccAddress(subject)) totalRewardForRecipientContainer = totalRewardForRecipientContainer.Add(rewardStore.Rewards.AmountOf(tc.reward.Denom)) suite.Require().True(exists) } @@ -259,7 +129,7 @@ func (suite *KeeperTestSuite) TestAfterNftPaymentWithCommission() { func (suite *KeeperTestSuite) TestAfterNftUnlistedWithoutPayment() { tests := []struct { testCase string - nftId nftmarkettypes.NftIdentifier + nftId nftbackedloantypes.NftId recipientContainerId string subjectAddrs []string weights []sdk.Dec @@ -268,9 +138,9 @@ func (suite *KeeperTestSuite) TestAfterNftUnlistedWithoutPayment() { }{ { testCase: "ordinal case", - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class1", - NftId: "nft1", + TokenId: "nft1", }, recipientContainerId: "recipientContainerId1", subjectAddrs: []string{ @@ -281,9 +151,9 @@ func (suite *KeeperTestSuite) TestAfterNftUnlistedWithoutPayment() { }, { testCase: "not recorded case", - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class2", - NftId: "nft2", + TokenId: "nft2", }, recipientContainerId: "recipientContainerId2", subjectAddrs: []string{ diff --git a/x/ecosystemincentive/keeper/incentive_unit_service.go b/x/ecosystemincentive/keeper/incentive_unit_service.go deleted file mode 100644 index b7e40978f..000000000 --- a/x/ecosystemincentive/keeper/incentive_unit_service.go +++ /dev/null @@ -1,150 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/x/ecosystemincentive/types" -) - -// Register method record subjects info in RecipientContainer type -func (k Keeper) Register(ctx sdk.Context, msg *types.MsgRegister) (*[]types.WeightedAddress, error) { - // check if the RecipientContainerId is already registered - if _, exists := k.GetRecipientContainer(ctx, msg.RecipientContainerId); exists { - return nil, sdkerrors.Wrap(types.ErrRegisteredIncentiveId, msg.RecipientContainerId) - } - - // check the length of the RecipientContainerId by referring MaxInentiveUnitIdLen in the Params - if err := types.ValidateRecipientContainerId(msg.RecipientContainerId); err != nil { - return nil, err - } - - var subjectInfoList []types.WeightedAddress - for i := 0; i < len(msg.Addresses); i++ { - subjectInfo := types.NewSubjectInfo(msg.Addresses[i], msg.Weights[i]) - subjectInfoList = append(subjectInfoList, subjectInfo) - } - - recipientContainer := types.NewRecipientContainer(msg.RecipientContainerId, subjectInfoList) - - if err := k.SetRecipientContainer(ctx, recipientContainer); err != nil { - return nil, err - } - - // operation related to RecipientContainerIdsByAddr - // if exists already, add incentuve unit id in msg into data - // if not, newly create and set - for _, addr := range msg.Addresses { - recipientContainerIdsByAddr := k.GetRecipientContainerIdsByAddr(ctx, sdk.MustAccAddressFromBech32(addr)) - recipientContainerIdsByAddr = recipientContainerIdsByAddr.CreateOrUpdate(addr, msg.RecipientContainerId) - - if err := k.SetRecipientContainerIdsByAddr(ctx, recipientContainerIdsByAddr); err != nil { - return nil, err - } - } - - return &subjectInfoList, nil -} - -func (k Keeper) SetRecipientContainer(ctx sdk.Context, recipientContainer types.RecipientContainer) error { - bz, err := k.cdc.Marshal(&recipientContainer) - if err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainer)) - prefixStore.Set([]byte(recipientContainer.Id), bz) - - return nil -} - -func (k Keeper) SetRecipientContainerIdsByAddr(ctx sdk.Context, recipientContainerIdsByAddr types.BelongingRecipientContainers) error { - bz, err := k.cdc.Marshal(&recipientContainerIdsByAddr) - if err != nil { - return err - } - - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdsByAddr)) - // Use byte array of accAddress as key - addressKeyBytes := sdk.MustAccAddressFromBech32(recipientContainerIdsByAddr.Address).Bytes() - prefixStore.Set(addressKeyBytes, bz) - - return nil -} - -func (k Keeper) GetRecipientContainer(ctx sdk.Context, id string) (types.RecipientContainer, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainer)) - - bz := prefixStore.Get([]byte(id)) - if bz == nil { - return types.RecipientContainer{}, false - } - - var recipientContainer types.RecipientContainer - k.cdc.MustUnmarshal(bz, &recipientContainer) - return recipientContainer, true -} - -func (k Keeper) GetRecipientContainerIdsByAddr(ctx sdk.Context, address sdk.AccAddress) types.BelongingRecipientContainers { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdsByAddr)) - - bz := prefixStore.Get(address) - if bz == nil { - return types.BelongingRecipientContainers{} - } - - var recipientContainerIdsByAddr types.BelongingRecipientContainers - k.cdc.MustUnmarshal(bz, &recipientContainerIdsByAddr) - return recipientContainerIdsByAddr -} - -func (k Keeper) GetAllRecipientContainers(ctx sdk.Context) []types.RecipientContainer { - store := ctx.KVStore(k.storeKey) - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixRecipientContainer)) - defer it.Close() - - allRecipientContainers := []types.RecipientContainer{} - for ; it.Valid(); it.Next() { - var recipientContainer types.RecipientContainer - k.cdc.MustUnmarshal(it.Value(), &recipientContainer) - - allRecipientContainers = append(allRecipientContainers, recipientContainer) - } - - return allRecipientContainers -} - -func (k Keeper) GetAllRecipientContainerIdsByAddrs(ctx sdk.Context) []types.BelongingRecipientContainers { - store := ctx.KVStore(k.storeKey) - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixRecipientContainerIdsByAddr)) - defer it.Close() - - allRecipientContainerIdsByAddrs := []types.BelongingRecipientContainers{} - for ; it.Valid(); it.Next() { - var recipientContainerIdsByAddr types.BelongingRecipientContainers - k.cdc.MustUnmarshal(it.Value(), &recipientContainerIdsByAddr) - - allRecipientContainerIdsByAddrs = append(allRecipientContainerIdsByAddrs, recipientContainerIdsByAddr) - } - - return allRecipientContainerIdsByAddrs -} - -func (k Keeper) DeleteRecipientContainer(ctx sdk.Context, id string) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainer)) - - prefixStore.Delete([]byte(id)) -} - -func (k Keeper) DeleteRecipientContainerIdsByAddr(ctx sdk.Context, address sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdsByAddr)) - - prefixStore.Delete(address) -} diff --git a/x/ecosystemincentive/keeper/incentive_unit_service_test.go b/x/ecosystemincentive/keeper/incentive_unit_service_test.go deleted file mode 100644 index 31858d88e..000000000 --- a/x/ecosystemincentive/keeper/incentive_unit_service_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper_test - -import ( - "github.com/UnUniFi/chain/x/ecosystemincentive/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (suite *KeeperTestSuite) TestRegister() { - - tests := []struct { - testCase string - recipientContainerId string - subjectAddrs []string - weights []sdk.Dec - success bool - }{ - { - testCase: "ordinal success case", - recipientContainerId: "test1", - subjectAddrs: []string{ - suite.addrs[0].String(), - }, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1")}, - success: true, - }, - { - testCase: "multiple subjects success case", - recipientContainerId: "test2", - subjectAddrs: []string{ - suite.addrs[0].String(), - suite.addrs[1].String(), - suite.addrs[2].String(), - }, - weights: []sdk.Dec{ - sdk.MustNewDecFromStr("0.33"), - sdk.MustNewDecFromStr("0.33"), - sdk.MustNewDecFromStr("0.34"), - }, - success: true, - }, - { - testCase: "failure due to the duplicated inentiveUnitId", - recipientContainerId: "test1", - subjectAddrs: []string{ - suite.addrs[0].String(), - }, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1")}, - success: false, - }, - { - testCase: "failure due to invalid recipientContainerId", - recipientContainerId: "", - subjectAddrs: []string{ - suite.addrs[0].String(), - }, - weights: []sdk.Dec{ - sdk.MustNewDecFromStr("1"), - }, - success: false, - }, - } - - for _, tc := range tests { - subjectInfo, err := suite.app.EcosystemincentiveKeeper.Register(suite.ctx, &types.MsgRegister{ - Sender: suite.addrs[0].String(), - RecipientContainerId: tc.recipientContainerId, - Addresses: tc.subjectAddrs, - Weights: tc.weights, - }) - if tc.success { - suite.Require().NoError(err) - for i, subject := range *subjectInfo { - suite.Require().Equal(subject.SubjectAddr, tc.subjectAddrs[i]) - suite.Require().Equal(subject.Weight, tc.weights[i]) - - recipientContainerIdsByAddr := suite.app.EcosystemincentiveKeeper.GetRecipientContainerIdsByAddr(suite.ctx, subject.SubjectAddr.AccAddress()) - suite.Require().Contains(recipientContainerIdsByAddr.RecipientContainerIds, tc.recipientContainerId) - } - } else { - suite.Require().Error(err) - } - } -} diff --git a/x/ecosystemincentive/keeper/keeper.go b/x/ecosystemincentive/keeper/keeper.go index 0ec759ac3..5d5a9a972 100644 --- a/x/ecosystemincentive/keeper/keeper.go +++ b/x/ecosystemincentive/keeper/keeper.go @@ -20,6 +20,7 @@ type ( paramstore paramtypes.Subspace authKeeper types.AccountKeeper bankKeeper types.BankKeeper + ckKeeper types.CommunityPoolKeeper feeDistributionNameForStakers string // name of the FeeCollector ModuleAccount } @@ -31,6 +32,7 @@ func NewKeeper( ps paramtypes.Subspace, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + ckKeeper types.CommunityPoolKeeper, feeDistributionNameForStakers string, ) Keeper { // set KeyTable if it has not already been set @@ -44,6 +46,7 @@ func NewKeeper( paramstore: ps, authKeeper: authKeeper, bankKeeper: bankKeeper, + ckKeeper: ckKeeper, feeDistributionNameForStakers: feeDistributionNameForStakers, } } diff --git a/x/ecosystemincentive/keeper/keeper_test.go b/x/ecosystemincentive/keeper/keeper_test.go index ed4553fa0..fbe0af4c9 100644 --- a/x/ecosystemincentive/keeper/keeper_test.go +++ b/x/ecosystemincentive/keeper/keeper_test.go @@ -13,28 +13,28 @@ import ( "github.com/stretchr/testify/suite" simapp "github.com/UnUniFi/chain/app" - nftmarketkeeper "github.com/UnUniFi/chain/x/nftbackedloan/keeper" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloankeeper "github.com/UnUniFi/chain/x/nftbackedloan/keeper" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) var ( maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - nft.ModuleName: nil, - nftmarkettypes.ModuleName: nil, - // nftmarkettypes.NftTradingFee: nil, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + nft.ModuleName: nil, + nftbackedloantypes.ModuleName: nil, + // nftbackedloantypes.NftTradingFee: nil, } ) type KeeperTestSuite struct { suite.Suite - ctx sdk.Context - app *simapp.App - addrs []sdk.AccAddress - nftmarketKeeper nftmarketkeeper.Keeper + ctx sdk.Context + app *simapp.App + addrs []sdk.AccAddress + nftbackedloanKeeper nftbackedloankeeper.Keeper } func (suite *KeeperTestSuite) SetupTest() { diff --git a/x/ecosystemincentive/keeper/msg_server.go b/x/ecosystemincentive/keeper/msg_server.go index 701c851a1..7dbb4b1b0 100644 --- a/x/ecosystemincentive/keeper/msg_server.go +++ b/x/ecosystemincentive/keeper/msg_server.go @@ -22,24 +22,6 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -func (k msgServer) Register(c context.Context, msg *types.MsgRegister) (*types.MsgRegisterResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - subjectInfoList, err := k.keeper.Register(ctx, msg) - if err != nil { - return nil, err - } - - if err := ctx.EventManager().EmitTypedEvent(&types.EventRegister{ - RecipientContainerId: msg.RecipientContainerId, - WeightedAddresses: *subjectInfoList, - }); err != nil { - return nil, err - } - - return &types.MsgRegisterResponse{}, nil -} - func (k msgServer) WithdrawAllRewards(c context.Context, msg *types.MsgWithdrawAllRewards) (*types.MsgWithdrawAllRewardsResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/ecosystemincentive/keeper/nftbackedloan_frontend.go b/x/ecosystemincentive/keeper/nftbackedloan_frontend.go new file mode 100644 index 000000000..97fa61b70 --- /dev/null +++ b/x/ecosystemincentive/keeper/nftbackedloan_frontend.go @@ -0,0 +1,133 @@ +// The implementations especially for the services about the nftbackedloan Frontend reward. +// The reason why it's separated is for achieving the explicity and extensibility of this module. + +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/ecosystemincentive/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +// RecordRecipientWithNftId is for recording recipient with nftId +// to know of the receriver of the incentive reward for the frontend creator +// of nftbackedloan in AfterNftPaymentWithCommission method. +func (k Keeper) RecordRecipientWithNftId(ctx sdk.Context, nftId nftbackedloantypes.NftId, recipient string) error { + if _, exists := k.GetRecipientByNftId(ctx, nftId); exists { + return sdkerrors.Wrap(types.ErrRecordedNftId, nftId.String()) + } + + err := k.SetRecipientByNftId(ctx, nftId, recipient) + if err != nil { + return err + } + + // emit event to tell it succeeded. + // err = ctx.EventManager().EmitTypedEvent(&types.EventRecordedRecipientContainerId{ + // RecipientContainerId: recipientContainerId, + // ClassId: nftId.ClassId, + // NftId: nftId.NftId, + // }) + + return err +} + +// DeleteFrontendRecord is called in case to clean the record related for frontend incentive +func (k Keeper) DeleteFrontendRecord(ctx sdk.Context, nftId nftbackedloantypes.NftId) error { + // If the passed NftId doesn't exist in the KVStore, emit the error message + // but not panic and just return + recipient, exists := k.GetRecipientByNftId(ctx, nftId) + if !exists { + return fmt.Errorf(sdkerrors.Wrap(types.ErrRecipientContainerIdByNftIdDoesntExist, nftId.String()).Error()) + + } + + k.DeleteRecipientByNftId(ctx, nftId) + + // emit event for telling the nftId is deleted from the KVStore + err := ctx.EventManager().EmitTypedEvent(&types.EventDeletedNftIdRecordedForFrontendReward{ + RecipientContainerId: recipient, + ClassId: nftId.ClassId, + TokenId: nftId.TokenId, + }) + + return err +} + +func (k Keeper) SetRecipientByNftId(ctx sdk.Context, nftIdByte nftbackedloantypes.NftId, recipient string) error { + store := ctx.KVStore(k.storeKey) + prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdByNftId)) + prefixStore.Set(nftIdByte.IdBytes(), []byte(recipient)) + + return nil +} + +func (k Keeper) GetRecipientByNftId(ctx sdk.Context, nftId nftbackedloantypes.NftId) (string, bool) { + store := ctx.KVStore(k.storeKey) + prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdByNftId)) + + bz := prefixStore.Get(nftId.IdBytes()) + if bz == nil { + return "", false + } + + return string(bz), true +} + +// DeleteRecipientByNftId deletes nftId and recipient from RecipientByNftId KVStore to clean the record. +func (k Keeper) DeleteRecipientByNftId(ctx sdk.Context, nftId nftbackedloantypes.NftId) { + // Delete incentive unit id by nft id + store := ctx.KVStore(k.storeKey) + prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdByNftId)) + + prefixStore.Delete(nftId.IdBytes()) +} + +// AccumulateReward is called in AfterNftPaymentWithCommission hook method +// This method updates the reward information for the subject who is associated with the nftId +func (k Keeper) AccumulateRewardForFrontend(ctx sdk.Context, recipient string, reward sdk.Coin) error { + addr, err := sdk.AccAddressFromBech32(recipient) + if err != nil { + return err + } + rewardStore, exists := k.GetRewardRecord(ctx, addr) + if !exists { + rewardStore = types.NewRewardRecord(recipient, nil) + } + + rewardStore.Rewards = rewardStore.Rewards.Add(sdk.NewCoins(reward)...) + if err := k.SetRewardRecord(ctx, rewardStore); err != nil { + panic(err) + } + + // emit event to inform that the recipientContainer defined by recipientContainerId + // received new reward + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdatedReward{ + RecipientContainerId: recipient, + EarnedReward: reward, + }) + return nil +} + +func (k Keeper) GetNftbackedloanFrontendRewardRate(ctx sdk.Context) sdk.Dec { + params := k.GetParams(ctx) + rewardParams := params.RewardParams + + for _, rewardParam := range rewardParams { + if rewardParam.ModuleName == nftbackedloantypes.ModuleName { + for _, rewardRate := range rewardParam.RewardRate { + if rewardRate.RewardType == types.RewardType_FRONTEND_DEVELOPERS { + return rewardRate.Rate + } + } + } + } + + // if target param wasn't found somehow, return zero dec + return sdk.ZeroDec() +} diff --git a/x/ecosystemincentive/keeper/nftmarket_frontend_service_test.go b/x/ecosystemincentive/keeper/nftbackedloan_frontend_test.go similarity index 53% rename from x/ecosystemincentive/keeper/nftmarket_frontend_service_test.go rename to x/ecosystemincentive/keeper/nftbackedloan_frontend_test.go index 93b1d4b7c..31cd318c8 100644 --- a/x/ecosystemincentive/keeper/nftmarket_frontend_service_test.go +++ b/x/ecosystemincentive/keeper/nftbackedloan_frontend_test.go @@ -9,57 +9,57 @@ import ( "github.com/cometbft/cometbft/crypto/ed25519" "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) func (suite *KeeperTestSuite) TestRecordIncentiveUnitIdWithNftId() { sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) tests := []struct { - testCase string - classId string - nftId string - incentiveUnitId string - subjectAddrs []string - weights []sdk.Dec - registerBefore bool - expectPass bool + testCase string + classId string + nftId string + recipientContainerId string + subjectAddrs []string + weights []sdk.Dec + registerBefore bool + expectPass bool }{ { - testCase: "not registered", - classId: "class1", - nftId: "nft1", - incentiveUnitId: "id1", - subjectAddrs: []string{sender.String()}, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1.0")}, - registerBefore: false, - expectPass: false, + testCase: "not registered", + classId: "class1", + nftId: "nft1", + recipientContainerId: "id1", + subjectAddrs: []string{sender.String()}, + weights: []sdk.Dec{sdk.MustNewDecFromStr("1.0")}, + registerBefore: false, + expectPass: false, }, { - testCase: "registered", - classId: "class2", - nftId: "nft2", - incentiveUnitId: "id2", - subjectAddrs: []string{sender.String()}, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1.0")}, - registerBefore: true, - expectPass: true, + testCase: "registered", + classId: "class2", + nftId: "nft2", + recipientContainerId: "id2", + subjectAddrs: []string{sender.String()}, + weights: []sdk.Dec{sdk.MustNewDecFromStr("1.0")}, + registerBefore: true, + expectPass: true, }, { - testCase: "already recorded", - classId: "class2", - nftId: "nft2", - incentiveUnitId: "id3", - subjectAddrs: []string{sender.String()}, - weights: []sdk.Dec{sdk.MustNewDecFromStr("1.0")}, - registerBefore: true, - expectPass: false, + testCase: "already recorded", + classId: "class2", + nftId: "nft2", + recipientContainerId: "id3", + subjectAddrs: []string{sender.String()}, + weights: []sdk.Dec{sdk.MustNewDecFromStr("1.0")}, + registerBefore: true, + expectPass: false, }, } for _, test := range tests { - nftId := nftmarkettypes.NftIdentifier{ + nftId := nftbackedloantypes.NftId{ ClassId: test.classId, - NftId: test.nftId, + TokenId: test.nftId, } if test.registerBefore { @@ -67,13 +67,13 @@ func (suite *KeeperTestSuite) TestRecordIncentiveUnitIdWithNftId() { suite.ctx, &types.MsgRegister{ Sender: sender.String(), - RecipientContainerId: test.incentiveUnitId, + RecipientContainerId: test.recipientContainerId, Addresses: test.subjectAddrs, Weights: test.weights, }, ) - err := suite.RecordIncentiveUnitIdWithNftIdTest(suite.ctx, nftId, test.incentiveUnitId) + err := suite.RecordIncentiveUnitIdWithNftIdTest(suite.ctx, nftId, test.recipientContainerId) if test.expectPass { suite.Require().NoError(err) @@ -81,7 +81,7 @@ func (suite *KeeperTestSuite) TestRecordIncentiveUnitIdWithNftId() { suite.Require().Error(err) } } else { - err := suite.RecordIncentiveUnitIdWithNftIdTest(suite.ctx, nftId, test.incentiveUnitId) + err := suite.RecordIncentiveUnitIdWithNftIdTest(suite.ctx, nftId, test.recipientContainerId) suite.Require().Error(err) } } @@ -91,27 +91,27 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) tests := []struct { - testCase string - incentiveUnitId string - subjectAddrs []ununifitypes.StringAccAddress - weights []sdk.Dec - fee sdk.Coin - nftId nftmarkettypes.NftIdentifier - rewardAmount math.Int - expect bool - record bool - multipleSubject bool - amplify bool + testCase string + recipientContainerId string + subjectAddrs []string + weights []sdk.Dec + fee sdk.Coin + nftId nftbackedloantypes.NftId + rewardAmount math.Int + expect bool + record bool + multipleSubject bool + amplify bool }{ { - testCase: "not recorded", - incentiveUnitId: "failure", - subjectAddrs: []ununifitypes.StringAccAddress{sender.Bytes()}, - weights: []sdk.Dec{sdk.OneDec()}, - fee: sdk.Coin{}, - nftId: nftmarkettypes.NftIdentifier{ + testCase: "not recorded", + recipientContainerId: "failure", + subjectAddrs: []string{sender.String()}, + weights: []sdk.Dec{sdk.OneDec()}, + fee: sdk.Coin{}, + nftId: nftbackedloantypes.NftId{ ClassId: "class2", - NftId: "nft2", + TokenId: "nft2", }, expect: false, record: false, @@ -119,17 +119,17 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { amplify: false, }, { - testCase: "single success case", - incentiveUnitId: "id1", - subjectAddrs: []ununifitypes.StringAccAddress{sender.Bytes()}, - weights: []sdk.Dec{sdk.OneDec()}, + testCase: "single success case", + recipientContainerId: "id1", + subjectAddrs: []string{sender.String()}, + weights: []sdk.Dec{sdk.OneDec()}, fee: sdk.Coin{ Denom: "uguu", Amount: sdk.NewInt(1000), }, - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class1", - NftId: "nft1", + TokenId: "nft1", }, expect: true, record: true, @@ -137,20 +137,20 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { amplify: false, }, { - testCase: "multiple subject case", - incentiveUnitId: "id2", - subjectAddrs: []ununifitypes.StringAccAddress{ - sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()).Bytes(), - sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()).Bytes(), + testCase: "multiple subject case", + recipientContainerId: "id2", + subjectAddrs: []string{ + sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()).String(), + sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()).String(), }, weights: []sdk.Dec{ sdk.MustNewDecFromStr("0.5"), sdk.MustNewDecFromStr("0.5"), }, fee: sdk.Coin{Denom: "uguu", Amount: math.NewInt(1000)}, - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class2", - NftId: "nft2", + TokenId: "nft2", }, expect: true, record: true, @@ -158,17 +158,17 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { amplify: false, }, { - testCase: "amplify case", - incentiveUnitId: "id1", - subjectAddrs: []ununifitypes.StringAccAddress{sender.Bytes()}, - weights: []sdk.Dec{sdk.OneDec()}, + testCase: "amplify case", + recipientContainerId: "id1", + subjectAddrs: []string{sender.String()}, + weights: []sdk.Dec{sdk.OneDec()}, fee: sdk.Coin{ Denom: "uguu", Amount: sdk.NewInt(1000), }, - nftId: nftmarkettypes.NftIdentifier{ + nftId: nftbackedloantypes.NftId{ ClassId: "class3", - NftId: "nft3", + TokenId: "nft3", }, rewardAmount: math.NewInt(500), expect: true, @@ -182,14 +182,14 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { _, _ = suite.app.EcosystemincentiveKeeper.Register( suite.ctx, &types.MsgRegister{ - Sender: sender.Bytes(), - IncentiveUnitId: test.incentiveUnitId, - SubjectAddrs: test.subjectAddrs, - Weights: test.weights, + Sender: sender.String(), + RecipientContainerId: test.recipientContainerId, + Addresses: test.subjectAddrs, + Weights: test.weights, }) if test.record { - suite.app.EcosystemincentiveKeeper.RecordIncentiveUnitIdWithNftId(suite.ctx, test.nftId, test.incentiveUnitId) + suite.app.EcosystemincentiveKeeper.RecordRecipientContainerIdWithNftId(suite.ctx, test.nftId, test.recipientContainerId) } if test.expect { @@ -197,7 +197,7 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { suite.Require().NoError(err) // check the actual accumalted reward amount - feeRate := suite.app.EcosystemincentiveKeeper.GetNftmarketFrontendRewardRate(suite.ctx) + feeRate := suite.app.EcosystemincentiveKeeper.GetnftbackedloanFrontendRewardRate(suite.ctx) rewardAmount := feeRate.MulInt(test.fee.Amount).RoundInt() if test.multipleSubject { for index := range test.weights { @@ -224,18 +224,18 @@ func (suite *KeeperTestSuite) TestAccumulateRewardForFrontend() { // RecordIncentiveUnitIdWithNftIdTest is a mehtod to have the exact same logic // for being used in test cases to return error as return value // since the normal RecordIncentiveUnitIdWithNftId doesn't return any value by intention -func (suite *KeeperTestSuite) RecordIncentiveUnitIdWithNftIdTest(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier, incentiveUnitId string) error { +func (suite *KeeperTestSuite) RecordIncentiveUnitIdWithNftIdTest(ctx sdk.Context, nftId nftbackedloantypes.NftId, recipientContainerId string) error { // panic if the nftId is already recorded in the store. - if _, exists := suite.app.EcosystemincentiveKeeper.GetIncentiveUnitIdByNftId(ctx, nftId); exists { + if _, exists := suite.app.EcosystemincentiveKeeper.GetRecipientContainerIdByNftId(ctx, nftId); exists { return types.ErrRecordedNftId } - // check incentiveUnitId is already registered - if _, exists := suite.app.EcosystemincentiveKeeper.GetIncentiveUnit(ctx, incentiveUnitId); !exists { - return types.ErrNotRegisteredIncentiveUnitId + // check recipientContainerId is already registered + if _, exists := suite.app.EcosystemincentiveKeeper.GetRecipientContainer(ctx, recipientContainerId); !exists { + return types.ErrNotRegisteredRecipientContainerId } - if err := suite.app.EcosystemincentiveKeeper.SetIncentiveUnitIdByNftId(ctx, nftId, incentiveUnitId); err != nil { + if err := suite.app.EcosystemincentiveKeeper.SetRecipientContainerIdByNftId(ctx, nftId, recipientContainerId); err != nil { return err } @@ -243,32 +243,32 @@ func (suite *KeeperTestSuite) RecordIncentiveUnitIdWithNftIdTest(ctx sdk.Context } // Just mock method to use in only test -func (suite *KeeperTestSuite) AccumulateRewardForFrontendTest(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier, fee sdk.Coin) error { - // get incentiveUnitId by nftId from IncentiveUnitIdByNftId KVStore - incentiveUnitId, exists := suite.app.EcosystemincentiveKeeper.GetIncentiveUnitIdByNftId(ctx, nftId) +func (suite *KeeperTestSuite) AccumulateRewardForFrontendTest(ctx sdk.Context, nftId nftbackedloantypes.NftId, fee sdk.Coin) error { + // get recipientContainerId by nftId from IncentiveUnitIdByNftId KVStore + recipientContainerId, exists := suite.app.EcosystemincentiveKeeper.GetRecipientContainerIdByNftId(ctx, nftId) if !exists { - return types.ErrIncentiveUnitIdByNftIdDoesntExist + return types.ErrRegisteredIncentiveId } - incentiveUnit, exists := suite.app.EcosystemincentiveKeeper.GetIncentiveUnit(ctx, incentiveUnitId) + incentiveUnit, exists := suite.app.EcosystemincentiveKeeper.GetRecipientContainer(ctx, recipientContainerId) if !exists { - return types.ErrNotRegisteredIncentiveUnitId + return types.ErrNotRegisteredRecipientContainerId } - nftmarketFrontendRewardRate := suite.app.EcosystemincentiveKeeper.GetNftmarketFrontendRewardRate(ctx) + nftbackedloanFrontendRewardRate := suite.app.EcosystemincentiveKeeper.GetnftbackedloanFrontendRewardRate(ctx) // if the reward rate was not found, emit panic - if nftmarketFrontendRewardRate == sdk.ZeroDec() { + if nftbackedloanFrontendRewardRate == sdk.ZeroDec() { return types.ErrRewardRateNotFound } // rewardAmountForAll = fee * rewardRate - rewardAmountForAll := nftmarketFrontendRewardRate.MulInt(fee.Amount).RoundInt() + rewardAmountForAll := nftbackedloanFrontendRewardRate.MulInt(fee.Amount).RoundInt() - for _, subjectInfo := range incentiveUnit.SubjectInfoLists { - rewardStore, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(ctx, subjectInfo.SubjectAddr.AccAddress()) + for _, subjectInfo := range incentiveUnit.WeightedAddresses { + rewardStore, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(ctx, sdk.AccAddress(subjectInfo.Address)) if !exists { - rewardStore = types.NewRewardStore(subjectInfo.SubjectAddr, nil) + rewardStore = types.NewRewardStore(subjectInfo.Address, nil) } weight := subjectInfo.Weight diff --git a/x/ecosystemincentive/keeper/nftmarket_frontend_service.go b/x/ecosystemincentive/keeper/nftmarket_frontend_service.go deleted file mode 100644 index 784f19b59..000000000 --- a/x/ecosystemincentive/keeper/nftmarket_frontend_service.go +++ /dev/null @@ -1,171 +0,0 @@ -// The implementations especially for the services about the Nftmarket Frontend reward. -// The reason why it's separated is for achieving the explicity and extensibility of this module. - -package keeper - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" -) - -// RecordIncentiveIdWithNftId is for recording recipientContainerId with nftId -// to know of the receriver of the incentive reward for the frontend creator -// of Nftmarket in AfterNftPaymentWithCommission method. -func (k Keeper) RecordRecipientContainerIdWithNftId(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier, recipientContainerId string) { - // panic if the nftId is already recorded in the store. - if _, exists := k.GetRecipientContainerIdByNftId(ctx, nftId); exists { - panic(sdkerrors.Wrap(types.ErrRecordedNftId, nftId.String())) - } - - // check recipientContainerId is already registered - if _, exists := k.GetRecipientContainer(ctx, recipientContainerId); !exists { - k.Logger(ctx).Error(types.ErrNotRegisteredRecipientContainerId.Error()) - - // emit event to inform that recording nftid failed because the recipientContainerId is not registered yet. - _ = ctx.EventManager().EmitTypedEvent(&types.EventNotRegisteredRecipientContainerId{ - RecipientContainerId: recipientContainerId, - ClassId: nftId.ClassId, - NftId: nftId.NftId, - }) - return - } - - if err := k.SetRecipientContainerIdByNftId(ctx, nftId, recipientContainerId); err != nil { - panic(err) - } - - // emit event to tell it succeeded. - _ = ctx.EventManager().EmitTypedEvent(&types.EventRecordedRecipientContainerId{ - RecipientContainerId: recipientContainerId, - ClassId: nftId.ClassId, - NftId: nftId.NftId, - }) -} - -// DeleteFrontendRecord is called in case to clean the record related for frontend incentive -func (k Keeper) DeleteFrontendRecord(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier) { - // If the passed NftId doesn't exist in the KVStore, emit the error message - // but not panic and just return - recipientContainerId, exists := k.GetRecipientContainerIdByNftId(ctx, nftId) - if !exists { - _ = fmt.Errorf(sdkerrors.Wrap(types.ErrRecipientContainerIdByNftIdDoesntExist, nftId.String()).Error()) - return - } - - k.DeleteRecipientContainerIdByNftId(ctx, nftId) - - // emit event for telling the nftId is deleted from the KVStore - _ = ctx.EventManager().EmitTypedEvent(&types.EventDeletedNftIdRecordedForFrontendReward{ - RecipientContainerId: recipientContainerId, - ClassId: nftId.ClassId, - NftId: nftId.NftId, - }) -} - -func (k Keeper) SetRecipientContainerIdByNftId(ctx sdk.Context, nftIdByte nftmarkettypes.NftIdentifier, recipientContainerId string) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdByNftId)) - prefixStore.Set(nftIdByte.IdBytes(), []byte(recipientContainerId)) - - return nil -} - -func (k Keeper) GetRecipientContainerIdByNftId(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier) (string, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdByNftId)) - - bz := prefixStore.Get(nftId.IdBytes()) - if bz == nil { - return "", false - } - - return string(bz), true -} - -// DeleteRecipientContainerIdByNftId deletes nftId and recipientContainerId from RecipientContainerIdByNftId KVStore to clean the record. -func (k Keeper) DeleteRecipientContainerIdByNftId(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier) { - // Delete incentive unit id by nft id - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRecipientContainerIdByNftId)) - - prefixStore.Delete(nftId.IdBytes()) -} - -// AccumulateReward is called in AfterNftPaymentWithCommission hook method -// This method updates the reward information for the subject who is associated with the nftId -func (k Keeper) AccumulateRewardForFrontend(ctx sdk.Context, recipientContainerId string, reward sdk.Coin) error { - recipientContainer, _ := k.GetRecipientContainer(ctx, recipientContainerId) - - // rewardAmountForAll = fee * rewardRate - rewardsForEach := CalculateRewardsForEachSubject( - extractWeightsFromSliceOfSubjectInfo(recipientContainer.WeightedAddresses), - reward, - ) - - for i, subjectInfo := range recipientContainer.WeightedAddresses { - rewardStore, exists := k.GetRewardStore(ctx, sdk.MustAccAddressFromBech32(subjectInfo.Address)) - if !exists { - rewardStore = types.NewRewardStore(subjectInfo.Address, nil) - } - - rewardStore.Rewards = rewardStore.Rewards.Add(sdk.NewCoins(rewardsForEach[i])...) - if err := k.SetRewardStore(ctx, rewardStore); err != nil { - panic(err) - } - } - - // emit event to inform that the recipientContainer defined by recipientContainerId - // received new reward - _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdatedReward{ - RecipientContainerId: recipientContainerId, - EarnedReward: reward, - }) - return nil -} - -// calculate actual reward to distribute for the subject addr by considering -// its weight defined in IncentivenUnit -// newRewardAmount = weight * rewardAmountForAll -func CalculateRewardsForEachSubject(weights []sdk.Dec, reward sdk.Coin) []sdk.Coin { - var rewardsForEach []sdk.Coin - - for _, weight := range weights { - newRewardAmount := weight.MulInt(reward.Amount).TruncateInt() - rewardCoin := sdk.NewCoin(reward.Denom, newRewardAmount) - rewardsForEach = append(rewardsForEach, rewardCoin) - } - - return rewardsForEach -} - -func extractWeightsFromSliceOfSubjectInfo(subjectsInfo []types.WeightedAddress) []sdk.Dec { - var weights []sdk.Dec - for _, subject := range subjectsInfo { - weights = append(weights, subject.Weight) - } - return weights -} - -func (k Keeper) GetNftmarketFrontendRewardRate(ctx sdk.Context) sdk.Dec { - params := k.GetParams(ctx) - rewardParams := params.RewardParams - - for _, rewardParam := range rewardParams { - if rewardParam.ModuleName == nftmarkettypes.ModuleName { - for _, rewardRate := range rewardParam.RewardRate { - if rewardRate.RewardType == types.RewardType_FRONTEND_DEVELOPERS { - return rewardRate.Rate - } - } - } - } - - // if target param wasn't found somehow, return zero dec - return sdk.ZeroDec() -} diff --git a/x/ecosystemincentive/keeper/params_test.go b/x/ecosystemincentive/keeper/params_test.go index 2268533c1..8d236ee6d 100644 --- a/x/ecosystemincentive/keeper/params_test.go +++ b/x/ecosystemincentive/keeper/params_test.go @@ -25,10 +25,10 @@ func (suite *KeeperTestSuite) TestParams() { input: types.Params{ RewardParams: []*types.RewardParams{ { - ModuleName: "nftmarket", + ModuleName: "nftbackedloan", RewardRate: []types.RewardRate{ { - RewardType: types.RewardType_NFTMARKET_FRONTEND, + RewardType: types.RewardType_FRONTEND_DEVELOPERS, Rate: sdk.MustNewDecFromStr("-0.5"), }, }, @@ -42,10 +42,10 @@ func (suite *KeeperTestSuite) TestParams() { input: types.Params{ RewardParams: []*types.RewardParams{ { - ModuleName: "nftmarket", + ModuleName: "nftbackedloan", RewardRate: []types.RewardRate{ { - RewardType: types.RewardType_NFTMARKET_FRONTEND, + RewardType: types.RewardType_FRONTEND_DEVELOPERS, Rate: sdk.MustNewDecFromStr("10"), }, }, diff --git a/x/ecosystemincentive/keeper/reward_service.go b/x/ecosystemincentive/keeper/reward_service.go index eb30f9b12..0dfc14eb7 100644 --- a/x/ecosystemincentive/keeper/reward_service.go +++ b/x/ecosystemincentive/keeper/reward_service.go @@ -1,64 +1,80 @@ package keeper import ( - "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (k Keeper) RewardDistributionOfNftmarket(ctx sdk.Context, nftId nftmarkettypes.NftIdentifier, fee sdk.Coin) error { +func (k Keeper) RewardDistributionOfnftbackedloan(ctx sdk.Context, nftId nftbackedloantypes.NftId, fee sdk.Coin) error { totalReward := sdk.ZeroInt() + rewardForCommunityPool := sdk.ZeroInt() // First, get recipientContainerId by nftId from RecipientContainerIdByNftId KVStore // If the recipientContainerId doesn't exist, return nil and distribute the reward for the frontend // to the treasury. - recipientContainerId, exists := k.GetRecipientContainerIdByNftId(ctx, nftId) + nftbackedloanFrontendRewardRate := k.GetNftbackedloanFrontendRewardRate(ctx) + if nftbackedloanFrontendRewardRate == sdk.ZeroDec() { + return sdkerrors.Wrap(types.ErrRewardRateIsZero, "nftbackedloan frontend") + } + rewardForRecipientContainer := nftbackedloanFrontendRewardRate.MulInt(fee.Amount).TruncateInt() + totalReward = totalReward.Add(rewardForRecipientContainer) + recipientContainerId, exists := k.GetRecipientByNftId(ctx, nftId) if !exists { // emit event to inform the nftId is not associated with recipientContainerId and return _ = ctx.EventManager().EmitTypedEvent(&types.EventNotRecordedNftId{ ClassId: nftId.ClassId, - NftId: nftId.NftId, + TokenId: nftId.TokenId, }) - // TODO: impl the logic to distribute the reward for the frontend to the treasury + // Distribute the reward to the community pool if there's no recipientContainerId associated with the nftId + rewardForCommunityPool = rewardForCommunityPool.Add(rewardForRecipientContainer) } else { - nftmarketFrontendRewardRate := k.GetNftmarketFrontendRewardRate(ctx) - // if the reward rate was not found or set as zero, just return - if nftmarketFrontendRewardRate == sdk.ZeroDec() { - err := fmt.Errorf(sdkerrors.Wrap(types.ErrRewardRateNotFound, "nftmarket frontend").Error()) - return err - } - rewardForRecipientContainer := nftmarketFrontendRewardRate.MulInt(fee.Amount).TruncateInt() - totalReward = totalReward.Add(rewardForRecipientContainer) - - // Distribute the reward to the incentive unit - if err := k.AccumulateRewardForFrontend(ctx, recipientContainerId, sdk.NewCoin(fee.Denom, rewardForRecipientContainer)); err != nil { - return err - } + rewardForRecipientContainer = sdk.ZeroInt() } stakersRewardRate := k.GetStakersRewardRate(ctx) // if the reward rate was not found or set as zero, just return if stakersRewardRate == sdk.ZeroDec() { - err := fmt.Errorf(sdkerrors.Wrap(types.ErrRewardRateNotFound, "stakers").Error()) - return err + return sdkerrors.Wrap(types.ErrRewardRateNotFound, "stakers") } - rewardForStakers := stakersRewardRate.MulInt(fee.Amount).TruncateInt() totalReward = totalReward.Add(rewardForStakers) + communityPoolRate := k.GetCommunityPoolRewardRate(ctx) + if communityPoolRate == sdk.ZeroDec() { + return sdkerrors.Wrap(types.ErrRewardRateIsZero, communityPoolRate.String()) + } + rewardForCommunityPool = rewardForCommunityPool.Add(communityPoolRate.MulInt(fee.Amount).TruncateInt()) + totalReward = totalReward.Add(rewardForCommunityPool) + + // TODO: we need better panic handling // Emit panic if the reward for incentive unit exceeds the fee amount if totalReward.GT(fee.Amount) { panic(types.ErrRewardExceedsFee) } - // Distribute the reward to the stakers - if err := k.AllocateTokensToStakers(ctx, sdk.NewCoin(fee.Denom, rewardForStakers)); err != nil { - return err + // Distribute the reward to the recipients if the reward exists + if !rewardForRecipientContainer.IsZero() { + if err := k.AccumulateRewardForFrontend(ctx, recipientContainerId, sdk.NewCoin(fee.Denom, rewardForRecipientContainer)); err != nil { + return err + } + } + + // Distribute the reward to the stakers if the reward exists + if !rewardForStakers.IsZero() { + if err := k.AllocateTokensToStakers(ctx, sdk.NewCoin(fee.Denom, rewardForStakers)); err != nil { + return err + } + } + + // Distribute the reward to the community pool if the reward exists + if !rewardForCommunityPool.IsZero() { + if err := k.AllocateTokensToCommunityPool(ctx, sdk.NewCoin(fee.Denom, rewardForCommunityPool)); err != nil { + return err + } } return nil @@ -67,7 +83,7 @@ func (k Keeper) RewardDistributionOfNftmarket(ctx sdk.Context, nftId nftmarketty // WithdrawReward is called to execute the actuall operation for MsgWithdrawReward func (k Keeper) WithdrawReward(ctx sdk.Context, msg *types.MsgWithdrawReward) (sdk.Coin, error) { senderAccAddr := sdk.MustAccAddressFromBech32(msg.Sender) - reward, exists := k.GetRewardStore(ctx, senderAccAddr) + reward, exists := k.GetRewardRecord(ctx, senderAccAddr) if !(exists) { return sdk.Coin{}, sdkerrors.Wrap(types.ErrRewardNotExists, msg.Sender) } @@ -93,12 +109,12 @@ func (k Keeper) WithdrawReward(ctx sdk.Context, msg *types.MsgWithdrawReward) (s } // If the reward for at least one denom remains, just reset - // the RewardStore data for the subject. + // the RewardRecord data for the subject. // Otherwise, delete the data by key if reward.Rewards.Empty() { - k.DeleteRewardStore(ctx, sdk.MustAccAddressFromBech32(reward.Address)) + k.DeleteRewardRecord(ctx, sdk.MustAccAddressFromBech32(reward.Address)) } else { - if err := k.SetRewardStore(ctx, reward); err != nil { + if err := k.SetRewardRecord(ctx, reward); err != nil { return sdk.Coin{}, err } } @@ -110,7 +126,7 @@ func (k Keeper) WithdrawReward(ctx sdk.Context, msg *types.MsgWithdrawReward) (s // After sending the all accumulated rewards, delete types.Reward data from KVStore for the subject func (k Keeper) WithdrawAllRewards(ctx sdk.Context, msg *types.MsgWithdrawAllRewards) (sdk.Coins, error) { senderAccAddr := sdk.MustAccAddressFromBech32(msg.Sender) - reward, exists := k.GetRewardStore(ctx, senderAccAddr) + reward, exists := k.GetRewardRecord(ctx, senderAccAddr) if !(exists) { return sdk.Coins{}, sdkerrors.Wrap(types.ErrRewardNotExists, msg.Sender) } @@ -123,55 +139,55 @@ func (k Keeper) WithdrawAllRewards(ctx sdk.Context, msg *types.MsgWithdrawAllRew } // delete types.Reward data from KVStore since it became none - k.DeleteRewardStore(ctx, senderAccAddr) + k.DeleteRewardRecord(ctx, senderAccAddr) return reward.Rewards, nil } -func (k Keeper) SetRewardStore(ctx sdk.Context, rewardStore types.RewardStore) error { - bz, err := k.cdc.Marshal(&rewardStore) +func (k Keeper) SetRewardRecord(ctx sdk.Context, RewardRecord types.RewardRecord) error { + bz, err := k.cdc.Marshal(&RewardRecord) if err != nil { return err } store := ctx.KVStore(k.storeKey) prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRewardStore)) - addressKeyBytes := sdk.MustAccAddressFromBech32(rewardStore.Address).Bytes() + addressKeyBytes := sdk.MustAccAddressFromBech32(RewardRecord.Address).Bytes() prefixStore.Set(addressKeyBytes, bz) return nil } -func (k Keeper) GetRewardStore(ctx sdk.Context, subject sdk.AccAddress) (types.RewardStore, bool) { +func (k Keeper) GetRewardRecord(ctx sdk.Context, subject sdk.AccAddress) (types.RewardRecord, bool) { store := ctx.KVStore(k.storeKey) prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRewardStore)) bz := prefixStore.Get(subject) if bz == nil { - return types.RewardStore{}, false + return types.RewardRecord{}, false } - var reward types.RewardStore + var reward types.RewardRecord k.cdc.MustUnmarshal(bz, &reward) return reward, true } -func (k Keeper) GetAllRewardStores(ctx sdk.Context) []types.RewardStore { +func (k Keeper) GetAllRewardRecords(ctx sdk.Context) []types.RewardRecord { store := ctx.KVStore(k.storeKey) it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixRewardStore)) defer it.Close() - allRewardStores := []types.RewardStore{} + allRewardRecords := []types.RewardRecord{} for ; it.Valid(); it.Next() { - var rewardStore types.RewardStore - k.cdc.MustUnmarshal(it.Value(), &rewardStore) + var RewardRecord types.RewardRecord + k.cdc.MustUnmarshal(it.Value(), &RewardRecord) - allRewardStores = append(allRewardStores, rewardStore) + allRewardRecords = append(allRewardRecords, RewardRecord) } - return allRewardStores + return allRewardRecords } -func (k Keeper) DeleteRewardStore(ctx sdk.Context, subject sdk.AccAddress) { +func (k Keeper) DeleteRewardRecord(ctx sdk.Context, subject sdk.AccAddress) { store := ctx.KVStore(k.storeKey) prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixRewardStore)) diff --git a/x/ecosystemincentive/keeper/reward_service_test.go b/x/ecosystemincentive/keeper/reward_service_test.go index 2b4734ccc..b1e0f36f4 100644 --- a/x/ecosystemincentive/keeper/reward_service_test.go +++ b/x/ecosystemincentive/keeper/reward_service_test.go @@ -6,21 +6,32 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (suite *KeeperTestSuite) TestRewardDistributionOfNftmarket() { +func (suite *KeeperTestSuite) TestRewardDistributionOfnftbackedloan() { testCases := []struct { testCase string - nftId nftmarkettypes.NftIdentifier + nftId nftbackedloantypes.NftId reward sdk.Coin validDenom bool success bool + // use default reward rates for the calculation of each reward + expRewardFornftbackedloanFrontend sdk.Coin + expRewardForStakers sdk.Coin + expRewardForCommunityPool sdk.Coin }{ { testCase: "success case", - nftId: nftmarkettypes.NftIdentifier{ClassId: "test1", NftId: "test1"}, - reward: sdk.NewCoin("uguu", sdk.NewInt(10)), + nftId: nftbackedloantypes.NftId{ClassId: "test1", TokenId: "test1"}, + reward: sdk.NewCoin("uguu", sdk.NewInt(100)), + validDenom: true, + success: true, + }, + { + testCase: "too small amount of reward to not distribute reward", + nftId: nftbackedloantypes.NftId{ClassId: "test2", TokenId: "test2"}, + reward: sdk.NewCoin("uguu", sdk.NewInt(1)), validDenom: true, success: true, }, @@ -31,13 +42,15 @@ func (suite *KeeperTestSuite) TestRewardDistributionOfNftmarket() { _ = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{tc.reward}) if tc.success { - err := suite.app.EcosystemincentiveKeeper.RewardDistributionOfNftmarket(suite.ctx, tc.nftId, tc.reward) + err := suite.app.EcosystemincentiveKeeper.RewardDistributionOfnftbackedloan(suite.ctx, tc.nftId, tc.reward) suite.Require().NoError(err) - // reward := suite.app.BankKeeper.GetBalance(suite.ctx, suite.app.EcosystemincentiveKeeper.GetNftMarketAddress(suite.ctx), tc.reward.Denom) + // TODO: check the reward distribution by seeing the balance of the approriate accounts + + // reward := suite.app.BankKeeper.GetBalance(suite.ctx, suite.app.EcosystemincentiveKeeper.GetnftbackedloanAddress(suite.ctx), tc.reward.Denom) // suite.Require().Equal(tc.reward, reward) } else { - err := suite.app.EcosystemincentiveKeeper.RewardDistributionOfNftmarket(suite.ctx, tc.nftId, tc.reward) + err := suite.app.EcosystemincentiveKeeper.RewardDistributionOfnftbackedloan(suite.ctx, tc.nftId, tc.reward) suite.Require().Error(err) } } @@ -83,7 +96,7 @@ func (suite *KeeperTestSuite) TestWithdrawReward() { _ = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{tc.reward}) if tc.success { - err := suite.app.EcosystemincentiveKeeper.SetRewardStore(suite.ctx, types.RewardStore{ + err := suite.app.EcosystemincentiveKeeper.SetRewardRecord(suite.ctx, types.RewardRecord{ Address: tc.withdrawer.String(), Rewards: sdk.NewCoins(tc.reward), }) @@ -96,7 +109,7 @@ func (suite *KeeperTestSuite) TestWithdrawReward() { suite.Require().NoError(err) suite.Require().Equal(withdrewReward, tc.reward) - _, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(suite.ctx, tc.withdrawer.String()) + _, exists := suite.app.EcosystemincentiveKeeper.GetRewardRecord(suite.ctx, tc.withdrawer) suite.Require().False(exists) } else if !tc.rewardExist { _, err := suite.app.EcosystemincentiveKeeper.WithdrawReward(suite.ctx, &types.MsgWithdrawReward{ @@ -106,10 +119,10 @@ func (suite *KeeperTestSuite) TestWithdrawReward() { suite.Require().Error(err) suite.Require().EqualError(err, sdkerrors.Wrap(types.ErrRewardNotExists, tc.withdrawer.String()).Error()) - _, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(suite.ctx, tc.withdrawer.String()) + _, exists := suite.app.EcosystemincentiveKeeper.GetRewardRecord(suite.ctx, tc.withdrawer) suite.Require().False(exists) } else if !tc.validDenom { - err := suite.app.EcosystemincentiveKeeper.SetRewardStore(suite.ctx, types.RewardStore{ + err := suite.app.EcosystemincentiveKeeper.SetRewardRecord(suite.ctx, types.RewardRecord{ Address: tc.withdrawer.String(), Rewards: sdk.NewCoins(tc.reward), }) @@ -122,13 +135,13 @@ func (suite *KeeperTestSuite) TestWithdrawReward() { suite.Require().Error(err) suite.Require().EqualError(err, sdkerrors.Wrap(types.ErrDenomRewardNotExists, "invalid").Error()) - rewardStore, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(suite.ctx, tc.withdrawer.String()) + RewardRecord, exists := suite.app.EcosystemincentiveKeeper.GetRewardRecord(suite.ctx, tc.withdrawer) suite.Require().True(exists) - rightRewardStore := types.RewardStore{ + rightRewardRecord := types.RewardRecord{ Address: tc.withdrawer.String(), Rewards: sdk.NewCoins(tc.reward), } - suite.Require().Equal(rewardStore, rightRewardStore) + suite.Require().Equal(RewardRecord, rightRewardRecord) } } } @@ -165,7 +178,7 @@ func (suite *KeeperTestSuite) TestWithdrawAllRewards() { _ = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, tc.rewards) if tc.success { - err := suite.app.EcosystemincentiveKeeper.SetRewardStore(suite.ctx, types.RewardStore{ + err := suite.app.EcosystemincentiveKeeper.SetRewardRecord(suite.ctx, types.RewardRecord{ Address: tc.withdrawer.String(), Rewards: tc.rewards, }) @@ -177,7 +190,7 @@ func (suite *KeeperTestSuite) TestWithdrawAllRewards() { suite.Require().NoError(err) suite.Require().Equal(withdrewRewards, tc.rewards) - _, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(suite.ctx, tc.withdrawer.String()) + _, exists := suite.app.EcosystemincentiveKeeper.GetRewardRecord(suite.ctx, tc.withdrawer) suite.Require().False(exists) } else { _, err := suite.app.EcosystemincentiveKeeper.WithdrawAllRewards(suite.ctx, &types.MsgWithdrawAllRewards{ @@ -186,7 +199,7 @@ func (suite *KeeperTestSuite) TestWithdrawAllRewards() { suite.Require().Error(err) suite.Require().EqualError(err, sdkerrors.Wrap(types.ErrRewardNotExists, tc.withdrawer.String()).Error()) - _, exists := suite.app.EcosystemincentiveKeeper.GetRewardStore(suite.ctx, tc.withdrawer.String()) + _, exists := suite.app.EcosystemincentiveKeeper.GetRewardRecord(suite.ctx, tc.withdrawer) suite.Require().False(exists) } } diff --git a/x/ecosystemincentive/keeper/stakers_distribution.go b/x/ecosystemincentive/keeper/stakers_distribution.go index b33c12be5..056590b96 100644 --- a/x/ecosystemincentive/keeper/stakers_distribution.go +++ b/x/ecosystemincentive/keeper/stakers_distribution.go @@ -5,10 +5,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/ecosystemincentive/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -// AllocateTokens performs reward and fee distribution to all validators based +// AllocateTokensToStakers performs reward and fee distribution to all validators based // on the F1 fee distribution specification. func (k Keeper) AllocateTokensToStakers(ctx sdk.Context, rewardAmount sdk.Coin) error { // transfer collected fees to the fee_collector module account eventually for the distribution module account @@ -33,7 +33,7 @@ func (k Keeper) GetStakersRewardRate(ctx sdk.Context) sdk.Dec { rewardParams := params.RewardParams for _, rewardParam := range rewardParams { - if rewardParam.ModuleName == nftmarkettypes.ModuleName { + if rewardParam.ModuleName == nftbackedloantypes.ModuleName { for _, rewardRate := range rewardParam.RewardRate { if rewardRate.RewardType == types.RewardType_STAKERS { return rewardRate.Rate diff --git a/x/ecosystemincentive/keeper/stakers_distribution_test.go b/x/ecosystemincentive/keeper/stakers_distribution_test.go index 938628773..ffe273546 100644 --- a/x/ecosystemincentive/keeper/stakers_distribution_test.go +++ b/x/ecosystemincentive/keeper/stakers_distribution_test.go @@ -36,9 +36,9 @@ func (suite *KeeperTestSuite) TestAllocateTokensToStakers() { reward := suite.app.BankKeeper.GetBalance(suite.ctx, feeCollector, tc.rewardAmount.Denom) suite.Require().NoError(err) suite.Require().Equal(tc.expReward, reward) - } else { - err := suite.app.EcosystemincentiveKeeper.AllocateTokensToStakers(suite.ctx, tc.rewardAmount) - suite.Require().Error(err) - } + } // else { + // err := suite.app.EcosystemincentiveKeeper.AllocateTokensToStakers(suite.ctx, tc.rewardAmount) + // suite.Require().Error(err) + // } } } diff --git a/x/ecosystemincentive/spec/01_concepts.md b/x/ecosystemincentive/spec/01_concepts.md deleted file mode 100644 index 44db6b1fe..000000000 --- a/x/ecosystemincentive/spec/01_concepts.md +++ /dev/null @@ -1,28 +0,0 @@ -# Concepts - -**NOTE: This is early draft.** - -This module aims to provide the incentive for the parties which especially bring value to our ecosystem like frontend service creator. -Fucosing on the case for the frontend service creator, any of them who creates UnUniFi NFT market and NFTFi frontend service are the subjects to recieve Ecosystem Incentive reward from the NFT trading fee in many denoms which are used in NFT market. - -## Joining Ecosystem Incentive - -Any subjects can send a register message `MsgIncentiveRegister` with the `incentive_id` and `subject_weight_map`. - -## Getting Ecosystem Incentive Reward - -This model of distribution reward could be applied to many use-cases. But, we write down only about the case for Nftmarket Frontend model here for better explanation of the sense of this module. -First, the subjects must register to get incentive by sending `MsgIncentiveRegister`. -Once the `incentive_id` is registered, they insert that `incentive_id` in the target message which is `MsgListNft` memo field precisely to get the reward for the Nftmarket Frontend incentive mode. -Once the `NftIdentifer` on the market is connected with `incentive_id`, `AfterNftPaymentWithCommission` hook function triggers methods to reflect the reward amount for according addresses in `incentive_id`. - -## Withdrawing Ecosystem Incentive Reward - -Any registered subjects can withdraw thier reward by sending a withdrawal message if they are there. -They can withdraw all rewards across all denoms by sending `MsgWithdrawAllRewards`. -In other way, they can withdraw specific denom reward by sending `MsgWithdrawSpecificDenomReward`. - -## The Reward Mechanism - -All the reward comes from the fees that UnUniFi protocol earned without gas fee which is defined in protocol as glocal parameter. -There is nothing inflational effect or depletion by rewarding subjects. diff --git a/x/ecosystemincentive/spec/02_state.md b/x/ecosystemincentive/spec/02_state.md deleted file mode 100644 index a2e09c33f..000000000 --- a/x/ecosystemincentive/spec/02_state.md +++ /dev/null @@ -1,139 +0,0 @@ -# State - -**NOTE: This is early draft.** - -## IncentiveUnit - -```protobuf -message IncentiveUnit { - string id = 1 [ - (gogoproto.moretags) = "yaml:\"id\"" - ]; - repeated SubjectInfo subject_info_list = 2 [ - (gogoproto.moretags) = "yaml:\"subject_info_lists\"", - (gogoproto.nullable) = false - ]; -} - -message SubjectInfo { - string address = 1 [ - (gogoproto.moretags) = "yaml:\"subject_addr\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string weight = 2 [ - (gogoproto.moretags) = "yaml:\"weight\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} -``` - -- Incentive: `"incentive_id" -> format(IncentiveStore)` - -### incentive_id - -`incentive_id` is the unique identifier in the `incentive_store` for the subjects. Hence, it can't be duplicated. - -## SubjectInfo - -### weight - -The ratio of the reward distribution in a `incentive_store` unit. -`incentive_store` can contain several `subject`s and ratio for each. - - -## NftmarketFrontendIncentiveIdTable - -- nftmarket_frontend_incentive_id_table: `format(nft_id) -> format(incentive_id)` - -This KVStore manages what NFT is connected to which `incentive_id`. - -## RewardTable - -RewardTable is the record of the rewards for the subject of the `ecosystem-incentive`. - -```protobuf -message Reward { - string subject_addr = 1 [ - (gogoproto.moretags) = "yaml:\"subject_addr\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated cosmos.base.v1beta1.Coin rewards = 2 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "yaml:\"rewards\"", - (gogoproto.nullable) = false - ]; -} -``` - -- RewardTable: `format(address) -> format(reward)` - -## Params - -```protobuf -message Params { - repeated RewardParams reward_params = 1 [ (gogoproto.moretags) = "yaml:\"reward_params\"" ]; - uint64 max_incentive_unit_id_len = 2 [ (gogoproto.moretags) = "yaml:\"max_incentive_unit_id_len\"" ]; - uint64 max_subject_info_num_in_unit = 3 [ (gogoproto.moretags) = "yaml:\"max_subject_info_num_in_unit\"" ]; -} - -message RewardParams { - string module_name = 1 [(gogoproto.nullable) = false]; - repeated IncentiveUnit incentive_units = 2 [(gogoproto.nullable) = false]; - repeated RewardStore reward_stores = 3 [(gogoproto.nullable) = false]; - repeated IncentiveUnitIdsByAddr incentive_unit_ids_by_addr = 4 [(gogoproto.nullable) = false]; -} - -// RewardRate defines the ratio to take reward for a specific reward_type. -// The total sum of reward_rate in a module cannot be exceed 1 -message RewardRate { - RewardType reward_type = 1 [ (gogoproto.moretags) = "yaml:\"reward_type\"" ]; - string rate = 2 [ - (gogoproto.moretags) = "yaml:\"rate\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -// At first, we go with this one type. -// NFTMARKET_FRONTEND type reward will be disributed for the creators of frontend of UnUniFi's services. -enum RewardType { - NFTMARKET_FRONTEND = 0; -} -``` - -`Params` contains `RewardParams` as the configuration of this module parameters and `MaxIncentiveUnitIdLen` as to define the max length of the IncentiveUnitId. - -### RewardRate - -The factor to multipy the trading fee for the reward of this module. -e.g. If `reward_rate` is 80% and the trading fee that is made in a target message is 100GUU, the actual reward for target `incentive_id` subjects is `100GUU * 0.80 = 80GUU`. - -### RewardType - -The reward type manages the types of the reward for the various subject. -At first, we support frontend creator. But, the reward will be able to distributed for the different type of parties in our ecosystem. - -### MaxIncentiveUnitIdLen - -The length of `IncentiveUnitId` must be between `MaxIncentiveUnitIdLen` and 0. - -## IncentiveUnitIdsByAddr - -IncentiveUnitIdsByAddr is the collection of the incentive unit ids for each address. - -```protobuf -message IncentiveUnitIdsByAddr { - string address = 1 [ - (gogoproto.moretags) = "yaml:\"address\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated string incentive_unit_ids = 2 [ - (gogoproto.moretags) = "yaml:\"incentive_unit_ids\"", - (gogoproto.nullable) = false - ]; -} -``` diff --git a/x/ecosystemincentive/spec/03_msgs_and_queries.md b/x/ecosystemincentive/spec/03_msgs_and_queries.md deleted file mode 100644 index 3368ca837..000000000 --- a/x/ecosystemincentive/spec/03_msgs_and_queries.md +++ /dev/null @@ -1,165 +0,0 @@ -# Messages and Queries - -**NOTE: This is early draft.** - -## Messages - -All messages of `ecosystem-incentive`. - -### Register - -A message to register `incentive_unit` to take reward from `ecosystem-incentive`. - -```protobuf -message MsgRegister { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string incentive_unit_id = 2 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; - repeated string subject_addrs = 3 [ - (gogoproto.moretags) = "yaml:\"subject_addrs\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated string weights = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.moretags) = "yaml:\"weights\"", - (gogoproto.nullable) = false - ]; -} -message MsgRegisterResponse {} -``` - -`weights` must be `1.000000000000000000` (just ok as long as it represent 1). -For example, -ok: [0.5, 0.5], [0.33, 0.33, 0.34] -not: [0.5, 0.1], [0.33, 0.33, 0.3333] - -And more importantly, don't forget how one `subject_addr` is associated with one `weight`. It's just order for those two lists. For example, in this case -```shell -subject_addrs = [ -"ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl", -"ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux" -] -weights = [ -"0.6", -"0.4 -] -``` - -`ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl`'s `weight` will be `0.6` and `ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux`'s will be `0.4`. - -#### CLI - -We receive a JSON file in CLI command for this message. -Example JSON file for CLI tx command: - -```Json -{ - "incentive_id": "incentive-unit1", - "subject_addrs": [ - "ununifi17gs6kgph4657epky2ctl9sf66ucyua939nexgl", - "ununifi1w9s3wpkh0kfk0t40m4lwjsx6h2v6gktsvfrgux" - ], - "weights": [ - "0.50", - "0.50" - ] -} -``` - -### WithdrawAllRewards - -A message to withdraw all accumulated rewards across all denoms. - -```protobuf -message MsgWithdrawAllRewards { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -``` - -### WithdrawReward - -A message to withdraw accumulated reward of specified denom. - -```protobuf -message MsgWithdrawReward { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; -} -``` - -## Queries - -All queries of `ecosystem-incentive`. - -### IncentiveUnit - -```protobuf -message QueryIncentiveUnitRequest { - string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; -} - -message QueryIncentiveUnitResponse { - IncentiveUnit incentive_unit = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit\"" ]; -} -``` - -### AllRewards - -```protobuf -message QueryAllRewardsRequest { - string subject_addr = 1 [ (gogoproto.moretags) = "yaml:\"subject_addr\"" ]; -} - -message QueryAllRewardsResponse { - Reward rewards = 1 [ - (gogoproto.moretags) = "yaml:\"rewards\"", - (gogoproto.nullable) = false - ]; -} -``` - -### SpecificDenomReward - -```protobuf -message QueryRewardRequest { - string subject_addr = 1 [ (gogoproto.moretags) = "yaml:\"subject_addr\"" ]; - string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; -} - -message QueryRewardResponse { - cosmos.base.v1beta1.Coin reward = 1 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", - (gogoproto.moretags) = "yaml:\"reward\"", - (gogoproto.nullable) = false - ]; -} -``` - -### IncentiveUnitIdsByAddr - -```protobuf -message QueryIncentiveUnitIdsByAddrRequest { - string address = 1 [ - (gogoproto.moretags) = "yaml:\"address\"" - ]; -} - -message QueryIncentiveUnitIdsByAddrResponse { - IncentiveUnitIdsByAddr incentive_unit_ids_by_addr = 1 [ - (gogoproto.moretags) = "yaml:\"incentive_unit_ids_by_addr\"", - (gogoproto.nullable) = false - ]; -} -``` diff --git a/x/ecosystemincentive/spec/04_hooks.md b/x/ecosystemincentive/spec/04_hooks.md deleted file mode 100644 index 052ce51d4..000000000 --- a/x/ecosystemincentive/spec/04_hooks.md +++ /dev/null @@ -1,43 +0,0 @@ -# Hooks - -**NOTE: This is early draft.** - -All rewards accumulation are executed when the according hooks function is called. - -The example hooks functions interfaces in x/nftmarket module: - -```go -type NftmarketHooks interface { - AfterNftListed(ctx sdk.Context, nftIdentifier NftIdentifier, txMemo string) - AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftIdentifier, fee sdk.Coin) - AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftIdentifier) -} -``` - -## AfterNftListed - -This hook function is called for the resistration for the `ecosystem-incentive` with the `txMemo` and `nftIdentifiler`. -To pass the `txMemo` from the memo data of `MsgListNft` requires a method to get memo data in the process of `MsgListNft` in `x/nftmarket` module. - -### Location to be inserted - -- `ListNft(ctx sdk.Context, msg *types.MsgListNft)` from x/nftmarket in nft_listing.go - -## AfterNftPaymentWithCommission - -This hook function is called for the accumulation of the reward for the subjects which are connected with the `nftIdentifiler` in the argument. -The calculation of the actual reward amount is executed in methods which this hook function calls in this module. - -### Location to be inserted - -- `ProcessPaymentWithCommissionFee(ctx sdk.Context, listingOwner sdk.AccAddress, denom string, amount sdk.Int)` from x/nftmarket in nft_listing.go - -## AfterNftUnlistedWituoutPayment - -This hook function is called when a nft is unlisted for some reason like liquidation. -The purpose is to remove the unlisted nft information from `NftmarketFrontendIncentiveIdTable` KVStore to keep the data consystent. - -### Location to be inserted - -- `CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing)` from x/nftmarket in nft_listing.go -- Case which bid's length for the listing is 0 in `EndNftListing(ctx sdk.Context, msg *types.MsgEndNftListing)` from x/nftmarket in nft_listing.go diff --git a/x/ecosystemincentive/spec/05_memo_structure.md b/x/ecosystemincentive/spec/05_memo_structure.md deleted file mode 100644 index 2ffc8dedd..000000000 --- a/x/ecosystemincentive/spec/05_memo_structure.md +++ /dev/null @@ -1,21 +0,0 @@ -# Data structure for the memo field - -We use tx memo field data to identify what incentive will be distributed to what `incentive-unit` by putting the correct formatted json data into that. - -The v1's formal data archtecture is: - -```json -{ - "version": "v1", - "incentive_unit_id": "incentive_unit-1" -} -``` - -NOTE: There's a lot of chances to be changed this structure with the change of the version. Please note it when to use. - -## Frontends - -We use memo field data to know which frontend a lisetd nft used in the case of frontend-incentive model. -So we have to use the organized data structure of memo field in a listing tx (MsgListNft) to distingush it as a legitimate entry or not. - -Even if you put the wrong formatted data in the memo of tx contains MsgListNft, the MsgListNft itself will still succeed. The registration of the information which nft-id relates to what `incentive-unit-id` will just fail. diff --git a/x/ecosystemincentive/spec/06_events.md b/x/ecosystemincentive/spec/06_events.md deleted file mode 100644 index 9ad5aa2f2..000000000 --- a/x/ecosystemincentive/spec/06_events.md +++ /dev/null @@ -1,86 +0,0 @@ -syntax = "proto3"; -package ununifi.ecosystemincentive; - -import "ecosystem-incentive/ecosystem_incentive.proto"; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/UnUniFi/chain/x/ecosystemincentive/types"; - -message EventRegister { - string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; - repeated SubjectInfo subject_info_lists = 2 [ - (gogoproto.moretags) = "yaml:\"subject_info_lists\"", - (gogoproto.nullable) = false - ]; -} - -message EventWithdrawAllRewards { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated cosmos.base.v1beta1.Coin all_withdrawn_rewards = 2 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "yaml:\"all_withdrawn_rewards\"", - (gogoproto.nullable) = false - ]; -} - -message EventWithdrawReward { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - cosmos.base.v1beta1.Coin withdrawn_reward = 2 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", - (gogoproto.moretags) = "yaml:\"withdrawn_reward\"", - (gogoproto.nullable) = false - ]; -} - -message EventFailedParsingMemoInputs { - string class_id = 1 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; - string nft_id = 2 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; - string memo = 3 [ (gogoproto.moretags) = "yaml:\"memo\"" ]; -} - -message EventRecordedIncentiveUnitId { - string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; - string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; - string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; -} - -message EventDeletedNftIdRecordedForFrontendReward { - string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; - string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; - string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; -} - -message EventNotRegisteredIncentiveUnitId { - string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; - string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; - string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; -} - -message EventNotRecordedNftId { - string class_id = 1 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; - string nft_id = 2 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; -} - -message EventUpdatedReward { - string incentive_unit_id = 1 [ (gogoproto.moretags) = "yaml:\"incentive_unit_id\"" ]; - cosmos.base.v1beta1.Coin earned_reward = 2 [ - (gogoproto.moretags) = "yaml:\"earned_reward\"", - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", - (gogoproto.nullable) = false - ]; -} - -message EventVersionUnmatched { - string unmatched_version = 1 [ (gogoproto.moretags) = "yaml:\"unmatched_version\"" ]; - string class_id = 2 [ (gogoproto.moretags) = "yaml:\"class_id\"" ]; - string nft_id = 3 [ (gogoproto.moretags) = "yaml:\"nft_id\"" ]; -} diff --git a/x/ecosystemincentive/spec/README.md b/x/ecosystemincentive/spec/README.md deleted file mode 100644 index 6f08c7da9..000000000 --- a/x/ecosystemincentive/spec/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# ecosystem Incentive - -## Abstract - -The `ecosystem-incentive` module provides the feature to incentivize the parties who bring value to our NFT market place users, especially frontend creator for the UnUniFi's NFTFi features by distributing certain rate of the NFT traded fee to the subjects. -The subjects put the required information in somewhare (current idea is memo field of the target message like MsgPayAuctionFee) and withdraw the accumulated rewards all at once or for one specific denom. - -## Contents - -[Concepts](https://github.com/UnUniFi/chain/blob/design/spec/x/ecosystem-incentive/spec/01_concepts.md) -[State](https://github.com/UnUniFi/chain/blob/design/spec/x/ecosystem-incentive/spec/02_state.md) -[Messages and Queries](https://github.com/UnUniFi/chain/blob/design/spec/x/ecosystem-incentive/spec/03_messages.md) -[Hooks](https://github.com/UnUniFi/chain/blob/design/spec/x/ecosystem-incentive/spec/04_hooks.md) -[Memo Structure](https://github.com/UnUniFi/chain/blob/design/spec/x/ecosystem-incentive/spec/05_memo_structure.md) -[Events](https://github.com/UnUniFi/chain/blob/design/spec/x/ecosystem-incentive/spec/06_events.md) - -### For developers in the core team - -[ADR of this module](https://github.com/UnUniFi/chain/blob/design/spec/doc/architecture/adr-ecosystem-incentive.md) -There's info about the requirement to achieve the purpose of this module. diff --git a/x/ecosystemincentive/types/codec.go b/x/ecosystemincentive/types/codec.go index 3e24f72fc..17523a8e9 100644 --- a/x/ecosystemincentive/types/codec.go +++ b/x/ecosystemincentive/types/codec.go @@ -12,7 +12,6 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgRegister{}, &MsgWithdrawAllRewards{}, &MsgWithdrawReward{}, ) diff --git a/x/ecosystemincentive/types/ecosystemincentive.pb.go b/x/ecosystemincentive/types/ecosystemincentive.pb.go index 8b33474fb..5268d6461 100644 --- a/x/ecosystemincentive/types/ecosystemincentive.pb.go +++ b/x/ecosystemincentive/types/ecosystemincentive.pb.go @@ -25,120 +25,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type RecipientContainer struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` - WeightedAddresses []WeightedAddress `protobuf:"bytes,2,rep,name=weighted_addresses,json=weightedAddresses,proto3" json:"weighted_addresses" yaml:"weighted_addresses"` -} - -func (m *RecipientContainer) Reset() { *m = RecipientContainer{} } -func (m *RecipientContainer) String() string { return proto.CompactTextString(m) } -func (*RecipientContainer) ProtoMessage() {} -func (*RecipientContainer) Descriptor() ([]byte, []int) { - return fileDescriptor_a12ba5b7ba43f547, []int{0} -} -func (m *RecipientContainer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RecipientContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RecipientContainer.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RecipientContainer) XXX_Merge(src proto.Message) { - xxx_messageInfo_RecipientContainer.Merge(m, src) -} -func (m *RecipientContainer) XXX_Size() int { - return m.Size() -} -func (m *RecipientContainer) XXX_DiscardUnknown() { - xxx_messageInfo_RecipientContainer.DiscardUnknown(m) -} - -var xxx_messageInfo_RecipientContainer proto.InternalMessageInfo - -func (m *RecipientContainer) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *RecipientContainer) GetWeightedAddresses() []WeightedAddress { - if m != nil { - return m.WeightedAddresses - } - return nil -} - -type WeightedAddress struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` - Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight" yaml:"weight"` -} - -func (m *WeightedAddress) Reset() { *m = WeightedAddress{} } -func (m *WeightedAddress) String() string { return proto.CompactTextString(m) } -func (*WeightedAddress) ProtoMessage() {} -func (*WeightedAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_a12ba5b7ba43f547, []int{1} -} -func (m *WeightedAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WeightedAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WeightedAddress.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WeightedAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_WeightedAddress.Merge(m, src) -} -func (m *WeightedAddress) XXX_Size() int { - return m.Size() -} -func (m *WeightedAddress) XXX_DiscardUnknown() { - xxx_messageInfo_WeightedAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_WeightedAddress proto.InternalMessageInfo - -func (m *WeightedAddress) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -type RewardStore struct { +type RewardRecord struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` Rewards github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"rewards" yaml:"rewards"` } -func (m *RewardStore) Reset() { *m = RewardStore{} } -func (m *RewardStore) String() string { return proto.CompactTextString(m) } -func (*RewardStore) ProtoMessage() {} -func (*RewardStore) Descriptor() ([]byte, []int) { - return fileDescriptor_a12ba5b7ba43f547, []int{2} +func (m *RewardRecord) Reset() { *m = RewardRecord{} } +func (m *RewardRecord) String() string { return proto.CompactTextString(m) } +func (*RewardRecord) ProtoMessage() {} +func (*RewardRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_a12ba5b7ba43f547, []int{0} } -func (m *RewardStore) XXX_Unmarshal(b []byte) error { +func (m *RewardRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RewardStore) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RewardRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RewardStore.Marshal(b, m, deterministic) + return xxx_messageInfo_RewardRecord.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -148,89 +51,34 @@ func (m *RewardStore) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *RewardStore) XXX_Merge(src proto.Message) { - xxx_messageInfo_RewardStore.Merge(m, src) +func (m *RewardRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_RewardRecord.Merge(m, src) } -func (m *RewardStore) XXX_Size() int { +func (m *RewardRecord) XXX_Size() int { return m.Size() } -func (m *RewardStore) XXX_DiscardUnknown() { - xxx_messageInfo_RewardStore.DiscardUnknown(m) +func (m *RewardRecord) XXX_DiscardUnknown() { + xxx_messageInfo_RewardRecord.DiscardUnknown(m) } -var xxx_messageInfo_RewardStore proto.InternalMessageInfo +var xxx_messageInfo_RewardRecord proto.InternalMessageInfo -func (m *RewardStore) GetAddress() string { +func (m *RewardRecord) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *RewardStore) GetRewards() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *RewardRecord) GetRewards() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.Rewards } return nil } -type BelongingRecipientContainers struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` - RecipientContainerIds []string `protobuf:"bytes,2,rep,name=recipient_container_ids,json=recipientContainerIds,proto3" json:"recipient_container_ids,omitempty" yaml:"recipient_container_ids"` -} - -func (m *BelongingRecipientContainers) Reset() { *m = BelongingRecipientContainers{} } -func (m *BelongingRecipientContainers) String() string { return proto.CompactTextString(m) } -func (*BelongingRecipientContainers) ProtoMessage() {} -func (*BelongingRecipientContainers) Descriptor() ([]byte, []int) { - return fileDescriptor_a12ba5b7ba43f547, []int{3} -} -func (m *BelongingRecipientContainers) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BelongingRecipientContainers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BelongingRecipientContainers.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BelongingRecipientContainers) XXX_Merge(src proto.Message) { - xxx_messageInfo_BelongingRecipientContainers.Merge(m, src) -} -func (m *BelongingRecipientContainers) XXX_Size() int { - return m.Size() -} -func (m *BelongingRecipientContainers) XXX_DiscardUnknown() { - xxx_messageInfo_BelongingRecipientContainers.DiscardUnknown(m) -} - -var xxx_messageInfo_BelongingRecipientContainers proto.InternalMessageInfo - -func (m *BelongingRecipientContainers) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *BelongingRecipientContainers) GetRecipientContainerIds() []string { - if m != nil { - return m.RecipientContainerIds - } - return nil -} - func init() { - proto.RegisterType((*RecipientContainer)(nil), "ununifi.ecosystemincentive.RecipientContainer") - proto.RegisterType((*WeightedAddress)(nil), "ununifi.ecosystemincentive.WeightedAddress") - proto.RegisterType((*RewardStore)(nil), "ununifi.ecosystemincentive.RewardStore") - proto.RegisterType((*BelongingRecipientContainers)(nil), "ununifi.ecosystemincentive.BelongingRecipientContainers") + proto.RegisterType((*RewardRecord)(nil), "ununifi.ecosystemincentive.RewardRecord") } func init() { @@ -238,84 +86,29 @@ func init() { } var fileDescriptor_a12ba5b7ba43f547 = []byte{ - // 472 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xc1, 0x6a, 0x13, 0x41, - 0x1c, 0xc6, 0x33, 0x11, 0x5a, 0x32, 0xa5, 0x8a, 0x8b, 0x62, 0x1a, 0x74, 0xb7, 0xce, 0x41, 0x02, - 0xea, 0x0c, 0x35, 0x37, 0x2f, 0xe2, 0x56, 0x04, 0x0f, 0x5e, 0x56, 0x4a, 0xa1, 0x97, 0xb0, 0x99, - 0xf9, 0xbb, 0xf9, 0x63, 0x33, 0x13, 0x76, 0x26, 0x8d, 0x39, 0xf8, 0x0e, 0x1e, 0x7d, 0x04, 0xf1, - 0x28, 0x3e, 0x44, 0x8f, 0x3d, 0x8a, 0x87, 0x55, 0x92, 0x37, 0xc8, 0x13, 0x48, 0x76, 0x67, 0xa1, - 0x9a, 0x08, 0xf6, 0xb4, 0xcb, 0xce, 0xf7, 0xfd, 0xe6, 0xfb, 0x7f, 0xb3, 0x43, 0x7b, 0x13, 0x3d, - 0xd1, 0xf8, 0x16, 0x05, 0x48, 0x63, 0x67, 0xd6, 0xc1, 0x08, 0xb5, 0x04, 0xed, 0xf0, 0x0c, 0x36, - 0x7c, 0xe2, 0xe3, 0xdc, 0x38, 0x13, 0x74, 0xbc, 0x89, 0xaf, 0x2b, 0x3a, 0xb7, 0x32, 0x93, 0x99, - 0x52, 0x26, 0x56, 0x6f, 0x95, 0xa3, 0x13, 0x4a, 0x63, 0x47, 0xc6, 0x8a, 0x41, 0x6a, 0x41, 0x9c, - 0x1d, 0x0c, 0xc0, 0xa5, 0x07, 0x42, 0x1a, 0xd4, 0xd5, 0x3a, 0xfb, 0x4a, 0x68, 0x90, 0x80, 0xc4, - 0x31, 0x82, 0x76, 0x87, 0x46, 0xbb, 0x14, 0x35, 0xe4, 0xc1, 0x3d, 0xda, 0x44, 0xd5, 0x26, 0xfb, - 0xa4, 0xdb, 0x8a, 0x77, 0x97, 0x45, 0xd4, 0x9a, 0xa5, 0xa3, 0xd3, 0xa7, 0x0c, 0x15, 0x4b, 0x9a, - 0xa8, 0x82, 0x0f, 0x34, 0x98, 0x02, 0x66, 0x43, 0x07, 0xaa, 0x9f, 0x2a, 0x95, 0x83, 0xb5, 0x60, - 0xdb, 0xcd, 0xfd, 0x6b, 0xdd, 0x9d, 0x27, 0x0f, 0xf9, 0xbf, 0x43, 0xf2, 0x63, 0xef, 0x7a, 0x5e, - 0x99, 0xe2, 0xfb, 0xe7, 0x45, 0xd4, 0x58, 0x16, 0xd1, 0x5e, 0xc5, 0x5f, 0x87, 0xb2, 0xe4, 0xe6, - 0xf4, 0x4f, 0x0f, 0x58, 0xf6, 0x89, 0xd0, 0x1b, 0x7f, 0x91, 0x82, 0x47, 0x74, 0xdb, 0x9b, 0x7c, - 0xec, 0x60, 0x59, 0x44, 0xd7, 0x2b, 0xac, 0x5f, 0x60, 0x49, 0x2d, 0x09, 0x8e, 0xe9, 0x56, 0x85, - 0x6d, 0x37, 0x4b, 0xf1, 0xb3, 0x55, 0x8e, 0x1f, 0x45, 0xf4, 0x20, 0x43, 0x37, 0x9c, 0x0c, 0xb8, - 0x34, 0x23, 0xe1, 0x9b, 0xab, 0x1e, 0x8f, 0xad, 0x7a, 0x27, 0xdc, 0x6c, 0x0c, 0x96, 0xbf, 0x00, - 0xb9, 0x2c, 0xa2, 0xdd, 0xcb, 0x89, 0x59, 0xe2, 0x71, 0xec, 0x1b, 0xa1, 0x3b, 0x09, 0x4c, 0xd3, - 0x5c, 0xbd, 0x71, 0x26, 0x87, 0x2b, 0xc6, 0x9a, 0xd2, 0xed, 0xbc, 0x34, 0xd7, 0x65, 0xee, 0xf1, - 0x6a, 0x7b, 0xbe, 0x3a, 0x3f, 0xee, 0xcf, 0x8f, 0x1f, 0x1a, 0xd4, 0x71, 0xec, 0xab, 0xf3, 0x30, - 0xef, 0x63, 0x5f, 0x7e, 0x46, 0xdd, 0xff, 0x18, 0x62, 0x85, 0xb0, 0x49, 0xbd, 0x1b, 0xfb, 0x4c, - 0xe8, 0xdd, 0x18, 0x4e, 0x8d, 0xce, 0x50, 0x67, 0xeb, 0xff, 0xc3, 0x55, 0xeb, 0x3d, 0xa1, 0x77, - 0xf2, 0x1a, 0xd2, 0x97, 0x35, 0xa5, 0x8f, 0x7e, 0xae, 0x56, 0xcc, 0x96, 0x45, 0x14, 0xd6, 0xc1, - 0x37, 0x0a, 0x59, 0x72, 0x3b, 0x5f, 0xcb, 0xf1, 0x4a, 0xd9, 0xf8, 0xf5, 0xf9, 0x3c, 0x24, 0x17, - 0xf3, 0x90, 0xfc, 0x9a, 0x87, 0xe4, 0xe3, 0x22, 0x6c, 0x5c, 0x2c, 0xc2, 0xc6, 0xf7, 0x45, 0xd8, - 0x38, 0xe9, 0x5d, 0x9a, 0xfb, 0x48, 0x1f, 0x69, 0x7c, 0x89, 0x42, 0x0e, 0x53, 0xd4, 0xe2, 0xfd, - 0xa6, 0x5b, 0x56, 0x16, 0x31, 0xd8, 0x2a, 0xef, 0x41, 0xef, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xad, 0x06, 0xc8, 0x09, 0x90, 0x03, 0x00, 0x00, -} - -func (m *RecipientContainer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RecipientContainer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RecipientContainer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.WeightedAddresses) > 0 { - for iNdEx := len(m.WeightedAddresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.WeightedAddresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEcosystemincentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintEcosystemincentive(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WeightedAddress) Marshal() (dAtA []byte, err error) { + // 293 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x31, 0x4e, 0xc3, 0x30, + 0x14, 0x86, 0x63, 0x90, 0xa8, 0x08, 0x88, 0x21, 0x62, 0x28, 0x1d, 0xdc, 0x2a, 0x53, 0x07, 0xb0, + 0x55, 0xb2, 0x31, 0x06, 0x89, 0x8d, 0x25, 0x52, 0x17, 0x36, 0xc7, 0x31, 0xa9, 0x05, 0xf1, 0xab, + 0xf2, 0x9c, 0x96, 0xdc, 0x82, 0x73, 0xb0, 0x73, 0x87, 0x8e, 0x1d, 0x99, 0x0a, 0x4a, 0x6e, 0xc0, + 0x09, 0x50, 0x93, 0x54, 0x20, 0xd1, 0xc9, 0x96, 0xdf, 0xff, 0x7f, 0x9f, 0xf5, 0xdc, 0xa0, 0x30, + 0x85, 0xd1, 0x8f, 0x9a, 0x2b, 0x09, 0x58, 0xa2, 0x55, 0x99, 0x36, 0x52, 0x19, 0xab, 0x17, 0x6a, + 0xcf, 0x13, 0x9b, 0xe7, 0x60, 0xc1, 0x1b, 0x74, 0x25, 0xf6, 0x3f, 0x31, 0x38, 0x4f, 0x21, 0x85, + 0x26, 0xc6, 0xb7, 0xb7, 0xb6, 0x31, 0xa0, 0x12, 0x30, 0x03, 0xe4, 0xb1, 0x40, 0xc5, 0x17, 0x93, + 0x58, 0x59, 0x31, 0xe1, 0x12, 0xb4, 0x69, 0xe7, 0xfe, 0x3b, 0x71, 0x4f, 0x23, 0xb5, 0x14, 0x79, + 0x12, 0x29, 0x09, 0x79, 0xe2, 0x5d, 0xba, 0x3d, 0x91, 0x24, 0xb9, 0x42, 0xec, 0x93, 0x11, 0x19, + 0x1f, 0x87, 0xde, 0xf7, 0x66, 0x78, 0x56, 0x8a, 0xec, 0xf9, 0xc6, 0xef, 0x06, 0x7e, 0xb4, 0x8b, + 0x78, 0x4b, 0xb7, 0x97, 0x37, 0x6d, 0xec, 0x1f, 0x8c, 0x0e, 0xc7, 0x27, 0xd7, 0x17, 0xac, 0x15, + 0xb2, 0xad, 0x90, 0x75, 0x42, 0x76, 0x0b, 0xda, 0x84, 0xe1, 0x6a, 0x33, 0x74, 0x7e, 0x61, 0x5d, + 0xcf, 0x7f, 0xfb, 0x1c, 0x8e, 0x53, 0x6d, 0x67, 0x45, 0xcc, 0x24, 0x64, 0xbc, 0xfb, 0x6f, 0x7b, + 0x5c, 0x61, 0xf2, 0xc4, 0x6d, 0x39, 0x57, 0xd8, 0x20, 0x30, 0xda, 0xd9, 0xc2, 0xfb, 0x55, 0x45, + 0xc9, 0xba, 0xa2, 0xe4, 0xab, 0xa2, 0xe4, 0xb5, 0xa6, 0xce, 0xba, 0xa6, 0xce, 0x47, 0x4d, 0x9d, + 0x87, 0xe0, 0x0f, 0x6c, 0x6a, 0xa6, 0x46, 0xdf, 0x69, 0x2e, 0x67, 0x42, 0x1b, 0xfe, 0xb2, 0x6f, + 0xd7, 0x0d, 0x3d, 0x3e, 0x6a, 0xb6, 0x11, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x3e, 0x3c, + 0xee, 0x96, 0x01, 0x00, 0x00, +} + +func (m *RewardRecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -325,52 +118,12 @@ func (m *WeightedAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WeightedAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *RewardRecord) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *WeightedAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Weight.Size() - i -= size - if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEcosystemincentive(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintEcosystemincentive(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RewardStore) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RewardStore) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RewardStore) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RewardRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -399,45 +152,6 @@ func (m *RewardStore) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *BelongingRecipientContainers) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BelongingRecipientContainers) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BelongingRecipientContainers) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RecipientContainerIds) > 0 { - for iNdEx := len(m.RecipientContainerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RecipientContainerIds[iNdEx]) - copy(dAtA[i:], m.RecipientContainerIds[iNdEx]) - i = encodeVarintEcosystemincentive(dAtA, i, uint64(len(m.RecipientContainerIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintEcosystemincentive(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintEcosystemincentive(dAtA []byte, offset int, v uint64) int { offset -= sovEcosystemincentive(v) base := offset @@ -449,41 +163,7 @@ func encodeVarintEcosystemincentive(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *RecipientContainer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovEcosystemincentive(uint64(l)) - } - if len(m.WeightedAddresses) > 0 { - for _, e := range m.WeightedAddresses { - l = e.Size() - n += 1 + l + sovEcosystemincentive(uint64(l)) - } - } - return n -} - -func (m *WeightedAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovEcosystemincentive(uint64(l)) - } - l = m.Weight.Size() - n += 1 + l + sovEcosystemincentive(uint64(l)) - return n -} - -func (m *RewardStore) Size() (n int) { +func (m *RewardRecord) Size() (n int) { if m == nil { return 0 } @@ -502,32 +182,13 @@ func (m *RewardStore) Size() (n int) { return n } -func (m *BelongingRecipientContainers) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovEcosystemincentive(uint64(l)) - } - if len(m.RecipientContainerIds) > 0 { - for _, s := range m.RecipientContainerIds { - l = len(s) - n += 1 + l + sovEcosystemincentive(uint64(l)) - } - } - return n -} - func sovEcosystemincentive(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozEcosystemincentive(x uint64) (n int) { return sovEcosystemincentive(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *RecipientContainer) Unmarshal(dAtA []byte) error { +func (m *RewardRecord) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -550,15 +211,15 @@ func (m *RecipientContainer) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RecipientContainer: wiretype end group for non-group") + return fmt.Errorf("proto: RewardRecord: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RecipientContainer: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RewardRecord: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -586,11 +247,11 @@ func (m *RecipientContainer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Id = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WeightedAddresses", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -617,356 +278,10 @@ func (m *RecipientContainer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WeightedAddresses = append(m.WeightedAddresses, WeightedAddress{}) - if err := m.WeightedAddresses[len(m.WeightedAddresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEcosystemincentive(dAtA[iNdEx:]) - if err != nil { + m.Rewards = append(m.Rewards, types.Coin{}) + if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEcosystemincentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WeightedAddress) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WeightedAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WeightedAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEcosystemincentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEcosystemincentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEcosystemincentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEcosystemincentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEcosystemincentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEcosystemincentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RewardStore) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RewardStore: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RewardStore: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEcosystemincentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEcosystemincentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEcosystemincentive - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEcosystemincentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Rewards = append(m.Rewards, types.Coin{}) - if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEcosystemincentive(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEcosystemincentive - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BelongingRecipientContainers) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BelongingRecipientContainers: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BelongingRecipientContainers: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEcosystemincentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEcosystemincentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEcosystemincentive - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEcosystemincentive - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEcosystemincentive - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainerIds = append(m.RecipientContainerIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/ecosystemincentive/types/errors.go b/x/ecosystemincentive/types/errors.go index 9e192433b..03d903996 100644 --- a/x/ecosystemincentive/types/errors.go +++ b/x/ecosystemincentive/types/errors.go @@ -20,4 +20,5 @@ var ( ErrInvalidRecipientContainerId = sdkerrors.Register(ModuleName, 13, "recipient container id includes invalid characteres") ErrAddressNotHasRecipientContainerId = sdkerrors.Register(ModuleName, 14, "the address deosn't have any incentive unit id") ErrRewardExceedsFee = sdkerrors.Register(ModuleName, 15, "the total reward exceeds the fee") + ErrRewardRateIsZero = sdkerrors.Register(ModuleName, 16, "the reward rate is set zero for") ) diff --git a/x/ecosystemincentive/types/event.pb.go b/x/ecosystemincentive/types/event.pb.go index 1d05008c3..41be7c081 100644 --- a/x/ecosystemincentive/types/event.pb.go +++ b/x/ecosystemincentive/types/event.pb.go @@ -25,58 +25,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type EventRegister struct { - RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` - WeightedAddresses []WeightedAddress `protobuf:"bytes,2,rep,name=weighted_addresses,json=weightedAddresses,proto3" json:"weighted_addresses" yaml:"weighted_addresses"` -} - -func (m *EventRegister) Reset() { *m = EventRegister{} } -func (m *EventRegister) String() string { return proto.CompactTextString(m) } -func (*EventRegister) ProtoMessage() {} -func (*EventRegister) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{0} -} -func (m *EventRegister) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventRegister) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventRegister.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventRegister) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventRegister.Merge(m, src) -} -func (m *EventRegister) XXX_Size() int { - return m.Size() -} -func (m *EventRegister) XXX_DiscardUnknown() { - xxx_messageInfo_EventRegister.DiscardUnknown(m) -} - -var xxx_messageInfo_EventRegister proto.InternalMessageInfo - -func (m *EventRegister) GetRecipientContainerId() string { - if m != nil { - return m.RecipientContainerId - } - return "" -} - -func (m *EventRegister) GetWeightedAddresses() []WeightedAddress { - if m != nil { - return m.WeightedAddresses - } - return nil -} - type EventWithdrawAllRewards struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` AllWithdrawnRewards github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=all_withdrawn_rewards,json=allWithdrawnRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"all_withdrawn_rewards" yaml:"all_withdrawn_rewards"` @@ -86,7 +34,7 @@ func (m *EventWithdrawAllRewards) Reset() { *m = EventWithdrawAllRewards func (m *EventWithdrawAllRewards) String() string { return proto.CompactTextString(m) } func (*EventWithdrawAllRewards) ProtoMessage() {} func (*EventWithdrawAllRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{1} + return fileDescriptor_4bc2d07e5e7a71a2, []int{0} } func (m *EventWithdrawAllRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -138,7 +86,7 @@ func (m *EventWithdrawReward) Reset() { *m = EventWithdrawReward{} } func (m *EventWithdrawReward) String() string { return proto.CompactTextString(m) } func (*EventWithdrawReward) ProtoMessage() {} func (*EventWithdrawReward) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{2} + return fileDescriptor_4bc2d07e5e7a71a2, []int{1} } func (m *EventWithdrawReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -181,130 +129,10 @@ func (m *EventWithdrawReward) GetWithdrawnReward() types.Coin { return types.Coin{} } -type EventFailedParsingTxMemoData struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty" yaml:"memo"` -} - -func (m *EventFailedParsingTxMemoData) Reset() { *m = EventFailedParsingTxMemoData{} } -func (m *EventFailedParsingTxMemoData) String() string { return proto.CompactTextString(m) } -func (*EventFailedParsingTxMemoData) ProtoMessage() {} -func (*EventFailedParsingTxMemoData) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{3} -} -func (m *EventFailedParsingTxMemoData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventFailedParsingTxMemoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventFailedParsingTxMemoData.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventFailedParsingTxMemoData) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventFailedParsingTxMemoData.Merge(m, src) -} -func (m *EventFailedParsingTxMemoData) XXX_Size() int { - return m.Size() -} -func (m *EventFailedParsingTxMemoData) XXX_DiscardUnknown() { - xxx_messageInfo_EventFailedParsingTxMemoData.DiscardUnknown(m) -} - -var xxx_messageInfo_EventFailedParsingTxMemoData proto.InternalMessageInfo - -func (m *EventFailedParsingTxMemoData) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventFailedParsingTxMemoData) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *EventFailedParsingTxMemoData) GetMemo() string { - if m != nil { - return m.Memo - } - return "" -} - -type EventRecordedRecipientContainerId struct { - RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` -} - -func (m *EventRecordedRecipientContainerId) Reset() { *m = EventRecordedRecipientContainerId{} } -func (m *EventRecordedRecipientContainerId) String() string { return proto.CompactTextString(m) } -func (*EventRecordedRecipientContainerId) ProtoMessage() {} -func (*EventRecordedRecipientContainerId) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{4} -} -func (m *EventRecordedRecipientContainerId) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventRecordedRecipientContainerId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventRecordedRecipientContainerId.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventRecordedRecipientContainerId) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventRecordedRecipientContainerId.Merge(m, src) -} -func (m *EventRecordedRecipientContainerId) XXX_Size() int { - return m.Size() -} -func (m *EventRecordedRecipientContainerId) XXX_DiscardUnknown() { - xxx_messageInfo_EventRecordedRecipientContainerId.DiscardUnknown(m) -} - -var xxx_messageInfo_EventRecordedRecipientContainerId proto.InternalMessageInfo - -func (m *EventRecordedRecipientContainerId) GetRecipientContainerId() string { - if m != nil { - return m.RecipientContainerId - } - return "" -} - -func (m *EventRecordedRecipientContainerId) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventRecordedRecipientContainerId) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - type EventDeletedNftIdRecordedForFrontendReward struct { RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty" yaml:"nft_id"` } func (m *EventDeletedNftIdRecordedForFrontendReward) Reset() { @@ -315,7 +143,7 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) String() string { } func (*EventDeletedNftIdRecordedForFrontendReward) ProtoMessage() {} func (*EventDeletedNftIdRecordedForFrontendReward) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{5} + return fileDescriptor_4bc2d07e5e7a71a2, []int{2} } func (m *EventDeletedNftIdRecordedForFrontendReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -358,85 +186,23 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) GetClassId() string { return "" } -func (m *EventDeletedNftIdRecordedForFrontendReward) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type EventNotRegisteredRecipientContainerId struct { - RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` -} - -func (m *EventNotRegisteredRecipientContainerId) Reset() { - *m = EventNotRegisteredRecipientContainerId{} -} -func (m *EventNotRegisteredRecipientContainerId) String() string { return proto.CompactTextString(m) } -func (*EventNotRegisteredRecipientContainerId) ProtoMessage() {} -func (*EventNotRegisteredRecipientContainerId) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{6} -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventNotRegisteredRecipientContainerId.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventNotRegisteredRecipientContainerId.Merge(m, src) -} -func (m *EventNotRegisteredRecipientContainerId) XXX_Size() int { - return m.Size() -} -func (m *EventNotRegisteredRecipientContainerId) XXX_DiscardUnknown() { - xxx_messageInfo_EventNotRegisteredRecipientContainerId.DiscardUnknown(m) -} - -var xxx_messageInfo_EventNotRegisteredRecipientContainerId proto.InternalMessageInfo - -func (m *EventNotRegisteredRecipientContainerId) GetRecipientContainerId() string { - if m != nil { - return m.RecipientContainerId - } - return "" -} - -func (m *EventNotRegisteredRecipientContainerId) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventNotRegisteredRecipientContainerId) GetNftId() string { +func (m *EventDeletedNftIdRecordedForFrontendReward) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } type EventNotRecordedNftId struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` + TokenId string `protobuf:"bytes,2,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty" yaml:"nft_id"` } func (m *EventNotRecordedNftId) Reset() { *m = EventNotRecordedNftId{} } func (m *EventNotRecordedNftId) String() string { return proto.CompactTextString(m) } func (*EventNotRecordedNftId) ProtoMessage() {} func (*EventNotRecordedNftId) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{7} + return fileDescriptor_4bc2d07e5e7a71a2, []int{3} } func (m *EventNotRecordedNftId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -472,9 +238,9 @@ func (m *EventNotRecordedNftId) GetClassId() string { return "" } -func (m *EventNotRecordedNftId) GetNftId() string { +func (m *EventNotRecordedNftId) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } @@ -488,7 +254,7 @@ func (m *EventUpdatedReward) Reset() { *m = EventUpdatedReward{} } func (m *EventUpdatedReward) String() string { return proto.CompactTextString(m) } func (*EventUpdatedReward) ProtoMessage() {} func (*EventUpdatedReward) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{8} + return fileDescriptor_4bc2d07e5e7a71a2, []int{4} } func (m *EventUpdatedReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -531,8 +297,60 @@ func (m *EventUpdatedReward) GetEarnedReward() types.Coin { return types.Coin{} } +type EventDistributionForStakers struct { + DistributedAmount types.Coin `protobuf:"bytes,1,opt,name=distributed_amount,json=distributedAmount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"distributed_amount" yaml:"distributed_amount"` + BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty" yaml:"block_height"` +} + +func (m *EventDistributionForStakers) Reset() { *m = EventDistributionForStakers{} } +func (m *EventDistributionForStakers) String() string { return proto.CompactTextString(m) } +func (*EventDistributionForStakers) ProtoMessage() {} +func (*EventDistributionForStakers) Descriptor() ([]byte, []int) { + return fileDescriptor_4bc2d07e5e7a71a2, []int{5} +} +func (m *EventDistributionForStakers) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventDistributionForStakers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventDistributionForStakers.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventDistributionForStakers) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventDistributionForStakers.Merge(m, src) +} +func (m *EventDistributionForStakers) XXX_Size() int { + return m.Size() +} +func (m *EventDistributionForStakers) XXX_DiscardUnknown() { + xxx_messageInfo_EventDistributionForStakers.DiscardUnknown(m) +} + +var xxx_messageInfo_EventDistributionForStakers proto.InternalMessageInfo + +func (m *EventDistributionForStakers) GetDistributedAmount() types.Coin { + if m != nil { + return m.DistributedAmount + } + return types.Coin{} +} + +func (m *EventDistributionForStakers) GetBlockHeight() int64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + type EventVersionUnmatched struct { - UnmatchedVersion string `protobuf:"bytes,1,opt,name=unmatched_version,json=unmatchedVersion,proto3" json:"unmatched_version,omitempty" yaml:"unmatched_version"` + UnmatchedVersion uint32 `protobuf:"varint,1,opt,name=unmatched_version,json=unmatchedVersion,proto3" json:"unmatched_version,omitempty" yaml:"unmatched_version"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` } @@ -541,7 +359,7 @@ func (m *EventVersionUnmatched) Reset() { *m = EventVersionUnmatched{} } func (m *EventVersionUnmatched) String() string { return proto.CompactTextString(m) } func (*EventVersionUnmatched) ProtoMessage() {} func (*EventVersionUnmatched) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{9} + return fileDescriptor_4bc2d07e5e7a71a2, []int{6} } func (m *EventVersionUnmatched) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -570,11 +388,11 @@ func (m *EventVersionUnmatched) XXX_DiscardUnknown() { var xxx_messageInfo_EventVersionUnmatched proto.InternalMessageInfo -func (m *EventVersionUnmatched) GetUnmatchedVersion() string { +func (m *EventVersionUnmatched) GetUnmatchedVersion() uint32 { if m != nil { return m.UnmatchedVersion } - return "" + return 0 } func (m *EventVersionUnmatched) GetClassId() string { @@ -591,174 +409,67 @@ func (m *EventVersionUnmatched) GetNftId() string { return "" } -type EventDistributionForStakers struct { - DistributedAmount types.Coin `protobuf:"bytes,1,opt,name=distributed_amount,json=distributedAmount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"distributed_amount" yaml:"distributed_amount"` - BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty" yaml:"block_height"` +func init() { + proto.RegisterType((*EventWithdrawAllRewards)(nil), "ununifi.ecosystemincentive.EventWithdrawAllRewards") + proto.RegisterType((*EventWithdrawReward)(nil), "ununifi.ecosystemincentive.EventWithdrawReward") + proto.RegisterType((*EventDeletedNftIdRecordedForFrontendReward)(nil), "ununifi.ecosystemincentive.EventDeletedNftIdRecordedForFrontendReward") + proto.RegisterType((*EventNotRecordedNftId)(nil), "ununifi.ecosystemincentive.EventNotRecordedNftId") + proto.RegisterType((*EventUpdatedReward)(nil), "ununifi.ecosystemincentive.EventUpdatedReward") + proto.RegisterType((*EventDistributionForStakers)(nil), "ununifi.ecosystemincentive.EventDistributionForStakers") + proto.RegisterType((*EventVersionUnmatched)(nil), "ununifi.ecosystemincentive.EventVersionUnmatched") } -func (m *EventDistributionForStakers) Reset() { *m = EventDistributionForStakers{} } -func (m *EventDistributionForStakers) String() string { return proto.CompactTextString(m) } -func (*EventDistributionForStakers) ProtoMessage() {} -func (*EventDistributionForStakers) Descriptor() ([]byte, []int) { - return fileDescriptor_4bc2d07e5e7a71a2, []int{10} -} -func (m *EventDistributionForStakers) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) +func init() { + proto.RegisterFile("ununifi/ecosystemincentive/event.proto", fileDescriptor_4bc2d07e5e7a71a2) } -func (m *EventDistributionForStakers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventDistributionForStakers.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventDistributionForStakers) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventDistributionForStakers.Merge(m, src) -} -func (m *EventDistributionForStakers) XXX_Size() int { - return m.Size() -} -func (m *EventDistributionForStakers) XXX_DiscardUnknown() { - xxx_messageInfo_EventDistributionForStakers.DiscardUnknown(m) -} - -var xxx_messageInfo_EventDistributionForStakers proto.InternalMessageInfo - -func (m *EventDistributionForStakers) GetDistributedAmount() types.Coin { - if m != nil { - return m.DistributedAmount - } - return types.Coin{} -} - -func (m *EventDistributionForStakers) GetBlockHeight() int64 { - if m != nil { - return m.BlockHeight - } - return 0 -} - -func init() { - proto.RegisterType((*EventRegister)(nil), "ununifi.ecosystemincentive.EventRegister") - proto.RegisterType((*EventWithdrawAllRewards)(nil), "ununifi.ecosystemincentive.EventWithdrawAllRewards") - proto.RegisterType((*EventWithdrawReward)(nil), "ununifi.ecosystemincentive.EventWithdrawReward") - proto.RegisterType((*EventFailedParsingTxMemoData)(nil), "ununifi.ecosystemincentive.EventFailedParsingTxMemoData") - proto.RegisterType((*EventRecordedRecipientContainerId)(nil), "ununifi.ecosystemincentive.EventRecordedRecipientContainerId") - proto.RegisterType((*EventDeletedNftIdRecordedForFrontendReward)(nil), "ununifi.ecosystemincentive.EventDeletedNftIdRecordedForFrontendReward") - proto.RegisterType((*EventNotRegisteredRecipientContainerId)(nil), "ununifi.ecosystemincentive.EventNotRegisteredRecipientContainerId") - proto.RegisterType((*EventNotRecordedNftId)(nil), "ununifi.ecosystemincentive.EventNotRecordedNftId") - proto.RegisterType((*EventUpdatedReward)(nil), "ununifi.ecosystemincentive.EventUpdatedReward") - proto.RegisterType((*EventVersionUnmatched)(nil), "ununifi.ecosystemincentive.EventVersionUnmatched") - proto.RegisterType((*EventDistributionForStakers)(nil), "ununifi.ecosystemincentive.EventDistributionForStakers") -} - -func init() { - proto.RegisterFile("ununifi/ecosystemincentive/event.proto", fileDescriptor_4bc2d07e5e7a71a2) -} - -var fileDescriptor_4bc2d07e5e7a71a2 = []byte{ - // 830 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x33, 0x09, 0x04, 0x98, 0x34, 0x4a, 0xb3, 0x49, 0x89, 0x1b, 0x82, 0x37, 0x19, 0xa4, - 0x12, 0x40, 0xec, 0xaa, 0xe4, 0xd6, 0x5b, 0xdc, 0x62, 0x08, 0xa2, 0x55, 0xb5, 0x10, 0x22, 0x71, - 0xb1, 0xc6, 0x3b, 0x2f, 0xf6, 0x28, 0xbb, 0x33, 0x61, 0x66, 0x1c, 0x37, 0x07, 0xce, 0x5c, 0x7b, - 0xe2, 0x86, 0xb8, 0xf3, 0x37, 0xf0, 0x07, 0xf4, 0x58, 0x09, 0x09, 0x21, 0x21, 0x6d, 0x51, 0x22, - 0xc1, 0x7d, 0x2f, 0x5c, 0xd1, 0xce, 0x8c, 0xd3, 0x38, 0x0e, 0x51, 0x7c, 0xf0, 0x01, 0x4e, 0xde, - 0x79, 0x3f, 0xbe, 0xf3, 0x3e, 0x6f, 0x7e, 0x19, 0xdf, 0xe9, 0x89, 0x9e, 0xe0, 0xfb, 0x3c, 0x86, - 0x54, 0xea, 0x63, 0x6d, 0x20, 0xe7, 0x22, 0x05, 0x61, 0xf8, 0x11, 0xc4, 0x70, 0x04, 0xc2, 0x44, - 0x87, 0x4a, 0x1a, 0x19, 0xac, 0xfa, 0xb8, 0x68, 0x34, 0x6e, 0x75, 0xeb, 0x2a, 0x8d, 0x11, 0x93, - 0x13, 0x5c, 0x5d, 0xee, 0xc8, 0x8e, 0xb4, 0x9f, 0x71, 0xf5, 0xe5, 0xad, 0xf5, 0x54, 0xea, 0x5c, - 0xea, 0xb8, 0x4d, 0x35, 0xc4, 0x47, 0x77, 0xdb, 0x60, 0xe8, 0xdd, 0x38, 0x95, 0x5c, 0x38, 0x3f, - 0xf9, 0x0b, 0xe1, 0xf9, 0x8f, 0xab, 0xb2, 0x12, 0xe8, 0x70, 0x6d, 0x40, 0x05, 0x7b, 0xf8, 0x4d, - 0x05, 0x29, 0x3f, 0xe4, 0x20, 0x4c, 0x2b, 0x95, 0xc2, 0x50, 0x2e, 0x40, 0xb5, 0x38, 0xab, 0xa1, - 0x75, 0xb4, 0xf9, 0x46, 0x63, 0xa3, 0x2c, 0xc2, 0xb7, 0x8f, 0x69, 0x9e, 0xdd, 0x23, 0x97, 0xc7, - 0x91, 0x64, 0xf9, 0xcc, 0x71, 0x7f, 0x60, 0xdf, 0x61, 0xc1, 0xb7, 0x38, 0xe8, 0x03, 0xef, 0x74, - 0x0d, 0xb0, 0x16, 0x65, 0x4c, 0x81, 0xd6, 0xa0, 0x6b, 0xd3, 0xeb, 0x33, 0x9b, 0x73, 0x1f, 0x7d, - 0x10, 0xfd, 0x7b, 0x3b, 0xa2, 0x3d, 0x9f, 0xb5, 0xed, 0x92, 0x1a, 0x1b, 0xcf, 0x8a, 0x70, 0xaa, - 0x2c, 0xc2, 0xdb, 0xae, 0x8a, 0x51, 0x51, 0x92, 0x2c, 0xf6, 0x87, 0x73, 0x40, 0x93, 0x3f, 0x11, - 0x5e, 0xb1, 0xa4, 0x7b, 0xdc, 0x74, 0x99, 0xa2, 0xfd, 0xed, 0x2c, 0x4b, 0xa0, 0x4f, 0x15, 0xd3, - 0xc1, 0x7b, 0x78, 0x56, 0x83, 0x60, 0xa0, 0x3c, 0xe3, 0x62, 0x59, 0x84, 0xf3, 0x4e, 0xdd, 0xd9, - 0x49, 0xe2, 0x03, 0x82, 0x1f, 0x11, 0xbe, 0x45, 0xb3, 0xac, 0xd5, 0xf7, 0x2a, 0xa2, 0xa5, 0x9c, - 0x88, 0x27, 0xb9, 0x1d, 0xb9, 0x8e, 0x47, 0x55, 0xc7, 0x23, 0xdf, 0xf1, 0xe8, 0xbe, 0xe4, 0xa2, - 0xf1, 0xd8, 0xd7, 0xbd, 0xe6, 0x94, 0x2f, 0x55, 0x21, 0x3f, 0xbd, 0x08, 0x37, 0x3b, 0xdc, 0x74, - 0x7b, 0xed, 0x28, 0x95, 0x79, 0xec, 0x97, 0xcf, 0xfd, 0x7c, 0xa8, 0xd9, 0x41, 0x6c, 0x8e, 0x0f, - 0x41, 0x5b, 0x41, 0x9d, 0x2c, 0xd1, 0x2c, 0x1b, 0xe0, 0x08, 0x0f, 0x43, 0x7e, 0x41, 0x78, 0x69, - 0x08, 0xd4, 0x39, 0xc6, 0x81, 0x7c, 0x8a, 0xf0, 0xcd, 0x8b, 0xa5, 0xd5, 0xa6, 0xd7, 0xd1, 0xd5, - 0x7c, 0x9f, 0x79, 0xbe, 0x15, 0xbf, 0x2e, 0x17, 0x04, 0x2a, 0xb4, 0x77, 0xaf, 0x89, 0x96, 0x2c, - 0xf4, 0x87, 0xb1, 0xc8, 0x0f, 0x08, 0xaf, 0x59, 0xaa, 0x26, 0xe5, 0x19, 0xb0, 0xc7, 0x54, 0x69, - 0x2e, 0x3a, 0x5f, 0x3e, 0x79, 0x08, 0xb9, 0x7c, 0x40, 0x0d, 0x0d, 0x22, 0xfc, 0x7a, 0x9a, 0x51, - 0xad, 0x5f, 0xee, 0xd4, 0xa5, 0xb2, 0x08, 0x17, 0x5c, 0x2d, 0x03, 0x0f, 0x49, 0x5e, 0xb3, 0x9f, - 0x3b, 0x2c, 0xd8, 0xc4, 0xb3, 0x62, 0xdf, 0x54, 0xd1, 0xd3, 0x17, 0xdb, 0xe1, 0xec, 0x24, 0x79, - 0x55, 0xec, 0x9b, 0x1d, 0x16, 0xbc, 0x83, 0x5f, 0xc9, 0x21, 0x97, 0xb5, 0x19, 0x1b, 0xb7, 0x50, - 0x16, 0xe1, 0x9c, 0x8b, 0xab, 0xac, 0x24, 0xb1, 0x4e, 0xf2, 0x2b, 0xc2, 0x1b, 0xfe, 0x20, 0xa5, - 0x52, 0x31, 0x60, 0xc9, 0x65, 0x67, 0x60, 0x62, 0x87, 0xeb, 0x3c, 0xfd, 0xf4, 0x58, 0xf4, 0x33, - 0x57, 0xd3, 0x93, 0x17, 0x08, 0xbf, 0x6f, 0xc1, 0x1e, 0x40, 0x06, 0x06, 0xd8, 0xa3, 0xca, 0x3a, - 0x80, 0x6c, 0x4a, 0xd5, 0x54, 0x52, 0x18, 0x10, 0xcc, 0xef, 0xb2, 0xff, 0x20, 0xe1, 0xef, 0x08, - 0xdf, 0xb1, 0x84, 0x8f, 0xe4, 0xd9, 0x35, 0xf8, 0xff, 0x59, 0xbf, 0x6f, 0xf0, 0xad, 0x97, 0x70, - 0x6e, 0xd5, 0xec, 0x12, 0x4e, 0xee, 0xc0, 0x90, 0xbf, 0x11, 0x0e, 0xec, 0x9c, 0xbb, 0x87, 0x8c, - 0x1a, 0x98, 0xf8, 0xd6, 0xf8, 0x0e, 0xe1, 0x79, 0xa0, 0x4a, 0x00, 0xbb, 0xf6, 0x5d, 0xf5, 0x89, - 0xbf, 0xab, 0x96, 0xdd, 0x7c, 0x43, 0xd9, 0x63, 0x5d, 0x54, 0x37, 0x5c, 0xaa, 0xbf, 0xa5, 0x7e, - 0x46, 0xbe, 0xdb, 0x5f, 0x81, 0xd2, 0x5c, 0x8a, 0x5d, 0x91, 0x53, 0x93, 0x76, 0x81, 0x05, 0x3b, - 0x78, 0xb1, 0x37, 0x18, 0xb4, 0x8e, 0x9c, 0xd7, 0x73, 0xaf, 0x95, 0x45, 0x58, 0x73, 0x75, 0x8c, - 0x84, 0x90, 0xe4, 0xe6, 0x99, 0xcd, 0x6b, 0x4e, 0x70, 0xaf, 0x94, 0x08, 0xbf, 0xe5, 0xce, 0x3a, - 0xd7, 0x46, 0xf1, 0x76, 0xcf, 0x70, 0x29, 0x9a, 0x52, 0x7d, 0x61, 0xe8, 0x01, 0x28, 0x1d, 0x7c, - 0x8f, 0x70, 0xc0, 0x06, 0xae, 0xea, 0xc5, 0xcd, 0x65, 0x4f, 0x18, 0x8b, 0x71, 0x65, 0xb7, 0x3f, - 0x1f, 0x7e, 0xb1, 0x47, 0x25, 0xc6, 0x6a, 0xf9, 0xe2, 0xb9, 0xfc, 0x6d, 0x9b, 0x1e, 0xdc, 0xc3, - 0x37, 0xda, 0x99, 0x4c, 0x0f, 0x5a, 0x5d, 0xfb, 0xee, 0xdb, 0xb6, 0xcc, 0x34, 0x56, 0xca, 0x22, - 0x5c, 0x72, 0x53, 0x9e, 0xf7, 0x92, 0x64, 0xce, 0x0e, 0x3f, 0xb5, 0xa3, 0xc6, 0xc3, 0x67, 0x27, - 0x75, 0xf4, 0xfc, 0xa4, 0x8e, 0xfe, 0x38, 0xa9, 0xa3, 0xa7, 0xa7, 0xf5, 0xa9, 0xe7, 0xa7, 0xf5, - 0xa9, 0xdf, 0x4e, 0xeb, 0x53, 0x5f, 0x6f, 0x9d, 0xab, 0x68, 0x57, 0xec, 0x0a, 0xde, 0xe4, 0x71, - 0xda, 0xa5, 0x5c, 0xc4, 0x4f, 0x2e, 0xfb, 0x6b, 0x66, 0x4b, 0x6c, 0xcf, 0xda, 0x3f, 0x56, 0x5b, - 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x02, 0xee, 0x6d, 0xd9, 0x09, 0x0a, 0x00, 0x00, -} - -func (m *EventRegister) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventRegister) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventRegister) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.WeightedAddresses) > 0 { - for iNdEx := len(m.WeightedAddresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.WeightedAddresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvent(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.RecipientContainerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + +var fileDescriptor_4bc2d07e5e7a71a2 = []byte{ + // 710 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x4f, 0x1b, 0x39, + 0x14, 0xc7, 0xe3, 0xa0, 0x65, 0x59, 0x03, 0x02, 0x26, 0xb0, 0x04, 0x96, 0xcd, 0xb0, 0x73, 0xd8, + 0xcd, 0xae, 0x76, 0x67, 0xc4, 0x72, 0xe3, 0x46, 0x68, 0xd3, 0xa6, 0x6a, 0x51, 0x35, 0x55, 0x8a, + 0xd4, 0x4b, 0x34, 0x19, 0x3f, 0x12, 0x2b, 0x13, 0x3b, 0xb2, 0x9d, 0xa4, 0x7c, 0x82, 0x5e, 0x39, + 0xf5, 0xda, 0x7b, 0x3f, 0x43, 0x3f, 0x00, 0x47, 0xa4, 0x5e, 0x7a, 0x4a, 0x2b, 0x22, 0xf5, 0x03, + 0xe4, 0xd2, 0x6b, 0x15, 0xdb, 0x41, 0x84, 0x50, 0x4a, 0x0e, 0x3d, 0x8d, 0xed, 0xf7, 0xfc, 0x7f, + 0xff, 0xdf, 0xd3, 0xb3, 0x06, 0xff, 0xd9, 0x66, 0x6d, 0x46, 0x8f, 0x69, 0x00, 0x31, 0x97, 0x27, + 0x52, 0x41, 0x93, 0xb2, 0x18, 0x98, 0xa2, 0x1d, 0x08, 0xa0, 0x03, 0x4c, 0xf9, 0x2d, 0xc1, 0x15, + 0x77, 0x36, 0x6d, 0x9e, 0x3f, 0x99, 0xb7, 0xb9, 0x7b, 0x9b, 0xc6, 0xc4, 0x91, 0x11, 0xdc, 0x5c, + 0xad, 0xf1, 0x1a, 0xd7, 0xcb, 0x60, 0xb8, 0xb2, 0xa7, 0xb9, 0x98, 0xcb, 0x26, 0x97, 0x41, 0x35, + 0x92, 0x10, 0x74, 0x76, 0xaa, 0xa0, 0xa2, 0x9d, 0x20, 0xe6, 0x94, 0x99, 0xb8, 0xf7, 0x19, 0xe1, + 0xf5, 0xfb, 0x43, 0x5b, 0x47, 0x54, 0xd5, 0x89, 0x88, 0xba, 0xfb, 0x49, 0x12, 0x42, 0x37, 0x12, + 0x44, 0x3a, 0x7f, 0xe3, 0x59, 0x09, 0x8c, 0x80, 0xc8, 0xa2, 0x6d, 0x94, 0xff, 0xa5, 0xb0, 0x32, + 0xe8, 0xb9, 0x8b, 0x27, 0x51, 0x33, 0xd9, 0xf3, 0xcc, 0xb9, 0x17, 0xda, 0x04, 0xe7, 0x0d, 0xc2, + 0x6b, 0x51, 0x92, 0x54, 0xba, 0x56, 0x85, 0x55, 0x84, 0x11, 0xc9, 0xa6, 0xb7, 0x67, 0xf2, 0xf3, + 0xff, 0x6f, 0xf8, 0xc6, 0x87, 0x3f, 0xf4, 0xe1, 0x5b, 0x1f, 0xfe, 0x01, 0xa7, 0xac, 0xf0, 0xf4, + 0xac, 0xe7, 0xa6, 0x06, 0x3d, 0x77, 0xcb, 0x28, 0xdf, 0xa8, 0xe2, 0xbd, 0xfd, 0xe8, 0xe6, 0x6b, + 0x54, 0xd5, 0xdb, 0x55, 0x3f, 0xe6, 0xcd, 0xc0, 0x42, 0x99, 0xcf, 0x7f, 0x92, 0x34, 0x02, 0x75, + 0xd2, 0x02, 0xa9, 0x05, 0x65, 0x98, 0x89, 0x92, 0x64, 0x84, 0xc3, 0x2c, 0x8c, 0xf7, 0x1e, 0xe1, + 0xcc, 0x18, 0xa8, 0x09, 0x4c, 0x03, 0x79, 0x8a, 0xf0, 0xf2, 0x75, 0x6b, 0xd9, 0xf4, 0x36, 0xba, + 0x9d, 0xef, 0x91, 0xe5, 0x5b, 0x37, 0xa2, 0xd7, 0x05, 0x86, 0x68, 0x7f, 0xdd, 0x11, 0x2d, 0x5c, + 0xea, 0x8e, 0x63, 0x79, 0x7d, 0x84, 0xff, 0xd1, 0x54, 0xf7, 0x20, 0x01, 0x05, 0xe4, 0xf0, 0x58, + 0x95, 0x48, 0x08, 0x31, 0x17, 0x04, 0x48, 0x91, 0x8b, 0xa2, 0xe0, 0x4c, 0x01, 0x23, 0x16, 0xf6, + 0x08, 0xff, 0x2a, 0x20, 0xa6, 0x2d, 0x0a, 0x4c, 0x55, 0x62, 0xce, 0x54, 0x44, 0x19, 0x88, 0x0a, + 0x25, 0x16, 0xfe, 0x8f, 0x41, 0xcf, 0xfd, 0xdd, 0xf8, 0xbc, 0x39, 0xcf, 0x0b, 0x57, 0x2f, 0x03, + 0x07, 0xa3, 0xf3, 0x12, 0x71, 0x7c, 0x3c, 0x17, 0x27, 0x91, 0x94, 0x43, 0xa9, 0xb4, 0x96, 0xca, + 0x0c, 0x7a, 0xee, 0x92, 0x91, 0x1a, 0x45, 0xbc, 0xf0, 0x67, 0xbd, 0x2c, 0x11, 0xe7, 0x5f, 0x3c, + 0xa7, 0x78, 0x03, 0xd8, 0x30, 0x7f, 0xe6, 0x7a, 0xdf, 0xd9, 0xb1, 0x32, 0xd9, 0x3a, 0xa5, 0x44, + 0xbc, 0x36, 0x5e, 0xd3, 0x90, 0x87, 0x5c, 0x8d, 0xd8, 0x34, 0xe8, 0x58, 0x59, 0x34, 0x65, 0xd9, + 0xf4, 0x77, 0xcb, 0x7e, 0x41, 0xd8, 0xd1, 0x75, 0xcb, 0x2d, 0x12, 0x29, 0xf8, 0xe1, 0x4d, 0x7c, + 0x85, 0xf0, 0x22, 0x44, 0x82, 0x01, 0xb9, 0xf3, 0x70, 0x3d, 0xb0, 0xc3, 0xb5, 0x6a, 0xea, 0x8d, + 0xdd, 0x9e, 0x6a, 0xb2, 0x16, 0xcc, 0x55, 0x3b, 0x56, 0x03, 0x84, 0x7f, 0x33, 0x63, 0x45, 0xa5, + 0x12, 0xb4, 0xda, 0x56, 0x94, 0xb3, 0x22, 0x17, 0xcf, 0x54, 0xd4, 0x00, 0x21, 0x9d, 0xd7, 0x08, + 0x3b, 0x64, 0x14, 0x02, 0x52, 0x89, 0x9a, 0xbc, 0xcd, 0x94, 0xe6, 0xbf, 0xd5, 0xee, 0x63, 0x6b, + 0x77, 0xc3, 0xd8, 0x9d, 0x94, 0x98, 0xca, 0xf3, 0xca, 0x95, 0xfb, 0xfb, 0xfa, 0xba, 0xb3, 0x87, + 0x17, 0xaa, 0x09, 0x8f, 0x1b, 0x95, 0x3a, 0xd0, 0x5a, 0x5d, 0xe9, 0x06, 0xce, 0x14, 0xd6, 0x07, + 0x3d, 0x37, 0x63, 0x4a, 0x5e, 0x8d, 0x7a, 0xe1, 0xbc, 0xde, 0x3e, 0x34, 0xbb, 0x77, 0xc8, 0x8e, + 0xd9, 0x73, 0x10, 0x92, 0x72, 0x56, 0x66, 0xcd, 0x48, 0xc5, 0x75, 0x20, 0x4e, 0x09, 0xaf, 0xb4, + 0x47, 0x9b, 0x4a, 0xc7, 0x44, 0x35, 0xec, 0x62, 0x61, 0x6b, 0xd0, 0x73, 0xb3, 0x46, 0x7a, 0x22, + 0xc5, 0x0b, 0x97, 0x2f, 0xcf, 0xac, 0xe6, 0xd4, 0x0f, 0x25, 0x8f, 0x67, 0xcd, 0x5c, 0x7e, 0xfb, + 0x99, 0xfc, 0xc4, 0x86, 0x6f, 0xa1, 0xf0, 0xe4, 0xec, 0x22, 0x87, 0xce, 0x2f, 0x72, 0xe8, 0xd3, + 0x45, 0x0e, 0x9d, 0xf6, 0x73, 0xa9, 0xf3, 0x7e, 0x2e, 0xf5, 0xa1, 0x9f, 0x4b, 0xbd, 0xd8, 0xbd, + 0xd2, 0xd0, 0x32, 0x2b, 0x33, 0x5a, 0xa4, 0x41, 0x5c, 0x8f, 0x28, 0x0b, 0x5e, 0xde, 0xf4, 0x87, + 0xd1, 0x1d, 0xae, 0xce, 0xea, 0xff, 0xc3, 0xee, 0xd7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x7d, + 0xe8, 0xa8, 0xd0, 0x06, 0x00, 0x00, } func (m *EventWithdrawAllRewards) Marshal() (dAtA []byte, err error) { @@ -845,51 +556,7 @@ func (m *EventWithdrawReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventFailedParsingTxMemoData) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventFailedParsingTxMemoData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventFailedParsingTxMemoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Memo) > 0 { - i -= len(m.Memo) - copy(dAtA[i:], m.Memo) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Memo))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventRecordedRecipientContainerId) Marshal() (dAtA []byte, err error) { +func (m *EventDeletedNftIdRecordedForFrontendReward) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -899,20 +566,20 @@ func (m *EventRecordedRecipientContainerId) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventRecordedRecipientContainerId) MarshalTo(dAtA []byte) (int, error) { +func (m *EventDeletedNftIdRecordedForFrontendReward) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventRecordedRecipientContainerId) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventDeletedNftIdRecordedForFrontendReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -933,7 +600,7 @@ func (m *EventRecordedRecipientContainerId) MarshalToSizedBuffer(dAtA []byte) (i return len(dAtA) - i, nil } -func (m *EventDeletedNftIdRecordedForFrontendReward) Marshal() (dAtA []byte, err error) { +func (m *EventNotRecordedNftId) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -943,41 +610,34 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Marshal() (dAtA []byte, err return dAtA[:n], nil } -func (m *EventDeletedNftIdRecordedForFrontendReward) MarshalTo(dAtA []byte) (int, error) { +func (m *EventNotRecordedNftId) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventDeletedNftIdRecordedForFrontendReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventNotRecordedNftId) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x12 - } - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.RecipientContainerId))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *EventNotRegisteredRecipientContainerId) Marshal() (dAtA []byte, err error) { +func (m *EventUpdatedReward) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -987,30 +647,26 @@ func (m *EventNotRegisteredRecipientContainerId) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *EventNotRegisteredRecipientContainerId) MarshalTo(dAtA []byte) (int, error) { +func (m *EventUpdatedReward) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventNotRegisteredRecipientContainerId) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventUpdatedReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 + { + size, err := m.EarnedReward.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.RecipientContainerId) > 0 { i -= len(m.RecipientContainerId) copy(dAtA[i:], m.RecipientContainerId) @@ -1021,7 +677,7 @@ func (m *EventNotRegisteredRecipientContainerId) MarshalToSizedBuffer(dAtA []byt return len(dAtA) - i, nil } -func (m *EventNotRecordedNftId) Marshal() (dAtA []byte, err error) { +func (m *EventDistributionForStakers) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1031,55 +687,23 @@ func (m *EventNotRecordedNftId) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventNotRecordedNftId) MarshalTo(dAtA []byte) (int, error) { +func (m *EventDistributionForStakers) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventNotRecordedNftId) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventDistributionForStakers) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + if m.BlockHeight != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.BlockHeight)) i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventUpdatedReward) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + dAtA[i] = 0x10 } - return dAtA[:n], nil -} - -func (m *EventUpdatedReward) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventUpdatedReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l { - size, err := m.EarnedReward.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DistributedAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1087,14 +711,7 @@ func (m *EventUpdatedReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintEvent(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.RecipientContainerId))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1132,88 +749,29 @@ func (m *EventVersionUnmatched) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.UnmatchedVersion) > 0 { - i -= len(m.UnmatchedVersion) - copy(dAtA[i:], m.UnmatchedVersion) - i = encodeVarintEvent(dAtA, i, uint64(len(m.UnmatchedVersion))) + if m.UnmatchedVersion != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.UnmatchedVersion)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *EventDistributionForStakers) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *EventDistributionForStakers) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *EventDistributionForStakers) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BlockHeight != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.DistributedAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvent(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { - offset -= sovEvent(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *EventRegister) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - if len(m.WeightedAddresses) > 0 { - for _, e := range m.WeightedAddresses { - l = e.Size() - n += 1 + l + sovEvent(uint64(l)) - } - } - return n -} - -func (m *EventWithdrawAllRewards) Size() (n int) { - if m == nil { - return 0 - } +func (m *EventWithdrawAllRewards) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Sender) @@ -1244,48 +802,6 @@ func (m *EventWithdrawReward) Size() (n int) { return n } -func (m *EventFailedParsingTxMemoData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventRecordedRecipientContainerId) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - func (m *EventDeletedNftIdRecordedForFrontendReward) Size() (n int) { if m == nil { return 0 @@ -1300,63 +816,56 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = len(m.NftId) + l = len(m.TokenId) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } return n } -func (m *EventNotRegisteredRecipientContainerId) Size() (n int) { +func (m *EventNotRecordedNftId) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } l = len(m.ClassId) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = len(m.NftId) + l = len(m.TokenId) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } return n } -func (m *EventNotRecordedNftId) Size() (n int) { +func (m *EventUpdatedReward) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) + l = len(m.RecipientContainerId) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } + l = m.EarnedReward.Size() + n += 1 + l + sovEvent(uint64(l)) return n } -func (m *EventUpdatedReward) Size() (n int) { +func (m *EventDistributionForStakers) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = m.EarnedReward.Size() + l = m.DistributedAmount.Size() n += 1 + l + sovEvent(uint64(l)) + if m.BlockHeight != 0 { + n += 1 + sovEvent(uint64(m.BlockHeight)) + } return n } @@ -1366,9 +875,8 @@ func (m *EventVersionUnmatched) Size() (n int) { } var l int _ = l - l = len(m.UnmatchedVersion) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) + if m.UnmatchedVersion != 0 { + n += 1 + sovEvent(uint64(m.UnmatchedVersion)) } l = len(m.ClassId) if l > 0 { @@ -1380,521 +888,14 @@ func (m *EventVersionUnmatched) Size() (n int) { } return n } - -func (m *EventDistributionForStakers) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.DistributedAmount.Size() - n += 1 + l + sovEvent(uint64(l)) - if m.BlockHeight != 0 { - n += 1 + sovEvent(uint64(m.BlockHeight)) - } - return n -} - -func sovEvent(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEvent(x uint64) (n int) { - return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *EventRegister) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventRegister: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventRegister: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WeightedAddresses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WeightedAddresses = append(m.WeightedAddresses, WeightedAddress{}) - if err := m.WeightedAddresses[len(m.WeightedAddresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventWithdrawAllRewards) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventWithdrawAllRewards: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventWithdrawAllRewards: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllWithdrawnRewards", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AllWithdrawnRewards = append(m.AllWithdrawnRewards, types.Coin{}) - if err := m.AllWithdrawnRewards[len(m.AllWithdrawnRewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventWithdrawReward) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventWithdrawReward: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventWithdrawReward: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnReward", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.WithdrawnReward.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventFailedParsingTxMemoData) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventFailedParsingTxMemoData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventFailedParsingTxMemoData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Memo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventRecordedRecipientContainerId) Unmarshal(dAtA []byte) error { + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventWithdrawAllRewards) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1917,15 +918,15 @@ func (m *EventRecordedRecipientContainerId) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventRecordedRecipientContainerId: wiretype end group for non-group") + return fmt.Errorf("proto: EventWithdrawAllRewards: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventRecordedRecipientContainerId: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventWithdrawAllRewards: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1953,13 +954,13 @@ func (m *EventRecordedRecipientContainerId) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AllWithdrawnRewards", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -1969,55 +970,25 @@ func (m *EventRecordedRecipientContainerId) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthEvent } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthEvent } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF + m.AllWithdrawnRewards = append(m.AllWithdrawnRewards, types.Coin{}) + if err := m.AllWithdrawnRewards[len(m.AllWithdrawnRewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.NftId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2040,7 +1011,7 @@ func (m *EventRecordedRecipientContainerId) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) error { +func (m *EventWithdrawReward) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2063,15 +1034,15 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventDeletedNftIdRecordedForFrontendReward: wiretype end group for non-group") + return fmt.Errorf("proto: EventWithdrawReward: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventDeletedNftIdRecordedForFrontendReward: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventWithdrawReward: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2099,13 +1070,13 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnReward", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -2115,55 +1086,24 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) erro } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthEvent } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthEvent } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.WithdrawnReward.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.NftId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2186,7 +1126,7 @@ func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) erro } return nil } -func (m *EventNotRegisteredRecipientContainerId) Unmarshal(dAtA []byte) error { +func (m *EventDeletedNftIdRecordedForFrontendReward) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2209,10 +1149,10 @@ func (m *EventNotRegisteredRecipientContainerId) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventNotRegisteredRecipientContainerId: wiretype end group for non-group") + return fmt.Errorf("proto: EventDeletedNftIdRecordedForFrontendReward: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventNotRegisteredRecipientContainerId: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventDeletedNftIdRecordedForFrontendReward: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2281,7 +1221,7 @@ func (m *EventNotRegisteredRecipientContainerId) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2309,7 +1249,7 @@ func (m *EventNotRegisteredRecipientContainerId) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2395,7 +1335,7 @@ func (m *EventNotRecordedNftId) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2423,7 +1363,7 @@ func (m *EventNotRecordedNftId) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2561,7 +1501,7 @@ func (m *EventUpdatedReward) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventVersionUnmatched) Unmarshal(dAtA []byte) error { +func (m *EventDistributionForStakers) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2584,17 +1524,17 @@ func (m *EventVersionUnmatched) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventVersionUnmatched: wiretype end group for non-group") + return fmt.Errorf("proto: EventDistributionForStakers: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventVersionUnmatched: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventDistributionForStakers: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnmatchedVersion", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DistributedAmount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -2604,61 +1544,30 @@ func (m *EventVersionUnmatched) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthEvent } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthEvent } if postIndex > l { return io.ErrUnexpectedEOF } - m.UnmatchedVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.DistributedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) } - var stringLen uint64 + m.BlockHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -2668,24 +1577,11 @@ func (m *EventVersionUnmatched) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.BlockHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -2707,7 +1603,7 @@ func (m *EventVersionUnmatched) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventDistributionForStakers) Unmarshal(dAtA []byte) error { +func (m *EventVersionUnmatched) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2730,17 +1626,36 @@ func (m *EventDistributionForStakers) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventDistributionForStakers: wiretype end group for non-group") + return fmt.Errorf("proto: EventVersionUnmatched: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventDistributionForStakers: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventVersionUnmatched: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnmatchedVersion", wireType) + } + m.UnmatchedVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnmatchedVersion |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributedAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -2750,30 +1665,29 @@ func (m *EventDistributionForStakers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvent } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvent } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DistributedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) } - m.BlockHeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -2783,11 +1697,24 @@ func (m *EventDistributionForStakers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockHeight |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) diff --git a/x/ecosystemincentive/types/expected_keepers.go b/x/ecosystemincentive/types/expected_keepers.go index 3a0793468..47ce50b72 100644 --- a/x/ecosystemincentive/types/expected_keepers.go +++ b/x/ecosystemincentive/types/expected_keepers.go @@ -20,3 +20,9 @@ type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI } + +// CommunityPoolKeeper defines the expected interface needed to retrieve community pool balances. +// It originally derives from the distribution module keeper. +type CommunityPoolKeeper interface { + FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error +} diff --git a/x/ecosystemincentive/types/frontend_metadata.go b/x/ecosystemincentive/types/frontend_metadata.go new file mode 100644 index 000000000..fc2f56043 --- /dev/null +++ b/x/ecosystemincentive/types/frontend_metadata.go @@ -0,0 +1,7 @@ +package types + +import () + +var AvailableVersions = []uint32{ + 1, +} diff --git a/x/ecosystemincentive/types/genesis.pb.go b/x/ecosystemincentive/types/genesis.pb.go index 5f68505d3..a4b497c4c 100644 --- a/x/ecosystemincentive/types/genesis.pb.go +++ b/x/ecosystemincentive/types/genesis.pb.go @@ -25,9 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the ecosystemincentive module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - RecipientContainers []RecipientContainer `protobuf:"bytes,2,rep,name=recipient_containers,json=recipientContainers,proto3" json:"recipient_containers"` - RewardStores []RewardStore `protobuf:"bytes,3,rep,name=reward_stores,json=rewardStores,proto3" json:"reward_stores"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + RewardRecords []RewardRecord `protobuf:"bytes,2,rep,name=reward_records,json=rewardRecords,proto3" json:"reward_records"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -70,16 +69,9 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetRecipientContainers() []RecipientContainer { +func (m *GenesisState) GetRewardRecords() []RewardRecord { if m != nil { - return m.RecipientContainers - } - return nil -} - -func (m *GenesisState) GetRewardStores() []RewardStore { - if m != nil { - return m.RewardStores + return m.RewardRecords } return nil } @@ -93,26 +85,24 @@ func init() { } var fileDescriptor_272784c1d7a40b26 = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xbd, 0x4e, 0xf3, 0x30, - 0x14, 0x40, 0x93, 0xf6, 0x53, 0x87, 0xb4, 0xdf, 0x12, 0x3a, 0x54, 0x19, 0x4c, 0xd5, 0xa5, 0x9d, - 0x6c, 0xa9, 0x79, 0x01, 0x54, 0x24, 0x98, 0x90, 0x50, 0xaa, 0x2e, 0x2c, 0x95, 0x6b, 0x2e, 0xe9, - 0x1d, 0x62, 0x47, 0xb6, 0x03, 0xf4, 0x21, 0x90, 0x78, 0xac, 0x8e, 0x1d, 0x99, 0x10, 0x4a, 0x5e, - 0x04, 0xe5, 0xa7, 0x62, 0x08, 0x64, 0x8b, 0x9c, 0x73, 0xce, 0xbd, 0xba, 0xde, 0x22, 0x93, 0x99, - 0xc4, 0x27, 0x64, 0x20, 0x94, 0x39, 0x18, 0x0b, 0x09, 0x4a, 0x01, 0xd2, 0xe2, 0x33, 0xb0, 0x18, - 0x24, 0x18, 0x34, 0x34, 0xd5, 0xca, 0x2a, 0x3f, 0x68, 0x48, 0xda, 0x26, 0x83, 0x71, 0xac, 0x62, - 0x55, 0x61, 0xac, 0xfc, 0xaa, 0x8d, 0x60, 0xde, 0xd1, 0x4e, 0xb9, 0xe6, 0x49, 0x93, 0x0e, 0xc2, - 0x0e, 0xb0, 0xfd, 0x54, 0x4b, 0xb3, 0xb7, 0x9e, 0x37, 0xba, 0xad, 0x37, 0x5c, 0x5b, 0x6e, 0xc1, - 0xbf, 0xf2, 0x06, 0x75, 0x75, 0xe2, 0x4e, 0xdd, 0xc5, 0x70, 0x39, 0xa3, 0x7f, 0x6f, 0x4c, 0xef, - 0x2b, 0x72, 0xf5, 0xef, 0xf8, 0x79, 0xe9, 0x44, 0x8d, 0xe7, 0xc7, 0xde, 0x58, 0x83, 0xc0, 0x14, - 0x41, 0xda, 0xad, 0x50, 0xd2, 0x72, 0x94, 0xa0, 0xcd, 0xa4, 0x37, 0xed, 0x2f, 0x86, 0x4b, 0xda, - 0xd5, 0x8b, 0xce, 0xde, 0xf5, 0x59, 0x6b, 0xda, 0x17, 0xba, 0xf5, 0xc7, 0xf8, 0x91, 0xf7, 0x5f, - 0xc3, 0x0b, 0xd7, 0x8f, 0x5b, 0x63, 0x95, 0x06, 0x33, 0xe9, 0x57, 0x13, 0xe6, 0xdd, 0x13, 0x4a, - 0x61, 0x5d, 0xf2, 0x4d, 0x7a, 0xa4, 0x7f, 0x9e, 0xcc, 0xea, 0xee, 0x98, 0x13, 0xf7, 0x94, 0x13, - 0xf7, 0x2b, 0x27, 0xee, 0x7b, 0x41, 0x9c, 0x53, 0x41, 0x9c, 0x8f, 0x82, 0x38, 0x0f, 0x61, 0x8c, - 0x76, 0x9f, 0xed, 0xa8, 0x50, 0x09, 0xdb, 0xc8, 0x8d, 0xc4, 0x1b, 0x64, 0x62, 0xcf, 0x51, 0xb2, - 0xd7, 0xdf, 0x2e, 0x6e, 0x0f, 0x29, 0x98, 0xdd, 0xa0, 0xba, 0x72, 0xf8, 0x1d, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xce, 0x3d, 0x25, 0x21, 0x02, 0x00, 0x00, + // 260 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x28, 0xcd, 0x2b, 0xcd, + 0xcb, 0x4c, 0xcb, 0xd4, 0x4f, 0x4d, 0xce, 0x2f, 0xae, 0x2c, 0x2e, 0x49, 0xcd, 0xcd, 0xcc, 0x4b, + 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x82, 0xaa, 0xd4, 0xc3, 0x54, 0x29, 0x25, 0x92, 0x9e, 0x9f, + 0x9e, 0x0f, 0x56, 0xa6, 0x0f, 0x62, 0x41, 0x74, 0x48, 0xa9, 0xe3, 0x31, 0xbb, 0x20, 0xb1, 0x28, + 0x31, 0x17, 0x6a, 0xb4, 0x94, 0x31, 0x1e, 0x85, 0x98, 0x42, 0x10, 0x4d, 0x4a, 0xcb, 0x19, 0xb9, + 0x78, 0xdc, 0x21, 0x2e, 0x0c, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x72, 0xe0, 0x62, 0x83, 0x98, 0x2a, + 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, 0xa4, 0x87, 0xdb, 0xc5, 0x7a, 0x01, 0x60, 0x95, 0x4e, + 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0xf5, 0x09, 0x85, 0x72, 0xf1, 0x15, 0xa5, 0x96, 0x27, + 0x16, 0xa5, 0xc4, 0x17, 0xa5, 0x26, 0xe7, 0x17, 0xa5, 0x14, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, + 0x1b, 0x69, 0xe0, 0x33, 0x29, 0x08, 0xac, 0x23, 0x08, 0xac, 0x01, 0x6a, 0x1e, 0x6f, 0x11, 0x92, + 0x58, 0xb1, 0x93, 0xef, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, + 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa7, + 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x87, 0xe6, 0x85, 0xe6, 0x65, 0xba, + 0x65, 0xea, 0x27, 0x67, 0x24, 0x66, 0xe6, 0xe9, 0x57, 0x60, 0x0b, 0x8b, 0x92, 0xca, 0x82, 0xd4, + 0xe2, 0x24, 0x36, 0xb0, 0xff, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x83, 0xac, 0x66, + 0xbb, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -135,24 +125,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.RewardStores) > 0 { - for iNdEx := len(m.RewardStores) - 1; iNdEx >= 0; iNdEx-- { + if len(m.RewardRecords) > 0 { + for iNdEx := len(m.RewardRecords) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.RewardStores[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.RecipientContainers) > 0 { - for iNdEx := len(m.RecipientContainers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RecipientContainers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RewardRecords[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -195,14 +171,8 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.RecipientContainers) > 0 { - for _, e := range m.RecipientContainers { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.RewardStores) > 0 { - for _, e := range m.RewardStores { + if len(m.RewardRecords) > 0 { + for _, e := range m.RewardRecords { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -280,41 +250,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainers = append(m.RecipientContainers, RecipientContainer{}) - if err := m.RecipientContainers[len(m.RecipientContainers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardStores", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RewardRecords", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -341,8 +277,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RewardStores = append(m.RewardStores, RewardStore{}) - if err := m.RewardStores[len(m.RewardStores)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RewardRecords = append(m.RewardRecords, RewardRecord{}) + if err := m.RewardRecords[len(m.RewardRecords)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ecosystemincentive/types/incentive_unit.go b/x/ecosystemincentive/types/incentive_unit.go deleted file mode 100644 index 43ad96ca3..000000000 --- a/x/ecosystemincentive/types/incentive_unit.go +++ /dev/null @@ -1,65 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func NewRecipientContainer(id string, subjectsInfos []WeightedAddress) RecipientContainer { - // check if the addresses in subjectInfo are valid AccAddress - for _, subjectInfo := range subjectsInfos { - if _, err := sdk.AccAddressFromBech32(subjectInfo.Address); err != nil { - panic(err) - } - } - - return RecipientContainer{ - Id: id, - WeightedAddresses: subjectsInfos, - } -} - -func NewSubjectInfo(subjectAddr string, weight sdk.Dec) WeightedAddress { - // check if the address in subjectInfo are valid AccAddress - if _, err := sdk.AccAddressFromBech32(subjectAddr); err != nil { - panic(err) - } - - return WeightedAddress{ - Address: subjectAddr, - Weight: weight, - } -} - -func NewRecipientContainerIdsByAddr(address string, recipientContainerId string) BelongingRecipientContainers { - // check if the address are valid AccAddress - if _, err := sdk.AccAddressFromBech32(address); err != nil { - panic(err) - } - - var recipientContainerIds []string - recipientContainerIds = append(recipientContainerIds, recipientContainerId) - - return BelongingRecipientContainers{ - Address: address, - RecipientContainerIds: recipientContainerIds, - } -} - -func (m BelongingRecipientContainers) AddRecipientContainerId(recipientContainerId string) []string { - return append(m.RecipientContainerIds, recipientContainerId) -} - -func (m BelongingRecipientContainers) CreateOrUpdate(address string, recipientContainerId string) BelongingRecipientContainers { - // check if the address are valid AccAddress - if _, err := sdk.AccAddressFromBech32(address); err != nil { - panic(err) - } - - if len(m.Address) == 0 { - m = NewRecipientContainerIdsByAddr(address, recipientContainerId) - } else { - m.RecipientContainerIds = m.AddRecipientContainerId(recipientContainerId) - } - - return m -} diff --git a/x/ecosystemincentive/types/incentive_unit_test.go b/x/ecosystemincentive/types/incentive_unit_test.go deleted file mode 100644 index f214c4483..000000000 --- a/x/ecosystemincentive/types/incentive_unit_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/UnUniFi/chain/x/ecosystemincentive/types" -) - -func TestAddIncentiveUnitid(t *testing.T) { - addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - - incentiveUnitIdsByAddr := types.NewIncentiveUnitIdsByAddr(addr.String(), "test") - addingId := "added_id" - newIncentiveUnitIdsByAddr := incentiveUnitIdsByAddr.AddIncentiveUnitId(addingId) - require.Equal(t, 2, len(newIncentiveUnitIdsByAddr)) - require.Contains(t, newIncentiveUnitIdsByAddr, addingId) -} - -func TestCreateOrUpdate(t *testing.T) { - addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - - // in case for creating new one - incentiveUnitIdsByAddr := types.IncentiveUnitIdsByAddr{} - incentiveUnitIdsByAddr = incentiveUnitIdsByAddr.CreateOrUpdate(addr.String(), "test") - require.Equal(t, 1, len(incentiveUnitIdsByAddr.IncentiveUnitIds)) - - // in case for the update by adding new id - addingId := "added_id" - incentiveUnitIdsByAddr = incentiveUnitIdsByAddr.CreateOrUpdate(addr.String(), addingId) - require.Equal(t, 2, len(incentiveUnitIdsByAddr.IncentiveUnitIds)) - require.Contains(t, incentiveUnitIdsByAddr.IncentiveUnitIds, addingId) -} diff --git a/x/ecosystemincentive/types/memo.go b/x/ecosystemincentive/types/memo.go deleted file mode 100644 index 37608ca47..000000000 --- a/x/ecosystemincentive/types/memo.go +++ /dev/null @@ -1,42 +0,0 @@ -package types - -import ( - "bytes" - "encoding/json" -) - -type XTxMemoData TxMemoData - -type XTxMemoDataExceptions struct { - XTxMemoData - Other *string // other won't raise an error -} - -func ParseMemo(memoContent []byte) (*TxMemoData, error) { - txMemoData := &TxMemoData{} - - if err := txMemoData.UnmarshalJSON(memoContent); err != nil { - return nil, err - } - - // make exception if unknown fields exists - return txMemoData, nil -} - -// UnmarshalJSON should error if there are fields unexpected. -func (memo *TxMemoData) UnmarshalJSON(data []byte) error { - var txMemoDataE XTxMemoDataExceptions - dec := json.NewDecoder(bytes.NewReader(data)) - dec.DisallowUnknownFields() // Force - - if err := dec.Decode(&txMemoDataE); err != nil { - return err - } - - *memo = TxMemoData(txMemoDataE.XTxMemoData) - return nil -} - -var AvailableVersions = []string{ - "v1", -} diff --git a/x/ecosystemincentive/types/memo.pb.go b/x/ecosystemincentive/types/memo.pb.go index ec6de355e..8a114a0e5 100644 --- a/x/ecosystemincentive/types/memo.pb.go +++ b/x/ecosystemincentive/types/memo.pb.go @@ -23,23 +23,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type TxMemoData struct { - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty" yaml:"version"` - RecipientContainerId string `protobuf:"bytes,2,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` +type FrontendMetadata struct { + Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty" yaml:"version"` + Recipient string `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty" yaml:"recipient"` } -func (m *TxMemoData) Reset() { *m = TxMemoData{} } -func (m *TxMemoData) String() string { return proto.CompactTextString(m) } -func (*TxMemoData) ProtoMessage() {} -func (*TxMemoData) Descriptor() ([]byte, []int) { +func (m *FrontendMetadata) Reset() { *m = FrontendMetadata{} } +func (m *FrontendMetadata) String() string { return proto.CompactTextString(m) } +func (*FrontendMetadata) ProtoMessage() {} +func (*FrontendMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_6a43f0dcca886bed, []int{0} } -func (m *TxMemoData) XXX_Unmarshal(b []byte) error { +func (m *FrontendMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TxMemoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *FrontendMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TxMemoData.Marshal(b, m, deterministic) + return xxx_messageInfo_FrontendMetadata.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -49,34 +49,34 @@ func (m *TxMemoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *TxMemoData) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxMemoData.Merge(m, src) +func (m *FrontendMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_FrontendMetadata.Merge(m, src) } -func (m *TxMemoData) XXX_Size() int { +func (m *FrontendMetadata) XXX_Size() int { return m.Size() } -func (m *TxMemoData) XXX_DiscardUnknown() { - xxx_messageInfo_TxMemoData.DiscardUnknown(m) +func (m *FrontendMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_FrontendMetadata.DiscardUnknown(m) } -var xxx_messageInfo_TxMemoData proto.InternalMessageInfo +var xxx_messageInfo_FrontendMetadata proto.InternalMessageInfo -func (m *TxMemoData) GetVersion() string { +func (m *FrontendMetadata) GetVersion() uint32 { if m != nil { return m.Version } - return "" + return 0 } -func (m *TxMemoData) GetRecipientContainerId() string { +func (m *FrontendMetadata) GetRecipient() string { if m != nil { - return m.RecipientContainerId + return m.Recipient } return "" } func init() { - proto.RegisterType((*TxMemoData)(nil), "ununifi.ecosystemincentive.TxMemoData") + proto.RegisterType((*FrontendMetadata)(nil), "ununifi.ecosystemincentive.FrontendMetadata") } func init() { @@ -84,26 +84,25 @@ func init() { } var fileDescriptor_6a43f0dcca886bed = []byte{ - // 251 bytes of a gzipped FileDescriptorProto + // 239 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2d, 0xcd, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0xd4, 0x4f, 0x4d, 0xce, 0x2f, 0xae, 0x2c, 0x2e, 0x49, 0xcd, 0xcd, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0xcf, 0x4d, 0xcd, 0xcd, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x82, 0x2a, 0xd3, 0xc3, 0x54, 0x26, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, - 0xa6, 0x0f, 0x62, 0x41, 0x74, 0x28, 0x4d, 0x66, 0xe4, 0xe2, 0x0a, 0xa9, 0xf0, 0x4d, 0xcd, 0xcd, - 0x77, 0x49, 0x2c, 0x49, 0x14, 0xd2, 0xe1, 0x62, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, 0x93, - 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x12, 0xfa, 0x74, 0x4f, 0x9e, 0xaf, 0x32, 0x31, 0x37, 0xc7, - 0x4a, 0x09, 0x2a, 0xa1, 0x14, 0x04, 0x53, 0x22, 0x14, 0xce, 0x25, 0x56, 0x94, 0x9a, 0x9c, 0x59, - 0x90, 0x99, 0x9a, 0x57, 0x12, 0x9f, 0x9c, 0x9f, 0x57, 0x92, 0x98, 0x99, 0x97, 0x5a, 0x14, 0x9f, - 0x99, 0x22, 0xc1, 0x04, 0xd6, 0xac, 0xf8, 0xe9, 0x9e, 0xbc, 0x2c, 0x44, 0x33, 0x76, 0x75, 0x4a, - 0x41, 0x22, 0x70, 0x09, 0x67, 0x98, 0xb8, 0x67, 0x8a, 0x93, 0xef, 0x89, 0x47, 0x72, 0x8c, 0x17, - 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, - 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, - 0xea, 0x87, 0xe6, 0x85, 0xe6, 0x65, 0xba, 0x65, 0xea, 0x27, 0x67, 0x24, 0x66, 0xe6, 0xe9, 0x57, - 0x60, 0x0b, 0x9b, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x5f, 0x8d, 0x01, 0x01, 0x00, - 0x00, 0xff, 0xff, 0xf6, 0x3b, 0x8d, 0x4a, 0x46, 0x01, 0x00, 0x00, + 0xa6, 0x0f, 0x62, 0x41, 0x74, 0x28, 0x95, 0x70, 0x09, 0xb8, 0x15, 0xe5, 0xe7, 0x95, 0xa4, 0xe6, + 0xa5, 0xf8, 0xa6, 0x96, 0x24, 0xa6, 0x24, 0x96, 0x24, 0x0a, 0xe9, 0x70, 0xb1, 0x97, 0xa5, 0x16, + 0x15, 0x67, 0xe6, 0xe7, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x3a, 0x09, 0x7d, 0xba, 0x27, 0xcf, + 0x57, 0x99, 0x98, 0x9b, 0x63, 0xa5, 0x04, 0x95, 0x50, 0x0a, 0x82, 0x29, 0x11, 0x32, 0xe2, 0xe2, + 0x2c, 0x4a, 0x4d, 0xce, 0x2c, 0xc8, 0x4c, 0xcd, 0x2b, 0x91, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x74, + 0x12, 0xf9, 0x74, 0x4f, 0x5e, 0x00, 0xa2, 0x1e, 0x2e, 0xa5, 0x14, 0x84, 0x50, 0xe6, 0xe4, 0x7b, + 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, + 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xc6, 0xe9, 0x99, 0x25, 0x19, 0xa5, + 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xa1, 0x79, 0xa1, 0x79, 0x99, 0x6e, 0x99, 0xfa, 0xc9, 0x19, + 0x89, 0x99, 0x79, 0xfa, 0x15, 0xd8, 0xfc, 0x5e, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, + 0x8b, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x88, 0xdf, 0xdc, 0x19, 0x26, 0x01, 0x00, 0x00, } -func (m *TxMemoData) Marshal() (dAtA []byte, err error) { +func (m *FrontendMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -113,29 +112,27 @@ func (m *TxMemoData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TxMemoData) MarshalTo(dAtA []byte) (int, error) { +func (m *FrontendMetadata) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TxMemoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *FrontendMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintMemo(dAtA, i, uint64(len(m.RecipientContainerId))) + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintMemo(dAtA, i, uint64(len(m.Recipient))) i-- dAtA[i] = 0x12 } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintMemo(dAtA, i, uint64(len(m.Version))) + if m.Version != 0 { + i = encodeVarintMemo(dAtA, i, uint64(m.Version)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -151,17 +148,16 @@ func encodeVarintMemo(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TxMemoData) Size() (n int) { +func (m *FrontendMetadata) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Version) - if l > 0 { - n += 1 + l + sovMemo(uint64(l)) + if m.Version != 0 { + n += 1 + sovMemo(uint64(m.Version)) } - l = len(m.RecipientContainerId) + l = len(m.Recipient) if l > 0 { n += 1 + l + sovMemo(uint64(l)) } @@ -174,7 +170,7 @@ func sovMemo(x uint64) (n int) { func sozMemo(x uint64) (n int) { return sovMemo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *TxMemoData) Unmarshal(dAtA []byte) error { +func (m *FrontendMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -197,17 +193,17 @@ func (m *TxMemoData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TxMemoData: wiretype end group for non-group") + return fmt.Errorf("proto: FrontendMetadata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TxMemoData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FrontendMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } - var stringLen uint64 + m.Version = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMemo @@ -217,27 +213,14 @@ func (m *TxMemoData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Version |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMemo - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMemo - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -265,7 +248,7 @@ func (m *TxMemoData) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) + m.Recipient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/ecosystemincentive/types/msgs.go b/x/ecosystemincentive/types/msgs.go index e279f08cb..c7c675a8d 100644 --- a/x/ecosystemincentive/types/msgs.go +++ b/x/ecosystemincentive/types/msgs.go @@ -5,77 +5,11 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const ( - TypeMsgRegister = "register" - TypeMsgWithdrawAllRewards = "withdraw-all-rewards" - TypeMsgWithdrawReward = "withdraw-reward" -) - var ( - _ sdk.Msg = &MsgRegister{} _ sdk.Msg = &MsgWithdrawAllRewards{} _ sdk.Msg = &MsgWithdrawReward{} ) -func NewMsgRegister( - sender string, - recipientContainerId string, - subjectAddrs []string, - weights []sdk.Dec, -) *MsgRegister { - return &MsgRegister{ - Sender: sender, - RecipientContainerId: recipientContainerId, - Addresses: subjectAddrs, - Weights: weights, - } -} - -func (msg MsgRegister) Route() string { return RouterKey } - -func (msg MsgRegister) Type() string { return TypeMsgRegister } - -func (msg MsgRegister) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") - } - - for _, addr := range msg.Addresses { - if _, err := sdk.AccAddressFromBech32(addr); err != nil { - return err - } - } - - // return err if the number of elements in subjects and weights aren't same - if len(msg.Addresses) != len(msg.Weights) { - return sdkerrors.Wrapf(ErrSubjectsWeightsNumUnmatched, "subjects element num: %d, weights element num: %d", len(msg.Addresses), len(msg.Weights)) - } - - // the summed number of all weights must be 1 - totalWeight := sdk.ZeroDec() - for _, weight := range msg.Weights { - totalWeight = totalWeight.Add(weight) - } - if !(totalWeight.Equal(sdk.OneDec())) { - return sdkerrors.Wrap(ErrInvalidTotalWeight, totalWeight.String()) - } - - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgRegister) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgRegister) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(msg.Sender) - return []sdk.AccAddress{addr} -} - func NewMsgWithdrawAllRewards( sender string, ) *MsgWithdrawAllRewards { @@ -84,10 +18,6 @@ func NewMsgWithdrawAllRewards( } } -func (msg MsgWithdrawAllRewards) Route() string { return RouterKey } - -func (msg MsgWithdrawAllRewards) Type() string { return TypeMsgWithdrawAllRewards } - func (msg MsgWithdrawAllRewards) ValidateBasic() error { // check if addresses are valid if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { @@ -97,12 +27,6 @@ func (msg MsgWithdrawAllRewards) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgWithdrawAllRewards) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgWithdrawAllRewards) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -120,10 +44,6 @@ func NewMsgWithdrawReward( } } -func (msg MsgWithdrawReward) Route() string { return RouterKey } - -func (msg MsgWithdrawReward) Type() string { return TypeMsgWithdrawReward } - func (msg MsgWithdrawReward) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -133,12 +53,6 @@ func (msg MsgWithdrawReward) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgWithdrawReward) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgWithdrawReward) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) diff --git a/x/ecosystemincentive/types/params.go b/x/ecosystemincentive/types/params.go index f0b86baf6..4b6dcbef6 100644 --- a/x/ecosystemincentive/types/params.go +++ b/x/ecosystemincentive/types/params.go @@ -6,26 +6,25 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - nftmarkettypes "github.com/UnUniFi/chain/x/nftbackedloan/types" + nftbackedloantypes "github.com/UnUniFi/chain/x/nftbackedloan/types" ) var ( DafaultRewardParams = []*RewardParams{ { - ModuleName: nftmarkettypes.ModuleName, + ModuleName: nftbackedloantypes.ModuleName, RewardRate: []RewardRate{ + { + RewardType: RewardType_STAKERS, + Rate: sdk.MustNewDecFromStr("0.25"), + }, { RewardType: RewardType_FRONTEND_DEVELOPERS, - Rate: sdk.MustNewDecFromStr("0.5"), + Rate: sdk.MustNewDecFromStr("0.2"), }, - }, - }, - { - ModuleName: nftmarkettypes.ModuleName, - RewardRate: []RewardRate{ { - RewardType: RewardType_STAKERS, - Rate: sdk.MustNewDecFromStr("0.5"), + RewardType: RewardType_COMMUNITY_POOL, + Rate: sdk.MustNewDecFromStr("0.3"), }, }, }, @@ -74,6 +73,7 @@ func validateRewardParams(i interface{}) error { } for _, rewardParam := range rewardParams { + totalRate := sdk.ZeroDec() for _, rate := range rewardParam.RewardRate { if rate.Rate.GT(sdk.OneDec()) { return fmt.Errorf("each reward rate must be less than 1 dec") @@ -82,6 +82,11 @@ func validateRewardParams(i interface{}) error { if rate.Rate.IsNegative() { return fmt.Errorf("each reward rate must be positive") } + + totalRate = totalRate.Add(rate.Rate) + } + if totalRate.GT(sdk.OneDec()) { + return fmt.Errorf("total reward rate must be less than 1 dec") } } diff --git a/x/ecosystemincentive/types/params.pb.go b/x/ecosystemincentive/types/params.pb.go index 90eec6823..434f07cbe 100644 --- a/x/ecosystemincentive/types/params.pb.go +++ b/x/ecosystemincentive/types/params.pb.go @@ -24,25 +24,30 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// NFTMARKET_FRONTEND type reward will be disributed for the creators of frontend of UnUniFi's services. +// STAKERS type reward will be distributed for the stakers of GUU token. +// FRONTEND_DEVELOPERS type reward will be disributed for the creators of frontend of UnUniFi's services. +// COMMUNITY_POOL type reward will be distributed for the community pool. type RewardType int32 const ( RewardType_UNKNOWN RewardType = 0 RewardType_STAKERS RewardType = 1 RewardType_FRONTEND_DEVELOPERS RewardType = 2 + RewardType_COMMUNITY_POOL RewardType = 3 ) var RewardType_name = map[int32]string{ 0: "UNKNOWN", 1: "STAKERS", 2: "FRONTEND_DEVELOPERS", + 3: "COMMUNITY_POOL", } var RewardType_value = map[string]int32{ "UNKNOWN": 0, "STAKERS": 1, "FRONTEND_DEVELOPERS": 2, + "COMMUNITY_POOL": 3, } func (x RewardType) String() string { @@ -100,7 +105,7 @@ func (m *Params) GetRewardParams() []*RewardParams { // RewardParams defines which module have which rewards type and rate // to maintain the correctness of the fee rate in a module -// e.g. if nftmarket module have "Frontend" and "Collection" incentive, +// e.g. if nftbackedloan module have "Frontend" and "Collection" incentive, // the combined those rates for the incentive cannot be exceed 1 type RewardParams struct { ModuleName string `protobuf:"bytes,1,opt,name=module_name,json=moduleName,proto3" json:"module_name,omitempty" yaml:"module_name"` @@ -213,34 +218,35 @@ func init() { } var fileDescriptor_4a7b5cb0e4986851 = []byte{ - // 427 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0xaa, 0xd3, 0x40, - 0x18, 0xc5, 0x33, 0x57, 0xb9, 0xe2, 0xe4, 0x2a, 0x97, 0xf1, 0xa2, 0xa1, 0x8b, 0xe4, 0x92, 0xc5, - 0xb5, 0x08, 0x26, 0xe0, 0x5d, 0x08, 0x82, 0x88, 0xa1, 0xe9, 0xa6, 0x9a, 0xd6, 0xb4, 0x55, 0x70, - 0x13, 0xa6, 0xe9, 0x98, 0x0e, 0x76, 0x66, 0x62, 0xfe, 0xa8, 0x79, 0x0b, 0x1f, 0xc4, 0x87, 0x70, - 0xd9, 0x65, 0x97, 0xe2, 0x22, 0x48, 0xfb, 0x06, 0x7d, 0x02, 0xc9, 0x24, 0xb6, 0x11, 0x15, 0x5d, - 0x25, 0xc3, 0x9c, 0xef, 0x77, 0xce, 0x19, 0x3e, 0x78, 0x37, 0xe7, 0x39, 0xa7, 0x6f, 0xa8, 0x4d, - 0x42, 0x91, 0x16, 0x69, 0x46, 0x18, 0xe5, 0x21, 0xe1, 0x19, 0x7d, 0x4f, 0xec, 0x18, 0x27, 0x98, - 0xa5, 0x56, 0x9c, 0x88, 0x4c, 0xa0, 0x4e, 0x23, 0xb4, 0x7e, 0x17, 0x76, 0xce, 0x22, 0x11, 0x09, - 0x29, 0xb3, 0xab, 0xbf, 0x7a, 0xc2, 0x7c, 0x07, 0x8f, 0x47, 0x92, 0x80, 0x22, 0x78, 0x23, 0x21, - 0x1f, 0x70, 0x32, 0x0f, 0x6a, 0xa4, 0x06, 0xce, 0xaf, 0x74, 0xd5, 0x07, 0x5d, 0xeb, 0xef, 0x4c, - 0xcb, 0x97, 0x03, 0x35, 0xc0, 0xd1, 0x76, 0xa5, 0x71, 0x56, 0x60, 0xb6, 0x7c, 0x64, 0xfe, 0x02, - 0x32, 0xfd, 0x93, 0xa4, 0xa5, 0x33, 0x3f, 0x03, 0x78, 0xd2, 0x1e, 0x44, 0x0f, 0xa1, 0xca, 0xc4, - 0x3c, 0x5f, 0x92, 0x80, 0x63, 0x46, 0x34, 0x70, 0x0e, 0xba, 0xd7, 0x9d, 0xdb, 0xbb, 0xd2, 0x40, - 0x35, 0xad, 0x75, 0x69, 0xfa, 0xb0, 0x3e, 0x79, 0x98, 0x11, 0x14, 0x42, 0xb5, 0x71, 0x4a, 0x70, - 0x46, 0xb4, 0x23, 0x19, 0xf8, 0xe2, 0xdf, 0x81, 0x7d, 0x9c, 0x11, 0xa7, 0xb3, 0x2a, 0x0d, 0xe5, - 0x60, 0xd2, 0x02, 0x99, 0x3e, 0x4c, 0xf6, 0x3a, 0xf3, 0x0b, 0x80, 0xf0, 0x30, 0x86, 0x82, 0xbd, - 0x67, 0x56, 0xc4, 0x75, 0xd8, 0x9b, 0xff, 0xe3, 0x39, 0x29, 0x62, 0xd2, 0x2e, 0xd5, 0x82, 0xec, - 0xfd, 0x2a, 0x0d, 0x7a, 0x01, 0xaf, 0x36, 0x6d, 0xaa, 0x67, 0x78, 0x5c, 0xa5, 0xfc, 0x56, 0x1a, - 0x17, 0x11, 0xcd, 0x16, 0xf9, 0xcc, 0x0a, 0x05, 0xb3, 0x43, 0x91, 0x32, 0x91, 0x36, 0x9f, 0xfb, - 0xe9, 0xfc, 0xad, 0x5d, 0x51, 0x52, 0xab, 0x47, 0xc2, 0x5d, 0x69, 0xa8, 0x0d, 0x5f, 0x16, 0x91, - 0xa8, 0x7b, 0x4f, 0x7e, 0x36, 0x90, 0x06, 0x2a, 0xbc, 0x36, 0xf5, 0x06, 0xde, 0xf0, 0x95, 0x77, - 0xaa, 0x54, 0x87, 0xf1, 0xe4, 0xe9, 0xc0, 0xf5, 0xc7, 0xa7, 0x00, 0xdd, 0x81, 0xb7, 0xfa, 0xfe, - 0xd0, 0x9b, 0xb8, 0x5e, 0x2f, 0xe8, 0xb9, 0x2f, 0xdd, 0x67, 0xc3, 0x51, 0x75, 0x71, 0xe4, 0x3c, - 0x5f, 0x6d, 0x74, 0xb0, 0xde, 0xe8, 0xe0, 0xfb, 0x46, 0x07, 0x9f, 0xb6, 0xba, 0xb2, 0xde, 0xea, - 0xca, 0xd7, 0xad, 0xae, 0xbc, 0xbe, 0x6c, 0xe5, 0x9a, 0xf2, 0x29, 0xa7, 0x7d, 0x6a, 0x87, 0x0b, - 0x4c, 0xb9, 0xfd, 0xf1, 0x4f, 0xdb, 0x2a, 0x83, 0xce, 0x8e, 0xe5, 0xee, 0x5d, 0xfe, 0x08, 0x00, - 0x00, 0xff, 0xff, 0x48, 0xc5, 0x26, 0xc5, 0xd8, 0x02, 0x00, 0x00, + // 446 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6b, 0xd4, 0x40, + 0x18, 0xc6, 0x33, 0xad, 0x54, 0x9c, 0xd4, 0xb2, 0x8c, 0x45, 0x97, 0x3d, 0x24, 0x25, 0x87, 0xba, + 0x08, 0x26, 0x60, 0x0f, 0x82, 0xe0, 0xc1, 0x75, 0x53, 0x90, 0x76, 0x93, 0x35, 0x9b, 0x28, 0x7a, + 0x09, 0xd3, 0xec, 0x98, 0x0e, 0x76, 0x66, 0x62, 0xfe, 0xa8, 0xf9, 0x16, 0x7e, 0x10, 0x3f, 0x84, + 0xc7, 0x1e, 0x7b, 0x14, 0x0f, 0x41, 0x76, 0xbf, 0xc1, 0x7e, 0x02, 0xc9, 0x24, 0xee, 0x46, 0x54, + 0xf4, 0x94, 0x0c, 0xf3, 0xbc, 0xbf, 0xe7, 0x79, 0x86, 0x17, 0xde, 0x2d, 0x78, 0xc1, 0xe9, 0x1b, + 0x6a, 0x91, 0x48, 0x64, 0x65, 0x96, 0x13, 0x46, 0x79, 0x44, 0x78, 0x4e, 0xdf, 0x13, 0x2b, 0xc1, + 0x29, 0x66, 0x99, 0x99, 0xa4, 0x22, 0x17, 0x68, 0xd0, 0x0a, 0xcd, 0xdf, 0x85, 0x83, 0xfd, 0x58, + 0xc4, 0x42, 0xca, 0xac, 0xfa, 0xaf, 0x99, 0x30, 0xde, 0xc1, 0x9d, 0xa9, 0x24, 0xa0, 0x18, 0xde, + 0x4c, 0xc9, 0x07, 0x9c, 0xce, 0xc3, 0x06, 0xd9, 0x07, 0x07, 0xdb, 0x43, 0xf5, 0xc1, 0xd0, 0xfc, + 0x3b, 0xd3, 0xf4, 0xe4, 0x40, 0x03, 0x18, 0xf5, 0x57, 0x95, 0xbe, 0x5f, 0x62, 0x76, 0xf1, 0xc8, + 0xf8, 0x05, 0x64, 0x78, 0xbb, 0x69, 0x47, 0x67, 0x7c, 0x06, 0x70, 0xb7, 0x3b, 0x88, 0x1e, 0x42, + 0x95, 0x89, 0x79, 0x71, 0x41, 0x42, 0x8e, 0x19, 0xe9, 0x83, 0x03, 0x30, 0xbc, 0x31, 0xba, 0xbd, + 0xaa, 0x74, 0xd4, 0xd0, 0x3a, 0x97, 0x86, 0x07, 0x9b, 0x93, 0x83, 0x19, 0x41, 0x11, 0x54, 0x5b, + 0xa7, 0x14, 0xe7, 0xa4, 0xbf, 0x25, 0x03, 0x1f, 0xfe, 0x3b, 0xb0, 0x87, 0x73, 0x32, 0x1a, 0x5c, + 0x56, 0xba, 0xb2, 0x31, 0xe9, 0x80, 0x0c, 0x0f, 0xa6, 0x6b, 0x9d, 0xf1, 0x05, 0x40, 0xb8, 0x19, + 0x43, 0xe1, 0xda, 0x33, 0x2f, 0x93, 0x26, 0xec, 0xde, 0xff, 0x78, 0xfa, 0x65, 0x42, 0xba, 0xa5, + 0x3a, 0x90, 0xb5, 0x5f, 0xad, 0x41, 0xcf, 0xe1, 0xb5, 0xb6, 0x4d, 0xfd, 0x0c, 0x8f, 0xeb, 0x94, + 0xdf, 0x2a, 0xfd, 0x30, 0xa6, 0xf9, 0x79, 0x71, 0x66, 0x46, 0x82, 0x59, 0x91, 0xc8, 0x98, 0xc8, + 0xda, 0xcf, 0xfd, 0x6c, 0xfe, 0xd6, 0xaa, 0x29, 0x99, 0x39, 0x26, 0xd1, 0xaa, 0xd2, 0xd5, 0x96, + 0x2f, 0x8b, 0x48, 0xd4, 0xbd, 0xd9, 0xcf, 0x06, 0xd2, 0x40, 0x85, 0xd7, 0x03, 0xe7, 0xc4, 0x71, + 0x5f, 0x3a, 0x3d, 0xa5, 0x3e, 0xcc, 0xfc, 0x27, 0x27, 0xb6, 0x37, 0xeb, 0x01, 0x74, 0x07, 0xde, + 0x3a, 0xf6, 0x5c, 0xc7, 0xb7, 0x9d, 0x71, 0x38, 0xb6, 0x5f, 0xd8, 0xa7, 0xee, 0xb4, 0xbe, 0xd8, + 0x42, 0x08, 0xee, 0x3d, 0x75, 0x27, 0x93, 0xc0, 0x79, 0xe6, 0xbf, 0x0a, 0xa7, 0xae, 0x7b, 0xda, + 0xdb, 0x1e, 0x4d, 0x2e, 0x17, 0x1a, 0xb8, 0x5a, 0x68, 0xe0, 0xfb, 0x42, 0x03, 0x9f, 0x96, 0x9a, + 0x72, 0xb5, 0xd4, 0x94, 0xaf, 0x4b, 0x4d, 0x79, 0x7d, 0xd4, 0xc9, 0x1a, 0xf0, 0x80, 0xd3, 0x63, + 0x6a, 0x45, 0xe7, 0x98, 0x72, 0xeb, 0xe3, 0x9f, 0x36, 0x58, 0x86, 0x3f, 0xdb, 0x91, 0xfb, 0x78, + 0xf4, 0x23, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xe1, 0xd3, 0x6d, 0xec, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/ecosystemincentive/types/query.pb.go b/x/ecosystemincentive/types/query.pb.go index 7481df9d3..20bb8ee21 100644 --- a/x/ecosystemincentive/types/query.pb.go +++ b/x/ecosystemincentive/types/query.pb.go @@ -112,94 +112,6 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryRecipientContainerRequest struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` -} - -func (m *QueryRecipientContainerRequest) Reset() { *m = QueryRecipientContainerRequest{} } -func (m *QueryRecipientContainerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRecipientContainerRequest) ProtoMessage() {} -func (*QueryRecipientContainerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{2} -} -func (m *QueryRecipientContainerRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRecipientContainerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRecipientContainerRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryRecipientContainerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecipientContainerRequest.Merge(m, src) -} -func (m *QueryRecipientContainerRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRecipientContainerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecipientContainerRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRecipientContainerRequest proto.InternalMessageInfo - -func (m *QueryRecipientContainerRequest) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -type QueryRecipientContainerResponse struct { - RecipientContainer *RecipientContainer `protobuf:"bytes,1,opt,name=recipient_container,json=recipientContainer,proto3" json:"recipient_container,omitempty" yaml:"recipient_container"` -} - -func (m *QueryRecipientContainerResponse) Reset() { *m = QueryRecipientContainerResponse{} } -func (m *QueryRecipientContainerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRecipientContainerResponse) ProtoMessage() {} -func (*QueryRecipientContainerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{3} -} -func (m *QueryRecipientContainerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRecipientContainerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRecipientContainerResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryRecipientContainerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecipientContainerResponse.Merge(m, src) -} -func (m *QueryRecipientContainerResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRecipientContainerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecipientContainerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRecipientContainerResponse proto.InternalMessageInfo - -func (m *QueryRecipientContainerResponse) GetRecipientContainer() *RecipientContainer { - if m != nil { - return m.RecipientContainer - } - return nil -} - type QueryAllRewardsRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` } @@ -208,7 +120,7 @@ func (m *QueryAllRewardsRequest) Reset() { *m = QueryAllRewardsRequest{} func (m *QueryAllRewardsRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllRewardsRequest) ProtoMessage() {} func (*QueryAllRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{4} + return fileDescriptor_bcc47a5d1657c31d, []int{2} } func (m *QueryAllRewardsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -245,14 +157,14 @@ func (m *QueryAllRewardsRequest) GetAddress() string { } type QueryAllRewardsResponse struct { - Rewards RewardStore `protobuf:"bytes,1,opt,name=rewards,proto3" json:"rewards" yaml:"rewards"` + RewardRecord RewardRecord `protobuf:"bytes,1,opt,name=reward_record,json=rewardRecord,proto3" json:"reward_record" yaml:"reward_record"` } func (m *QueryAllRewardsResponse) Reset() { *m = QueryAllRewardsResponse{} } func (m *QueryAllRewardsResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllRewardsResponse) ProtoMessage() {} func (*QueryAllRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{5} + return fileDescriptor_bcc47a5d1657c31d, []int{3} } func (m *QueryAllRewardsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -281,11 +193,11 @@ func (m *QueryAllRewardsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllRewardsResponse proto.InternalMessageInfo -func (m *QueryAllRewardsResponse) GetRewards() RewardStore { +func (m *QueryAllRewardsResponse) GetRewardRecord() RewardRecord { if m != nil { - return m.Rewards + return m.RewardRecord } - return RewardStore{} + return RewardRecord{} } type QueryRewardRequest struct { @@ -297,7 +209,7 @@ func (m *QueryRewardRequest) Reset() { *m = QueryRewardRequest{} } func (m *QueryRewardRequest) String() string { return proto.CompactTextString(m) } func (*QueryRewardRequest) ProtoMessage() {} func (*QueryRewardRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{6} + return fileDescriptor_bcc47a5d1657c31d, []int{4} } func (m *QueryRewardRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -348,7 +260,7 @@ func (m *QueryRewardResponse) Reset() { *m = QueryRewardResponse{} } func (m *QueryRewardResponse) String() string { return proto.CompactTextString(m) } func (*QueryRewardResponse) ProtoMessage() {} func (*QueryRewardResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{7} + return fileDescriptor_bcc47a5d1657c31d, []int{5} } func (m *QueryRewardResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -384,217 +296,13 @@ func (m *QueryRewardResponse) GetReward() types.Coin { return types.Coin{} } -type QueryRecordedRecipientContainerIdRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty" yaml:"nft_id"` -} - -func (m *QueryRecordedRecipientContainerIdRequest) Reset() { - *m = QueryRecordedRecipientContainerIdRequest{} -} -func (m *QueryRecordedRecipientContainerIdRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRecordedRecipientContainerIdRequest) ProtoMessage() {} -func (*QueryRecordedRecipientContainerIdRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{8} -} -func (m *QueryRecordedRecipientContainerIdRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRecordedRecipientContainerIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRecordedRecipientContainerIdRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryRecordedRecipientContainerIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordedRecipientContainerIdRequest.Merge(m, src) -} -func (m *QueryRecordedRecipientContainerIdRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRecordedRecipientContainerIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordedRecipientContainerIdRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRecordedRecipientContainerIdRequest proto.InternalMessageInfo - -func (m *QueryRecordedRecipientContainerIdRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryRecordedRecipientContainerIdRequest) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type QueryRecordedRecipientContainerIdResponse struct { - RecipientContainerId string `protobuf:"bytes,1,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` -} - -func (m *QueryRecordedRecipientContainerIdResponse) Reset() { - *m = QueryRecordedRecipientContainerIdResponse{} -} -func (m *QueryRecordedRecipientContainerIdResponse) String() string { - return proto.CompactTextString(m) -} -func (*QueryRecordedRecipientContainerIdResponse) ProtoMessage() {} -func (*QueryRecordedRecipientContainerIdResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{9} -} -func (m *QueryRecordedRecipientContainerIdResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRecordedRecipientContainerIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRecordedRecipientContainerIdResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryRecordedRecipientContainerIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordedRecipientContainerIdResponse.Merge(m, src) -} -func (m *QueryRecordedRecipientContainerIdResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRecordedRecipientContainerIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordedRecipientContainerIdResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRecordedRecipientContainerIdResponse proto.InternalMessageInfo - -func (m *QueryRecordedRecipientContainerIdResponse) GetRecipientContainerId() string { - if m != nil { - return m.RecipientContainerId - } - return "" -} - -type QueryBelongingRecipientContainerIdsByAddrRequest struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` -} - -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) Reset() { - *m = QueryBelongingRecipientContainerIdsByAddrRequest{} -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) String() string { - return proto.CompactTextString(m) -} -func (*QueryBelongingRecipientContainerIdsByAddrRequest) ProtoMessage() {} -func (*QueryBelongingRecipientContainerIdsByAddrRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{10} -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrRequest.Merge(m, src) -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrRequest proto.InternalMessageInfo - -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -type QueryBelongingRecipientContainerIdsByAddrResponse struct { - RecipientContainerIds []string `protobuf:"bytes,2,rep,name=recipient_container_ids,json=recipientContainerIds,proto3" json:"recipient_container_ids,omitempty" yaml:"recipient_container_ids"` -} - -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) Reset() { - *m = QueryBelongingRecipientContainerIdsByAddrResponse{} -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) String() string { - return proto.CompactTextString(m) -} -func (*QueryBelongingRecipientContainerIdsByAddrResponse) ProtoMessage() {} -func (*QueryBelongingRecipientContainerIdsByAddrResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bcc47a5d1657c31d, []int{11} -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrResponse.Merge(m, src) -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBelongingRecipientContainerIdsByAddrResponse proto.InternalMessageInfo - -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) GetRecipientContainerIds() []string { - if m != nil { - return m.RecipientContainerIds - } - return nil -} - func init() { proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.ecosystemincentive.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.ecosystemincentive.QueryParamsResponse") - proto.RegisterType((*QueryRecipientContainerRequest)(nil), "ununifi.ecosystemincentive.QueryRecipientContainerRequest") - proto.RegisterType((*QueryRecipientContainerResponse)(nil), "ununifi.ecosystemincentive.QueryRecipientContainerResponse") proto.RegisterType((*QueryAllRewardsRequest)(nil), "ununifi.ecosystemincentive.QueryAllRewardsRequest") proto.RegisterType((*QueryAllRewardsResponse)(nil), "ununifi.ecosystemincentive.QueryAllRewardsResponse") proto.RegisterType((*QueryRewardRequest)(nil), "ununifi.ecosystemincentive.QueryRewardRequest") proto.RegisterType((*QueryRewardResponse)(nil), "ununifi.ecosystemincentive.QueryRewardResponse") - proto.RegisterType((*QueryRecordedRecipientContainerIdRequest)(nil), "ununifi.ecosystemincentive.QueryRecordedRecipientContainerIdRequest") - proto.RegisterType((*QueryRecordedRecipientContainerIdResponse)(nil), "ununifi.ecosystemincentive.QueryRecordedRecipientContainerIdResponse") - proto.RegisterType((*QueryBelongingRecipientContainerIdsByAddrRequest)(nil), "ununifi.ecosystemincentive.QueryBelongingRecipientContainerIdsByAddrRequest") - proto.RegisterType((*QueryBelongingRecipientContainerIdsByAddrResponse)(nil), "ununifi.ecosystemincentive.QueryBelongingRecipientContainerIdsByAddrResponse") } func init() { @@ -602,66 +310,44 @@ func init() { } var fileDescriptor_bcc47a5d1657c31d = []byte{ - // 931 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0xdc, 0x44, - 0x18, 0x8d, 0x17, 0x65, 0x43, 0x06, 0x5a, 0x60, 0x92, 0xa6, 0xc1, 0x6a, 0xed, 0x32, 0xaa, 0x9a, - 0x50, 0x11, 0x0f, 0xc9, 0xaa, 0x42, 0x2a, 0x42, 0x50, 0xb7, 0x44, 0x8a, 0xd4, 0x08, 0x6a, 0x14, - 0x21, 0x7a, 0x29, 0x5e, 0x7b, 0xe2, 0x0c, 0xec, 0xce, 0x6c, 0x3d, 0xde, 0xc2, 0x6a, 0xb5, 0x42, - 0xaa, 0x38, 0x71, 0x01, 0x84, 0xf8, 0x03, 0x9c, 0x10, 0xe2, 0x87, 0xf4, 0xc0, 0xa1, 0x12, 0x17, - 0x4e, 0x06, 0x12, 0x7e, 0x81, 0x7f, 0x01, 0xda, 0x99, 0xf1, 0x26, 0x8b, 0xbd, 0xde, 0x4d, 0xe8, - 0x29, 0xd6, 0xcc, 0xf7, 0xbd, 0xef, 0xbd, 0xcf, 0x2f, 0xcf, 0x0b, 0xae, 0x75, 0x59, 0x97, 0xd1, - 0x7d, 0x8a, 0x49, 0xc0, 0x45, 0x4f, 0x24, 0xa4, 0x4d, 0x59, 0x40, 0x58, 0x42, 0x1f, 0x11, 0xfc, - 0xb0, 0x4b, 0xe2, 0x9e, 0xd3, 0x89, 0x79, 0xc2, 0xa1, 0xa9, 0xeb, 0x9c, 0x62, 0x9d, 0xb9, 0x1c, - 0xf1, 0x88, 0xcb, 0x32, 0x3c, 0x7c, 0x52, 0x1d, 0xe6, 0xa5, 0x88, 0xf3, 0xa8, 0x45, 0xb0, 0xdf, - 0xa1, 0xd8, 0x67, 0x8c, 0x27, 0x7e, 0x42, 0x39, 0x13, 0xfa, 0xf6, 0x7a, 0xc0, 0x45, 0x9b, 0x0b, - 0xdc, 0xf4, 0x85, 0x1e, 0x84, 0x1f, 0x6d, 0x36, 0x49, 0xe2, 0x6f, 0xe2, 0x8e, 0x1f, 0x51, 0x26, - 0x8b, 0x75, 0xed, 0x5a, 0x05, 0xc7, 0x8e, 0x1f, 0xfb, 0xed, 0x1c, 0xb4, 0x51, 0x51, 0x58, 0x3c, - 0xd2, 0x4d, 0xd6, 0x49, 0x26, 0x39, 0x87, 0x80, 0x53, 0x3d, 0x1d, 0x2d, 0x03, 0x78, 0x6f, 0xc8, - 0xef, 0x43, 0x39, 0xc9, 0x23, 0x0f, 0xbb, 0x44, 0x24, 0xe8, 0x00, 0x2c, 0x8d, 0x9d, 0x8a, 0x0e, - 0x67, 0x82, 0xc0, 0x7b, 0xa0, 0xae, 0x18, 0xad, 0x1a, 0x57, 0x8c, 0xf5, 0x17, 0xb6, 0x90, 0x33, - 0x79, 0x6f, 0x8e, 0xea, 0x75, 0x2f, 0x3c, 0x49, 0xed, 0xb9, 0x2c, 0xb5, 0xcf, 0xf5, 0xfc, 0x76, - 0xeb, 0x26, 0x52, 0xfd, 0xc8, 0xd3, 0x40, 0xe8, 0x5d, 0x60, 0xc9, 0x49, 0x1e, 0x09, 0x68, 0x87, - 0x12, 0x96, 0xdc, 0xe6, 0x2c, 0xf1, 0x29, 0x23, 0xb1, 0xe6, 0x02, 0x2f, 0x83, 0x1a, 0x0d, 0xe5, - 0xc0, 0x45, 0xf7, 0x5c, 0x96, 0xda, 0x8b, 0x0a, 0x88, 0x86, 0xc8, 0xab, 0xd1, 0x10, 0xfd, 0x64, - 0x00, 0x7b, 0x22, 0x82, 0xe6, 0xfd, 0x15, 0x58, 0x8a, 0xf3, 0xdb, 0x07, 0x41, 0x7e, 0xad, 0x45, - 0x38, 0x55, 0x22, 0x8a, 0xa0, 0xae, 0x95, 0xa5, 0xb6, 0xa9, 0x38, 0x94, 0x80, 0x22, 0x0f, 0xc6, - 0x85, 0x1e, 0xb4, 0x0d, 0x56, 0x24, 0xc7, 0x5b, 0xad, 0x96, 0x47, 0xbe, 0xf0, 0xe3, 0x30, 0xdf, - 0x34, 0x7c, 0x03, 0x2c, 0xf8, 0x61, 0x18, 0x13, 0x21, 0xb4, 0x44, 0x98, 0xa5, 0xf6, 0x79, 0x05, - 0xaf, 0x2f, 0x90, 0x97, 0x97, 0xa0, 0x04, 0x5c, 0x2c, 0xe0, 0x68, 0x8d, 0x9f, 0x80, 0x85, 0x58, - 0x1d, 0x69, 0x5d, 0x6b, 0xd5, 0xba, 0x86, 0xa5, 0x1f, 0x25, 0x3c, 0x26, 0xee, 0x8a, 0x7e, 0x43, - 0xe7, 0x73, 0x51, 0x12, 0x05, 0x79, 0x39, 0x1e, 0xfa, 0x4c, 0x7b, 0x44, 0x35, 0x9d, 0x89, 0x39, - 0xbc, 0x06, 0xe6, 0x43, 0xc2, 0x78, 0x7b, 0xb5, 0x26, 0x6b, 0x5f, 0xce, 0x52, 0xfb, 0x45, 0x55, - 0x2b, 0x8f, 0x91, 0xa7, 0xae, 0xd1, 0x37, 0x86, 0xb6, 0x5e, 0x3e, 0x4c, 0xcb, 0x13, 0xa0, 0xae, - 0xe8, 0x68, 0x75, 0xaf, 0x3a, 0xca, 0xd8, 0xce, 0xd0, 0xd8, 0x8e, 0x36, 0xb6, 0x73, 0x9b, 0x53, - 0xe6, 0xbe, 0x37, 0xee, 0x38, 0xd5, 0x86, 0x7e, 0xf9, 0xd3, 0x5e, 0x8b, 0x68, 0x72, 0xd0, 0x6d, - 0x3a, 0x01, 0x6f, 0x63, 0xfd, 0x6f, 0xa1, 0xfe, 0x6c, 0x88, 0xf0, 0x73, 0x9c, 0xf4, 0x3a, 0x44, - 0x48, 0x04, 0x4f, 0x8f, 0x42, 0x5f, 0x1b, 0x60, 0x3d, 0xf7, 0x16, 0x8f, 0x43, 0x12, 0x16, 0xed, - 0xb0, 0x33, 0xda, 0x87, 0x03, 0x9e, 0x0f, 0x5a, 0xbe, 0x10, 0x0f, 0x46, 0x6e, 0x5d, 0xca, 0x52, - 0xfb, 0x25, 0x45, 0x22, 0xbf, 0x41, 0xde, 0x82, 0x7c, 0xdc, 0x09, 0xe1, 0x3a, 0xa8, 0xb3, 0xfd, - 0x64, 0x58, 0xad, 0x56, 0xf2, 0xca, 0x31, 0x65, 0x75, 0x8e, 0xbc, 0x79, 0xb6, 0x9f, 0xec, 0x48, - 0x1a, 0xaf, 0xcf, 0x40, 0x43, 0x6f, 0xea, 0x63, 0xb0, 0x52, 0xe2, 0xcb, 0x63, 0x56, 0xaf, 0x65, - 0xa9, 0x7d, 0x79, 0xa2, 0x7f, 0xe5, 0xdc, 0xe5, 0xb8, 0x64, 0x00, 0xfa, 0x14, 0xbc, 0x29, 0x59, - 0xb8, 0xa4, 0xc5, 0x59, 0x44, 0x59, 0x54, 0x46, 0x43, 0xb8, 0xbd, 0x5b, 0x61, 0x18, 0x9f, 0xcd, - 0xde, 0xdf, 0x1a, 0x60, 0xf3, 0x14, 0x23, 0xb4, 0xe0, 0xfb, 0xe0, 0x62, 0xb9, 0x10, 0xb1, 0x5a, - 0xbb, 0xf2, 0xdc, 0xfa, 0xa2, 0x8b, 0xb2, 0xd4, 0xb6, 0xaa, 0x14, 0x0b, 0xe4, 0x5d, 0x28, 0x93, - 0x2c, 0xb6, 0xfe, 0x5e, 0x04, 0xf3, 0x92, 0x11, 0xfc, 0xd1, 0x00, 0x75, 0x15, 0x69, 0xb0, 0x32, - 0x31, 0x8a, 0x69, 0x6a, 0xe2, 0x99, 0xeb, 0x95, 0x22, 0x74, 0xfd, 0xf1, 0xef, 0xff, 0xfc, 0x50, - 0xbb, 0x0a, 0x11, 0x9e, 0xfa, 0x6d, 0x80, 0xbf, 0x19, 0x00, 0x16, 0xb7, 0x04, 0x6f, 0x4e, 0x9d, - 0x39, 0x31, 0x71, 0xcd, 0xb7, 0xcf, 0xd4, 0xab, 0xb9, 0xbf, 0x23, 0xb9, 0xbf, 0x05, 0x6f, 0x54, - 0x71, 0x1f, 0x2d, 0x7b, 0x63, 0xf4, 0x1a, 0x04, 0xee, 0xd3, 0x70, 0x00, 0x7f, 0x35, 0x00, 0x38, - 0x4e, 0x37, 0xb8, 0x35, 0x95, 0x4a, 0x21, 0x52, 0xcd, 0xc6, 0xa9, 0x7a, 0x34, 0xed, 0x1b, 0x92, - 0x36, 0x86, 0x1b, 0xd5, 0xb4, 0x65, 0x13, 0xee, 0x6b, 0xc3, 0x0e, 0xe0, 0xcf, 0x06, 0xa8, 0x2b, - 0xa8, 0x19, 0x5c, 0x31, 0x96, 0x9f, 0x33, 0xb8, 0x62, 0x3c, 0x02, 0x67, 0xdd, 0xec, 0x7f, 0x28, - 0xe2, 0xbe, 0x0c, 0xd6, 0x01, 0x7c, 0x5c, 0x03, 0x97, 0xaa, 0x02, 0x04, 0xde, 0x99, 0xe5, 0xb5, - 0x4f, 0x8b, 0x41, 0xf3, 0xfd, 0xff, 0x89, 0xa2, 0xc5, 0xee, 0x49, 0xb1, 0x1f, 0xc0, 0xdd, 0x29, - 0x36, 0x92, 0x48, 0x1b, 0xe5, 0x7e, 0xca, 0x43, 0x77, 0x80, 0xfb, 0x2a, 0x51, 0x07, 0xf0, 0xfb, - 0x1a, 0xb8, 0x3a, 0x4b, 0xb8, 0xc0, 0xbb, 0x53, 0x65, 0x9c, 0x22, 0x06, 0xcd, 0xdd, 0x67, 0x84, - 0xa6, 0x97, 0x73, 0x57, 0x2e, 0x67, 0x1b, 0xde, 0xa9, 0x5a, 0x4e, 0x33, 0x47, 0x9c, 0xb0, 0x9d, - 0xdc, 0x20, 0xee, 0xee, 0x93, 0x43, 0xcb, 0x78, 0x7a, 0x68, 0x19, 0x7f, 0x1d, 0x5a, 0xc6, 0x77, - 0x47, 0xd6, 0xdc, 0xd3, 0x23, 0x6b, 0xee, 0x8f, 0x23, 0x6b, 0xee, 0x7e, 0xe3, 0xc4, 0x07, 0x73, - 0x8f, 0xed, 0x31, 0xba, 0x4d, 0x71, 0x70, 0xe0, 0x53, 0x86, 0xbf, 0x2c, 0x9b, 0x28, 0xbf, 0xa0, - 0xcd, 0xba, 0xfc, 0x61, 0xd9, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x50, 0xcc, 0xc0, 0x83, 0x7c, - 0x0b, 0x00, 0x00, + // 591 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0x56, 0x1a, 0x71, 0x6c, 0x45, 0xc6, 0xaa, 0x35, 0x94, 0x8d, 0x0c, 0xd2, 0x96, 0x62, + 0x77, 0x68, 0x42, 0x11, 0x04, 0x41, 0x23, 0xf4, 0x26, 0xd8, 0x85, 0x5e, 0xbc, 0xc8, 0x64, 0x77, + 0xdc, 0x8c, 0xcd, 0xce, 0x6c, 0x77, 0x36, 0xd5, 0x50, 0x7a, 0xf1, 0xe0, 0xc1, 0x93, 0x20, 0xfe, + 0x07, 0x11, 0x7f, 0x48, 0x8f, 0x05, 0x2f, 0x9e, 0xa2, 0x24, 0xfe, 0x82, 0xdc, 0xbc, 0x49, 0x66, + 0xde, 0x62, 0x42, 0x74, 0x9b, 0x7a, 0xda, 0xe5, 0xcd, 0xf7, 0xbe, 0xef, 0x7b, 0x6f, 0xbe, 0x5d, + 0xb4, 0xda, 0x91, 0x1d, 0x29, 0x5e, 0x08, 0xca, 0x03, 0xa5, 0xbb, 0x3a, 0xe3, 0xb1, 0x90, 0x01, + 0x97, 0x99, 0x38, 0xe4, 0xf4, 0xa0, 0xc3, 0xd3, 0xae, 0x97, 0xa4, 0x2a, 0x53, 0xb8, 0x02, 0x38, + 0x6f, 0x1a, 0x57, 0x59, 0x8a, 0x54, 0xa4, 0x0c, 0x8c, 0x8e, 0xde, 0x6c, 0x47, 0x65, 0x25, 0x52, + 0x2a, 0x6a, 0x73, 0xca, 0x12, 0x41, 0x99, 0x94, 0x2a, 0x63, 0x99, 0x50, 0x52, 0xc3, 0xe9, 0x46, + 0xa0, 0x74, 0xac, 0x34, 0x6d, 0x32, 0x0d, 0x42, 0xf4, 0x70, 0xab, 0xc9, 0x33, 0xb6, 0x45, 0x13, + 0x16, 0x09, 0x69, 0xc0, 0x80, 0x5d, 0x2b, 0xf0, 0x98, 0xb0, 0x94, 0xc5, 0x39, 0x69, 0xbd, 0x00, + 0x38, 0x5d, 0x82, 0x26, 0x77, 0xdc, 0x49, 0xee, 0x21, 0x50, 0x02, 0xd4, 0xc9, 0x12, 0xc2, 0xbb, + 0x23, 0x7f, 0x4f, 0x8d, 0x92, 0xcf, 0x0f, 0x3a, 0x5c, 0x67, 0xa4, 0x85, 0xae, 0x4d, 0x54, 0x75, + 0xa2, 0xa4, 0xe6, 0x78, 0x17, 0x95, 0xad, 0xa3, 0x65, 0xe7, 0xb6, 0xb3, 0x7e, 0xb9, 0x46, 0xbc, + 0x7f, 0xef, 0xcd, 0xb3, 0xbd, 0x8d, 0xeb, 0x27, 0xbd, 0x6a, 0x69, 0xd8, 0xab, 0x2e, 0x76, 0x59, + 0xdc, 0xbe, 0x4f, 0x6c, 0x3f, 0xf1, 0x81, 0x88, 0xec, 0xa0, 0x1b, 0x46, 0xe9, 0x51, 0xbb, 0xed, + 0xf3, 0x57, 0x2c, 0x0d, 0x73, 0x0f, 0xf8, 0x2e, 0xba, 0xc8, 0xc2, 0x30, 0xe5, 0xda, 0xaa, 0x5d, + 0x6a, 0xe0, 0x61, 0xaf, 0x7a, 0xc5, 0xb2, 0xc0, 0x01, 0xf1, 0x73, 0x08, 0x79, 0xeb, 0xa0, 0x9b, + 0x53, 0x44, 0x60, 0x7b, 0x1f, 0x2d, 0xa6, 0xa6, 0xf4, 0x3c, 0xe5, 0x81, 0x4a, 0x43, 0x70, 0xbf, + 0x5e, 0xe4, 0xde, 0x72, 0xf8, 0x06, 0xdf, 0x58, 0x81, 0x19, 0x96, 0xac, 0xfa, 0x04, 0x19, 0xf1, + 0x17, 0xd2, 0x31, 0x2c, 0x79, 0x09, 0x0b, 0xcd, 0x09, 0xfe, 0x63, 0x18, 0xbc, 0x8a, 0xe6, 0x43, + 0x2e, 0x55, 0xbc, 0x3c, 0x67, 0xb0, 0x57, 0x87, 0xbd, 0xea, 0x82, 0xc5, 0x9a, 0x32, 0xf1, 0xed, + 0x31, 0x79, 0xe7, 0xc0, 0x3d, 0xe5, 0x62, 0x30, 0xb0, 0x46, 0x65, 0xeb, 0x09, 0x26, 0xbd, 0xe5, + 0xd9, 0x14, 0x78, 0xa3, 0x14, 0x78, 0x90, 0x02, 0xef, 0xb1, 0x12, 0xb2, 0xf1, 0x70, 0xf2, 0x7a, + 0x6c, 0x1b, 0xf9, 0xfc, 0xbd, 0xba, 0x16, 0x89, 0xac, 0xd5, 0x69, 0x7a, 0x81, 0x8a, 0x29, 0x64, + 0xc8, 0x3e, 0x36, 0x75, 0xb8, 0x4f, 0xb3, 0x6e, 0xc2, 0xb5, 0x61, 0xf0, 0x41, 0xaa, 0xf6, 0xeb, + 0x02, 0x9a, 0x37, 0x66, 0xf0, 0x47, 0x07, 0x95, 0xed, 0xed, 0x63, 0xaf, 0x68, 0xc7, 0xd3, 0xc1, + 0xab, 0xd0, 0x99, 0xf1, 0x76, 0x54, 0xb2, 0xf1, 0xe6, 0xeb, 0xcf, 0x0f, 0x73, 0x77, 0x30, 0xa1, + 0x67, 0x7e, 0x46, 0xf8, 0x8b, 0x83, 0xd0, 0x9f, 0x78, 0xe0, 0xda, 0x99, 0x5a, 0x53, 0xa1, 0xac, + 0xd4, 0xcf, 0xd5, 0x03, 0x1e, 0xb7, 0x8d, 0x47, 0x8a, 0x37, 0x8b, 0x3c, 0xda, 0x2d, 0x6a, 0x7a, + 0x04, 0x21, 0x38, 0xc6, 0x9f, 0x1c, 0x54, 0xb6, 0x54, 0x33, 0xac, 0x71, 0x22, 0x6e, 0x33, 0xac, + 0x71, 0x32, 0x31, 0xe4, 0x81, 0xb1, 0x78, 0x0f, 0x6f, 0x9f, 0xcb, 0x22, 0x3d, 0x32, 0x39, 0x3c, + 0x6e, 0x3c, 0x39, 0xe9, 0xbb, 0xce, 0x69, 0xdf, 0x75, 0x7e, 0xf4, 0x5d, 0xe7, 0xfd, 0xc0, 0x2d, + 0x9d, 0x0e, 0xdc, 0xd2, 0xb7, 0x81, 0x5b, 0x7a, 0x56, 0x1f, 0x8b, 0xd1, 0x9e, 0xdc, 0x93, 0x62, + 0x47, 0xd0, 0xa0, 0xc5, 0x84, 0xa4, 0xaf, 0xff, 0x26, 0x61, 0x72, 0xd5, 0x2c, 0x9b, 0x7f, 0x53, + 0xfd, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0xd3, 0x62, 0x7e, 0xbf, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -678,11 +364,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - RecipientContainer(ctx context.Context, in *QueryRecipientContainerRequest, opts ...grpc.CallOption) (*QueryRecipientContainerResponse, error) AllRewards(ctx context.Context, in *QueryAllRewardsRequest, opts ...grpc.CallOption) (*QueryAllRewardsResponse, error) Reward(ctx context.Context, in *QueryRewardRequest, opts ...grpc.CallOption) (*QueryRewardResponse, error) - RecordedRecipientContainerId(ctx context.Context, in *QueryRecordedRecipientContainerIdRequest, opts ...grpc.CallOption) (*QueryRecordedRecipientContainerIdResponse, error) - BelongingRecipientContainerIdsByAddr(ctx context.Context, in *QueryBelongingRecipientContainerIdsByAddrRequest, opts ...grpc.CallOption) (*QueryBelongingRecipientContainerIdsByAddrResponse, error) } type queryClient struct { @@ -702,15 +385,6 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) RecipientContainer(ctx context.Context, in *QueryRecipientContainerRequest, opts ...grpc.CallOption) (*QueryRecipientContainerResponse, error) { - out := new(QueryRecipientContainerResponse) - err := c.cc.Invoke(ctx, "/ununifi.ecosystemincentive.Query/RecipientContainer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) AllRewards(ctx context.Context, in *QueryAllRewardsRequest, opts ...grpc.CallOption) (*QueryAllRewardsResponse, error) { out := new(QueryAllRewardsResponse) err := c.cc.Invoke(ctx, "/ununifi.ecosystemincentive.Query/AllRewards", in, out, opts...) @@ -729,33 +403,12 @@ func (c *queryClient) Reward(ctx context.Context, in *QueryRewardRequest, opts . return out, nil } -func (c *queryClient) RecordedRecipientContainerId(ctx context.Context, in *QueryRecordedRecipientContainerIdRequest, opts ...grpc.CallOption) (*QueryRecordedRecipientContainerIdResponse, error) { - out := new(QueryRecordedRecipientContainerIdResponse) - err := c.cc.Invoke(ctx, "/ununifi.ecosystemincentive.Query/RecordedRecipientContainerId", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) BelongingRecipientContainerIdsByAddr(ctx context.Context, in *QueryBelongingRecipientContainerIdsByAddrRequest, opts ...grpc.CallOption) (*QueryBelongingRecipientContainerIdsByAddrResponse, error) { - out := new(QueryBelongingRecipientContainerIdsByAddrResponse) - err := c.cc.Invoke(ctx, "/ununifi.ecosystemincentive.Query/BelongingRecipientContainerIdsByAddr", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - RecipientContainer(context.Context, *QueryRecipientContainerRequest) (*QueryRecipientContainerResponse, error) AllRewards(context.Context, *QueryAllRewardsRequest) (*QueryAllRewardsResponse, error) Reward(context.Context, *QueryRewardRequest) (*QueryRewardResponse, error) - RecordedRecipientContainerId(context.Context, *QueryRecordedRecipientContainerIdRequest) (*QueryRecordedRecipientContainerIdResponse, error) - BelongingRecipientContainerIdsByAddr(context.Context, *QueryBelongingRecipientContainerIdsByAddrRequest) (*QueryBelongingRecipientContainerIdsByAddrResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -765,21 +418,12 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) RecipientContainer(ctx context.Context, req *QueryRecipientContainerRequest) (*QueryRecipientContainerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RecipientContainer not implemented") -} func (*UnimplementedQueryServer) AllRewards(ctx context.Context, req *QueryAllRewardsRequest) (*QueryAllRewardsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllRewards not implemented") } func (*UnimplementedQueryServer) Reward(ctx context.Context, req *QueryRewardRequest) (*QueryRewardResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Reward not implemented") } -func (*UnimplementedQueryServer) RecordedRecipientContainerId(ctx context.Context, req *QueryRecordedRecipientContainerIdRequest) (*QueryRecordedRecipientContainerIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RecordedRecipientContainerId not implemented") -} -func (*UnimplementedQueryServer) BelongingRecipientContainerIdsByAddr(ctx context.Context, req *QueryBelongingRecipientContainerIdsByAddrRequest) (*QueryBelongingRecipientContainerIdsByAddrResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BelongingRecipientContainerIdsByAddr not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -803,24 +447,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_RecipientContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRecipientContainerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RecipientContainer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.ecosystemincentive.Query/RecipientContainer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RecipientContainer(ctx, req.(*QueryRecipientContainerRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_AllRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAllRewardsRequest) if err := dec(in); err != nil { @@ -857,42 +483,6 @@ func _Query_Reward_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_RecordedRecipientContainerId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRecordedRecipientContainerIdRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RecordedRecipientContainerId(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.ecosystemincentive.Query/RecordedRecipientContainerId", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RecordedRecipientContainerId(ctx, req.(*QueryRecordedRecipientContainerIdRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_BelongingRecipientContainerIdsByAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBelongingRecipientContainerIdsByAddrRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).BelongingRecipientContainerIdsByAddr(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.ecosystemincentive.Query/BelongingRecipientContainerIdsByAddr", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BelongingRecipientContainerIdsByAddr(ctx, req.(*QueryBelongingRecipientContainerIdsByAddrRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ununifi.ecosystemincentive.Query", HandlerType: (*QueryServer)(nil), @@ -901,10 +491,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "RecipientContainer", - Handler: _Query_RecipientContainer_Handler, - }, { MethodName: "AllRewards", Handler: _Query_AllRewards_Handler, @@ -913,14 +499,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Reward", Handler: _Query_Reward_Handler, }, - { - MethodName: "RecordedRecipientContainerId", - Handler: _Query_RecordedRecipientContainerId_Handler, - }, - { - MethodName: "BelongingRecipientContainerIdsByAddr", - Handler: _Query_BelongingRecipientContainerIdsByAddr_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "ununifi/ecosystemincentive/query.proto", @@ -982,7 +560,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryRecipientContainerRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllRewardsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -992,27 +570,27 @@ func (m *QueryRecipientContainerRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecipientContainerRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllRewardsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecipientContainerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryRecipientContainerResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllRewardsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1022,83 +600,18 @@ func (m *QueryRecipientContainerResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecipientContainerResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllRewardsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecipientContainerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RecipientContainer != nil { - { - size, err := m.RecipientContainer.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllRewardsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllRewardsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllRewardsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllRewardsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Rewards.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RewardRecord.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1180,135 +693,6 @@ func (m *QueryRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryRecordedRecipientContainerIdRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryRecordedRecipientContainerIdRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRecordedRecipientContainerIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRecordedRecipientContainerIdResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryRecordedRecipientContainerIdResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRecordedRecipientContainerIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RecipientContainerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RecipientContainerIds) > 0 { - for iNdEx := len(m.RecipientContainerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RecipientContainerIds[iNdEx]) - copy(dAtA[i:], m.RecipientContainerIds[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RecipientContainerIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - return len(dAtA) - i, nil -} - func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1340,32 +724,6 @@ func (m *QueryParamsResponse) Size() (n int) { return n } -func (m *QueryRecipientContainerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRecipientContainerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RecipientContainer != nil { - l = m.RecipientContainer.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - func (m *QueryAllRewardsRequest) Size() (n int) { if m == nil { return 0 @@ -1385,7 +743,7 @@ func (m *QueryAllRewardsResponse) Size() (n int) { } var l int _ = l - l = m.Rewards.Size() + l = m.RewardRecord.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -1418,64 +776,6 @@ func (m *QueryRewardResponse) Size() (n int) { return n } -func (m *QueryRecordedRecipientContainerIdRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRecordedRecipientContainerIdResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.RecipientContainerIds) > 0 { - for _, s := range m.RecipientContainerIds { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1615,7 +915,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecipientContainerRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllRewardsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1638,15 +938,15 @@ func (m *QueryRecipientContainerRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecipientContainerRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRewardsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecipientContainerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1674,7 +974,7 @@ func (m *QueryRecipientContainerRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Id = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1697,7 +997,7 @@ func (m *QueryRecipientContainerRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecipientContainerResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllRewardsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1720,15 +1020,15 @@ func (m *QueryRecipientContainerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecipientContainerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRewardsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecipientContainerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RewardRecord", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1755,10 +1055,7 @@ func (m *QueryRecipientContainerResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RecipientContainer == nil { - m.RecipientContainer = &RecipientContainer{} - } - if err := m.RecipientContainer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RewardRecord.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1783,7 +1080,7 @@ func (m *QueryRecipientContainerResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllRewardsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRewardRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1806,10 +1103,10 @@ func (m *QueryAllRewardsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllRewardsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRewardRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRewardRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1844,174 +1141,9 @@ func (m *QueryAllRewardsRequest) Unmarshal(dAtA []byte) error { } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllRewardsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllRewardsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rewards.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRewardRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryRewardRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRewardRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2145,366 +1277,6 @@ func (m *QueryRewardResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecordedRecipientContainerIdRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryRecordedRecipientContainerIdRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordedRecipientContainerIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRecordedRecipientContainerIdResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryRecordedRecipientContainerIdResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordedRecipientContainerIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBelongingRecipientContainerIdsByAddrRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryBelongingRecipientContainerIdsByAddrRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBelongingRecipientContainerIdsByAddrRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBelongingRecipientContainerIdsByAddrResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryBelongingRecipientContainerIdsByAddrResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBelongingRecipientContainerIdsByAddrResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainerIds = append(m.RecipientContainerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ecosystemincentive/types/query.pb.gw.go b/x/ecosystemincentive/types/query.pb.gw.go index f3efe9d0a..b3cae2069 100644 --- a/x/ecosystemincentive/types/query.pb.gw.go +++ b/x/ecosystemincentive/types/query.pb.gw.go @@ -51,60 +51,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_RecipientContainer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecipientContainerRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := client.RecipientContainer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_RecipientContainer_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecipientContainerRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := server.RecipientContainer(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_AllRewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllRewardsRequest var metadata runtime.ServerMetadata @@ -235,136 +181,6 @@ func local_request_Query_Reward_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_RecordedRecipientContainerId_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecordedRecipientContainerIdRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.RecordedRecipientContainerId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_RecordedRecipientContainerId_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecordedRecipientContainerIdRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.RecordedRecipientContainerId(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_BelongingRecipientContainerIdsByAddr_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBelongingRecipientContainerIdsByAddrRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := client.BelongingRecipientContainerIdsByAddr(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_BelongingRecipientContainerIdsByAddr_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBelongingRecipientContainerIdsByAddrRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := server.BelongingRecipientContainerIdsByAddr(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -394,29 +210,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_RecipientContainer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_RecipientContainer_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RecipientContainer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_AllRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -463,52 +256,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_RecordedRecipientContainerId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_RecordedRecipientContainerId_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RecordedRecipientContainerId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_BelongingRecipientContainerIdsByAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_BelongingRecipientContainerIdsByAddr_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_BelongingRecipientContainerIdsByAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -570,26 +317,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_RecipientContainer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_RecipientContainer_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RecipientContainer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_AllRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -630,73 +357,21 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_RecordedRecipientContainerId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_RecordedRecipientContainerId_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RecordedRecipientContainerId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_BelongingRecipientContainerIdsByAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_BelongingRecipientContainerIdsByAddr_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_BelongingRecipientContainerIdsByAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "ecosystemincentive", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_RecipientContainer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "ecosystemincentive", "recipient-containers", "id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_AllRewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "ecosystemincentive", "rewards", "address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Reward_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "ecosystemincentive", "rewards", "address", "denom"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_RecordedRecipientContainerId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "ecosystemincentive", "recorded-recipient-containers", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_BelongingRecipientContainerIdsByAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "ecosystemincentive", "belonging-recipient-containers", "address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_RecipientContainer_0 = runtime.ForwardResponseMessage - forward_Query_AllRewards_0 = runtime.ForwardResponseMessage forward_Query_Reward_0 = runtime.ForwardResponseMessage - - forward_Query_RecordedRecipientContainerId_0 = runtime.ForwardResponseMessage - - forward_Query_BelongingRecipientContainerIdsByAddr_0 = runtime.ForwardResponseMessage ) diff --git a/x/ecosystemincentive/types/reward_store.go b/x/ecosystemincentive/types/reward_record.go similarity index 55% rename from x/ecosystemincentive/types/reward_store.go rename to x/ecosystemincentive/types/reward_record.go index 36818a222..60b3af011 100644 --- a/x/ecosystemincentive/types/reward_store.go +++ b/x/ecosystemincentive/types/reward_record.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func NewRewardStore(address string, rewards sdk.Coins) RewardStore { - return RewardStore{ +func NewRewardRecord(address string, rewards sdk.Coins) RewardRecord { + return RewardRecord{ Address: address, Rewards: rewards, } diff --git a/x/ecosystemincentive/types/tx.pb.go b/x/ecosystemincentive/types/tx.pb.go index bf00d000a..0ec842f66 100644 --- a/x/ecosystemincentive/types/tx.pb.go +++ b/x/ecosystemincentive/types/tx.pb.go @@ -7,7 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -30,103 +29,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgRegister struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - RecipientContainerId string `protobuf:"bytes,2,opt,name=recipient_container_id,json=recipientContainerId,proto3" json:"recipient_container_id,omitempty" yaml:"recipient_container_id"` - Addresses []string `protobuf:"bytes,3,rep,name=addresses,proto3" json:"addresses,omitempty" yaml:"subject_addrs"` - Weights []github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,rep,name=weights,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weights" yaml:"weights"` -} - -func (m *MsgRegister) Reset() { *m = MsgRegister{} } -func (m *MsgRegister) String() string { return proto.CompactTextString(m) } -func (*MsgRegister) ProtoMessage() {} -func (*MsgRegister) Descriptor() ([]byte, []int) { - return fileDescriptor_df57aae78a8732aa, []int{0} -} -func (m *MsgRegister) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRegister) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRegister.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRegister) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegister.Merge(m, src) -} -func (m *MsgRegister) XXX_Size() int { - return m.Size() -} -func (m *MsgRegister) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegister.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRegister proto.InternalMessageInfo - -func (m *MsgRegister) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgRegister) GetRecipientContainerId() string { - if m != nil { - return m.RecipientContainerId - } - return "" -} - -func (m *MsgRegister) GetAddresses() []string { - if m != nil { - return m.Addresses - } - return nil -} - -type MsgRegisterResponse struct { -} - -func (m *MsgRegisterResponse) Reset() { *m = MsgRegisterResponse{} } -func (m *MsgRegisterResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterResponse) ProtoMessage() {} -func (*MsgRegisterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_df57aae78a8732aa, []int{1} -} -func (m *MsgRegisterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRegisterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRegisterResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgRegisterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterResponse.Merge(m, src) -} -func (m *MsgRegisterResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRegisterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRegisterResponse proto.InternalMessageInfo - type MsgWithdrawAllRewards struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` } @@ -135,7 +37,7 @@ func (m *MsgWithdrawAllRewards) Reset() { *m = MsgWithdrawAllRewards{} } func (m *MsgWithdrawAllRewards) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawAllRewards) ProtoMessage() {} func (*MsgWithdrawAllRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_df57aae78a8732aa, []int{2} + return fileDescriptor_df57aae78a8732aa, []int{0} } func (m *MsgWithdrawAllRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -178,7 +80,7 @@ func (m *MsgWithdrawAllRewardsResponse) Reset() { *m = MsgWithdrawAllRew func (m *MsgWithdrawAllRewardsResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawAllRewardsResponse) ProtoMessage() {} func (*MsgWithdrawAllRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_df57aae78a8732aa, []int{3} + return fileDescriptor_df57aae78a8732aa, []int{1} } func (m *MsgWithdrawAllRewardsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -216,7 +118,7 @@ func (m *MsgWithdrawReward) Reset() { *m = MsgWithdrawReward{} } func (m *MsgWithdrawReward) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawReward) ProtoMessage() {} func (*MsgWithdrawReward) Descriptor() ([]byte, []int) { - return fileDescriptor_df57aae78a8732aa, []int{4} + return fileDescriptor_df57aae78a8732aa, []int{2} } func (m *MsgWithdrawReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -266,7 +168,7 @@ func (m *MsgWithdrawRewardResponse) Reset() { *m = MsgWithdrawRewardResp func (m *MsgWithdrawRewardResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawRewardResponse) ProtoMessage() {} func (*MsgWithdrawRewardResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_df57aae78a8732aa, []int{5} + return fileDescriptor_df57aae78a8732aa, []int{3} } func (m *MsgWithdrawRewardResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -296,8 +198,6 @@ func (m *MsgWithdrawRewardResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawRewardResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgRegister)(nil), "ununifi.ecosystemincentive.MsgRegister") - proto.RegisterType((*MsgRegisterResponse)(nil), "ununifi.ecosystemincentive.MsgRegisterResponse") proto.RegisterType((*MsgWithdrawAllRewards)(nil), "ununifi.ecosystemincentive.MsgWithdrawAllRewards") proto.RegisterType((*MsgWithdrawAllRewardsResponse)(nil), "ununifi.ecosystemincentive.MsgWithdrawAllRewardsResponse") proto.RegisterType((*MsgWithdrawReward)(nil), "ununifi.ecosystemincentive.MsgWithdrawReward") @@ -309,39 +209,28 @@ func init() { } var fileDescriptor_df57aae78a8732aa = []byte{ - // 502 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0xe4, 0xfb, 0x0a, 0x59, 0xa0, 0xa2, 0x26, 0x45, 0xa9, 0x51, 0xed, 0xb2, 0x48, - 0xa5, 0x1c, 0x6a, 0x0b, 0x2a, 0x90, 0xe0, 0x04, 0x01, 0x21, 0x71, 0xc8, 0xc5, 0x52, 0x55, 0xa9, - 0x97, 0xc8, 0xf1, 0x4e, 0x9d, 0x85, 0x78, 0x37, 0xf2, 0x6c, 0x9a, 0xe6, 0xca, 0x13, 0xf0, 0x12, - 0xbc, 0x4b, 0x8f, 0x3d, 0x22, 0x0e, 0x16, 0x4a, 0x2e, 0x9c, 0xfd, 0x04, 0x28, 0x5e, 0x3b, 0x44, - 0x24, 0x88, 0xe6, 0x64, 0x7b, 0xe6, 0xf7, 0x9f, 0x19, 0xff, 0x77, 0x6c, 0xf2, 0x68, 0x28, 0x86, - 0x82, 0x9f, 0x71, 0x0f, 0x42, 0x89, 0x63, 0x54, 0x10, 0x73, 0x11, 0x82, 0x50, 0xfc, 0x1c, 0x3c, - 0x75, 0xe1, 0x0e, 0x12, 0xa9, 0xa4, 0x69, 0x15, 0x90, 0xbb, 0x0c, 0x59, 0x8d, 0x48, 0x46, 0x32, - 0xc7, 0xbc, 0xd9, 0x9d, 0x56, 0x58, 0x3b, 0xa1, 0xc4, 0x58, 0x62, 0x47, 0x27, 0xf4, 0x83, 0x4e, - 0xd1, 0xaf, 0x55, 0x72, 0xab, 0x8d, 0x91, 0x0f, 0x11, 0x47, 0x05, 0x89, 0xf9, 0x84, 0x6c, 0x20, - 0x08, 0x06, 0x49, 0xd3, 0xd8, 0x33, 0x0e, 0xea, 0xad, 0xad, 0x2c, 0x75, 0xee, 0x8c, 0x83, 0xb8, - 0xff, 0x8a, 0xea, 0x38, 0xf5, 0x0b, 0xc0, 0x3c, 0x21, 0xf7, 0x13, 0x08, 0xf9, 0x80, 0x83, 0x50, - 0x9d, 0x50, 0x0a, 0x15, 0x70, 0x01, 0x49, 0x87, 0xb3, 0x66, 0x35, 0x97, 0x3e, 0xcc, 0x52, 0x67, - 0x57, 0x4b, 0x57, 0x73, 0xd4, 0x6f, 0xcc, 0x13, 0x6f, 0xcb, 0xf8, 0x07, 0x66, 0xbe, 0x20, 0xf5, - 0x80, 0xb1, 0x04, 0x10, 0x01, 0x9b, 0xb5, 0xbd, 0xda, 0x41, 0xbd, 0xd5, 0xcc, 0x52, 0xa7, 0x51, - 0x8c, 0x31, 0xec, 0x7e, 0x84, 0x50, 0x75, 0x66, 0x08, 0x52, 0xff, 0x37, 0x6a, 0x9e, 0x92, 0x1b, - 0x23, 0xe0, 0x51, 0x4f, 0x61, 0xf3, 0xbf, 0x5c, 0xf5, 0xfa, 0x32, 0x75, 0x2a, 0xdf, 0x53, 0x67, - 0x3f, 0xe2, 0xaa, 0x37, 0xec, 0xba, 0xa1, 0x8c, 0x8b, 0xb7, 0x2f, 0x2e, 0x87, 0xc8, 0x3e, 0x79, - 0x6a, 0x3c, 0x00, 0x74, 0xdf, 0x41, 0x98, 0xa5, 0xce, 0xa6, 0xee, 0x51, 0x94, 0xa1, 0x7e, 0x59, - 0x90, 0x6e, 0x93, 0x7b, 0x0b, 0x36, 0xf9, 0x80, 0x03, 0x29, 0x10, 0x68, 0x8b, 0x6c, 0xb7, 0x31, - 0x3a, 0xe1, 0xaa, 0xc7, 0x92, 0x60, 0xf4, 0xa6, 0xdf, 0xf7, 0x61, 0x14, 0x24, 0x0c, 0xd7, 0xf0, - 0x91, 0x3a, 0x64, 0x77, 0x65, 0x8d, 0x79, 0x93, 0x33, 0xb2, 0xb5, 0x00, 0xe8, 0xec, 0x3a, 0x07, - 0xb5, 0x4f, 0xfe, 0x67, 0x20, 0x64, 0x5c, 0x9c, 0xcb, 0xdd, 0x2c, 0x75, 0x6e, 0x6b, 0x32, 0x0f, - 0x53, 0x5f, 0xa7, 0xe9, 0x03, 0xb2, 0xb3, 0xd4, 0xa7, 0x1c, 0xe2, 0xd9, 0xcf, 0x2a, 0xa9, 0xb5, - 0x31, 0x32, 0x19, 0xb9, 0x39, 0x5f, 0x96, 0xc7, 0xee, 0xdf, 0x57, 0xd1, 0x5d, 0xb0, 0xcb, 0xf2, - 0xae, 0x09, 0x96, 0xdd, 0xcc, 0xcf, 0x06, 0x31, 0x57, 0xb8, 0xfa, 0xf4, 0x1f, 0x75, 0x96, 0x25, - 0xd6, 0xcb, 0xb5, 0x25, 0xf3, 0x21, 0xce, 0xc9, 0xe6, 0x1f, 0xa6, 0x1f, 0x5e, 0xb3, 0x98, 0xc6, - 0xad, 0xe7, 0x6b, 0xe1, 0x65, 0xdf, 0x56, 0xfb, 0x72, 0x62, 0x1b, 0x57, 0x13, 0xdb, 0xf8, 0x31, - 0xb1, 0x8d, 0x2f, 0x53, 0xbb, 0x72, 0x35, 0xb5, 0x2b, 0xdf, 0xa6, 0x76, 0xe5, 0xf4, 0x68, 0x61, - 0x91, 0x8f, 0xc5, 0xb1, 0xe0, 0xef, 0xb9, 0x17, 0xf6, 0x02, 0x2e, 0xbc, 0x8b, 0x95, 0xbf, 0x8c, - 0xd9, 0x66, 0x77, 0x37, 0xf2, 0x2f, 0xfd, 0xe8, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0x35, - 0x31, 0xe8, 0x5d, 0x04, 0x00, 0x00, + // 330 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0xcd, 0x2b, 0xcd, + 0xcb, 0x4c, 0xcb, 0xd4, 0x4f, 0x4d, 0xce, 0x2f, 0xae, 0x2c, 0x2e, 0x49, 0xcd, 0xcd, 0xcc, 0x4b, + 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x92, 0x82, 0x2a, 0xd2, 0xc3, 0x54, 0x24, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa6, 0x0f, + 0x62, 0x41, 0x74, 0x48, 0x49, 0x26, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xc7, 0x43, 0x24, 0x20, 0x1c, + 0x88, 0x94, 0x92, 0x13, 0x97, 0xa8, 0x6f, 0x71, 0x7a, 0x78, 0x66, 0x49, 0x46, 0x4a, 0x51, 0x62, + 0xb9, 0x63, 0x4e, 0x4e, 0x50, 0x6a, 0x79, 0x62, 0x51, 0x4a, 0xb1, 0x90, 0x26, 0x17, 0x5b, 0x71, + 0x6a, 0x5e, 0x4a, 0x6a, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xe0, 0xa7, 0x7b, 0xf2, + 0xbc, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x10, 0x71, 0xa5, 0x20, 0xa8, 0x02, 0x25, 0x79, 0x2e, + 0x59, 0xac, 0x66, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x2a, 0xa5, 0x71, 0x09, 0x22, + 0x29, 0x80, 0xc8, 0x92, 0x60, 0x81, 0x90, 0x1a, 0x17, 0x6b, 0x4a, 0x6a, 0x5e, 0x7e, 0xae, 0x04, + 0x13, 0x58, 0xa5, 0xc0, 0xa7, 0x7b, 0xf2, 0x3c, 0x10, 0x95, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, + 0x92, 0x34, 0x97, 0x24, 0x86, 0x3d, 0x30, 0x47, 0x18, 0x35, 0x31, 0x71, 0x31, 0xfb, 0x16, 0xa7, + 0x0b, 0x35, 0x31, 0x72, 0x09, 0x61, 0xf1, 0xaf, 0xa1, 0x1e, 0xee, 0x60, 0xd5, 0xc3, 0xea, 0x3d, + 0x29, 0x4b, 0x92, 0xb5, 0xc0, 0x1c, 0x23, 0x54, 0xc6, 0xc5, 0x87, 0x16, 0x1c, 0xba, 0x44, 0x1a, + 0x06, 0x51, 0x2e, 0x65, 0x4a, 0x92, 0x72, 0x98, 0xbd, 0x4e, 0xbe, 0x27, 0x1e, 0xc9, 0x31, 0x5e, + 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, + 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9c, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, + 0xab, 0x1f, 0x9a, 0x17, 0x9a, 0x97, 0xe9, 0x96, 0xa9, 0x9f, 0x9c, 0x91, 0x98, 0x99, 0xa7, 0x5f, + 0x81, 0x35, 0x35, 0x56, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x13, 0x91, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xcb, 0xc7, 0x23, 0xbf, 0xb8, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -356,7 +245,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - Register(ctx context.Context, in *MsgRegister, opts ...grpc.CallOption) (*MsgRegisterResponse, error) WithdrawAllRewards(ctx context.Context, in *MsgWithdrawAllRewards, opts ...grpc.CallOption) (*MsgWithdrawAllRewardsResponse, error) WithdrawReward(ctx context.Context, in *MsgWithdrawReward, opts ...grpc.CallOption) (*MsgWithdrawRewardResponse, error) } @@ -369,15 +257,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) Register(ctx context.Context, in *MsgRegister, opts ...grpc.CallOption) (*MsgRegisterResponse, error) { - out := new(MsgRegisterResponse) - err := c.cc.Invoke(ctx, "/ununifi.ecosystemincentive.Msg/Register", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) WithdrawAllRewards(ctx context.Context, in *MsgWithdrawAllRewards, opts ...grpc.CallOption) (*MsgWithdrawAllRewardsResponse, error) { out := new(MsgWithdrawAllRewardsResponse) err := c.cc.Invoke(ctx, "/ununifi.ecosystemincentive.Msg/WithdrawAllRewards", in, out, opts...) @@ -398,7 +277,6 @@ func (c *msgClient) WithdrawReward(ctx context.Context, in *MsgWithdrawReward, o // MsgServer is the server API for Msg service. type MsgServer interface { - Register(context.Context, *MsgRegister) (*MsgRegisterResponse, error) WithdrawAllRewards(context.Context, *MsgWithdrawAllRewards) (*MsgWithdrawAllRewardsResponse, error) WithdrawReward(context.Context, *MsgWithdrawReward) (*MsgWithdrawRewardResponse, error) } @@ -407,9 +285,6 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) Register(ctx context.Context, req *MsgRegister) (*MsgRegisterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") -} func (*UnimplementedMsgServer) WithdrawAllRewards(ctx context.Context, req *MsgWithdrawAllRewards) (*MsgWithdrawAllRewardsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawAllRewards not implemented") } @@ -421,24 +296,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRegister) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Register(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.ecosystemincentive.Msg/Register", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Register(ctx, req.(*MsgRegister)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_WithdrawAllRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgWithdrawAllRewards) if err := dec(in); err != nil { @@ -479,10 +336,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ununifi.ecosystemincentive.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Register", - Handler: _Msg_Register_Handler, - }, { MethodName: "WithdrawAllRewards", Handler: _Msg_WithdrawAllRewards_Handler, @@ -496,89 +349,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "ununifi/ecosystemincentive/tx.proto", } -func (m *MsgRegister) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRegister) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRegister) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Weights) > 0 { - for iNdEx := len(m.Weights) - 1; iNdEx >= 0; iNdEx-- { - { - size := m.Weights[iNdEx].Size() - i -= size - if _, err := m.Weights[iNdEx].MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.RecipientContainerId) > 0 { - i -= len(m.RecipientContainerId) - copy(dAtA[i:], m.RecipientContainerId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RecipientContainerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgRegisterResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgRegisterResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRegisterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgWithdrawAllRewards) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -703,44 +473,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgRegister) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.RecipientContainerId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Addresses) > 0 { - for _, s := range m.Addresses { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.Weights) > 0 { - for _, e := range m.Weights { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgRegisterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgWithdrawAllRewards) Size() (n int) { if m == nil { return 0 @@ -795,238 +527,6 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgRegister) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRegister: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegister: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecipientContainerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecipientContainerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weights", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_cosmos_cosmos_sdk_types.Dec - m.Weights = append(m.Weights, v) - if err := m.Weights[len(m.Weights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRegisterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgWithdrawAllRewards) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/epochs/keeper/keeper.go b/x/epochs/keeper/keeper.go index bd4bfb199..2a7f74d97 100644 --- a/x/epochs/keeper/keeper.go +++ b/x/epochs/keeper/keeper.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/epochs/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/UnUniFi/chain/x/epochs/types" ) // Keeper of this module maintains collections of epochs and hooks. diff --git a/x/eventhook/keeper/abci.go b/x/eventhook/keeper/abci.go index 7a04b4b01..00d25987e 100644 --- a/x/eventhook/keeper/abci.go +++ b/x/eventhook/keeper/abci.go @@ -1,9 +1,13 @@ package keeper import ( + "encoding/json" + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/UnUniFi/chain/x/eventhook/types" ) @@ -26,8 +30,26 @@ func inspectEventForHook(event sdk.Event, hook types.Hook) bool { return true } +type EventHookMsg struct { + EventType string `json:"event_type"` + EventAttributes []*types.KeyValuePair `json:"event_attributes"` +} + func (k Keeper) CallHook(ctx sdk.Context, event sdk.Event, hook types.Hook) { - // TODO: call cosmwasm contract + contractAddr := sdk.MustAccAddressFromBech32(hook.ContractAddress) + address := authtypes.NewModuleAddress(types.ModuleName) + wasmMsg, err := json.Marshal(EventHookMsg{ + EventType: hook.EventType, + EventAttributes: hook.EventAttributes, + }) + if err != nil { + k.Logger(ctx).Debug("failed to marshal wasm msg", "error", err) + } + + _, err = k.wasmKeeper.Execute(ctx, contractAddr, address, []byte(wasmMsg), sdk.Coins{}) + if err != nil { + k.Logger(ctx).Debug("failed to execute wasm contract", "error", err) + } } func (k Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { diff --git a/x/eventhook/keeper/keeper.go b/x/eventhook/keeper/keeper.go index b3743771c..42f12261c 100644 --- a/x/eventhook/keeper/keeper.go +++ b/x/eventhook/keeper/keeper.go @@ -7,38 +7,34 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/UnUniFi/chain/x/eventhook/types" + + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + + wasmKeeper wasmtypes.ContractOpsKeeper + authority string } ) func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - + storeKey storetypes.StoreKey, + wasmKeeper wasmtypes.ContractOpsKeeper, + authority string, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return &Keeper{ - cdc: cdc, storeKey: storeKey, - memKey: memKey, - paramstore: ps, + wasmKeeper: wasmKeeper, + authority: authority, } } diff --git a/x/eventhook/keeper/msg_server_register_hook.go b/x/eventhook/keeper/msg_server_register_hook.go new file mode 100644 index 000000000..e54321084 --- /dev/null +++ b/x/eventhook/keeper/msg_server_register_hook.go @@ -0,0 +1,31 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/eventhook/types" +) + +func (k msgServer) RegisterHook(goCtx context.Context, msg *types.MsgRegisterHook) (*types.MsgRegisterHookResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if msg.Sender != k.authority { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "unauthorized") + } + + hook := types.Hook{ + Name: msg.Name, + ContractAddress: msg.ContractAddress, + GitUrl: msg.GitUrl, + EventType: msg.EventType, + EventAttributes: msg.EventAttributes, + } + id := k.AppendHook(ctx, msg.EventType, hook) + + return &types.MsgRegisterHookResponse{ + Id: id, + }, nil +} diff --git a/x/eventhook/keeper/msg_server_unregister_hook.go b/x/eventhook/keeper/msg_server_unregister_hook.go new file mode 100644 index 000000000..824fd1574 --- /dev/null +++ b/x/eventhook/keeper/msg_server_unregister_hook.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/eventhook/types" +) + +func (k msgServer) UnregisterHook(goCtx context.Context, msg *types.MsgUnregisterHook) (*types.MsgUnregisterHookResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if msg.Sender != k.authority { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "unauthorized") + } + + _, found := k.GetHook(ctx, msg.EventType, msg.Id) + + if !found { + return nil, sdkerrors.Wrap(types.ErrHookNotFound, "hook not found") + } + + k.RemoveHook(ctx, msg.EventType, msg.Id) + + return &types.MsgUnregisterHookResponse{}, nil +} diff --git a/x/eventhook/keeper/params.go b/x/eventhook/keeper/params.go index 220a96b7d..64666ccee 100644 --- a/x/eventhook/keeper/params.go +++ b/x/eventhook/keeper/params.go @@ -13,5 +13,5 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) + } diff --git a/x/eventhook/types/errors.go b/x/eventhook/types/errors.go index 339f9d966..84cc2c49f 100644 --- a/x/eventhook/types/errors.go +++ b/x/eventhook/types/errors.go @@ -8,5 +8,5 @@ import ( // x/eventhook module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrHookNotFound = sdkerrors.Register(ModuleName, 1, "hook not found") ) diff --git a/x/eventhook/types/eventhook.pb.go b/x/eventhook/types/eventhook.pb.go index 9979b16e8..c1339237e 100644 --- a/x/eventhook/types/eventhook.pb.go +++ b/x/eventhook/types/eventhook.pb.go @@ -25,10 +25,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Hook struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - EventType string `protobuf:"bytes,2,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` ContractAddress string `protobuf:"bytes,3,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - GitUrl string `protobuf:"bytes,5,opt,name=git_url,json=gitUrl,proto3" json:"git_url,omitempty"` + GitUrl string `protobuf:"bytes,4,opt,name=git_url,json=gitUrl,proto3" json:"git_url,omitempty"` + EventType string `protobuf:"bytes,5,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` EventAttributes []*KeyValuePair `protobuf:"bytes,6,rep,name=event_attributes,json=eventAttributes,proto3" json:"event_attributes,omitempty"` } @@ -72,9 +72,9 @@ func (m *Hook) GetId() uint64 { return 0 } -func (m *Hook) GetEventType() string { +func (m *Hook) GetName() string { if m != nil { - return m.EventType + return m.Name } return "" } @@ -86,16 +86,16 @@ func (m *Hook) GetContractAddress() string { return "" } -func (m *Hook) GetName() string { +func (m *Hook) GetGitUrl() string { if m != nil { - return m.Name + return m.GitUrl } return "" } -func (m *Hook) GetGitUrl() string { +func (m *Hook) GetEventType() string { if m != nil { - return m.GitUrl + return m.EventType } return "" } @@ -167,28 +167,28 @@ func init() { func init() { proto.RegisterFile("ununifi/eventhook/eventhook.proto", fileDescriptor_8298502638ea5b43) } var fileDescriptor_8298502638ea5b43 = []byte{ - // 336 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x6a, 0xea, 0x40, - 0x18, 0x85, 0x1d, 0x8d, 0x5e, 0x9c, 0x7b, 0xb9, 0xca, 0x20, 0x34, 0x08, 0x1d, 0x52, 0x57, 0xb6, - 0x8b, 0x04, 0x5a, 0xe8, 0xde, 0x52, 0x4a, 0xc1, 0x4d, 0x09, 0xb5, 0x8b, 0x6e, 0x64, 0x4c, 0xc6, - 0x38, 0x18, 0x67, 0xc2, 0xe4, 0x1f, 0x69, 0xde, 0xa2, 0x8f, 0xd5, 0xa5, 0xcb, 0xd2, 0x55, 0xd1, - 0x17, 0x29, 0x99, 0xb4, 0x56, 0x70, 0x77, 0x72, 0xbe, 0xf3, 0x67, 0x38, 0x07, 0x9f, 0x19, 0x69, - 0xa4, 0x98, 0x8b, 0x80, 0xaf, 0xb9, 0x84, 0x85, 0x52, 0xcb, 0x5f, 0xe5, 0x67, 0x5a, 0x81, 0x22, - 0x44, 0xce, 0x61, 0xcd, 0x4c, 0x0a, 0xfe, 0x9e, 0xf4, 0x7b, 0x89, 0x4a, 0x94, 0xc5, 0x41, 0xa9, - 0xaa, 0x64, 0x9f, 0x1e, 0xff, 0x2c, 0x63, 0x9a, 0xad, 0xf2, 0x8a, 0x0f, 0x3e, 0x10, 0x76, 0xee, - 0x95, 0x5a, 0x92, 0xff, 0xb8, 0x2e, 0x62, 0x17, 0x79, 0x68, 0xe8, 0x84, 0x75, 0x11, 0x93, 0x53, - 0x8c, 0xed, 0xc9, 0x14, 0x8a, 0x8c, 0xbb, 0x75, 0x0f, 0x0d, 0xdb, 0x61, 0xdb, 0x3a, 0x8f, 0x45, - 0xc6, 0xc9, 0x39, 0xee, 0x46, 0x4a, 0x82, 0x66, 0x11, 0x4c, 0x59, 0x1c, 0x6b, 0x9e, 0xe7, 0x6e, - 0xc3, 0x86, 0x3a, 0x3f, 0xfe, 0xa8, 0xb2, 0x09, 0xc1, 0x8e, 0x64, 0x2b, 0xee, 0x3a, 0x16, 0x5b, - 0x4d, 0x4e, 0xf0, 0x9f, 0x44, 0xc0, 0xd4, 0xe8, 0xd4, 0x6d, 0x5a, 0xbb, 0x95, 0x08, 0x98, 0xe8, - 0x94, 0x8c, 0x71, 0xb7, 0x7a, 0x96, 0x01, 0x68, 0x31, 0x33, 0xc0, 0x73, 0xb7, 0xe5, 0x35, 0x86, - 0x7f, 0x2f, 0x3d, 0xff, 0xb8, 0xb4, 0x3f, 0xe6, 0xc5, 0x13, 0x4b, 0x0d, 0x7f, 0x60, 0x42, 0x87, - 0x1d, 0xeb, 0x8f, 0xf6, 0x87, 0x83, 0x6b, 0xfc, 0xef, 0x30, 0x40, 0xba, 0xb8, 0xb1, 0xe4, 0x85, - 0x2d, 0xd9, 0x0e, 0x4b, 0x49, 0x7a, 0xb8, 0xb9, 0x2e, 0xf1, 0x77, 0xc1, 0xea, 0xe3, 0xe6, 0xf6, - 0x6d, 0x4b, 0xd1, 0x66, 0x4b, 0xd1, 0xe7, 0x96, 0xa2, 0xd7, 0x1d, 0xad, 0x6d, 0x76, 0xb4, 0xf6, - 0xbe, 0xa3, 0xb5, 0xe7, 0x8b, 0x44, 0xc0, 0xc2, 0xcc, 0xfc, 0x48, 0xad, 0x82, 0x89, 0x9c, 0x48, - 0x71, 0x27, 0x82, 0x68, 0xc1, 0x84, 0x0c, 0x5e, 0x0e, 0x16, 0x2e, 0x27, 0xcb, 0x67, 0x2d, 0xbb, - 0xf0, 0xd5, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x84, 0xaf, 0xef, 0xd0, 0x01, 0x00, 0x00, + // 324 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x4b, 0xc3, 0x30, + 0x14, 0xc6, 0x97, 0xad, 0x9b, 0x2c, 0x8a, 0x1b, 0x61, 0x60, 0x11, 0x0c, 0x75, 0xa7, 0xe9, 0xa1, + 0x05, 0x05, 0xef, 0x13, 0x11, 0x61, 0x17, 0x29, 0xce, 0x83, 0x97, 0x91, 0xb5, 0x59, 0x17, 0xd6, + 0x25, 0x23, 0x7d, 0x19, 0xf6, 0xbf, 0xf0, 0xcf, 0xf2, 0xb8, 0xa3, 0x78, 0x92, 0xf5, 0x1f, 0x91, + 0xa6, 0x3a, 0x07, 0xde, 0xbe, 0x7c, 0xbf, 0x2f, 0xf0, 0xbe, 0xf7, 0xf0, 0xb9, 0x91, 0x46, 0x8a, + 0x99, 0x08, 0xf8, 0x9a, 0x4b, 0x98, 0x2b, 0xb5, 0xf8, 0x53, 0xfe, 0x4a, 0x2b, 0x50, 0x84, 0xc8, + 0x19, 0xac, 0x99, 0x49, 0xc1, 0xdf, 0x91, 0xd3, 0x5e, 0xa2, 0x12, 0x65, 0x71, 0x50, 0xaa, 0x2a, + 0xd9, 0xff, 0x44, 0xd8, 0x79, 0x50, 0x6a, 0x41, 0x8e, 0x71, 0x5d, 0xc4, 0x2e, 0xf2, 0xd0, 0xc0, + 0x09, 0xeb, 0x22, 0x26, 0x04, 0x3b, 0x92, 0x2d, 0xb9, 0x5b, 0xf7, 0xd0, 0xa0, 0x1d, 0x5a, 0x4d, + 0x2e, 0x70, 0x37, 0x52, 0x12, 0x34, 0x8b, 0x60, 0xc2, 0xe2, 0x58, 0xf3, 0x2c, 0x73, 0x1b, 0x96, + 0x77, 0x7e, 0xfd, 0x61, 0x65, 0x93, 0x13, 0x7c, 0x90, 0x08, 0x98, 0x18, 0x9d, 0xba, 0x8e, 0x4d, + 0xb4, 0x12, 0x01, 0x63, 0x9d, 0x92, 0x33, 0x8c, 0xed, 0x4c, 0x13, 0xc8, 0x57, 0xdc, 0x6d, 0x5a, + 0xd6, 0xb6, 0xce, 0x53, 0xbe, 0xe2, 0x64, 0x84, 0xbb, 0x15, 0x66, 0x00, 0x5a, 0x4c, 0x0d, 0xf0, + 0xcc, 0x6d, 0x79, 0x8d, 0xc1, 0xe1, 0x95, 0xe7, 0xff, 0x2f, 0xe5, 0x8f, 0x78, 0xfe, 0xcc, 0x52, + 0xc3, 0x1f, 0x99, 0xd0, 0x61, 0xc7, 0xfa, 0xc3, 0xdd, 0xc7, 0xfe, 0x0d, 0x3e, 0xda, 0x0f, 0x90, + 0x2e, 0x6e, 0x2c, 0x78, 0x6e, 0x4b, 0xb6, 0xc3, 0x52, 0x92, 0x1e, 0x6e, 0xae, 0x4b, 0xfc, 0x53, + 0xb3, 0x7a, 0xdc, 0xde, 0xbd, 0x6f, 0x29, 0xda, 0x6c, 0x29, 0xfa, 0xda, 0x52, 0xf4, 0x56, 0xd0, + 0xda, 0xa6, 0xa0, 0xb5, 0x8f, 0x82, 0xd6, 0x5e, 0x2e, 0x13, 0x01, 0x73, 0x33, 0xf5, 0x23, 0xb5, + 0x0c, 0xc6, 0x72, 0x2c, 0xc5, 0xbd, 0x08, 0xa2, 0x39, 0x13, 0x32, 0x78, 0xdd, 0x3b, 0x47, 0x59, + 0x2d, 0x9b, 0xb6, 0xec, 0x86, 0xaf, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x45, 0xf4, 0x77, + 0xb0, 0x01, 0x00, 0x00, } func (m *Hook) Marshal() (dAtA []byte, err error) { @@ -225,18 +225,18 @@ func (m *Hook) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x32 } } + if len(m.EventType) > 0 { + i -= len(m.EventType) + copy(dAtA[i:], m.EventType) + i = encodeVarintEventhook(dAtA, i, uint64(len(m.EventType))) + i-- + dAtA[i] = 0x2a + } if len(m.GitUrl) > 0 { i -= len(m.GitUrl) copy(dAtA[i:], m.GitUrl) i = encodeVarintEventhook(dAtA, i, uint64(len(m.GitUrl))) i-- - dAtA[i] = 0x2a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintEventhook(dAtA, i, uint64(len(m.Name))) - i-- dAtA[i] = 0x22 } if len(m.ContractAddress) > 0 { @@ -246,10 +246,10 @@ func (m *Hook) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.EventType) > 0 { - i -= len(m.EventType) - copy(dAtA[i:], m.EventType) - i = encodeVarintEventhook(dAtA, i, uint64(len(m.EventType))) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintEventhook(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x12 } @@ -318,7 +318,7 @@ func (m *Hook) Size() (n int) { if m.Id != 0 { n += 1 + sovEventhook(uint64(m.Id)) } - l = len(m.EventType) + l = len(m.Name) if l > 0 { n += 1 + l + sovEventhook(uint64(l)) } @@ -326,11 +326,11 @@ func (m *Hook) Size() (n int) { if l > 0 { n += 1 + l + sovEventhook(uint64(l)) } - l = len(m.Name) + l = len(m.GitUrl) if l > 0 { n += 1 + l + sovEventhook(uint64(l)) } - l = len(m.GitUrl) + l = len(m.EventType) if l > 0 { n += 1 + l + sovEventhook(uint64(l)) } @@ -416,7 +416,7 @@ func (m *Hook) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -444,7 +444,7 @@ func (m *Hook) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.EventType = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -480,7 +480,7 @@ func (m *Hook) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GitUrl", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -508,11 +508,11 @@ func (m *Hook) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.GitUrl = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GitUrl", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -540,7 +540,7 @@ func (m *Hook) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.GitUrl = string(dAtA[iNdEx:postIndex]) + m.EventType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: if wireType != 2 { diff --git a/x/eventhook/types/tx.pb.go b/x/eventhook/types/tx.pb.go index b01d36ee9..6fe99bb82 100644 --- a/x/eventhook/types/tx.pb.go +++ b/x/eventhook/types/tx.pb.go @@ -9,7 +9,11 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,19 +27,268 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// this line is used by starport scaffolding # proto/tx/message +type MsgRegisterHook struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + ContractAddress string `protobuf:"bytes,3,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + GitUrl string `protobuf:"bytes,4,opt,name=git_url,json=gitUrl,proto3" json:"git_url,omitempty"` + EventType string `protobuf:"bytes,5,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + EventAttributes []*KeyValuePair `protobuf:"bytes,6,rep,name=event_attributes,json=eventAttributes,proto3" json:"event_attributes,omitempty"` +} + +func (m *MsgRegisterHook) Reset() { *m = MsgRegisterHook{} } +func (m *MsgRegisterHook) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterHook) ProtoMessage() {} +func (*MsgRegisterHook) Descriptor() ([]byte, []int) { + return fileDescriptor_20cafb73a0f25f2d, []int{0} +} +func (m *MsgRegisterHook) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterHook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterHook.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterHook) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterHook.Merge(m, src) +} +func (m *MsgRegisterHook) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterHook) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterHook.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterHook proto.InternalMessageInfo + +func (m *MsgRegisterHook) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgRegisterHook) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgRegisterHook) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *MsgRegisterHook) GetGitUrl() string { + if m != nil { + return m.GitUrl + } + return "" +} + +func (m *MsgRegisterHook) GetEventType() string { + if m != nil { + return m.EventType + } + return "" +} + +func (m *MsgRegisterHook) GetEventAttributes() []*KeyValuePair { + if m != nil { + return m.EventAttributes + } + return nil +} + +type MsgRegisterHookResponse struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgRegisterHookResponse) Reset() { *m = MsgRegisterHookResponse{} } +func (m *MsgRegisterHookResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterHookResponse) ProtoMessage() {} +func (*MsgRegisterHookResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_20cafb73a0f25f2d, []int{1} +} +func (m *MsgRegisterHookResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterHookResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterHookResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterHookResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterHookResponse.Merge(m, src) +} +func (m *MsgRegisterHookResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterHookResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterHookResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterHookResponse proto.InternalMessageInfo + +func (m *MsgRegisterHookResponse) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +type MsgUnregisterHook struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + EventType string `protobuf:"bytes,2,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + Id uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgUnregisterHook) Reset() { *m = MsgUnregisterHook{} } +func (m *MsgUnregisterHook) String() string { return proto.CompactTextString(m) } +func (*MsgUnregisterHook) ProtoMessage() {} +func (*MsgUnregisterHook) Descriptor() ([]byte, []int) { + return fileDescriptor_20cafb73a0f25f2d, []int{2} +} +func (m *MsgUnregisterHook) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnregisterHook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnregisterHook.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnregisterHook) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnregisterHook.Merge(m, src) +} +func (m *MsgUnregisterHook) XXX_Size() int { + return m.Size() +} +func (m *MsgUnregisterHook) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnregisterHook.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnregisterHook proto.InternalMessageInfo + +func (m *MsgUnregisterHook) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgUnregisterHook) GetEventType() string { + if m != nil { + return m.EventType + } + return "" +} + +func (m *MsgUnregisterHook) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +type MsgUnregisterHookResponse struct { +} + +func (m *MsgUnregisterHookResponse) Reset() { *m = MsgUnregisterHookResponse{} } +func (m *MsgUnregisterHookResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnregisterHookResponse) ProtoMessage() {} +func (*MsgUnregisterHookResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_20cafb73a0f25f2d, []int{3} +} +func (m *MsgUnregisterHookResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnregisterHookResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnregisterHookResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnregisterHookResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnregisterHookResponse.Merge(m, src) +} +func (m *MsgUnregisterHookResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnregisterHookResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnregisterHookResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnregisterHookResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgRegisterHook)(nil), "nftvault.eventhook.MsgRegisterHook") + proto.RegisterType((*MsgRegisterHookResponse)(nil), "nftvault.eventhook.MsgRegisterHookResponse") + proto.RegisterType((*MsgUnregisterHook)(nil), "nftvault.eventhook.MsgUnregisterHook") + proto.RegisterType((*MsgUnregisterHookResponse)(nil), "nftvault.eventhook.MsgUnregisterHookResponse") +} + func init() { proto.RegisterFile("ununifi/eventhook/tx.proto", fileDescriptor_20cafb73a0f25f2d) } var fileDescriptor_20cafb73a0f25f2d = []byte{ - // 139 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xcd, 0x2b, 0xcd, - 0xcb, 0x4c, 0xcb, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0xc9, 0xc8, 0xcf, 0xcf, 0xd6, 0x2f, 0xa9, - 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xca, 0x4b, 0x2b, 0x29, 0x4b, 0x2c, 0xcd, 0x29, - 0xd1, 0x83, 0x4b, 0x1a, 0xb1, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x3b, 0xb9, 0x9c, 0x78, 0x24, 0xc7, - 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, - 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x56, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, - 0x7e, 0xae, 0x7e, 0x68, 0x5e, 0x68, 0x5e, 0xa6, 0x5b, 0xa6, 0x7e, 0x72, 0x46, 0x62, 0x66, 0x9e, - 0x7e, 0x05, 0xb2, 0x1d, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x7b, 0x8c, 0x01, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x8e, 0x55, 0x3f, 0xae, 0x85, 0x00, 0x00, 0x00, + // 402 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x18, 0x86, 0x9b, 0xa4, 0x56, 0xf6, 0x53, 0xb6, 0xeb, 0x1c, 0xdc, 0x18, 0x31, 0xd4, 0x8a, 0xb0, + 0xab, 0x98, 0xc0, 0xfa, 0x0b, 0x56, 0x44, 0x84, 0xa5, 0x20, 0xc1, 0x78, 0xd8, 0x4b, 0x9d, 0x26, + 0x5f, 0xd3, 0xa1, 0xe9, 0x4c, 0x98, 0x99, 0x94, 0xe6, 0x5f, 0xf8, 0xb3, 0xbc, 0xd9, 0xa3, 0x47, + 0x69, 0xcf, 0xfe, 0x07, 0x61, 0x62, 0x83, 0x4d, 0x5d, 0xe8, 0x6d, 0xf2, 0xbe, 0xef, 0xf7, 0x66, + 0x9e, 0xe4, 0x03, 0xaf, 0xe4, 0x25, 0x67, 0x53, 0x16, 0xe2, 0x12, 0xb9, 0x9e, 0x09, 0x31, 0x0f, + 0xf5, 0x2a, 0x28, 0xa4, 0xd0, 0x82, 0x10, 0x3e, 0xd5, 0x4b, 0x5a, 0xe6, 0x3a, 0x68, 0x4c, 0xef, + 0xf9, 0x61, 0xbe, 0x39, 0xd5, 0x63, 0xc3, 0xdf, 0x16, 0xf4, 0x47, 0x2a, 0x8b, 0x30, 0x63, 0x4a, + 0xa3, 0xfc, 0x28, 0xc4, 0x9c, 0x3c, 0x86, 0x9e, 0x42, 0x9e, 0xa2, 0x74, 0xad, 0x81, 0x75, 0x71, + 0x12, 0xfd, 0x7d, 0x22, 0x04, 0xba, 0x9c, 0x2e, 0xd0, 0xb5, 0x8d, 0x6a, 0xce, 0xe4, 0x12, 0xce, + 0x12, 0xc1, 0xb5, 0xa4, 0x89, 0x1e, 0xd3, 0x34, 0x95, 0xa8, 0x94, 0xeb, 0x18, 0xbf, 0xbf, 0xd3, + 0xaf, 0x6b, 0x99, 0x9c, 0xc3, 0xfd, 0x8c, 0xe9, 0x71, 0x29, 0x73, 0xb7, 0x5b, 0xf7, 0x66, 0x4c, + 0xc7, 0x32, 0x27, 0xcf, 0x00, 0xcc, 0xb5, 0xc6, 0xba, 0x2a, 0xd0, 0xbd, 0x67, 0xbc, 0x13, 0xa3, + 0x7c, 0xae, 0x0a, 0x24, 0x37, 0x70, 0x56, 0xdb, 0x54, 0x6b, 0xc9, 0x26, 0xa5, 0x46, 0xe5, 0xf6, + 0x06, 0xce, 0xc5, 0x83, 0xab, 0x41, 0x70, 0x08, 0x1d, 0xdc, 0x60, 0xf5, 0x85, 0xe6, 0x25, 0x7e, + 0xa2, 0x4c, 0x46, 0x7d, 0xa3, 0x5f, 0x37, 0x83, 0xc3, 0x4b, 0x38, 0x6f, 0xe1, 0x46, 0xa8, 0x0a, + 0xc1, 0x15, 0x92, 0x53, 0xb0, 0x59, 0x6a, 0x90, 0xbb, 0x91, 0xcd, 0xd2, 0xe1, 0x2d, 0x3c, 0x1a, + 0xa9, 0x2c, 0xe6, 0xf2, 0x98, 0x6f, 0xb3, 0xcf, 0x60, 0xb7, 0x19, 0xea, 0x6e, 0xa7, 0xe9, 0x7e, + 0x0a, 0x4f, 0x0e, 0xba, 0x77, 0x17, 0xb9, 0xfa, 0x61, 0x81, 0x33, 0x52, 0x19, 0xf9, 0x0a, 0x0f, + 0xf7, 0xfe, 0xcb, 0x8b, 0xff, 0xe1, 0xb6, 0x68, 0xbc, 0xd7, 0x47, 0x84, 0x1a, 0xe4, 0x29, 0x9c, + 0xb6, 0xf8, 0x5e, 0xde, 0x31, 0xbe, 0x1f, 0xf3, 0xde, 0x1c, 0x15, 0xdb, 0xbd, 0xe7, 0xdd, 0xfb, + 0xef, 0x1b, 0xdf, 0x5a, 0x6f, 0x7c, 0xeb, 0xd7, 0xc6, 0xb7, 0xbe, 0x6d, 0xfd, 0xce, 0x7a, 0xeb, + 0x77, 0x7e, 0x6e, 0xfd, 0xce, 0xed, 0xab, 0x8c, 0xe9, 0x59, 0x39, 0x09, 0x12, 0xb1, 0x08, 0x63, + 0x1e, 0x73, 0xf6, 0x81, 0x85, 0xc9, 0x8c, 0x32, 0x1e, 0xae, 0xfe, 0xdd, 0xf2, 0xaa, 0x40, 0x35, + 0xe9, 0x99, 0x95, 0x7d, 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xe9, 0x3c, 0x99, 0x07, 0x03, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +303,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // this line is used by starport scaffolding # proto/tx/rpc + RegisterHook(ctx context.Context, in *MsgRegisterHook, opts ...grpc.CallOption) (*MsgRegisterHookResponse, error) + UnregisterHook(ctx context.Context, in *MsgUnregisterHook, opts ...grpc.CallOption) (*MsgUnregisterHookResponse, error) } type msgClient struct { @@ -60,22 +316,934 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) RegisterHook(ctx context.Context, in *MsgRegisterHook, opts ...grpc.CallOption) (*MsgRegisterHookResponse, error) { + out := new(MsgRegisterHookResponse) + err := c.cc.Invoke(ctx, "/nftvault.eventhook.Msg/RegisterHook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UnregisterHook(ctx context.Context, in *MsgUnregisterHook, opts ...grpc.CallOption) (*MsgUnregisterHookResponse, error) { + out := new(MsgUnregisterHookResponse) + err := c.cc.Invoke(ctx, "/nftvault.eventhook.Msg/UnregisterHook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + // this line is used by starport scaffolding # proto/tx/rpc + RegisterHook(context.Context, *MsgRegisterHook) (*MsgRegisterHookResponse, error) + UnregisterHook(context.Context, *MsgUnregisterHook) (*MsgUnregisterHookResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) RegisterHook(ctx context.Context, req *MsgRegisterHook) (*MsgRegisterHookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterHook not implemented") +} +func (*UnimplementedMsgServer) UnregisterHook(ctx context.Context, req *MsgUnregisterHook) (*MsgUnregisterHookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnregisterHook not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_RegisterHook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterHook) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterHook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nftvault.eventhook.Msg/RegisterHook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterHook(ctx, req.(*MsgRegisterHook)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UnregisterHook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnregisterHook) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnregisterHook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nftvault.eventhook.Msg/UnregisterHook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnregisterHook(ctx, req.(*MsgUnregisterHook)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "nftvault.eventhook.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "ununifi/eventhook/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterHook", + Handler: _Msg_RegisterHook_Handler, + }, + { + MethodName: "UnregisterHook", + Handler: _Msg_UnregisterHook_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ununifi/eventhook/tx.proto", +} + +func (m *MsgRegisterHook) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterHook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EventAttributes) > 0 { + for iNdEx := len(m.EventAttributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EventAttributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.EventType) > 0 { + i -= len(m.EventType) + copy(dAtA[i:], m.EventType) + i = encodeVarintTx(dAtA, i, uint64(len(m.EventType))) + i-- + dAtA[i] = 0x2a + } + if len(m.GitUrl) > 0 { + i -= len(m.GitUrl) + copy(dAtA[i:], m.GitUrl) + i = encodeVarintTx(dAtA, i, uint64(len(m.GitUrl))) + i-- + dAtA[i] = 0x22 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterHookResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterHookResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgUnregisterHook) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnregisterHook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnregisterHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x18 + } + if len(m.EventType) > 0 { + i -= len(m.EventType) + copy(dAtA[i:], m.EventType) + i = encodeVarintTx(dAtA, i, uint64(len(m.EventType))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUnregisterHookResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnregisterHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnregisterHookResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterHook) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.GitUrl) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.EventType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.EventAttributes) > 0 { + for _, e := range m.EventAttributes { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgRegisterHookResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + return n +} + +func (m *MsgUnregisterHook) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.EventType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + return n +} + +func (m *MsgUnregisterHookResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterHook) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterHook: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterHook: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GitUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GitUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EventType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EventAttributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EventAttributes = append(m.EventAttributes, &KeyValuePair{}) + if err := m.EventAttributes[len(m.EventAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterHookResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterHookResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterHookResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } +func (m *MsgUnregisterHook) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnregisterHook: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnregisterHook: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EventType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnregisterHookResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnregisterHookResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnregisterHookResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/nft/keeper/keeper.go b/x/nft/keeper/keeper.go index d8d70647e..88c5beb7f 100644 --- a/x/nft/keeper/keeper.go +++ b/x/nft/keeper/keeper.go @@ -1,24 +1,75 @@ package keeper import ( - "github.com/UnUniFi/chain/x/nft/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/cosmos/cosmos-sdk/x/nft" "github.com/cosmos/cosmos-sdk/x/nft/keeper" + + // wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/UnUniFi/chain/x/nft/types" ) type Keeper struct { keeper.Keeper cdc codec.BinaryCodec + + // wasmKeeper wasmtypes.ContractOpsKeeper + authority string } -func NewKeeper(k keeper.Keeper, cdc codec.BinaryCodec) Keeper { +func NewKeeper(k keeper.Keeper, cdc codec.BinaryCodec /*wasmKeeper wasmtypes.ContractOpsKeeper,*/, authority string) Keeper { return Keeper{ Keeper: k, cdc: cdc, + // wasmKeeper: wasmKeeper, + authority: authority, + } +} + +func (k Keeper) GetClassData(ctx sdk.Context, classId string) (types.ClassData, bool) { + token, found := k.Keeper.GetClass(ctx, classId) + if !found { + return types.ClassData{}, false + } + + var classDataI types.ClassDataI + if err := k.cdc.UnpackAny(token.Data, classDataI); err != nil { + return types.ClassData{}, true + } + + if token.Data == nil { + return types.ClassData{}, true + } + + switch classData := classDataI.(type) { + case *types.ClassData: + return *classData, true + default: + return types.ClassData{}, true + } +} + +func (k Keeper) SetClassData(ctx sdk.Context, classId string, data types.ClassData) error { + class, found := k.Keeper.GetClass(ctx, classId) + if !found { + return nft.ErrClassNotExists } + + dataAny, err := codectypes.NewAnyWithValue(&data) + if err != nil { + return err + } + + class.Data = dataAny + err = k.Keeper.UpdateClass(ctx, class) + if err != nil { + return err + } + + return nil } func (k Keeper) GetNftData(ctx sdk.Context, classId string, id string) (types.NftData, bool) { @@ -27,18 +78,27 @@ func (k Keeper) GetNftData(ctx sdk.Context, classId string, id string) (types.Nf return types.NftData{}, false } - var nftData types.NftData - if err := k.cdc.UnpackAny(token.Data, &nftData); err != nil { - return types.NftData{}, false + var nftDataI types.NftDataI + if err := k.cdc.UnpackAny(token.Data, nftDataI); err != nil { + return types.NftData{}, true + } + + if token.Data == nil { + return types.NftData{}, true } - return nftData, true + switch nftData := nftDataI.(type) { + case *types.NftData: + return *nftData, true + default: + return types.NftData{}, true + } } func (k Keeper) SetNftData(ctx sdk.Context, classId string, id string, data types.NftData) error { token, found := k.Keeper.GetNFT(ctx, classId, id) if !found { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown NFT %s", id) + return nft.ErrNFTNotExists } dataAny, err := codectypes.NewAnyWithValue(&data) diff --git a/x/nft/keeper/msg_server.go b/x/nft/keeper/msg_server.go index 2267efe52..3d6591758 100644 --- a/x/nft/keeper/msg_server.go +++ b/x/nft/keeper/msg_server.go @@ -2,10 +2,13 @@ package keeper import ( "context" + // "encoding/json" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/nft" + // authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var _ nft.MsgServer = Keeper{} @@ -20,7 +23,7 @@ func (k Keeper) Send(goCtx context.Context, msg *nft.MsgSend) (*nft.MsgSendRespo owner := k.GetOwner(ctx, msg.ClassId, msg.Id) if !owner.Equals(sender) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of nft %s", sender, msg.Id) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of nft %s", sender, msg.Id) } receiver, err := sdk.AccAddressFromBech32(msg.Receiver) @@ -28,20 +31,44 @@ func (k Keeper) Send(goCtx context.Context, msg *nft.MsgSend) (*nft.MsgSendRespo return nil, err } + // Check NftData nftData, found := k.GetNftData(ctx, msg.ClassId, msg.Id) if !found { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown NFT %s", msg.Id) + return nil, nft.ErrNFTNotExists } if nftData.SendDisabled { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Sending NFT %s of class %s is disabled", msg.Id, msg.ClassId) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "Sending NFT %s of class %s is disabled", msg.Id, msg.ClassId) } + // Check ClassData + // Must be done after checking NftData + // class, found := k.GetClassData(ctx, msg.ClassId) + // if !found { + // return nil, nft.ErrClassNotExists + // } + // if class.SendPrehookContract != "" { + // contractAddr, err := sdk.AccAddressFromBech32(class.SendPrehookContract) + // if err != nil { + // return nil, err + // } + // address := authtypes.NewModuleAddress(nft.ModuleName) + // wasmMsg, err := json.Marshal(struct{}{}) + // if err != nil { + // return nil, err + // } + + // _, err = k.wasmKeeper.Execute(ctx, contractAddr, address, []byte(wasmMsg), sdk.Coins{}) + // if err != nil { + // return nil, err + // } + // } + if err := k.Transfer(ctx, msg.ClassId, msg.Id, receiver); err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&nft.EventSend{ + _ = ctx.EventManager().EmitTypedEvent(&nft.EventSend{ ClassId: msg.ClassId, Id: msg.Id, Sender: msg.Sender, diff --git a/x/nft/keeper/test/01_nft_transfer_disable.sh b/x/nft/keeper/test/01_nft_transfer_disable.sh new file mode 100644 index 000000000..c0ddb11b0 --- /dev/null +++ b/x/nft/keeper/test/01_nft_transfer_disable.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# block speed +sleep=5 + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------check nft------------" +ununifid q nft nft ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 + +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "------------check nft------------" +ununifid q nft nft ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 diff --git a/x/nft/module/module.go b/x/nft/module/module.go index 5e6850b6d..b6500c9cc 100644 --- a/x/nft/module/module.go +++ b/x/nft/module/module.go @@ -1,14 +1,27 @@ package module import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/nft" nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module" newkeeper "github.com/UnUniFi/chain/x/nft/keeper" + "github.com/UnUniFi/chain/x/nft/types" ) +// AppModuleBasic defines the basic application module used by the nft module. +type AppModuleBasic struct { + nftmodule.AppModuleBasic +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + a.AppModuleBasic.RegisterInterfaces(reg) + types.RegisterInterfaces(reg) +} + // AppModule implements the sdk.AppModule interface type AppModule struct { nftmodule.AppModule diff --git a/deprecated/x/yieldfarm/types/codec.go b/x/nft/types/codec.go similarity index 56% rename from deprecated/x/yieldfarm/types/codec.go rename to x/nft/types/codec.go index d3848edba..12ee13396 100644 --- a/deprecated/x/yieldfarm/types/codec.go +++ b/x/nft/types/codec.go @@ -9,11 +9,9 @@ func RegisterCodec(cdc *codec.LegacyAmino) { } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - - // msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + registry.RegisterInterface( + "ununifi.nft.NftDataI", + (*NftDataI)(nil), + &NftData{}, + ) } - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/nft/types/data.go b/x/nft/types/data.go new file mode 100644 index 000000000..0e6d3f8f1 --- /dev/null +++ b/x/nft/types/data.go @@ -0,0 +1,13 @@ +package types + +import ( + proto "github.com/cosmos/gogoproto/proto" +) + +type ClassDataI interface { + proto.Message +} + +type NftDataI interface { + proto.Message +} diff --git a/x/nft/types/nft.pb.go b/x/nft/types/nft.pb.go index b839c93a8..521957b32 100644 --- a/x/nft/types/nft.pb.go +++ b/x/nft/types/nft.pb.go @@ -6,6 +6,7 @@ package types import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -24,6 +25,50 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type ClassData struct { + SendPrehookContract string `protobuf:"bytes,1,opt,name=send_prehook_contract,json=sendPrehookContract,proto3" json:"send_prehook_contract,omitempty"` +} + +func (m *ClassData) Reset() { *m = ClassData{} } +func (m *ClassData) String() string { return proto.CompactTextString(m) } +func (*ClassData) ProtoMessage() {} +func (*ClassData) Descriptor() ([]byte, []int) { + return fileDescriptor_e3328dbf8ea3b159, []int{0} +} +func (m *ClassData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClassData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClassData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClassData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClassData.Merge(m, src) +} +func (m *ClassData) XXX_Size() int { + return m.Size() +} +func (m *ClassData) XXX_DiscardUnknown() { + xxx_messageInfo_ClassData.DiscardUnknown(m) +} + +var xxx_messageInfo_ClassData proto.InternalMessageInfo + +func (m *ClassData) GetSendPrehookContract() string { + if m != nil { + return m.SendPrehookContract + } + return "" +} + type NftData struct { SendDisabled bool `protobuf:"varint,1,opt,name=send_disabled,json=sendDisabled,proto3" json:"send_disabled,omitempty"` } @@ -32,7 +77,7 @@ func (m *NftData) Reset() { *m = NftData{} } func (m *NftData) String() string { return proto.CompactTextString(m) } func (*NftData) ProtoMessage() {} func (*NftData) Descriptor() ([]byte, []int) { - return fileDescriptor_e3328dbf8ea3b159, []int{0} + return fileDescriptor_e3328dbf8ea3b159, []int{1} } func (m *NftData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -69,25 +114,60 @@ func (m *NftData) GetSendDisabled() bool { } func init() { + proto.RegisterType((*ClassData)(nil), "ununifi.nft.ClassData") proto.RegisterType((*NftData)(nil), "ununifi.nft.NftData") } func init() { proto.RegisterFile("ununifi/nft/nft.proto", fileDescriptor_e3328dbf8ea3b159) } var fileDescriptor_e3328dbf8ea3b159 = []byte{ - // 188 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0xcd, 0x2b, 0xcd, - 0xcb, 0x4c, 0xcb, 0xd4, 0xcf, 0x4b, 0x2b, 0x01, 0x61, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, - 0x6e, 0xa8, 0xb0, 0x5e, 0x5e, 0x5a, 0x89, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x58, 0x5c, 0x1f, - 0xc4, 0x82, 0x28, 0x91, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x87, 0x48, 0x40, 0x38, - 0x10, 0x29, 0x25, 0x3d, 0x2e, 0x76, 0xbf, 0xb4, 0x12, 0x97, 0xc4, 0x92, 0x44, 0x21, 0x65, 0x2e, - 0xde, 0xe2, 0xd4, 0xbc, 0x94, 0xf8, 0x94, 0xcc, 0xe2, 0xc4, 0xa4, 0x9c, 0xd4, 0x14, 0x09, 0x46, - 0x05, 0x46, 0x0d, 0x8e, 0x20, 0x1e, 0x90, 0xa0, 0x0b, 0x54, 0xcc, 0xc9, 0xee, 0xc4, 0x23, 0x39, - 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, - 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x54, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, - 0xf3, 0x73, 0xf5, 0x43, 0xf3, 0x42, 0xf3, 0x32, 0xdd, 0x32, 0xf5, 0x93, 0x33, 0x12, 0x33, 0xf3, - 0xf4, 0x2b, 0xc0, 0x2e, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x5b, 0x6b, 0x0c, 0x08, - 0x00, 0x00, 0xff, 0xff, 0x76, 0x76, 0xea, 0xc4, 0xcd, 0x00, 0x00, 0x00, + // 249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x31, 0x4b, 0xc4, 0x30, + 0x14, 0xc7, 0x9b, 0x45, 0xbd, 0xa8, 0xcb, 0xe9, 0x81, 0xde, 0x10, 0xe4, 0x74, 0x70, 0x6a, 0x40, + 0x77, 0x05, 0xef, 0x70, 0x14, 0x39, 0xb8, 0xc5, 0xa5, 0xa4, 0x69, 0x92, 0x06, 0x7b, 0xef, 0x95, + 0x26, 0x05, 0xef, 0x5b, 0xf8, 0xb1, 0x1c, 0x6f, 0x74, 0x94, 0xf6, 0x8b, 0x48, 0x93, 0xde, 0x10, + 0xc8, 0xff, 0xf7, 0x7b, 0x7f, 0x78, 0x3c, 0x3a, 0x6b, 0xa1, 0x05, 0xab, 0x2d, 0x07, 0xed, 0x87, + 0x97, 0xd6, 0x0d, 0x7a, 0x9c, 0x9e, 0x8e, 0x38, 0x05, 0xed, 0xe7, 0x97, 0x06, 0x0d, 0x06, 0xce, + 0x87, 0x5f, 0x1c, 0x99, 0x5f, 0x4b, 0x74, 0x5b, 0x74, 0x59, 0x14, 0x31, 0x1c, 0x94, 0x41, 0x34, + 0x95, 0xe2, 0x21, 0xe5, 0xad, 0xe6, 0x02, 0x76, 0x51, 0x2d, 0x9e, 0xe9, 0x64, 0x59, 0x09, 0xe7, + 0x56, 0xc2, 0x8b, 0xe9, 0x03, 0x9d, 0x39, 0x05, 0x45, 0x56, 0x37, 0xaa, 0x44, 0xfc, 0xcc, 0x24, + 0x82, 0x6f, 0x84, 0xf4, 0x57, 0xe4, 0x86, 0xdc, 0x4f, 0xd6, 0x17, 0x83, 0x7c, 0x8f, 0x6e, 0x39, + 0xaa, 0x45, 0x4a, 0x8f, 0xdf, 0xb4, 0x0f, 0xf5, 0x5b, 0x7a, 0x1e, 0xea, 0x85, 0x75, 0x22, 0xaf, + 0x54, 0x11, 0x6a, 0x27, 0xeb, 0xb3, 0x01, 0xae, 0x46, 0xf6, 0xf2, 0xf4, 0xd3, 0x31, 0xb2, 0xef, + 0x18, 0xf9, 0xeb, 0x18, 0xf9, 0xee, 0x59, 0xb2, 0xef, 0x59, 0xf2, 0xdb, 0xb3, 0xe4, 0xe3, 0xce, + 0x58, 0x5f, 0xb6, 0x79, 0x2a, 0x71, 0xcb, 0x37, 0xb0, 0x01, 0xfb, 0x6a, 0xb9, 0x2c, 0x85, 0x05, + 0xfe, 0x15, 0xae, 0xe1, 0x77, 0xb5, 0x72, 0xf9, 0x51, 0xd8, 0xfb, 0xf1, 0x3f, 0x00, 0x00, 0xff, + 0xff, 0x08, 0xe6, 0x4a, 0x2f, 0x29, 0x01, 0x00, 0x00, +} + +func (m *ClassData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClassData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClassData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SendPrehookContract) > 0 { + i -= len(m.SendPrehookContract) + copy(dAtA[i:], m.SendPrehookContract) + i = encodeVarintNft(dAtA, i, uint64(len(m.SendPrehookContract))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *NftData) Marshal() (dAtA []byte, err error) { @@ -134,6 +214,19 @@ func encodeVarintNft(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *ClassData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SendPrehookContract) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *NftData) Size() (n int) { if m == nil { return 0 @@ -152,6 +245,88 @@ func sovNft(x uint64) (n int) { func sozNft(x uint64) (n int) { return sovNft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *ClassData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClassData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClassData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SendPrehookContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SendPrehookContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NftData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/nftbackedloan/LICENSE.md b/x/nftbackedloan/LICENSE.md new file mode 100644 index 000000000..e2ad27d0d --- /dev/null +++ b/x/nftbackedloan/LICENSE.md @@ -0,0 +1,102 @@ +Business Source License 1.1 + +License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. +"Business Source License" is a trademark of MariaDB Corporation Ab. + +----------------------------------------------------------------------------- + +Parameters + +Licensor: CAUCHYE ASIA PTE. LTD. + +Licensed Work: UnUniFi Core NFT Backed loan module + UnUniFi Core Interchain Yield Aggregator module + UnUniFi Core Derivatives module + The Licensed Work is (c) 2023 CAUCHYE ASIA PTE. LTD. + +Additional Use Grant: Non-commercial testnet building + Development of smart contracts that are integrated with the Licensed Work + Type definition files for developing interoperable modules or smart contracts that are integrated with the Licensed Work + +Change Date: The earlier of 2027-08-01 + +Change License: GNU General Public License v3.0 or later + +----------------------------------------------------------------------------- + +Terms + +The Licensor hereby grants you the right to copy, modify, create derivative +works, redistribute, and make non-production use of the Licensed Work. The +Licensor may make an Additional Use Grant, above, permitting limited +production use. + +Effective on the Change Date, or the fourth anniversary of the first publicly +available distribution of a specific version of the Licensed Work under this +License, whichever comes first, the Licensor hereby grants you rights under +the terms of the Change License, and the rights granted in the paragraph +above terminate. + +If your use of the Licensed Work does not comply with the requirements +currently in effect as described in this License, you must purchase a +commercial license from the Licensor, its affiliated entities, or authorized +resellers, or you must refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works +of the Licensed Work, are subject to this License. This License applies +separately for each version of the Licensed Work and the Change Date may vary +for each version of the Licensed Work released by Licensor. + +You must conspicuously display this License on each original or modified copy +of the Licensed Work. If you receive the Licensed Work in original or +modified form from a third party, the terms and conditions set forth in this +License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically +terminate your rights under this License for the current and all other +versions of the Licensed Work. + +This License does not grant you any right in any trademark or logo of +Licensor or its affiliates (provided that you may use a trademark or logo of +Licensor as expressly required by this License). + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +TITLE. + +MariaDB hereby grants you permission to use this License’s text to license +your works, and to refer to it using the trademark "Business Source License", +as long as you comply with the Covenants of Licensor below. + +----------------------------------------------------------------------------- + +Covenants of Licensor + +In consideration of the right to use this License’s text and the "Business +Source License" name and trademark, Licensor covenants to MariaDB, and to all +other recipients of the licensed work to be provided by Licensor: + +1. To specify as the Change License the GPL Version 2.0 or any later version, + or a license that is compatible with GPL Version 2.0 or a later version, + where "compatible" means that software provided under the Change License can + be included in a program with software provided under GPL Version 2.0 or a + later version. Licensor may specify additional Change Licenses without + limitation. + +2. To either: (a) specify an additional grant of rights to use that does not + impose any additional restriction on the right granted in this License, as + the Additional Use Grant; or (b) insert the text "None". + +3. To specify a Change Date. + +4. Not to modify this License in any other way. + +----------------------------------------------------------------------------- + +Notice + +The Business Source License (this document, or the "License") is not an Open +Source license. However, the Licensed Work will eventually be made available +under an Open Source License, as stated in this License. diff --git a/x/nftbackedloan/README.md b/x/nftbackedloan/README.md index d3499b643..44fd0102d 100644 --- a/x/nftbackedloan/README.md +++ b/x/nftbackedloan/README.md @@ -1,6 +1,6 @@ -# NFTMARKET +# NFT BACKED LOAN -The ``NFTMARKET`` module provides the logic to create and interact with auction on the UnUniFi for NFT liquidity +The `NFTBACKEDLOAN` module provides NFT-Fi services that allow borrowers to borrow tokens by putting NFTs as collateral. ## Contents @@ -13,11 +13,13 @@ The ``NFTMARKET`` module provides the logic to create and interact with auction ## Concepts -The `x/nftmarket` module implements an NFT Auction +The `x/nftbackedloan` module implements NFT-Fi services. -Here we will explain basic NFT Auction concepts. +The borrowers list the NFT on the marketplace for collateral. The Lenders bid on the NFTs in the marketplace, and the deposit amounts at this time become the borrower's lending pool. -### Auction +If the loan is not repaid by the due date or the borrower decides to sell, the NFT belongs to the lender. + +### NFT Market #### List @@ -26,45 +28,45 @@ You can list your NFTs for auction. #### Cancel List You can cancel list. -The requirement is that the lister does not borrow any tokens on this listing. +This operation is valid only when there are no bids for the NFT. #### Bid -You can bid on the auction. +You can bid on NFTs to lend tokens. A deposit of at least the minimum deposit rate must be paid at the time of bidding. To be eligible to bid, you must meet the following requirements New bids must meet the following criteria -##### Definition - -- $i \in I$: index of bids -- $n = |I|$: number of bids -- $\{p_i\}_{i \in I}$: the price of $i$ th bid -- $\{d_i\}_{i \in I}$: the deposit amount of $i$ th bid -- $\{r_i\}_{i \in I}$: the interest rate of $i$ th bid -- $\{t_i\}_{i \in I}$: the expiration date of $i$ th bid -- $q = \frac{1}{n} \sum_{i \in I} p_i$ -- $s = \sum_{i \in I} d_i$: means the amount which lister can borrow with NFT as collateral -- $\{a_i\}_{i \in I}$: means the amount borrowed from $i$ th bid deposit -- $b = \sum_{i \in I} a_i$ -- $i_p(j)$: means the index of the $j$ th highest price bid -- $i_d(j)$: means the index of the $j$ th highest deposit amount bid -- $i_r(j)$: means the index of the $j$ th lowest interest rate bid -- $i_t(j)$: means the index of the $j$ th farthest expiration date bid -- $c$: minimum deposit rate +##### New Bid Definition + +$i \in I$: index of bids +$n = |I|$: number of bids +$\{p_i\}_{i \in I}$: the price of $i$ th bid +$\{d_i\}_{i \in I}$: the deposit amount of $i$ th bid +$\{r_i\}_{i \in I}$: the interest rate of $i$ th bid +$\{t_i\}_{i \in I}$: the expiration date of $i$ th bid +$q = \frac{1}{n} \sum_{i \in I} p_i$ +$s = \sum_{i \in I} d_i$: means the amount which lister can borrow with NFT as collateral +$\{a_i\}_{i \in I}$: means the amount borrowed from $i$ th bid deposit +$b = \sum_{i \in I} a_i$ +$i_p(j)$: means the index of the $j$ th highest price bid +$i_d(j)$: means the index of the $j$ th highest deposit amount bid +$i_r(j)$: means the index of the $j$ th lowest interest rate bid +$i_t(j)$: means the index of the $j$ th farthest expiration date bid +$c$: minimum deposit rate ##### New bid formulation When $(p_{\text{new}}, d_{\text{new}}, r_{\text{new}}, t_{\text{new}})$ will be added to the set of bids, the new bids sequence will be -- $I' = I \cup \{n+1\}$ -- $n' = n + 1$ -- $\{p_i'\}_{i \in I'} = \{p_i\}_{i \in I} \cup \{p_{\text{new}}\}$ -- $\{d_i'\}_{i \in I'} = \{d_i\}_{i \in I} \cup \{d_{\text{new}}\}$ -- $\{r_i'\}_{i \in I'} = \{r_i\}_{i \in I} \cup \{r_{\text{new}}\}$ -- $\{t_i'\}_{i \in I'} = \{t_i\}_{i \in I} \cup \{t_{\text{new}}\}$ -- $q' = \frac{1}{n'} \sum_{i \in I'} p_i'$ -- $s' = \sum_{i \in I'} d_i'$ +$I' = I \cup \{n+1\}$ +$n' = n + 1$ +$\{p_i'\}_{i \in I'} = \{p_i\}_{i \in I} \cup \{p_{\text{new}}\}$ +$\{d_i'\}_{i \in I'} = \{d_i\}_{i \in I} \cup \{d_{\text{new}}\}$ +$\{r_i'\}_{i \in I'} = \{r_i\}_{i \in I} \cup \{r_{\text{new}}\}$ +$\{t_i'\}_{i \in I'} = \{t_i\}_{i \in I} \cup \{t_{\text{new}}\}$ +$q' = \frac{1}{n'} \sum_{i \in I'} p_i'$ +$s' = \sum_{i \in I'} d_i'$ where the prime means the next state. @@ -84,66 +86,85 @@ where $c$ means minimum deposit rate. #### Cancel Bid You can cancel the bid. -Provided that the deposit of the bid is not rented out. +However, it is limited to the extent that NFT can liquidate and may not be canceled. Rebid is similarly limited. #### Sell lister can sell the NFT to the highest bidder. When the bidder accepts the offer and pays the price, the sale is completed. -If the bidder does not pay the `bidder price - deposit price` while the sell offer is being made, the bidder's deposit will be collected by the PROTOCOL. +If the bidder does not pay the `bidder price - deposit price` while the sell offer is being made, the bidder's deposit will be collected by the PROTOCOL. #### Borrow The lister can borrow a token when there is a bid for an auction that he/she has listed. -Failure to return borrowed tokens before the bid expires will result in liquidation. +Failure to return borrowed tokens before the bid expires will result in liquidation. + +Borrows must meet the following criteria + +##### Borrow Definition + +$p_i$: Bidder $i$'s bid price. + +$d_i$: Bidder $i$'s deposit. + +$r_i$: Bidder $i$'s interest rate (annual rate). + +$r'(r, x)$: Interest rate converted to a period of $x$. + +$i_p(k)$: Bidder index for the $k$th bid price. + +$i_d(k)$: Bidder index for the $k$th deposit. + +$i_r(k)$: Bidder index for the $k$th interest rate. + +##### Borrow formulation + +Borrowing capacity $a$ is defined as follows. $x$ is the borrowing period. + +$$ +\begin{aligned}a(x) &= \sum_{k=1}^K(x) d_{i_r(k)} \\ K(x) &= \max\left\{K \middle| \sum_{k=1}^K (1 + r'(r_{i_r(k)}, x)) d_{i_r(k)} \le \min_L \left\{ p_{i_p(l)} + \sum_{l=1}^{L-1} d_{i_p(l)} \right\} \right\} \end{aligned} +$$ + +In the scenario where "after several consecutive deposit forfeitures, the bidder is eventually successful in an auction, and the amount becomes the smallest," it is possible to borrow only up to the amount that can be covered, including interest, at that amount. ### Liquidation -If the borrowed tokens are not returned by the bid's expiration date, a liquidation of the auction occurs. +If the borrowed tokens are not returned by the bid's expiration date, a liquidation of the auction occurs. When liquidation occurs, the following will happen: -- The bidder must pay the liquidation amount (bid price - deposit price) by the payment deadline. -- If the bidder does not pay the liquidation amount, the deposit amount will be collected. +- All bidder must pay the liquidation amount (bid price - deposit price) by the payment deadline. If the winning bidder did not pay the liquidation amount, the deposit amount will be collected. - The winning bidder is determined by verifying the payment in descending order of deposit amount (not bid price), and the winning bidder is established once the payment is confirmed. -- The guaranteed winning amount for the lister is only the total deposit price. - Unsuccessful bidders will have their deposits returned. -- If interest accrues for the bidder, interest will be paid under the following conditions: - - If deposit interest < (winning bid amount - winning bidder's deposit amount): the bidder receives the full interest amount - - If deposit interest > (winning bid amount - winning bidder's deposit amount): the bidder receives a portion of the interest based on the proportion of all interest at the time of liquidation -- If no bidder pays the liquidation amount, the NFT and the total deposit amount become the property of the lister. - -#### Auto Re-refinancing - -Auto Re-refinancing is a feature that automatically refinances the borrowed deposit of a listed bid when its expiration date is reached, preventing liquidation from occurring. This function requires another bid to be available, and the amount that can be borrowed from that bid must exceed the amount to be refinanced. The criteria for selecting the deposit to refinance is that the auto refinancing is performed in order of the lowest interest rate. -The lister sets this when listing. +- The bidder's interest will be paid from the liquidation amount of the winning bid price. +- If all bidders did not pay the liquidation amount, the NFT and the total deposit amount become the property of the lister. #### Auto Payment -Auto Payment is a feature that automatically pays the liquidation amount when the auction's liquidation occurs for a bid. If there are insufficient funds at the time of liquidation, manual payment will be required. -The bidder sets this when bidding. +Auto Payment is a option of bidding that automatically pays the liquidation amount when the auction's liquidation occurs for a bid. If there are insufficient funds at the time of liquidation, manual payment will be required. +The bidder can set when bidding. ## network-parameters -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `min_staking_for_listing` | [string](#string) | | | -| `bid_tokens` | [string](#string) | repeated | | -| `auto_relisting_count_if_no_bid` | [uint64](#uint64) | | | -| `nft_listing_delay_seconds` | [uint64](#uint64) | | | -| `nft_listing_period_initial` | [uint64](#uint64) | | | -| `nft_listing_cancel_required_seconds` | [uint64](#uint64) | | | -| `nft_listing_cancel_fee_percentage` | [uint64](#uint64) | | | -| `nft_listing_gap_time` | [uint64](#uint64) | | | -| `bid_cancel_required_seconds` | [uint64](#uint64) | | | -| `bid_token_disburse_seconds_after_cancel` | [uint64](#uint64) | | | -| `nft_listing_full_payment_period` | [uint64](#uint64) | | | -| `nft_listing_nft_delivery_period` | [uint64](#uint64) | | | -| `nft_creator_share_percentage` | [uint64](#uint64) | | | -| `market_administrator` | [string](#string) | | | -| `nft_listing_commission_fee` | [uint64](#uint64) | | | -| `nft_listing_extend_seconds` | [uint64](#uint64) | | | -| `nft_listing_period_extend_fee_per_hour` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| Field | Type | Label | Description | +| ----------------------------------------- | ----------------------------------------------------- | -------- | ----------- | +| `min_staking_for_listing` | [string](#string) | | | +| `bid_tokens` | [string](#string) | repeated | | +| `auto_relisting_count_if_no_bid` | [uint64](#uint64) | | | +| `nft_listing_delay_seconds` | [uint64](#uint64) | | | +| `nft_listing_period_initial` | [uint64](#uint64) | | | +| `nft_listing_cancel_required_seconds` | [uint64](#uint64) | | | +| `nft_listing_cancel_fee_percentage` | [uint64](#uint64) | | | +| `nft_listing_gap_time` | [uint64](#uint64) | | | +| `bid_cancel_required_seconds` | [uint64](#uint64) | | | +| `bid_token_disburse_seconds_after_cancel` | [uint64](#uint64) | | | +| `nft_listing_full_payment_period` | [uint64](#uint64) | | | +| `nft_listing_nft_delivery_period` | [uint64](#uint64) | | | +| `nft_creator_share_percentage` | [uint64](#uint64) | | | +| `market_administrator` | [string](#string) | | | +| `nft_listing_commission_fee` | [uint64](#uint64) | | | +| `nft_listing_extend_seconds` | [uint64](#uint64) | | | +| `nft_listing_period_extend_fee_per_hour` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | 1. min_staking_for_listing - not use 1. bid_tokens - Types of tokens available for auction @@ -167,50 +188,46 @@ The bidder sets this when bidding. ### MsgListNft -[MsgListNft](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L39-L59) +[MsgListNft](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L34-L49) ### MsgCancelNftListing -[MsgCancelNftListing](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L62-L69) +[MsgCancelNftListing](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L52-L55) -### MsgBorrow +### MsgPlaceBid -[MsgBorrow](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L131-L139) +[MsgPlaceBid](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L58-L70) ### MsgCancelBid -[MsgCancelBid](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L91-L98) - -### MsgMintNft - -[MsgMintNft](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L26-L36) - -### MsgPayFullBid +[MsgCancelBid](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L73-L76) -[MsgPayFullBid](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L121-L128) - -### MsgPlaceBid +### MsgBorrow -[MsgPlaceBid](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L72-L88) +[MsgBorrow](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L102-L106) ### MsgRepay -[MsgRepay](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L142-L150) +[MsgRepay](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L109-L113) ### MsgSellingDecision -[MsgSellingDecision](https://github.com/UnUniFi/chain/blob/newDevelop/proto/nftmarket/tx.proto#L111-L118) +[MsgSellingDecision](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L85-L88) -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `ListNft` | [MsgListNft](#ununifi.nftmarket.MsgListNft) | [MsgListNftResponse](#ununifi.nftmarket.MsgListNftResponse) | | | -| `CancelNftListing` | [MsgCancelNftListing](#ununifi.nftmarket.MsgCancelNftListing) | [MsgCancelNftListingResponse](#ununifi.nftmarket.MsgCancelNftListingResponse) | | | -| `PlaceBid` | [MsgPlaceBid](#ununifi.nftmarket.MsgPlaceBid) | [MsgPlaceBidResponse](#ununifi.nftmarket.MsgPlaceBidResponse) | | | -| `CancelBid` | [MsgCancelBid](#ununifi.nftmarket.MsgCancelBid) | [MsgCancelBidResponse](#ununifi.nftmarket.MsgCancelBidResponse) | | | -| `SellingDecision` | [MsgSellingDecision](#ununifi.nftmarket.MsgSellingDecision) | [MsgSellingDecisionResponse](#ununifi.nftmarket.MsgSellingDecisionResponse) | | | -| `PayFullBid` | [MsgPayFullBid](#ununifi.nftmarket.MsgPayFullBid) | [MsgPayFullBidResponse](#ununifi.nftmarket.MsgPayFullBidResponse) | | | -| `Borrow` | [MsgBorrow](#ununifi.nftmarket.MsgBorrow) | [MsgBorrowResponse](#ununifi.nftmarket.MsgBorrowResponse) | | | -| `Repay` | [MsgRepay](#ununifi.nftmarket.MsgRepay) | [MsgRepayResponse](#ununifi.nftmarket.MsgRepayResponse) | | | +### MsgPayRemainder + +[MsgPayRemainder](https://github.com/UnUniFi/chain/blob/newDevelop/proto/ununifi/nftbackedloan/tx.proto#L91-L94) + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ------------------ | ------------------------------------------- | ----------------------------------------------------------- | ----------- | --------- | -------- | +| `ListNft` | [MsgListNft](#MsgListNft) | [MsgListNftResponse](#MsgListNftResponse) | | | +| `CancelNftListing` | [MsgCancelNftListing](#MsgCancelNftListing) | [MsgCancelNftListingResponse](#MsgCancelNftListingResponse) | | | +| `PlaceBid` | [MsgPlaceBid](#MsgPlaceBid) | [MsgPlaceBidResponse](#MsgPlaceBidResponse) | | | +| `CancelBid` | [MsgCancelBid](#MsgCancelBid) | [MsgCancelBidResponse](#MsgCancelBidResponse) | | | +| `Borrow` | [MsgBorrow](#MsgBorrow) | [MsgBorrowResponse](#MsgBorrowResponse) | | | +| `Repay` | [MsgRepay](#MsgRepay) | [MsgRepayResponse](#MsgRepayResponse) | | | +| `SellingDecision` | [MsgSellingDecision](#MsgSellingDecision) | [MsgSellingDecisionResponse](#MsgSellingDecisionResponse) | | | +| `PayRemainder` | [MsgPayRemainder](#MsgPayRemainder) | [MsgPayRemainderResponse](#MsgPayRemainderResponse) | | | ## transactions @@ -219,7 +236,7 @@ The bidder sets this when bidding. Put the NFT up for auction. ```sh -ununifid tx nftmarket listing [nft-class-id] [nft-id] --min-minimum-deposit-rate [dec] --bid-token [token] --automatic-refinancing --min-bidding-period-hours [num] --from --chain-id +ununifid tx nftbackedloan list [nft-class-id] [nft-id] --min-deposit-rate [dec] --bid-token [token] --automatic-refinancing --min-bidding-period-hours [dec] --from --chain-id ``` ::: details Example @@ -229,15 +246,15 @@ The token used for bidding is `uguu` and the minimum bid deposit is `0.1%`. Enable the automatic-refinancing function ```sh -ununifid tx nftmarket listing a10 a10 --min-minimum-deposit-rate 0.01 --bid-token uguu --automatic-refinancing --from user --chain-id test +ununifid tx nftbackedloan list a10 a10 --min-deposit-rate 0.01 --bid-token uguu --automatic-refinancing --from user --chain-id test ``` -### Cancel List +### Cancel Listing -cancel list +Cancel NFT listing. ```sh -ununifid tx nftmarket cancel_listing [nft-class-id] [nft-id] --from --chain-id +ununifid tx nftbackedloan cancel-listing [nft-class-id] [nft-id] --from --chain-id ``` ::: details Example @@ -245,15 +262,15 @@ ununifid tx nftmarket cancel_listing [nft-class-id] [nft-id] --from --chain-id The List of `a10/a10` will be cancel. ```sh -ununifid tx nftmarket cancel_listing a10 a10 --chain-id test --from user --gas=300000 -y +ununifid tx nftbackedloan cancel-listing a10 a10 --chain-id test --from user --gas=300000 -y ``` -### Bid +### Place bid -Bid on the auction. +Bid on the NFT. ```sh -ununifid tx nftmarket placebid [nft-class-id] [nft-id] [bid-amount] [deposit-amount] [deposit-interest-rate] [bidding_hour_time] --from --chain-id +ununifid tx nftbackedloan place-bid [nft-class-id] [nft-id] [bid-amount] [deposit-amount] [deposit-interest-rate] [bidding_hour_time] --from --chain-id ``` ::: details Example @@ -264,63 +281,63 @@ The lending interest rate on the deposit is `0.1%`. The bid is valid for `48` hours. ```sh -ununifid tx nftmarket placebid a10 a10 100uguu 50uguu 0.1 48 --from user2 --chain-id test +ununifid tx nftbackedloan place-bid a10 a10 100uguu 50uguu 0.1 48 --from user2 --chain-id test ``` -### Cancel Bid +### Cancel Bidding Cancel Bid. ```sh -ununifid tx nftmarket cancelbid [nft-class-id] [nft-id] --from --chain-id +ununifid tx nftbackedloan cancel-bid [nft-class-id] [nft-id] --from --chain-id ``` ::: details Example -Cancel Bid on `a10/a10` auction. +Cancel Bid on `a10/a10` auction. ```sh -ununifid tx nftmarket cancelbid a10 a10 --from user2 --chain-id test +ununifid tx nftbackedloan cancel-bid a10 a10 --from user2 --chain-id test ``` -### Borrow +### Borrow tokens Borrow tokens from the auction you have listed. ```sh -ununifid tx nftmarket borrow [nft-class-id] [nft-id] [amount] --from --chain-id test +ununifid tx nftbackedloan borrow [nft-class-id] [nft-id] [bidder] [amount] --from --chain-id test ``` ::: details Example -Borrow 50uguu from a10/a10 auction +Borrow 50uguu from bidder `ununifitest` in a10/a10 auction ```sh -ununifid tx nftmarket borrow a10 a10 50uguu --from user --chain-id test +ununifid tx nftbackedloan borrow a10 a10 ununifitest 50uguu --from user --chain-id test ``` -### Repay +### Repay tokens Returns borrowed tokens. ```sh -ununifid tx nftmarket repay [nft-class-id] [nft-id] [amount] --from --chain-id test +ununifid tx nftbackedloan repay [nft-class-id] [nft-id] [bidder] [amount] --from --chain-id test ``` ::: details Example -Repay 50uguu from a10/a10 auction +Repay 50uguu to bidder `ununifitest` in a10/a10 auction ```sh -ununifid tx nftmarket repay a10 a10 50uguu --from user --chain-id test +ununifid tx nftbackedloan repay a10 a10 ununifitest 50uguu --from user --chain-id test ``` -### Sell +### Decide to sell Offer to sell NFT to the highest bidder. ```sh -ununifid tx nftmarket selling_decision [nft-class-id] [nft-id] --from --chain-id test +ununifid tx nftbackedloan selling-decision [nft-class-id] [nft-id] --from --chain-id test ``` ::: details Example @@ -328,44 +345,66 @@ ununifid tx nftmarket selling_decision [nft-class-id] [nft-id] --from --chain-id Make an offer to the highest bidder in the a10/a10 auction ```sh -ununifid tx nftmarket selling_decision a10 a10 --from user --chain-id test +ununifid tx nftbackedloan selling-decision a10 a10 --from user --chain-id test ``` -## queries +### Pay full bid price + +Pay the difference between the bid price and the deposit amount. + +```sh +ununifid tx nftbackedloan pay-remainder [nft-class-id] [nft-id] --from --chain-id test +``` + +::: details Example + +Pay full bid price for the a10/a10 auction + +```sh +ununifid tx nftbackedloan pay-remainder a10 a10 --from user --chain-id test +``` -todo: write spec +## queries -### bidder_bids +### bidder-bids Show User's bids ```sh -ununifid query nftmarket bidder_bids [bidder_address] +ununifid query nftbackedloan bidder-bids [bidder_address] +``` + +### liquidation + +Show Information on liquidation of listing NFT + +```sh +ununifid query nftbackedloan liquidation [class-id] [nft-id] ``` -### listed_class +### listed-class Show NFT class on listed ```bash -ununifid query nftmarket listed_class +ununifid query nftbackedloan listed-class ``` -### listed_nfts +### listed-nfts Show NFT on listed ```sh -ununifid query nftmarket listed_nfts +ununifid query nftbackedloan listed-nfts ``` ### loan -show loans in the auction +show loans of listing NFT ```sh -ununifid query nftmarket loan [class-id] [nft-id] +ununifid query nftbackedloan loan [class-id] [nft-id] ``` ### loans @@ -373,29 +412,29 @@ ununifid query nftmarket loan [class-id] [nft-id] show loans in all auctions ```sh -ununifid query nftmarket loans +ununifid query nftbackedloan loans ``` -### nft_bids +### nft-bids show bid in auction ```sh -ununifid query nftmarket nft_bids [class_id] [nft_id] +ununifid query nftbackedloan nft_bids [class_id] [nft_id] ``` -### nft_listing +### nft-listing show list info ```sh -ununifid query nftmarket nft_listing [class_id] [nft_id] +ununifid query nftbackedloan nft-listing [class_id] [nft_id] ``` ### params -shows nftmarket params +shows nftbackedloan params ```sh -ununifid q nftmarket params +ununifid q nftbackedloan params ``` diff --git a/x/nftbackedloan/abci.go b/x/nftbackedloan/abci.go index 9374c46a5..430d5bb14 100644 --- a/x/nftbackedloan/abci.go +++ b/x/nftbackedloan/abci.go @@ -1,4 +1,4 @@ -package nftmarket +package nftbackedloan import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -9,18 +9,12 @@ import ( // EndBlocker updates the current pricefeed func EndBlocker(ctx sdk.Context, k keeper.Keeper) { - // process ending nft listings - k.ProcessEndingNftListings(ctx) + // process liquidation of expired bids + k.LiquidateExpiredBids(ctx) // handle full payment period endings k.HandleFullPaymentsPeriodEndings(ctx) - // deliever successful bids - k.DelieverSuccessfulBids(ctx) - - // process matured nft bids cancel - err := k.HandleMaturedCancelledBids(ctx) - if err != nil { - panic(err) - } + // deliver successful bids + k.DeliverSuccessfulBids(ctx) } diff --git a/x/nftbackedloan/client/cli/flags.go b/x/nftbackedloan/client/cli/flags.go index 17a7de96f..9ad135124 100644 --- a/x/nftbackedloan/client/cli/flags.go +++ b/x/nftbackedloan/client/cli/flags.go @@ -3,7 +3,7 @@ package cli const ( FlagAutomaticPayment = "automatic-payment" FlagBidToken = "bid-token" - FlagMinimumDepositRate = "min-minimum-deposit-rate" + FlagMinimumDepositRate = "min-deposit-rate" FlagOwner = "owner" FlagAutomaticRefinancing = "automatic-refinancing" FlagMinimumBiddingPeriodHours = "min-bidding-period-hours" diff --git a/x/nftbackedloan/client/cli/query.go b/x/nftbackedloan/client/cli/query.go index 88b30dc92..4f42a2bea 100644 --- a/x/nftbackedloan/client/cli/query.go +++ b/x/nftbackedloan/client/cli/query.go @@ -27,11 +27,10 @@ func GetQueryCmd(queryRoute string) *cobra.Command { CmdQueryParams(), CmdQueryNftListing(), CmdQueryListedNfts(), - CmdQueryLoans(), + // CmdQueryLoans(), CmdQueryLoan(), CmdQueryNftBids(), CmdQueryBidderBids(), - CmdQueryCDPsList(), CmdQueryRewards(), CmdQueryListedClass(), CmdQueryLiquidation(), @@ -135,31 +134,31 @@ func CmdQueryListedNfts() *cobra.Command { return cmd } -func CmdQueryLoans() *cobra.Command { - cmd := &cobra.Command{ - Use: "loans", - Short: "shows loans", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) +// func CmdQueryLoans() *cobra.Command { +// cmd := &cobra.Command{ +// Use: "loans", +// Short: "shows loans", +// Args: cobra.ExactArgs(0), +// RunE: func(cmd *cobra.Command, args []string) error { +// clientCtx := client.GetClientContextFromCmd(cmd) - queryClient := types.NewQueryClient(clientCtx) +// queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryLoansRequest{} +// params := &types.QueryLoansRequest{} - res, err := queryClient.Loans(context.Background(), params) - if err != nil { - return err - } +// res, err := queryClient.Loans(context.Background(), params) +// if err != nil { +// return err +// } - return clientCtx.PrintProto(res) - }, - } +// return clientCtx.PrintProto(res) +// }, +// } - flags.AddQueryFlagsToCmd(cmd) +// flags.AddQueryFlagsToCmd(cmd) - return cmd -} +// return cmd +// } func CmdQueryLoan() *cobra.Command { cmd := &cobra.Command{ @@ -247,32 +246,6 @@ func CmdQueryBidderBids() *cobra.Command { return cmd } -func CmdQueryCDPsList() *cobra.Command { - cmd := &cobra.Command{ - Use: "cdp-list", - Short: "shows cdps", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryCDPsListRequest{} - - res, err := queryClient.CDPsList(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - func CmdQueryRewards() *cobra.Command { cmd := &cobra.Command{ Use: "rewards [address]", diff --git a/x/nftbackedloan/client/cli/tx.go b/x/nftbackedloan/client/cli/tx.go index c96d9d02e..7c155fcc5 100644 --- a/x/nftbackedloan/client/cli/tx.go +++ b/x/nftbackedloan/client/cli/tx.go @@ -28,14 +28,13 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand( - CmdMintNft(), - CmdCreateListing(), + CmdCreateList(), CmdCancelNftListing(), CmdSellingDecision(), CmdCreatePlaceBid(), CmdCancelBid(), - CmdPayFullBid(), - CmdEndListing(), + CmdPayRemainder(), + // CmdEndListing(), CmdBorrow(), CmdRepay(), ) @@ -43,45 +42,16 @@ func GetTxCmd() *cobra.Command { return cmd } -func CmdMintNft() *cobra.Command { - cmd := &cobra.Command{ - Use: "mint [class-id] [nft-id] [uri] [uri-hash]", - Short: "Mint an nft", - Long: strings.TrimSpace( - fmt.Sprintf(`Mint an nft. -Example: -$ %s tx %s mint a10 a10 uri 888838 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgMintNft(clientCtx.GetFromAddress().String(), args[0], args[1], args[2], args[3]) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - // todo: Implementation fields // BidToken, MinBid, BidHook, ListingType -func CmdCreateListing() *cobra.Command { +func CmdCreateList() *cobra.Command { cmd := &cobra.Command{ - Use: "listing [class-id] [nft-id]", + Use: "list [class-id] [token-id]", Short: "Creates a new listing", Long: strings.TrimSpace( fmt.Sprintf(`Create a new listing, depositing nft. Example: -$ %s tx %s listing 1 1 --from myKeyName --chain-id ununifi-x +$ %s tx %s list ununifi-1 a1 --bid-token uguu --min-deposit-rate 0.1 --min-bidding-period-hours 168 --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -91,10 +61,10 @@ $ %s tx %s listing 1 1 --from myKeyName --chain-id ununifi-x } classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ + tokenId := args[1] + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: tokenId, } minDepositRate, err := cmd.Flags().GetString(FlagMinimumDepositRate) @@ -105,24 +75,31 @@ $ %s tx %s listing 1 1 --from myKeyName --chain-id ununifi-x if err != nil { return err } - automaticRef, err := cmd.Flags().GetBool(FlagAutomaticRefinancing) + // automaticRef, err := cmd.Flags().GetBool(FlagAutomaticRefinancing) + // if err != nil { + // return err + // } + + bidToken, err := cmd.Flags().GetString(FlagBidToken) if err != nil { return err } - bidToken, err := cmd.Flags().GetString(FlagBidToken) + minBiddingPeriodHour, err := cmd.Flags().GetString(FlagMinimumBiddingPeriodHours) if err != nil { return err } - - minBiddingPeriodHour, err := cmd.Flags().GetUint64(FlagMinimumBiddingPeriodHours) + minBiddingPeriodHourDec, err := sdk.NewDecFromStr(minBiddingPeriodHour) if err != nil { return err } + minBiddingPeriodMinute := minBiddingPeriodHourDec.Mul(sdk.NewDecFromInt(sdk.NewInt(60))).TruncateInt() + minBiddingPeriodSecond := minBiddingPeriodHourDec.Mul(sdk.NewDecFromInt(sdk.NewInt(60))).Sub(sdk.NewDecFromInt(minBiddingPeriodMinute)).Mul(sdk.NewDecFromInt(sdk.NewInt(60))).TruncateInt() // convert uint64 to time.Duration - minBiddingPeriod := time.Duration(minBiddingPeriodHour) * time.Hour + minBiddingPeriod := time.Duration(minBiddingPeriodMinute.Int64())*time.Minute + + time.Duration(minBiddingPeriodSecond.Int64())*time.Second - msg := types.NewMsgListNft(clientCtx.GetFromAddress().String(), nftIde, bidToken, minDepositRateDec, automaticRef, minBiddingPeriod) + msg := types.NewMsgListNft(clientCtx.GetFromAddress().String(), nftIde, bidToken, minDepositRateDec, minBiddingPeriod) if err := msg.ValidateBasic(); err != nil { return err } @@ -132,8 +109,8 @@ $ %s tx %s listing 1 1 --from myKeyName --chain-id ununifi-x cmd.Flags().String(FlagBidToken, "uguu", "bid token") cmd.Flags().String(FlagMinimumDepositRate, "0.1", "minimum deposit rate") - cmd.Flags().Uint64(FlagMinimumBiddingPeriodHours, 1, "minimum bidding period") - cmd.Flags().BoolP(FlagAutomaticRefinancing, "r", false, "automatic refinancing") + cmd.Flags().String(FlagMinimumBiddingPeriodHours, "1", "minimum bidding period") + // cmd.Flags().BoolP(FlagAutomaticRefinancing, "r", false, "automatic refinancing") flags.AddTxFlagsToCmd(cmd) return cmd @@ -141,12 +118,12 @@ $ %s tx %s listing 1 1 --from myKeyName --chain-id ununifi-x func CmdCreatePlaceBid() *cobra.Command { cmd := &cobra.Command{ - Use: "place-bid [class-id] [nft-id] [bid-amount] [deposit-amount] [deposit-interest-rate] [bidding-hour-time]", + Use: "place-bid [class-id] [nft-id] [bid-amount] [deposit-amount] [deposit-interest-rate] [expire-after-hour]", Short: "Creates a new place bid", Long: strings.TrimSpace( fmt.Sprintf(`Creates a new place bid. Example: -$ %s tx %s place-bid 1 1 100uguu --automatic-payment --from myKeyName --chain-id ununifi-x +$ %s tx %s place-bid ununifi-1 a1 100uguu 20uguu 0.05 240 --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), Args: cobra.ExactArgs(6), RunE: func(cmd *cobra.Command, args []string) error { @@ -159,14 +136,14 @@ $ %s tx %s place-bid 1 1 100uguu --automatic-payment --from myKeyName --chain-id nftIdArg := 1 bidArgs := 2 depositArg := 3 - depositRateArg := 4 + interestRateArg := 4 bidEndArg := 5 classId := args[classIdArg] nftId := args[nftIdArg] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } bidCoin, err := sdk.ParseCoinNormalized(args[bidArgs]) if err != nil { @@ -178,7 +155,7 @@ $ %s tx %s place-bid 1 1 100uguu --automatic-payment --from myKeyName --chain-id return err } - depositInterestRate, err := sdk.NewDecFromStr(args[depositRateArg]) + depositInterestRate, err := sdk.NewDecFromStr(args[interestRateArg]) if err != nil { return err } @@ -206,47 +183,47 @@ $ %s tx %s place-bid 1 1 100uguu --automatic-payment --from myKeyName --chain-id }, } - cmd.Flags().BoolP(FlagAutomaticPayment, "p", false, "automation payment") + cmd.Flags().BoolP(FlagAutomaticPayment, "p", true, "automation payment") flags.AddTxFlagsToCmd(cmd) return cmd } -func CmdEndListing() *cobra.Command { - cmd := &cobra.Command{ - Use: "end-listing [class-id] [nft-id]", - Short: "end listing", - Long: strings.TrimSpace( - fmt.Sprintf(`end listing. -Example: -$ %s tx %s end-listing 1 1 --from myKeyName --chain-id ununifi-x -`, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - classId := args[0] - nftId := args[1] - nftIde := types.NftIdentifier{ - ClassId: classId, - NftId: nftId, - } - - msg := types.NewMsgEndNftListing(clientCtx.GetFromAddress().String(), nftIde) - - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} +// func CmdEndListing() *cobra.Command { +// cmd := &cobra.Command{ +// Use: "end-listing [class-id] [nft-id]", +// Short: "end listing", +// Long: strings.TrimSpace( +// fmt.Sprintf(`end listing. +// Example: +// $ %s tx %s end-listing 1 1 --from myKeyName --chain-id ununifi-x +// `, version.AppName, types.ModuleName)), +// Args: cobra.ExactArgs(2), +// RunE: func(cmd *cobra.Command, args []string) error { +// clientCtx, err := client.GetClientTxContext(cmd) +// if err != nil { +// return err +// } + +// classId := args[0] +// nftId := args[1] +// nftIde := types.NftId{ +// ClassId: classId, +// NftId: nftId, +// } + +// msg := types.NewMsgEndNftListing(clientCtx.GetFromAddress().String(), nftIde) + +// if err := msg.ValidateBasic(); err != nil { +// return err +// } +// return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) +// }, +// } + +// flags.AddTxFlagsToCmd(cmd) +// return cmd +// } func CmdSellingDecision() *cobra.Command { cmd := &cobra.Command{ @@ -266,9 +243,9 @@ $ %s tx %s selling-decision 1 1 --from myKeyName --chain-id ununifi-x classId := args[0] nftId := args[1] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } msg := types.NewMsgSellingDecision(clientCtx.GetFromAddress().String(), nftIde) @@ -286,14 +263,14 @@ $ %s tx %s selling-decision 1 1 --from myKeyName --chain-id ununifi-x func CmdBorrow() *cobra.Command { cmd := &cobra.Command{ - Use: "borrow [class-id] [nft-id] [amount]", + Use: "borrow [class-id] [nft-id] [bidder] [amount]", Short: "borrow denom", Long: strings.TrimSpace( fmt.Sprintf(`borrow denom. Example: $ %s tx %s borrow 1 1 100uguu --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), + Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -302,17 +279,19 @@ $ %s tx %s borrow 1 1 100uguu --from myKeyName --chain-id ununifi-x classId := args[0] nftId := args[1] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } - borrowCoin, err := sdk.ParseCoinNormalized(args[2]) + bidder := args[2] + borrowCoin, err := sdk.ParseCoinNormalized(args[3]) if err != nil { return err } - msg := types.NewMsgBorrow(clientCtx.GetFromAddress().String(), nftIde, borrowCoin) + borrowBid := types.BorrowBid{Bidder: bidder, Amount: borrowCoin} + msg := types.NewMsgBorrow(clientCtx.GetFromAddress().String(), nftIde, []types.BorrowBid{borrowBid}) if err := msg.ValidateBasic(); err != nil { return err @@ -327,14 +306,14 @@ $ %s tx %s borrow 1 1 100uguu --from myKeyName --chain-id ununifi-x func CmdRepay() *cobra.Command { cmd := &cobra.Command{ - Use: "repay [class-id] [nft-id] [amount]", + Use: "repay [class-id] [nft-id] [bidder] [amount]", Short: "repay loan on nft", Long: strings.TrimSpace( fmt.Sprintf(`repay loan on nft. Example: $ %s tx %s repay 1 1 100uguu --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), - Args: cobra.ExactArgs(3), + Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -343,17 +322,19 @@ $ %s tx %s repay 1 1 100uguu --from myKeyName --chain-id ununifi-x classId := args[0] nftId := args[1] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } - borrowCoin, err := sdk.ParseCoinNormalized(args[2]) + bidder := args[2] + borrowCoin, err := sdk.ParseCoinNormalized(args[3]) if err != nil { return err } - msg := types.NewMsgRepay(clientCtx.GetFromAddress().String(), nftIde, borrowCoin) + borrowBid := types.BorrowBid{Bidder: bidder, Amount: borrowCoin} + msg := types.NewMsgRepay(clientCtx.GetFromAddress().String(), nftIde, []types.BorrowBid{borrowBid}) if err := msg.ValidateBasic(); err != nil { return err @@ -384,9 +365,9 @@ $ %s tx %s cancel_listing 1 1 --from myKeyName --chain-id ununifi-x classId := args[0] nftId := args[1] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } msg := types.NewMsgCancelNftListing(clientCtx.GetFromAddress().String(), nftIde) @@ -420,9 +401,9 @@ $ %s tx %s cancel-bid 1 1 --from myKeyName --chain-id ununifi-x classId := args[0] nftId := args[1] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } msg := types.NewMsgCancelBid(clientCtx.GetFromAddress().String(), nftIde) @@ -439,14 +420,14 @@ $ %s tx %s cancel-bid 1 1 --from myKeyName --chain-id ununifi-x return cmd } -func CmdPayFullBid() *cobra.Command { +func CmdPayRemainder() *cobra.Command { cmd := &cobra.Command{ - Use: "pay-full-bid [class-id] [nft-id]", - Short: "Pay full bid on nft", + Use: "pay-remainder [class-id] [nft-id]", + Short: "Pay full bid price on nft", Long: strings.TrimSpace( fmt.Sprintf(`Pay full bid on nft. Example: -$ %s tx %s pay-full-bid 1 1 --from myKeyName --chain-id ununifi-x +$ %s tx %s pay-remainder 1 1 --from myKeyName --chain-id ununifi-x `, version.AppName, types.ModuleName)), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -457,12 +438,12 @@ $ %s tx %s pay-full-bid 1 1 --from myKeyName --chain-id ununifi-x classId := args[0] nftId := args[1] - nftIde := types.NftIdentifier{ + nftIde := types.NftId{ ClassId: classId, - NftId: nftId, + TokenId: nftId, } - msg := types.NewMsgPayFullBid(clientCtx.GetFromAddress().String(), nftIde) + msg := types.NewMsgPayRemainder(clientCtx.GetFromAddress().String(), nftIde) if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/nftbackedloan/genesis.go b/x/nftbackedloan/genesis.go index fd09bcbf6..ad1c23011 100644 --- a/x/nftbackedloan/genesis.go +++ b/x/nftbackedloan/genesis.go @@ -1,4 +1,4 @@ -package nftmarket +package nftbackedloan import ( sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,21 +16,17 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, accountKeeper types.AccountKe for _, bid := range gs.Bids { k.SetBid(ctx, bid) } - for _, bid := range gs.CancelledBids { - k.SetCancelledBid(ctx, bid) - } - for _, loan := range gs.Loans { - k.SetDebt(ctx, loan) - } + // for _, loan := range gs.Loans { + // k.SetDebt(ctx, loan) + // } } -// ExportGenesis export genesis state for nftmarket module +// ExportGenesis export genesis state for nftbackedloan module func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { return types.GenesisState{ - Params: k.GetParamSet(ctx), - Listings: k.GetAllNftListings(ctx), - Bids: k.GetAllBids(ctx), - CancelledBids: k.GetAllCancelledBids(ctx), - Loans: k.GetAllDebts(ctx), + Params: k.GetParamSet(ctx), + Listings: k.GetAllNftListings(ctx), + Bids: k.GetAllBids(ctx), + // Loans: k.GetAllDebts(ctx), } } diff --git a/x/nftbackedloan/keeper/bid.go b/x/nftbackedloan/keeper/bid.go index 63154926b..626be4374 100644 --- a/x/nftbackedloan/keeper/bid.go +++ b/x/nftbackedloan/keeper/bid.go @@ -10,8 +10,8 @@ import ( "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (k Keeper) GetBid(ctx sdk.Context, nftIdBytes []byte, bidder sdk.AccAddress) (types.NftBid, error) { - bid := types.NftBid{} +func (k Keeper) GetBid(ctx sdk.Context, nftIdBytes []byte, bidder sdk.AccAddress) (types.Bid, error) { + bid := types.Bid{} store := ctx.KVStore(k.storeKey) bz := store.Get(types.NftBidKey(nftIdBytes, bidder)) if bz == nil { @@ -22,15 +22,15 @@ func (k Keeper) GetBid(ctx sdk.Context, nftIdBytes []byte, bidder sdk.AccAddress return bid, nil } -func (k Keeper) GetAllBids(ctx sdk.Context) []types.NftBid { +func (k Keeper) GetAllBids(ctx sdk.Context) []types.Bid { store := ctx.KVStore(k.storeKey) - bids := []types.NftBid{} + bids := []types.Bid{} it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftBid)) defer it.Close() for ; it.Valid(); it.Next() { - bid := types.NftBid{} + bid := types.Bid{} k.cdc.MustUnmarshal(it.Value(), &bid) bids = append(bids, bid) @@ -38,46 +38,31 @@ func (k Keeper) GetAllBids(ctx sdk.Context) []types.NftBid { return bids } -func (k Keeper) GetBidsByNft(ctx sdk.Context, nftIdBytes []byte) []types.NftBid { +func (k Keeper) GetBidsByNft(ctx sdk.Context, nftIdBytes []byte) []types.Bid { store := ctx.KVStore(k.storeKey) - bids := []types.NftBid{} + bids := []types.Bid{} it := sdk.KVStorePrefixIterator(store, append([]byte(types.KeyPrefixNftBid), nftIdBytes...)) defer it.Close() for ; it.Valid(); it.Next() { - bid := types.NftBid{} + bid := types.Bid{} k.cdc.MustUnmarshal(it.Value(), &bid) bids = append(bids, bid) } - - // sort bids by rank - // todo: sord by lower deposit interest rate - // sort.SliceStable(bids, func(i, j int) bool { - // if bids[i].Amount.Amount.LT(bids[j].Amount.Amount) { - // return true - // } - // if bids[i].Amount.Amount.GT(bids[j].Amount.Amount) { - // return false - // } - // if bids[i].BidTime.After(bids[j].BidTime) { - // return true - // } - // return false - // }) return bids } -func (k Keeper) GetBidsByBidder(ctx sdk.Context, bidder sdk.AccAddress) []types.NftBid { +func (k Keeper) GetBidsByBidder(ctx sdk.Context, bidder sdk.AccAddress) []types.Bid { store := ctx.KVStore(k.storeKey) - bids := []types.NftBid{} + bids := []types.Bid{} it := sdk.KVStorePrefixIterator(store, types.AddressBidKeyPrefix(bidder)) defer it.Close() for ; it.Valid(); it.Next() { - bid := types.NftBid{} + bid := types.Bid{} k.cdc.MustUnmarshal(it.Value(), &bid) bids = append(bids, bid) @@ -85,8 +70,8 @@ func (k Keeper) GetBidsByBidder(ctx sdk.Context, bidder sdk.AccAddress) []types. return bids } -func (k Keeper) SetBid(ctx sdk.Context, bid types.NftBid) error { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) +func (k Keeper) SetBid(ctx sdk.Context, bid types.Bid) error { + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) if err != nil { return err } @@ -101,80 +86,22 @@ func (k Keeper) SetBid(ctx sdk.Context, bid types.NftBid) error { store := ctx.KVStore(k.storeKey) store.Set(types.NftBidKey(bid.IdBytes(), bidder), bz) store.Set(types.AddressBidKey(bid.IdBytes(), bidder), bz) - store.Set(append(getTimeKey(types.KeyPrefixEndTimeNftBid, bid.BiddingPeriod), bid.GetIdToByte()...), bid.GetIdToByte()) + store.Set(append(getTimeKey(types.KeyPrefixEndTimeNftBid, bid.Expiry), bid.GetIdToByte()...), bid.GetIdToByte()) return nil } -func (k Keeper) DeleteBid(ctx sdk.Context, bid types.NftBid) error { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) +func (k Keeper) DeleteBid(ctx sdk.Context, bid types.Bid) error { + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) if err != nil { return err } store := ctx.KVStore(k.storeKey) store.Delete(types.NftBidKey(bid.IdBytes(), bidder)) store.Delete(types.AddressBidKey(bid.IdBytes(), bidder)) - store.Delete(append(getTimeKey(types.KeyPrefixEndTimeNftBid, bid.BiddingPeriod), bid.GetIdToByte()...)) + store.Delete(append(getTimeKey(types.KeyPrefixEndTimeNftBid, bid.Expiry), bid.GetIdToByte()...)) return nil } -func getCancelledBidTimeKey(timestamp time.Time) []byte { - timeBz := sdk.FormatTimeBytes(timestamp) - timeBzL := len(timeBz) - prefixL := len(types.KeyPrefixNftBidCancelled) - - bz := make([]byte, prefixL+8+timeBzL) - - // copy the prefix - copy(bz[:prefixL], types.KeyPrefixNftBidCancelled) - - // copy the encoded time bytes length - copy(bz[prefixL:prefixL+8], sdk.Uint64ToBigEndian(uint64(timeBzL))) - - // copy the encoded time bytes - copy(bz[prefixL+8:prefixL+8+timeBzL], timeBz) - return bz -} - -func (k Keeper) SetCancelledBid(ctx sdk.Context, bid types.NftBid) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&bid) - store.Set(append(append(getCancelledBidTimeKey(bid.BidTime), bid.IdBytes()...), []byte(bid.Bidder)...), bz) -} - -func (k Keeper) GetAllCancelledBids(ctx sdk.Context) []types.NftBid { - store := ctx.KVStore(k.storeKey) - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftBidCancelled)) - defer it.Close() - - bids := []types.NftBid{} - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - bids = append(bids, bid) - } - return bids -} - -func (k Keeper) GetMaturedCancelledBids(ctx sdk.Context, endTime time.Time) []types.NftBid { - store := ctx.KVStore(k.storeKey) - timeKey := getCancelledBidTimeKey(endTime) - it := store.Iterator([]byte(types.KeyPrefixNftBidCancelled), storetypes.InclusiveEndBytes(timeKey)) - defer it.Close() - - bids := []types.NftBid{} - for ; it.Valid(); it.Next() { - bid := types.NftBid{} - k.cdc.MustUnmarshal(it.Value(), &bid) - bids = append(bids, bid) - } - return bids -} - -func (k Keeper) DeleteCancelledBid(ctx sdk.Context, bid types.NftBid) { - store := ctx.KVStore(k.storeKey) - store.Delete(append(append(getCancelledBidTimeKey(bid.BidTime), bid.IdBytes()...), []byte(bid.Bidder)...)) -} - func (k Keeper) PlaceBid(ctx sdk.Context, msg *types.MsgPlaceBid) error { // Verify listing is in BIDDING state listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) @@ -183,68 +110,62 @@ func (k Keeper) PlaceBid(ctx sdk.Context, msg *types.MsgPlaceBid) error { } if !listing.CanBid() { - return types.ErrNftListingNotInBidState + return types.ErrStatusCannotPlaceBid + } + + if listing.Owner == msg.Sender { + return types.ErrOwnerCannotPlaceBid + } + + if listing.BidDenom != msg.Price.Denom { + return types.ErrInvalidPriceDenom + } + if !msg.Price.IsPositive() { + return types.ErrInvalidPriceAmount + } + if listing.BidDenom != msg.Deposit.Denom { + return types.ErrInvalidDepositDenom } - if listing.BidToken != msg.BidAmount.Denom { - return types.ErrInvalidBidDenom + // check over min_deposit_rate + minDeposit := listing.MinDepositRate.Mul(sdk.NewDecFromInt(msg.Price.Amount)).TruncateInt() + if msg.Deposit.Amount.LT(minDeposit) { + return types.ErrInvalidDepositAmount } // todo add test case - minimumBiddingPeriodHour := time.Now().Add(listing.MinimumBiddingPeriod) - if msg.BiddingPeriod.Before(minimumBiddingPeriodHour) { - return types.ErrSmallBiddingPeriod + minimumBiddingPeriodHour := time.Now().Add(listing.MinBidPeriod) + if msg.Expiry.Before(minimumBiddingPeriodHour) { + return types.ErrSmallExpiryPeriod } bids := types.NftBids(k.GetBidsByNft(ctx, listing.IdBytes())) bidder := msg.Sender oldBid := bids.GetBidByBidder(bidder) - newBid := types.NftBid{ - NftId: msg.NftId, - Bidder: bidder, - BidAmount: msg.BidAmount, - AutomaticPayment: msg.AutomaticPayment, - DepositAmount: msg.DepositAmount, - BidTime: ctx.BlockTime(), - BiddingPeriod: msg.BiddingPeriod, + newBid := types.Bid{ Id: types.BidId{ NftId: &msg.NftId, Bidder: bidder, }, - PaidAmount: sdk.NewCoin(listing.BidToken, sdk.ZeroInt()), - DepositLendingRate: msg.DepositLendingRate, - InterestAmount: sdk.NewCoin(listing.BidToken, sdk.ZeroInt()), + Price: msg.Price, + Deposit: msg.Deposit, + PaidAmount: sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()), + Expiry: msg.Expiry, + InterestRate: msg.InterestRate, + AutomaticPayment: msg.AutomaticPayment, + CreatedAt: ctx.BlockTime(), + Loan: types.Loan{Amount: sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()), LastRepaidAt: ctx.BlockTime()}, } if !oldBid.IsNil() { return k.ReBid(ctx, listing, oldBid, newBid, bids) } else { - return k.FirstBid(ctx, listing, newBid, bids) + return k.FirstBid(ctx, listing, newBid) } } -func (k Keeper) ManualBid(ctx sdk.Context, listing types.NftListing, newBid types.NftBid, bids types.NftBids) error { - err := CheckBidParams(listing, newBid.BidAmount, newBid.DepositAmount, bids) - if err != nil { - kickOutBid := bids.FindKickOutBid(newBid, ctx.BlockTime()) - if kickOutBid.IsNil() { - // cannot kick out bid - return err - } else { - bids = bids.RemoveBids(types.NftBids{kickOutBid}) - err = CheckBidParams(listing, newBid.BidAmount, newBid.DepositAmount, bids) - if err != nil { - return err - } else { - err = k.SafeCloseBidWithAllInterest(ctx, kickOutBid) - if err != nil { - return err - } - } - } - } - - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32(newBid.Bidder), types.ModuleName, sdk.Coins{newBid.DepositAmount}) +func (k Keeper) ManualBid(ctx sdk.Context, listing types.Listing, newBid types.Bid) error { + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32(newBid.Id.Bidder), types.ModuleName, sdk.Coins{newBid.Deposit}) if err != nil { return err } @@ -255,65 +176,63 @@ func (k Keeper) ManualBid(ctx sdk.Context, listing types.NftListing, newBid type return err } - // extend bid if there's bid within gap time - params := k.GetParamSet(ctx) if listing.State == types.ListingState_LISTING { listing.State = types.ListingState_BIDDING } - // todo implement listing end - gapTime := ctx.BlockTime().Add(time.Duration(params.NftListingGapTime) * time.Second) - if listing.EndAt.Before(gapTime) { - listing.EndAt = gapTime - } k.SaveNftListing(ctx, listing) return nil } -func (k Keeper) FirstBid(ctx sdk.Context, listing types.NftListing, newBid types.NftBid, bids types.NftBids) error { - err := k.ManualBid(ctx, listing, newBid, bids) +func (k Keeper) FirstBid(ctx sdk.Context, listing types.Listing, newBid types.Bid) error { + err := k.ManualBid(ctx, listing, newBid) if err != nil { return err } - ctx.EventManager().EmitTypedEvent(&types.EventPlaceBid{ - Bidder: newBid.Bidder, - ClassId: newBid.NftId.ClassId, - NftId: newBid.NftId.NftId, - Amount: newBid.BidAmount.String(), + _ = ctx.EventManager().EmitTypedEvent(&types.EventPlaceBid{ + Bidder: newBid.Id.Bidder, + ClassId: newBid.Id.NftId.ClassId, + TokenId: newBid.Id.NftId.TokenId, + Amount: newBid.Price.String(), }) return nil } -func (k Keeper) ReBid(ctx sdk.Context, listing types.NftListing, oldBid, newBid types.NftBid, bids types.NftBids) error { - // TODO: decide specification more in detail - // re-bidのとき - // 自動借り換えを行う - // 自動借り換えは - // 以前の利息を計算して引き継ぐ +func (k Keeper) ReBid(ctx sdk.Context, listing types.Listing, oldBid, newBid types.Bid, bids types.NftBids) error { + // check no borrow if !oldBid.CanReBid() { - return types.ErrBorrowedDeposit + return types.ErrCannotChangeBidBorrowed + } + // check for liquidation + if !types.IsAbleToReBid(bids, oldBid.Id, newBid, listing) { + return types.ErrCannotReBidForLiquidation } - bids = bids.RemoveBid(oldBid) + // bids can only be updated X days after bidding + params := k.GetParamSet(ctx) + if oldBid.CreatedAt.Add(time.Duration(params.BidCancelRequiredSeconds) * time.Second).After(ctx.BlockTime()) { + return types.ErrRebidAfterSomeTime + } + err := k.SafeCloseBid(ctx, oldBid) if err != nil { return err } - err = k.ManualBid(ctx, listing, newBid, bids) + err = k.ManualBid(ctx, listing, newBid) if err != nil { return err } - ctx.EventManager().EmitTypedEvent(&types.EventPlaceBid{ - Bidder: newBid.Bidder, - ClassId: newBid.NftId.ClassId, - NftId: newBid.NftId.NftId, - Amount: newBid.BidAmount.String(), + _ = ctx.EventManager().EmitTypedEvent(&types.EventPlaceBid{ + Bidder: newBid.Id.Bidder, + ClassId: newBid.Id.NftId.ClassId, + TokenId: newBid.Id.NftId.TokenId, + Amount: newBid.Price.String(), }) return nil } -func (k Keeper) ManualSafeCloseBid(ctx sdk.Context, bid types.NftBid, bidder sdk.AccAddress) error { +func (k Keeper) ManualSafeCloseBid(ctx sdk.Context, bid types.Bid, bidder sdk.AccAddress) error { err := k.DeleteBid(ctx, bid) if err != nil { return err @@ -324,19 +243,19 @@ func (k Keeper) ManualSafeCloseBid(ctx sdk.Context, bid types.NftBid, bidder sdk return err } } - return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(bid.DepositAmount.Denom, bid.DepositAmount.Amount)}) + return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(bid.Deposit.Denom, bid.Deposit.Amount)}) } -func (k Keeper) SafeCloseBid(ctx sdk.Context, bid types.NftBid) error { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) +func (k Keeper) SafeCloseBid(ctx sdk.Context, bid types.Bid) error { + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) if err != nil { return err } return k.ManualSafeCloseBid(ctx, bid, bidder) } -func (k Keeper) SafeCloseBidCollectDeposit(ctx sdk.Context, bid types.NftBid) (sdk.Coin, error) { - CollectedAmount := bid.DepositAmount +func (k Keeper) SafeCloseBidCollectDeposit(ctx sdk.Context, bid types.Bid) (sdk.Coin, error) { + CollectedAmount := bid.Deposit err := k.DeleteBid(ctx, bid) if err != nil { return sdk.Coin{}, err @@ -345,12 +264,12 @@ func (k Keeper) SafeCloseBidCollectDeposit(ctx sdk.Context, bid types.NftBid) (s } // todo make unit test -func (k Keeper) SafeCloseBidWithAllInterest(ctx sdk.Context, bid types.NftBid) error { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) +func (k Keeper) SafeCloseBidWithAllInterest(ctx sdk.Context, bid types.Bid, time time.Time) error { + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) if err != nil { return err } - interestAmount := bid.TotalInterestAmount(ctx.BlockTime()) + interestAmount := bid.CompoundInterest(time) if interestAmount.Amount.IsPositive() { err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(interestAmount.Denom, interestAmount.Amount)}) if err != nil { @@ -360,33 +279,15 @@ func (k Keeper) SafeCloseBidWithAllInterest(ctx sdk.Context, bid types.NftBid) e return k.ManualSafeCloseBid(ctx, bid, bidder) } -// implement SafeCloseBidWithPartInterest -func (k Keeper) SafeCloseBidWithPartInterest(ctx sdk.Context, bid types.NftBid, interest sdk.Coin) error { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - // check total interest amount is greater than interest - if bid.TotalInterestAmount(ctx.BlockTime()).Amount.LT(interest.Amount) { - return types.ErrInterestAmountTooLarge - } - if interest.Amount.GT(sdk.ZeroInt()) { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(interest.Denom, interest.Amount)}) - if err != nil { - return err - } - } - return k.ManualSafeCloseBid(ctx, bid, bidder) -} - func (k Keeper) CancelBid(ctx sdk.Context, msg *types.MsgCancelBid) error { listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) if err != nil { return err } + // check status if !listing.CanCancelBid() { - return types.ErrCannotCancelBid + return types.ErrStatusCannotCancelBid } bidder, err := sdk.AccAddressFromBech32(msg.Sender) @@ -400,45 +301,42 @@ func (k Keeper) CancelBid(ctx sdk.Context, msg *types.MsgCancelBid) error { return types.ErrBidDoesNotExists } + // check borrow if !bid.CanCancel() { - return types.ErrBorrowedDeposit + return types.ErrCannotChangeBidBorrowed } // bids can only be cancelled X days after bidding params := k.GetParamSet(ctx) - if bid.BidTime.Add(time.Duration(params.BidCancelRequiredSeconds) * time.Second).After(ctx.BlockTime()) { - return types.ErrBidCancelIsAllowedAfterSomeTime + if bid.CreatedAt.Add(time.Duration(params.BidCancelRequiredSeconds) * time.Second).After(ctx.BlockTime()) { + return types.ErrCancelAfterSomeTime } bids := k.GetBidsByNft(ctx, msg.NftId.IdBytes()) if len(bids) == 1 { return types.ErrCannotCancelListingSingleBid } + // for liquidation validation + if !types.IsAbleToCancelBid(types.BidId{Bidder: msg.Sender, NftId: bid.Id.NftId}, bids, listing) { + return types.ErrCannotCancelBidForLiquidation + } - err = k.DeleteBid(ctx, bid) + err = k.SafeCloseBid(ctx, bid) if err != nil { return err } - // tokens will be reimbursed X days after the bid cancellation is approved - bid.BidTime = ctx.BlockTime().Add(time.Duration(params.BidTokenDisburseSecondsAfterCancel) * time.Second) - k.SetCancelledBid(ctx, bid) - - // TODO: Liquidation may occur for sellers whose bids are cancelled. - // Emit event for cancelling bid - ctx.EventManager().EmitTypedEvent(&types.EventCancelBid{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventCancelBid{ Bidder: msg.Sender, ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, + TokenId: msg.NftId.TokenId, }) return nil } -// todo test for pay part amount and full amount -func (k Keeper) PayFullBid(ctx sdk.Context, msg *types.MsgPayFullBid) error { - // todo update for v2 +func (k Keeper) PayRemainder(ctx sdk.Context, msg *types.MsgPayRemainder) error { listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) if err != nil { return err @@ -456,9 +354,9 @@ func (k Keeper) PayFullBid(ctx sdk.Context, msg *types.MsgPayFullBid) error { } // Transfer unpaid amount of token from bid account - unpaidAmount := bid.BidAmount.Sub(bid.DepositAmount).Sub(bid.PaidAmount) + unpaidAmount := bid.Price.Sub(bid.Deposit).Sub(bid.PaidAmount) if unpaidAmount.IsPositive() { - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.Coins{sdk.NewCoin(listing.BidToken, unpaidAmount.Amount)}) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, bidder, types.ModuleName, sdk.Coins{sdk.NewCoin(listing.BidDenom, unpaidAmount.Amount)}) if err != nil { return err } @@ -470,84 +368,24 @@ func (k Keeper) PayFullBid(ctx sdk.Context, msg *types.MsgPayFullBid) error { } } // Emit event for paying full bid - ctx.EventManager().EmitTypedEvent(&types.EventPayFullBid{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventPayRemainder{ Bidder: msg.Sender, ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, + TokenId: msg.NftId.TokenId, }) return nil } -func (k Keeper) HandleMaturedCancelledBids(ctx sdk.Context) error { - bids := k.GetMaturedCancelledBids(ctx, ctx.BlockTime()) - for _, bid := range bids { - // transfer amount of token except fee to bid account - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - return err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(bid.BidAmount.Denom, bid.DepositAmount.Amount)}) - if err != nil { - return err - } - k.DeleteCancelledBid(ctx, bid) - } - - return nil -} - -// todo add unit test -func CheckBidParams(listing types.NftListing, bid, deposit sdk.Coin, bids []types.NftBid) error { - c := listing.MinimumDepositRate - p := sdk.NewDecFromInt(bid.Amount) - cp := c.Mul(p) - depositDec := sdk.NewDecFromInt(deposit.Amount) - if cp.GT(depositDec) { - return types.ErrNotEnoughDeposit - } - q := bid - s := deposit - for _, bid := range bids { - q = q.Add(bid.BidAmount) - s = s.Add(bid.DepositAmount) - } - - bidLen := 1 - if len(bids) > 0 { - // sum new bid and old bids - bidLen = len(bids) + 1 - } - q.Amount = q.Amount.Quo(sdk.NewInt(int64(bidLen))) - if q.IsLTE(s) { - fmt.Println("q", q.String()) - fmt.Println("s", s.String()) - return types.ErrBidParamInvalid - } - q_s := q.Sub(s) - q_s_dec := sdk.NewDecFromInt(q_s.Amount) - // todo implement min{bid, q-s} - - if depositDec.GT(q_s_dec) { - fmt.Println("depositDec", depositDec.String()) - fmt.Println("q_s_dec", q_s_dec.String()) - // deposit amount bigger - return types.ErrBidParamInvalid - } - return nil -} - -func (k Keeper) GetActiveNftBiddingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftBid { +func (k Keeper) GetExpiredBids(ctx sdk.Context, endTime time.Time) []types.Bid { store := ctx.KVStore(k.storeKey) timeKey := getTimeKey(types.KeyPrefixEndTimeNftBid, endTime) it := store.Iterator([]byte(types.KeyPrefixEndTimeNftBid), storetypes.InclusiveEndBytes(timeKey)) defer it.Close() - bids := []types.NftBid{} + bids := []types.Bid{} for ; it.Valid(); it.Next() { bidId := types.NftBidBytesToBidId(it.Value()) - fmt.Println("GetActiveNftBiddingsEndingAt") - fmt.Println(bidId) bidder, _ := sdk.AccAddressFromBech32(bidId.Bidder) bid, err := k.GetBid(ctx, bidId.NftId.IdBytes(), bidder) if err != nil { @@ -559,13 +397,20 @@ func (k Keeper) GetActiveNftBiddingsEndingAt(ctx sdk.Context, endTime time.Time) return bids } -func (k Keeper) DeleteBidsWithoutBorrowing(ctx sdk.Context, bids []types.NftBid) { +func (k Keeper) DeleteBidsWithoutBorrowing(ctx sdk.Context, bids []types.Bid) { for _, bid := range bids { - if !bid.IsBorrowing() { - err := k.SafeCloseBid(ctx, bid) - if err != nil { - fmt.Println(err) - continue + listing, err := k.GetNftListingByIdBytes(ctx, bid.Id.NftId.IdBytes()) + if err != nil { + fmt.Println(err) + continue + } + if listing.IsBidding() { + if !bid.IsBorrowed() { + err := k.SafeCloseBid(ctx, bid) + if err != nil { + fmt.Println(err) + continue + } } } } diff --git a/x/nftbackedloan/keeper/bid_test.go b/x/nftbackedloan/keeper/bid_test.go index 6c2c422c1..b7af7c45a 100644 --- a/x/nftbackedloan/keeper/bid_test.go +++ b/x/nftbackedloan/keeper/bid_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "fmt" "time" "github.com/cometbft/cometbft/crypto/ed25519" @@ -9,758 +8,276 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (suite *KeeperTestSuite) TestNftBidBasics() { +func (suite *KeeperTestSuite) TestPlaceBid() { owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - normalListing := types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "class1", - NftId: "nft1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - AutomaticRefinancing: true, - MinimumBiddingPeriod: time.Hour * 1, - State: types.ListingState_LISTING, - } - endListing := types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "class2", - NftId: "nft2", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - AutomaticRefinancing: true, - MinimumBiddingPeriod: time.Hour * 1, - State: types.ListingState_END_LISTING, - } - biddingListing := types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "class3", - NftId: "nft3", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - AutomaticRefinancing: true, - MinimumBiddingPeriod: time.Hour * 1, - State: types.ListingState_BIDDING, + + listing := types.Listing{ + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Owner: owner.String(), + State: types.ListingState_LISTING, + BidDenom: "uguu", + MinDepositRate: sdk.NewDecWithPrec(1, 1), + StartedAt: time.Now(), } - testCases := []struct { - testCase string - bid types.MsgPlaceBid - listing *types.NftListing - expErr error + + tests := []struct { + testCase string + msgBid types.MsgPlaceBid + expectError error + expectPass bool }{ { - testCase: "test basic functions of bids on nft bids1", - bid: types.MsgPlaceBid{ - Sender: bidder.Bytes(), - NftId: normalListing.NftId, - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 1000000/2), - AutomaticPayment: true, - BiddingPeriod: time.Now().Add(time.Hour * 2), - }, - listing: &normalListing, - expErr: nil, - }, - { - testCase: "test basic functions of bids on nft bids2", - bid: types.MsgPlaceBid{ - Sender: bidder.Bytes(), - NftId: biddingListing.NftId, - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 1000000/2), + testCase: "No listing", + msgBid: types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class999", TokenId: "nft99"}, + Price: sdk.NewInt64Coin("uatom", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), AutomaticPayment: true, - BiddingPeriod: time.Now().Add(time.Hour * 2), + Deposit: sdk.NewInt64Coin("uatom", 1000000), }, - listing: &biddingListing, - expErr: nil, + expectError: types.ErrNftListingDoesNotExist, + expectPass: false, }, { - testCase: "not exist listing", - bid: types.MsgPlaceBid{ - Sender: bidder.Bytes(), - NftId: normalListing.NftId, - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 1000000/2), + testCase: "Bid denom is not the same as listing denom", + msgBid: types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Price: sdk.NewInt64Coin("uatom", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), AutomaticPayment: true, - BiddingPeriod: time.Now().Add(time.Hour * 2), + Deposit: sdk.NewInt64Coin("uatom", 1000000), }, - listing: nil, - expErr: fmt.Errorf("nft listing does not exist"), + expectError: types.ErrInvalidPriceDenom, + expectPass: false, }, { - testCase: "can not bid", - bid: types.MsgPlaceBid{ - Sender: bidder.Bytes(), - NftId: endListing.NftId, - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 1000000/2), + testCase: "pass first bid", + msgBid: types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Price: sdk.NewInt64Coin("uguu", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), AutomaticPayment: true, - BiddingPeriod: time.Now().Add(time.Hour * 2), - }, - listing: &endListing, - expErr: types.ErrNftListingNotInBidState, - }, - { - testCase: "invalid bid token", - bid: types.MsgPlaceBid{ - Sender: bidder.Bytes(), - NftId: normalListing.NftId, - BidAmount: sdk.NewInt64Coin("xxx", 1000000), - DepositAmount: sdk.NewInt64Coin("xxx", 1000000/2), - AutomaticPayment: true, - BiddingPeriod: time.Now().Add(time.Hour * 2), - }, - listing: &normalListing, - expErr: types.ErrInvalidBidDenom, - }, - { - testCase: "not enough bidding period", - bid: types.MsgPlaceBid{ - Sender: bidder.Bytes(), - NftId: normalListing.NftId, - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 1000000/2), - AutomaticPayment: true, - BiddingPeriod: time.Now().Add(time.Minute * 1), - }, - listing: &normalListing, - expErr: types.ErrSmallBiddingPeriod, - }, - } - for _, tc := range testCases { - var err error - initUguuAmount := sdk.NewInt64Coin("uguu", 100000000) - initAmount := sdk.NewCoins(initUguuAmount) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, initAmount) - suite.Require().NoError(err, tc.testCase) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, - tc.bid.Sender.AccAddress(), initAmount) - suite.Require().NoError(err, tc.testCase) - if tc.listing != nil { - suite.keeper.SetNftListing(suite.ctx, *tc.listing) - } - - err = suite.keeper.PlaceBid(suite.ctx, &tc.bid) - if tc.expErr != nil { - suite.Require().Error(err, tc.testCase) - suite.Require().Equal(tc.expErr.Error(), err.Error(), tc.testCase) - continue - } - - suite.Require().NoError(err, tc.testCase) - afterAmount := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bid.Sender.AccAddress(), "uguu") - suite.Equal(afterAmount.Add(tc.bid.DepositAmount), initUguuAmount, tc.testCase) - - // cleanup - suite.keeper.DeleteNftListing(suite.ctx, *tc.listing) - err = suite.app.BankKeeper.SendCoinsFromAccountToModule(suite.ctx, tc.bid.Sender.AccAddress(), types.ModuleName, sdk.NewCoins(afterAmount)) - suite.Require().NoError(err, tc.testCase) - cleanupAmount := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bid.Sender.AccAddress(), "uguu") - suite.Equal(cleanupAmount, sdk.NewCoin("uguu", sdk.ZeroInt()), tc.testCase) - } -} - -//todo make Rebid tests -//todo make FirstBid tests -//todo make ManualBid tests - -func (suite *KeeperTestSuite) TestCancelledBid() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - now := time.Now().UTC() - cancelledBids := []types.NftBid{ - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", + Deposit: sdk.NewInt64Coin("uguu", 1000000), }, - Bidder: owner.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - AutomaticPayment: true, - DepositAmount: sdk.NewInt64Coin("uguu", 1000000), - BidTime: now, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Bidder: owner2.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - AutomaticPayment: true, - DepositAmount: sdk.NewInt64Coin("uguu", 1000000), - BidTime: now, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "2", - }, - Bidder: owner.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - AutomaticPayment: true, - DepositAmount: sdk.NewInt64Coin("uguu", 1000000), - BidTime: now.Add(time.Second), + expectError: nil, + expectPass: true, }, + // Test Rebid + // Now check from the frontend } - for _, bid := range cancelledBids { - suite.app.NftmarketKeeper.SetCancelledBid(suite.ctx, bid) - } + for _, tc := range tests { + suite.SetupTest() - // check all cancelled bids - allCancelledBids := suite.app.NftmarketKeeper.GetAllCancelledBids(suite.ctx) - suite.Require().Len(allCancelledBids, len(cancelledBids)) + now := time.Now() + suite.ctx = suite.ctx.WithBlockTime(now) - // check matured cancelled bids - maturedCancelledBids := suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now.Add(time.Second)) - suite.Require().Len(maturedCancelledBids, 2) + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: listing.NftId.ClassId, + Name: listing.NftId.ClassId, + Symbol: listing.NftId.ClassId, + }) + _ = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: listing.NftId.ClassId, + Id: listing.NftId.TokenId, + }, owner) + + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: listing.Owner, + NftId: listing.NftId, + BidDenom: listing.BidDenom, + MinDepositRate: listing.MinDepositRate, + }) + suite.Require().NoError(err) - // check normal bids - allBids := suite.app.NftmarketKeeper.GetAllBids(suite.ctx) - suite.Require().Len(allBids, 0) + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.msgBid.Price}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{tc.msgBid.Price}) + suite.NoError(err) - // delete all cancelled bids - for _, bid := range cancelledBids { - suite.app.NftmarketKeeper.DeleteCancelledBid(suite.ctx, bid) + err = suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &tc.msgBid) + if tc.expectPass { + suite.NoError(err) + } else { + suite.Require().Equal(tc.expectError, err) + } } - - // check all cancelled bids - allCancelledBids = suite.app.NftmarketKeeper.GetAllCancelledBids(suite.ctx) - suite.Require().Len(allCancelledBids, 0) - - // check matured cancelled bids - maturedCancelledBids = suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now) - suite.Require().Len(maturedCancelledBids, 0) } +// CloseBid Test func (suite *KeeperTestSuite) TestSafeCloseBid() { owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - now := time.Now().UTC() - bids := []types.NftBid{ - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Bidder: owner.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - AutomaticPayment: true, - DepositAmount: sdk.NewInt64Coin("uguu", 1000000), - BidTime: now, - PaidAmount: sdk.NewInt64Coin("uguu", 0), - }, - } - - for _, bid := range bids { - suite.app.NftmarketKeeper.SetBid(suite.ctx, bid) - } - - // try safe close of bids when module account does not have enough balance - for i, bid := range bids { - cacheCtx, _ := suite.ctx.CacheContext() - err := suite.app.NftmarketKeeper.SafeCloseBid(cacheCtx, bid) - suite.Require().Error(err, i) - } - - // allocate tokens to the module - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - - // try safe close of bids when module account has enough balance - for _, bid := range bids { - cacheCtx, _ := suite.ctx.CacheContext() - err := suite.app.NftmarketKeeper.SafeCloseBid(cacheCtx, bid) - suite.Require().NoError(err) - - // check tokens are received - balance := suite.app.BankKeeper.GetBalance(cacheCtx, owner, "uguu") - suite.Require().True(balance.IsPositive()) + listing := types.Listing{ + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Owner: owner.String(), + State: types.ListingState_LISTING, + BidDenom: "uguu", + MinDepositRate: sdk.NewDecWithPrec(1, 1), + StartedAt: time.Now(), } -} - -func (suite *KeeperTestSuite) TestCancelBid() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) tests := []struct { - testCase string - classId string - nftId string - nftOwner sdk.AccAddress - bidder sdk.AccAddress - prevBids int - bidAmount sdk.Coin - depositAmount sdk.Coin - listBefore bool - cancelAfter time.Duration - loanAmount sdk.Coin - expectPass bool - expectCancelFee bool + testCase string + msgBid types.MsgPlaceBid + expectPrice sdk.Coin + expectClosedAmount sdk.Coin }{ { - testCase: "bid on not listed nft", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - bidder: bidder, - prevBids: 0, - bidAmount: sdk.NewInt64Coin("uguu", 0), - depositAmount: sdk.NewInt64Coin("uguu", 0), - listBefore: false, - loanAmount: sdk.NewInt64Coin("uguu", 0), - cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - expectPass: false, - expectCancelFee: false, - }, - { - testCase: "did not bid previously", - classId: "class4", - nftId: "nft4", - nftOwner: acc1, - bidder: bidder, - prevBids: 1, - bidAmount: sdk.NewInt64Coin("uguu", 0), - depositAmount: sdk.NewInt64Coin("uguu", 0), - listBefore: true, - loanAmount: sdk.NewInt64Coin("uguu", 0), - cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - expectPass: false, - expectCancelFee: false, - }, - { - testCase: "cancelling just after bid", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - bidder: bidder, - prevBids: 1, - bidAmount: sdk.NewInt64Coin("uguu", 10000000), - depositAmount: sdk.NewInt64Coin("uguu", 1000000), - listBefore: true, - loanAmount: sdk.NewInt64Coin("uguu", 0), - cancelAfter: 0, - expectPass: false, - expectCancelFee: false, - }, - { - testCase: "cancel single bid case", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - bidder: bidder, - prevBids: 0, - bidAmount: sdk.NewInt64Coin("uguu", 10000000), - depositAmount: sdk.NewInt64Coin("uguu", 1000000), - listBefore: true, - loanAmount: sdk.NewInt64Coin("uguu", 0), - cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - expectPass: false, - expectCancelFee: false, + testCase: "pass first bid", + msgBid: types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Price: sdk.NewInt64Coin("uguu", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), + AutomaticPayment: true, + Deposit: sdk.NewInt64Coin("uguu", 1000000), + }, + expectPrice: sdk.NewInt64Coin("uguu", 9000000), + expectClosedAmount: sdk.NewInt64Coin("uguu", 10000000), }, - // { - // testCase: "successful bid cancel on active rank with loan with cancel fee", - // classId: "class5", - // nftId: "nft5", - // nftOwner: acc1, - // bidder: bidder, - // prevBids: 2, - // bidAmount: sdk.NewInt64Coin("uguu", 100000000), - // depositAmount: sdk.NewInt64Coin("uguu", 10000000), - // listBefore: true, - // loanAmount: sdk.NewInt64Coin("uguu", 10000000), - // cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - // expectPass: true, - // expectCancelFee: true, - // }, - // { - // testCase: "successful bid cancel on active rank without loan without cancel fee", - // classId: "class5", - // nftId: "nft5", - // nftOwner: acc1, - // bidder: bidder, - // prevBids: 2, - // bidAmount: sdk.NewInt64Coin("uguu", 100000000), - // depositAmount: sdk.NewInt64Coin("uguu", 10000000), - // listBefore: true, - // loanAmount: sdk.NewInt64Coin("uguu", 0), - // cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - // expectPass: true, - // expectCancelFee: false, - // }, - // { - // testCase: "successful bid cancel on not active rank", - // classId: "class5", - // nftId: "nft5", - // nftOwner: acc1, - // bidder: bidder, - // prevBids: 2, - // bidAmount: sdk.NewInt64Coin("uguu", 1000), - // depositAmount: sdk.NewInt64Coin("uguu", 100), - // listBefore: true, - // loanAmount: sdk.NewInt64Coin("uguu", 0), - // cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - // expectPass: true, - // expectCancelFee: false, - // }, } for _, tc := range tests { suite.SetupTest() - now := time.Now().UTC() + now := time.Now() suite.ctx = suite.ctx.WithBlockTime(now) - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: listing.NftId.ClassId, + Name: listing.NftId.ClassId, + Symbol: listing.NftId.ClassId, + Description: listing.NftId.ClassId, + Uri: listing.NftId.ClassId, }) - err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - } - - for i := 0; i < tc.prevBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: depositAmount, - }) - fmt.Println(bidAmount) - suite.Require().NoError(err) - } - - if tc.bidAmount.IsPositive() { - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.bidder, sdk.Coins{tc.bidAmount}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: tc.bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: tc.depositAmount, - }) - suite.Require().NoError(err) - } - - // originBid, _ := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), tc.bidder) - - if tc.loanAmount.IsPositive() { - suite.app.NftmarketKeeper.SetDebt(suite.ctx, types.Loan{ - NftId: nftIdentifier, - Loan: tc.loanAmount, - }) - } - suite.ctx = suite.ctx.WithBlockTime(now.Add(tc.cancelAfter)) - err = suite.app.NftmarketKeeper.CancelBid(suite.ctx, &types.MsgCancelBid{ - Sender: ununifitypes.StringAccAddress(tc.bidder), - NftId: nftIdentifier, + _ = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: listing.NftId.ClassId, + Id: listing.NftId.TokenId, + Uri: listing.NftId.TokenId, + UriHash: listing.NftId.TokenId, + }, owner) + + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: listing.Owner, + NftId: listing.NftId, + BidDenom: listing.BidDenom, + MinDepositRate: listing.MinDepositRate, }) + suite.Require().NoError(err) - if tc.expectPass { - suite.Require().NoError(err) - - // bid removal check - _, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), tc.bidder) - suite.Require().Error(err) - - // cancelled bid creation check - cancelledBids := suite.app.NftmarketKeeper.GetAllCancelledBids(suite.ctx) - suite.Require().Len(cancelledBids, 1) - - // cancelled bid delievery time check - suite.Require().Equal(cancelledBids[0].BidTime, suite.ctx.BlockTime().Add(time.Duration(params.BidTokenDisburseSecondsAfterCancel)*time.Second)) - - // cancel fee check if in active rank - // if tc.expectCancelFee { - // suite.Require().True(cancelledBids[0].PaidAmount.LT(originBid.PaidAmount)) - // } else { - // suite.Require().True(cancelledBids[0].PaidAmount.Equal(originBid.PaidAmount)) - // } - } else { - suite.Require().Error(err) - } + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.msgBid.Price}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{tc.msgBid.Price}) + suite.NoError(err) + + err = suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &tc.msgBid) + suite.NoError(err) + bid, err := suite.app.NftbackedloanKeeper.GetBid(suite.ctx, tc.msgBid.NftId.IdBytes(), bidder) + suite.NoError(err) + balance := suite.app.BankKeeper.GetBalance(suite.ctx, bidder, "uguu") + suite.Equal(tc.expectPrice, balance) + + err = suite.app.NftbackedloanKeeper.SafeCloseBid(suite.ctx, bid) + suite.NoError(err) + balance = suite.app.BankKeeper.GetBalance(suite.ctx, bidder, "uguu") + suite.Equal(tc.expectClosedAmount, balance) } } -func (suite *KeeperTestSuite) TestPayFullBid() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) +func (suite *KeeperTestSuite) TestPayRemainder() { + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + listing := types.Listing{ + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Owner: owner.String(), + State: types.ListingState_LISTING, + BidDenom: "uguu", + MinDepositRate: sdk.NewDecWithPrec(1, 1), + StartedAt: time.Now(), + } + tests := []struct { - testCase string - classId string - nftId string - nftOwner sdk.AccAddress - bidder sdk.AccAddress - bidAmount sdk.Coin - depositAmount sdk.Coin - listBefore bool - loanAmount sdk.Coin - expectPass bool - expectCancelFee bool + testCase string + msgBid types.MsgPlaceBid + initAmount sdk.Coin + expectAfterDeposit sdk.Coin + expectAfterPayment sdk.Coin }{ { - testCase: "bid on not listed nft", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - bidder: bidder, - bidAmount: sdk.NewInt64Coin("uguu", 0), - depositAmount: sdk.NewInt64Coin("uguu", 0), - listBefore: false, - loanAmount: sdk.NewInt64Coin("uguu", 0), - expectPass: false, - expectCancelFee: false, - }, - { - testCase: "did not bid previously", - classId: "class4", - nftId: "nft4", - nftOwner: acc1, - bidder: bidder, - bidAmount: sdk.NewInt64Coin("uguu", 0), - depositAmount: sdk.NewInt64Coin("uguu", 0), - listBefore: true, - loanAmount: sdk.NewInt64Coin("uguu", 0), - expectPass: false, - expectCancelFee: false, - }, - { - testCase: "successful full pay", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - bidder: bidder, - bidAmount: sdk.NewInt64Coin("uguu", 100000000), - depositAmount: sdk.NewInt64Coin("uguu", 10000000), - listBefore: true, - loanAmount: sdk.NewInt64Coin("uguu", 10000000), - expectPass: true, - expectCancelFee: true, + testCase: "pass first bid", + msgBid: types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Price: sdk.NewInt64Coin("uguu", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), + AutomaticPayment: true, + Deposit: sdk.NewInt64Coin("uguu", 1000000), + }, + initAmount: sdk.NewInt64Coin("uguu", 20000000), + expectAfterDeposit: sdk.NewInt64Coin("uguu", 19000000), + expectAfterPayment: sdk.NewInt64Coin("uguu", 10000000), }, } for _, tc := range tests { suite.SetupTest() - now := time.Now().UTC() + now := time.Now() suite.ctx = suite.ctx.WithBlockTime(now) - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: listing.NftId.ClassId, + Name: listing.NftId.ClassId, + Symbol: listing.NftId.ClassId, + Description: listing.NftId.ClassId, + Uri: listing.NftId.ClassId, + }) + _ = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: listing.NftId.ClassId, + Id: listing.NftId.TokenId, + Uri: listing.NftId.TokenId, + UriHash: listing.NftId.TokenId, + }, owner) + + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: listing.Owner, + NftId: listing.NftId, + BidDenom: listing.BidDenom, + MinDepositRate: listing.MinDepositRate, }) - err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) suite.Require().NoError(err) - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - } + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.initAmount}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{tc.initAmount}) + suite.NoError(err) - if tc.bidAmount.IsPositive() { - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{tc.bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.bidder, sdk.Coins{tc.bidAmount}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: tc.bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: tc.depositAmount, - }) - suite.Require().NoError(err) - } - - oldBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") + err = suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &tc.msgBid) + suite.NoError(err) + balance := suite.app.BankKeeper.GetBalance(suite.ctx, bidder, "uguu") + suite.Equal(tc.expectAfterDeposit, balance) - err = suite.app.NftmarketKeeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ - Sender: ununifitypes.StringAccAddress(tc.bidder), - NftId: nftIdentifier, + err = suite.app.NftbackedloanKeeper.PayRemainder(suite.ctx, &types.MsgPayRemainder{ + Sender: bidder.String(), + NftId: tc.msgBid.NftId, }) - - if tc.expectPass { - suite.Require().NoError(err) - - // check balance changes after execution - newBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") - suite.Require().True(newBidderBalance.Amount.LT(oldBidderBalance.Amount)) - - // check paid amount changes after execution - bid, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), tc.bidder) - suite.Require().NoError(err) - suite.Require().Equal(bid.BidAmount.Amount, bid.PaidAmount.Amount.Add(bid.DepositAmount.Amount), tc.testCase) - - // re-execute full pay - err = suite.app.NftmarketKeeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ - Sender: ununifitypes.StringAccAddress(tc.bidder), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - - // check balance after reexecution - new2BidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.bidder, "uguu") - suite.Require().True(newBidderBalance.Amount.Equal(new2BidderBalance.Amount)) - } else { - suite.Require().Error(err) - } + suite.NoError(err) + balance = suite.app.BankKeeper.GetBalance(suite.ctx, bidder, "uguu") + suite.Equal(tc.expectAfterPayment, balance) } } - -func (suite *KeeperTestSuite) TestHandleMaturedCancelledBids() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - now := time.Now().UTC() - cancelledBids := []types.NftBid{ - // TODO: check again - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Bidder: owner.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 100000), - PaidAmount: sdk.NewInt64Coin("uguu", 0), - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - BidTime: now, - InterestAmount: sdk.NewInt64Coin("uguu", 0), - Borrowings: []types.Borrowing{}, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Bidder: owner2.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 100000), - PaidAmount: sdk.NewInt64Coin("uguu", 0), - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - BidTime: now, - InterestAmount: sdk.NewInt64Coin("uguu", 0), - Borrowings: []types.Borrowing{}, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "2", - }, - Bidder: owner.String(), - BidAmount: sdk.NewInt64Coin("uguu", 1000000), - DepositAmount: sdk.NewInt64Coin("uguu", 100000), - PaidAmount: sdk.NewInt64Coin("uguu", 0), - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - BidTime: now.Add(time.Second), - InterestAmount: sdk.NewInt64Coin("uguu", 0), - Borrowings: []types.Borrowing{}, - }, - } - - for _, bid := range cancelledBids { - suite.app.NftmarketKeeper.SetCancelledBid(suite.ctx, bid) - } - - // check matured cancelled bids - maturedCancelledBids := suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now.Add(time.Second)) - suite.Require().Len(maturedCancelledBids, 2) - - // allocate tokens to the module - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - - // execute matured cancelled bids - err = suite.app.NftmarketKeeper.HandleMaturedCancelledBids(suite.ctx) - suite.Require().NoError(err) - - // check matured cancelled bids after handle - maturedCancelledBids = suite.app.NftmarketKeeper.GetMaturedCancelledBids(suite.ctx, now.Add(time.Second)) - suite.Require().Len(maturedCancelledBids, 0) -} diff --git a/x/nftbackedloan/keeper/grpc_query.go b/x/nftbackedloan/keeper/grpc_query.go index 7d73142af..7b4fcd393 100644 --- a/x/nftbackedloan/keeper/grpc_query.go +++ b/x/nftbackedloan/keeper/grpc_query.go @@ -3,6 +3,7 @@ package keeper import ( "context" "sort" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" @@ -63,12 +64,12 @@ func (k Keeper) ListedNfts(c context.Context, req *types.QueryListedNftsRequest) } -func (k Keeper) GetNftListingDetails(ctx sdk.Context, listings []types.NftListing) ([]types.NftListingDetail, error) { +func (k Keeper) GetNftListingDetails(ctx sdk.Context, listings []types.Listing) ([]types.NftListingDetail, error) { res := []types.NftListingDetail{} for _, v := range listings { - nftInfo, found := k.nftKeeper.GetNFT(ctx, v.NftId.ClassId, v.NftId.NftId) + nftInfo, found := k.nftKeeper.GetNFT(ctx, v.NftId.ClassId, v.NftId.TokenId) if !found { - return []types.NftListingDetail{}, types.ErrNotExistsNft + return []types.NftListingDetail{}, types.ErrNftDoesNotExists } detail := types.NftListingDetail{ Listing: v, @@ -95,7 +96,7 @@ func (k Keeper) ListedNftsByOwner(c context.Context, address sdk.AccAddress) (*t }, nil } -// todo add pagenation +// todo add pagination func (k Keeper) ListedClasses(c context.Context, req *types.QueryListedClassesRequest) (*types.QueryListedClassesResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -168,7 +169,7 @@ func (k Keeper) GetListedClass(ctx sdk.Context, classId string, limit int) (*typ nfts = append(nfts, types.NftInfo{Id: nftInfo.Id, Uri: nftInfo.Uri, UriHash: nftInfo.UriHash}) } - for i, _ := range nfts { + for i := range nfts { pnfts = append(pnfts, &nfts[i]) } @@ -184,69 +185,53 @@ func (k Keeper) GetListedClass(ctx sdk.Context, classId string, limit int) (*typ }, nil } -func (k Keeper) Loans(c context.Context, req *types.QueryLoansRequest) (*types.QueryLoansResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryLoansResponse{ - Loans: k.GetAllDebts(ctx), - }, nil -} - func (k Keeper) Loan(c context.Context, req *types.QueryLoanRequest) (*types.QueryLoanResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - nftId := types.NftIdentifier{ + nftId := types.NftId{ ClassId: req.ClassId, - NftId: req.NftId, + TokenId: req.NftId, } ctx := sdk.UnwrapSDKContext(c) - // nft, err := k.GetNftListingByIdBytes(ctx, nftId.IdBytes()) - // if err != nil { - // return &types.QueryLoanResponse{ - // Loan: types.Loan{}, - // BorrowingLimit: sdk.ZeroInt(), - // }, nil - // } + listing, err := k.GetNftListingByIdBytes(ctx, nftId.IdBytes()) + if err != nil { + return &types.QueryLoanResponse{}, err + } bids := k.GetBidsByNft(ctx, nftId.IdBytes()) // Change the order of bids to descending order sort.SliceStable(bids, func(i, j int) bool { - if bids[i].BidAmount.Amount.LT(bids[j].BidAmount.Amount) { + if bids[i].Price.Amount.LT(bids[j].Price.Amount) { return false } - if bids[i].BidAmount.Amount.GT(bids[j].BidAmount.Amount) { + if bids[i].Price.Amount.GT(bids[j].Price.Amount) { return true } - if bids[i].BidTime.After(bids[j].BidTime) { + if bids[i].CreatedAt.After(bids[j].CreatedAt) { return true } return false }) - max := sdk.ZeroInt() - // todo update for v2 + max, err := types.MaxBorrowAmount(bids, listing, ctx.BlockTime()) + if err != nil { + return nil, err + } + deposits := sdk.NewCoin(max.Denom, sdk.NewInt(0)) + borrows := sdk.NewCoin(max.Denom, sdk.NewInt(0)) + for _, v := range bids { - max = max.Add(v.DepositAmount.Amount) + deposits = deposits.Add(v.Deposit) + borrows = borrows.Add(v.Loan.Amount) } return &types.QueryLoanResponse{ - Loan: k.GetDebtByNft(ctx, nftId.IdBytes()), - BorrowingLimit: max, + NftId: nftId, + BorrowingAmount: borrows, + BorrowingLimit: max, + TotalDeposit: deposits, }, nil } -func (k Keeper) CDPsList(c context.Context, req *types.QueryCDPsListRequest) (*types.QueryCDPsListResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - _ = ctx - return &types.QueryCDPsListResponse{}, nil -} - func (k Keeper) NftBids(c context.Context, req *types.QueryNftBidsRequest) (*types.QueryNftBidsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -281,50 +266,6 @@ func (k Keeper) Rewards(c context.Context, req *types.QueryRewardsRequest) (*typ return &types.QueryRewardsResponse{}, nil } -func (k Keeper) PaymentStatus(c context.Context, req *types.QueryPaymentStatusRequest) (*types.QueryPaymentStatusResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - nft := types.NftIdentifier{ - ClassId: req.ClassId, - NftId: req.NftId, - } - listing, err := k.GetNftListingByIdBytes(ctx, nft.IdBytes()) - if err != nil { - return &types.QueryPaymentStatusResponse{}, err - } - bids := k.GetBidsByNft(ctx, nft.IdBytes()) - if len(bids) == 0 { - return nil, status.Error(codes.InvalidArgument, "not existing bidder") - } - - var bidderBid types.NftBid - for _, v := range bids { - if v.Bidder == req.Bidder { - bidderBid = v - } - } - if (bidderBid.Equal(types.NftBid{})) { - return nil, status.Error(codes.InvalidArgument, "does not match bidder") - } - - allPaid := listing.State >= types.ListingState_END_LISTING && bidderBid.BidAmount.Amount.Equal(bidderBid.DepositAmount.Amount) - return &types.QueryPaymentStatusResponse{ - PaymentStatus: types.PaymentStatus{ - NftId: listing.NftId, - State: listing.State, - Bidder: bidderBid.Bidder, - Amount: bidderBid.BidAmount, - AutomaticPayment: bidderBid.AutomaticPayment, - PaidAmount: bidderBid.DepositAmount.Amount, - BidTime: bidderBid.BidTime, - AllPaid: allPaid, - }, - }, nil -} - func (k Keeper) Liquidation(c context.Context, req *types.QueryLiquidationRequest) (*types.QueryLiquidationResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -336,32 +277,29 @@ func (k Keeper) Liquidation(c context.Context, req *types.QueryLiquidationReques } bids := types.NftBids(k.GetBidsByNft(ctx, listing.NftId.IdBytes())) - bids = bids.SortLowerBiddingPeriod() - liqs := &types.Liquidations{} - bidsLen := len(bids) - for i := 0; i < bidsLen; i++ { - checkBid := bids[0] - if listing.CanRefinancing(bids, []types.NftBid{checkBid}, ctx.BlockTime()) { - require := checkBid.LiquidationAmount(checkBid.BiddingPeriod) - // we must use new bids because we need to exclude expired bids - bids = bids.MakeBorrowedBidExcludeExpiredBids(require, checkBid.BiddingPeriod, []types.NftBid{checkBid}) + bids = bids.SortLowerExpiryDate() + liquidations := &types.Liquidations{} + // after 1 hour + afterAnHour := ctx.BlockTime().Add(time.Hour) + + for _, bid := range bids { + if bid.Loan.Amount.Amount.Equal(sdk.ZeroInt()) { continue + } + + liq := types.Liquidation{ + Amount: sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()), + } + liq.Amount = bid.LiquidationAmount(afterAnHour) + liq.LiquidationDate = bid.Expiry + if liquidations.Liquidation == nil { + liquidations.Liquidation = &liq } else { - liq := types.Liquidation{ - Amount: sdk.NewCoin(listing.BidToken, sdk.ZeroInt()), - } - liq.Amount = checkBid.LiquidationAmount(checkBid.BiddingPeriod) - liq.LiquidationDate = checkBid.BiddingPeriod - if liqs.Liquidation == nil { - liqs.Liquidation = &liq - } else { - liqs.NextLiquidation = append(liqs.NextLiquidation, liq) - } - bids = bids.MakeBorrowedBidExcludeExpiredBids(liq.Amount, checkBid.BiddingPeriod, []types.NftBid{checkBid}) + liquidations.NextLiquidation = append(liquidations.NextLiquidation, liq) } } return &types.QueryLiquidationResponse{ - Liquidations: liqs, + Liquidations: liquidations, }, nil } diff --git a/x/nftbackedloan/keeper/grpc_query_test.go b/x/nftbackedloan/keeper/grpc_query_test.go index a765cfa8b..762293b52 100644 --- a/x/nftbackedloan/keeper/grpc_query_test.go +++ b/x/nftbackedloan/keeper/grpc_query_test.go @@ -61,22 +61,21 @@ func (s *KeeperTestSuite) TestListedNfts() { "", []types.NftListingDetail{ { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class2", NftId: "nft2"}, + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class2", TokenId: "nft2"}, Owner: s.addrs[0].String(), - ListingType: 0, - State: 0, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + State: 1, + BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0x0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft2", @@ -85,20 +84,20 @@ func (s *KeeperTestSuite) TestListedNfts() { }, }, { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class5", NftId: "nft5"}, - Owner: s.addrs[0].String(), - ListingType: 0, State: 0, BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class5", TokenId: "nft5"}, + Owner: s.addrs[0].String(), + State: 1, BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft5", @@ -107,20 +106,20 @@ func (s *KeeperTestSuite) TestListedNfts() { }, }, { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class6", NftId: "nft6"}, - Owner: s.addrs[0].String(), - ListingType: 0, State: 0, BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class6", TokenId: "nft6"}, + Owner: s.addrs[0].String(), + State: 1, BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft6", @@ -130,7 +129,7 @@ func (s *KeeperTestSuite) TestListedNfts() { }, }, func(index int, msg string, require *require.Assertions, res *types.QueryListedNftsResponse, expListingNft []types.NftListingDetail) { - require.Equal(res.Listings, expListingNft, "the error occurred on:%d", msg, res.Listings[index].Listing.NftId) + require.Equal(expListingNft, res.Listings, "the error occurred on:%d", msg, res.Listings[index].Listing.NftId) }, }, { @@ -143,21 +142,20 @@ func (s *KeeperTestSuite) TestListedNfts() { "", []types.NftListingDetail{ { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class7", NftId: "nft7"}, - Owner: s.addrs[1].String(), - ListingType: 0, State: 0, BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class7", TokenId: "nft7"}, + Owner: s.addrs[1].String(), + State: 1, BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft7", @@ -178,22 +176,21 @@ func (s *KeeperTestSuite) TestListedNfts() { "", []types.NftListingDetail{ { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class2", NftId: "nft2"}, + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class2", TokenId: "nft2"}, Owner: s.addrs[0].String(), - ListingType: 0, - State: 0, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + State: 1, + BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0x0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft2", @@ -202,20 +199,20 @@ func (s *KeeperTestSuite) TestListedNfts() { }, }, { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class5", NftId: "nft5"}, - Owner: s.addrs[0].String(), - ListingType: 0, State: 0, BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class5", TokenId: "nft5"}, + Owner: s.addrs[0].String(), + State: 1, BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft5", @@ -224,20 +221,20 @@ func (s *KeeperTestSuite) TestListedNfts() { }, }, { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class6", NftId: "nft6"}, - Owner: s.addrs[0].String(), - ListingType: 0, State: 0, BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class6", TokenId: "nft6"}, + Owner: s.addrs[0].String(), + State: 1, BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft6", @@ -246,20 +243,20 @@ func (s *KeeperTestSuite) TestListedNfts() { }, }, { - Listing: types.NftListing{ - NftId: types.NftIdentifier{ClassId: "class7", NftId: "nft7"}, - Owner: s.addrs[1].String(), - ListingType: 0, State: 0, BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + Listing: types.Listing{ + NftId: types.NftId{ClassId: "class7", TokenId: "nft7"}, + Owner: s.addrs[1].String(), + State: 1, BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), StartedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - EndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), + LiquidatedAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), FullPaymentEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), SuccessfulBidEndAt: time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), - AutoRelistedCount: 0, CollectedAmount: sdk.Coin{ Denom: "uguu", Amount: sdk.ZeroInt(), }, + CollectedAmountNegative: false, }, NftInfo: types.NftInfo{ Id: "nft7", @@ -301,226 +298,3 @@ func (s *KeeperTestSuite) TestListedNfts() { }) } } - -func (s *KeeperTestSuite) TestLoan() { - testCases := []struct { - msg string - malleate func(index int, require *require.Assertions) - req *types.QueryLoanRequest - expError string - expResult types.QueryLoanResponse - }{ - { - "success empty", - func(index int, require *require.Assertions) { - }, - &types.QueryLoanRequest{}, - "", - types.QueryLoanResponse{ - Loan: types.Loan{ - NftId: types.NftIdentifier{}, - Loan: sdk.Coin{ - Amount: sdk.NewInt(0), - }, - }, - BorrowingLimit: sdk.ZeroInt(), - }, - }, - { - "fail invalid class id", - func(index int, require *require.Assertions) { - }, - &types.QueryLoanRequest{ - ClassId: "ddfdifd", - NftId: "a10", - }, - "", - types.QueryLoanResponse{ - Loan: types.Loan{ - NftId: types.NftIdentifier{}, - Loan: sdk.Coin{ - Amount: sdk.NewInt(0), - }, - }, - BorrowingLimit: sdk.ZeroInt(), - }, - }, - { - "Success", - func(index int, require *require.Assertions) { - s.TestBorrow() - }, - &types.QueryLoanRequest{ - ClassId: "class5", - NftId: "nft5", - }, - "", - types.QueryLoanResponse{ - Loan: types.Loan{ - NftId: types.NftIdentifier{ - ClassId: "class5", - NftId: "nft5", - }, - Loan: sdk.Coin{ - Denom: "uguu", - Amount: sdk.NewInt(15000), - }, - }, - BorrowingLimit: sdk.NewInt(100000), - }, - }, - } - for index, tc := range testCases { - s.Run(fmt.Sprintf("Case %s", tc.msg), func() { - require := s.Require() - tc.malleate(index, require) - result, err := s.queryClient.Loan(gocontext.Background(), tc.req) - if tc.expError == "" { - require.NoError(err) - require.Equal(result, &tc.expResult, "the error occurred on:%d", index) - } else { - require.Error(err) - require.Contains(err.Error(), tc.expError) - } - }) - } -} - -// func (s *KeeperTestSuite) TestClasses() { -// testCases := []struct { -// msg string -// malleate func(index int, require *require.Assertions) -// req *types.QueryListedClassesRequest -// expError string -// expResult types.QueryListedClassesResponse -// }{ -// { -// "success empty", -// func(index int, require *require.Assertions) { -// }, -// &types.QueryListedClassesRequest{}, -// "", -// types.QueryListedClassesResponse{ -// Classes: []*types.QueryListedClassResponse(nil), -// }, -// }, -// { -// "Success list nft", -// func(index int, require *require.Assertions) { -// s.TestListNft() -// }, -// &types.QueryListedClassesRequest{}, -// "", -// types.QueryListedClassesResponse{ -// Classes: []*types.QueryListedClassResponse{ -// { -// ClassId: "class2", -// Name: "class2", -// Description: "class2", -// Symbol: "class2", -// Uri: "class2", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft2", -// Uri: "nft2", -// UriHash: "nft2", -// }, -// }, -// NftCount: 1, -// }, -// { -// ClassId: "class5", -// Name: "class5", -// Description: "class5", -// Symbol: "class5", -// Uri: "class5", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft5", -// Uri: "nft5", -// UriHash: "nft5", -// }, -// }, -// NftCount: 1, -// }, -// { -// ClassId: "class6", -// Name: "class6", -// Description: "class6", -// Symbol: "class6", -// Uri: "class6", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft6", -// Uri: "nft6", -// UriHash: "nft6", -// }, -// }, -// NftCount: 1, -// }, -// { -// ClassId: "class7", -// Name: "class7", -// Description: "class7", -// Symbol: "class7", -// Uri: "class7", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft7", -// Uri: "nft7", -// UriHash: "nft7", -// }, -// }, -// NftCount: 1, -// }, -// }, -// }, -// }, -// { -// "Success plaace bid", -// func(index int, require *require.Assertions) { -// s.TestPlaceBid() -// }, -// &types.QueryListedClassesRequest{}, -// "", -// types.QueryListedClassesResponse{ -// Classes: []*types.QueryListedClassResponse{ -// { -// ClassId: "class5", -// Name: "class5", -// Description: "class5", -// Symbol: "class5", -// Uri: "class5", -// Urihash: "", -// Nfts: []*types.ListedNft{ -// { -// Id: "nft5", -// Uri: "nft5", -// UriHash: "nft5", -// }, -// }, -// NftCount: 1, -// }, -// }, -// }, -// }, -// } -// for index, tc := range testCases { -// s.Run(fmt.Sprintf("Case %s", tc.msg), func() { -// require := s.Require() -// tc.malleate(index, require) -// result, err := s.queryClient.ListedClasses(gocontext.Background(), tc.req) -// if tc.expError == "" { -// require.NoError(err) -// require.Equal(result, &tc.expResult, "the error occurred on:%d", index) -// } else { -// require.Error(err) -// require.Contains(err.Error(), tc.expError) -// } -// }) -// } -// } diff --git a/x/nftbackedloan/keeper/hooks.go b/x/nftbackedloan/keeper/hooks.go index ee8c75251..b9e50545c 100644 --- a/x/nftbackedloan/keeper/hooks.go +++ b/x/nftbackedloan/keeper/hooks.go @@ -6,21 +6,15 @@ import ( "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -var _ types.NftmarketHooks = Keeper{} +var _ types.NftbackedloanHooks = Keeper{} -func (k Keeper) AfterNftListed(ctx sdk.Context, nftIdentifier types.NftIdentifier, txMemo string) { - if k.hooks != nil { - k.hooks.AfterNftListed(ctx, nftIdentifier, txMemo) - } -} - -func (k Keeper) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier types.NftIdentifier, fee sdk.Coin) { +func (k Keeper) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier types.NftId, fee sdk.Coin) { if k.hooks != nil { k.hooks.AfterNftPaymentWithCommission(ctx, nftIdentifier, fee) } } -func (k Keeper) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier types.NftIdentifier) { +func (k Keeper) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier types.NftId) { if k.hooks != nil { k.hooks.AfterNftUnlistedWithoutPayment(ctx, nftIdentifier) } diff --git a/x/nftbackedloan/keeper/hooks_test.go b/x/nftbackedloan/keeper/hooks_test.go index 941d6e686..c7b8769fd 100644 --- a/x/nftbackedloan/keeper/hooks_test.go +++ b/x/nftbackedloan/keeper/hooks_test.go @@ -12,14 +12,14 @@ var statusAfterNftUnlistedWithoutPayment bool type dummyNftmarketHook struct{} -func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftIdentifier, txMemo string) { +func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftId, txMemo string) { statusAfterNftListed = true } -func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, nftId types.NftIdentifier, fee sdk.Coin) { +func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, nftId types.NftId, fee sdk.Coin) { statusAfterNftPaymentWithCommission = true } -func (hook *dummyNftmarketHook) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftId types.NftIdentifier) { +func (hook *dummyNftmarketHook) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftId types.NftId) { statusAfterNftUnlistedWithoutPayment = true } diff --git a/x/nftbackedloan/keeper/keeper.go b/x/nftbackedloan/keeper/keeper.go index b07d2938c..7a5f3d343 100644 --- a/x/nftbackedloan/keeper/keeper.go +++ b/x/nftbackedloan/keeper/keeper.go @@ -5,7 +5,6 @@ import ( "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,17 +15,16 @@ import ( type Keeper struct { cdc codec.Codec - txCfg client.TxConfig storeKey storetypes.StoreKey memKey storetypes.StoreKey paramSpace paramtypes.Subspace accountKeeper types.AccountKeeper bankKeeper types.BankKeeper nftKeeper types.NftKeeper - hooks types.NftmarketHooks + hooks types.NftbackedloanHooks } -func NewKeeper(cdc codec.Codec, txCfg client.TxConfig, storeKey, +func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, nftKeeper types.NftKeeper) Keeper { @@ -36,7 +34,6 @@ func NewKeeper(cdc codec.Codec, txCfg client.TxConfig, storeKey, return Keeper{ cdc: cdc, - txCfg: txCfg, storeKey: storeKey, memKey: memKey, paramSpace: paramSpace, @@ -51,8 +48,8 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// SetHooks sets the nftmarket keeper hooks -func (k *Keeper) SetHooks(hooks types.NftmarketHooks) *Keeper { +// SetHooks sets the nftbackedloan keeper hooks +func (k *Keeper) SetHooks(hooks types.NftbackedloanHooks) *Keeper { if k.hooks != nil { panic("cannot set validator hooks twice") } diff --git a/x/nftbackedloan/keeper/keeper_test.go b/x/nftbackedloan/keeper/keeper_test.go index 7381aca28..d481ed396 100644 --- a/x/nftbackedloan/keeper/keeper_test.go +++ b/x/nftbackedloan/keeper/keeper_test.go @@ -16,7 +16,10 @@ import ( distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/nft" - nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" + + sdknftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" + + nftkeeper "github.com/UnUniFi/chain/x/nft/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -57,13 +60,12 @@ func (suite *KeeperTestSuite) SetupTest() { suite.addrs = simapp.AddTestAddrsIncremental(app, suite.ctx, 3, sdk.NewInt(30000000)) suite.app = app queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, app.NftmarketKeeper) + types.RegisterQueryServer(queryHelper, app.NftbackedloanKeeper) suite.queryClient = types.NewQueryClient(queryHelper) encodingConfig := appparams.MakeEncodingConfig() - appCodec := encodingConfig.Marshaler + appCodec := encodingConfig.Codec - txCfg := encodingConfig.TxConfig accountKeeper := authkeeper.NewAccountKeeper( appCodec, app.GetKey(authtypes.StoreKey), @@ -80,8 +82,8 @@ func (suite *KeeperTestSuite) SetupTest() { app.BlockedAddrs(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - nftKeeper := nftkeeper.NewKeeper(app.GetKey(nft.StoreKey), appCodec, accountKeeper, bankKeeper) - keeper := keeper.NewKeeper(appCodec, txCfg, app.GetKey(types.StoreKey), app.GetKey(types.MemStoreKey), suite.app.GetSubspace(types.ModuleName), accountKeeper, bankKeeper, nftKeeper) + nftKeeper := nftkeeper.NewKeeper(sdknftkeeper.NewKeeper(app.GetKey(nft.StoreKey), appCodec, accountKeeper, bankKeeper), appCodec, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + keeper := keeper.NewKeeper(appCodec, app.GetKey(types.StoreKey), app.GetKey(types.MemStoreKey), suite.app.GetSubspace(types.ModuleName), accountKeeper, bankKeeper, nftKeeper) hooks := dummyNftmarketHook{} keeper.SetHooks(&hooks) suite.nftKeeper = nftKeeper diff --git a/x/nftbackedloan/keeper/liquidation.go b/x/nftbackedloan/keeper/liquidation.go new file mode 100644 index 000000000..bc76673f5 --- /dev/null +++ b/x/nftbackedloan/keeper/liquidation.go @@ -0,0 +1,273 @@ +package keeper + +import ( + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +// Status update to Liquidation +func (k Keeper) SetLiquidation(ctx sdk.Context, msg *types.MsgEndNftListing) error { + // check listing already exists + listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) + if err != nil { + return types.ErrNftListingDoesNotExist + } + + // Check nft exists + _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.TokenId) + if !found { + return types.ErrNftDoesNotExists + } + + // check ownership of listing + if listing.Owner != msg.Sender { + return types.ErrNotNftListingOwner + } + + // check if listing is already ended + if listing.IsEnded() { + return types.ErrStatusEndedListing + } + + bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) + if len(bids) == 0 { + + // enable NFT transfer + data, found := k.nftKeeper.GetNftData(ctx, msg.NftId.ClassId, msg.NftId.TokenId) + if !found { + return types.ErrNftDoesNotExists + } + data.SendDisabled = false + err := k.nftKeeper.SetNftData(ctx, msg.NftId.ClassId, msg.NftId.TokenId, data) + if err != nil { + return err + } + + k.DeleteNftListings(ctx, listing) + + // Call AfterNftUnlistedWithoutPayment to delete NFT ID from the ecosystem-incentive KVStore + // since it's unlisted. + if _, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()); err != nil { + k.AfterNftUnlistedWithoutPayment(ctx, listing.NftId) + } + + } else { + params := k.GetParamSet(ctx) + listing.State = types.ListingState_LIQUIDATION + listing.LiquidatedAt = ctx.BlockTime() + listing.FullPaymentEndAt = ctx.BlockTime().Add(time.Duration(params.NftListingFullPaymentPeriod) * time.Second) + k.SaveNftListing(ctx, listing) + + // automatic payment after listing ends + for _, bid := range bids { + if bid.AutomaticPayment { + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) + if err != nil { + fmt.Println(err) + continue + } + + cacheCtx, write := ctx.CacheContext() + err = k.PayRemainder(cacheCtx, &types.MsgPayRemainder{ + Sender: bidder.String(), + NftId: listing.NftId, + }) + if err == nil { + write() + } else { + fmt.Println(err) + continue + } + } + } + } + + // Emit event for nft listing end + _ = ctx.EventManager().EmitTypedEvent(&types.EventEndListing{ + Owner: msg.Sender, + ClassId: msg.NftId.ClassId, + TokenId: msg.NftId.TokenId, + }) + + return nil +} + +func (k Keeper) LiquidateExpiredBids(ctx sdk.Context) { + fmt.Println("---Block time---") + fmt.Println(ctx.BlockTime()) + bids := k.GetExpiredBids(ctx, ctx.BlockTime()) + fmt.Println("---expired bids---") + fmt.Println(bids) + k.DeleteBidsWithoutBorrowing(ctx, bids) + checkListingsWithBorrowedBids := map[types.Listing][]types.Bid{} + for _, bid := range bids { + if !bid.IsBorrowed() { + continue + } + + listing, err := k.GetNftListingByIdBytes(ctx, bid.Id.NftId.IdBytes()) + if err != nil { + fmt.Println("failed to get listing by id bytes: %w", err) + continue + } + if listing.IsEnded() { + continue + } + checkListingsWithBorrowedBids[listing] = append(checkListingsWithBorrowedBids[listing], bid) + } + + for listing := range checkListingsWithBorrowedBids { + // check if listing is already ended + fmt.Println("---occur liquidation---") + listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) + if err != nil { + fmt.Println(err) + continue + } + err = k.SetLiquidation(ctx, &types.MsgEndNftListing{ + Sender: listingOwner.String(), + NftId: listing.NftId, + }) + if err != nil { + fmt.Println(err) + continue + } + } +} + +func (k Keeper) RunLiquidationProcess(ctx sdk.Context, bids types.NftBids, listing types.Listing, params types.Params) error { + // loop to find winner bid (collect deposits + bid amount > repay amount) + bidsSortedByDeposit := bids.SortHigherDeposit() + winnerBid, forfeitedBids, refundBids, err := types.LiquidationBid(bidsSortedByDeposit, listing, listing.LiquidatedAt) + if err != nil { + return err + } + + cacheCtx, write := ctx.CacheContext() + if winnerBid.IsNil() { + // No one has PayRemainder. + err := k.LiquidateWithoutWinner(cacheCtx, bidsSortedByDeposit, listing) + if err != nil { + fmt.Println("failed to liquidation process with no winner: %w", err) + return err + } + k.DeleteNftListings(ctx, listing) + } else { + // forfeitedBids, refundBids := types.ForfeitedBidsAndRefundBids(bidsSortedByDeposit, winnerBid) + err := k.LiquidateWithWinner(cacheCtx, forfeitedBids, refundBids, listing) + if err != nil { + fmt.Println("failed to liquidation process with winner: %w", err) + return err + } + // schedule NFT & token send after X days + listing.SuccessfulBidEndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingNftDeliveryPeriod)) + listing.State = types.ListingState_SUCCESSFUL_BID + k.SaveNftListing(ctx, listing) + } + write() + return nil +} + +// todo add test +func (k Keeper) LiquidateWithoutWinner(ctx sdk.Context, bids types.NftBids, listing types.Listing) error { + listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) + if err != nil { + return err + } + + // collect deposit from all bids + forfeitedDeposit, err := k.ForfeitDepositsFromBids(ctx, bids, listing) + if err != nil { + return err + } + listing = listing.AddCollectedAmount(forfeitedDeposit) + + borrowAmount := bids.TotalBorrowedAmount() + // pay fee + if listing.IsNegativeCollectedAmount() { + return types.ErrNegativeCollectedAmount + } + listerProfit := listing.CollectedAmount.Amount.Sub(borrowAmount.Amount) + if listerProfit.IsNegative() { + return types.ErrNegativeProfit + } + err = k.ProcessPaymentWithCommissionFee(ctx, listingOwner, sdk.NewCoin(listing.BidDenom, listerProfit), listing.NftId) + if err != nil { + return err + } + + // enable NFT transfer + data, found := k.nftKeeper.GetNftData(ctx, listing.NftId.ClassId, listing.NftId.TokenId) + if !found { + return types.ErrNftDoesNotExists + } + data.SendDisabled = false + err = k.nftKeeper.SetNftData(ctx, listing.NftId.ClassId, listing.NftId.TokenId, data) + if err != nil { + return err + } + return nil +} + +// todo add test +func (k Keeper) LiquidateWithWinner(ctx sdk.Context, forfeitedBids, refundBids types.NftBids, listing types.Listing) error { + forfeitedDeposit, err := k.ForfeitDepositsFromBids(ctx, forfeitedBids, listing) + if err != nil { + fmt.Println("failed to collect deposit from bids: %w", err) + return err + } + listing = listing.AddCollectedAmount(forfeitedDeposit) + if listing.IsNegativeCollectedAmount() { + return types.ErrNegativeCollectedAmount + } + + totalSubAmount := sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()) + + // refund bids + if len(refundBids) > 0 { + refundInterestAmount := refundBids.TotalCompoundInterest(listing.LiquidatedAt) + refundBorrowedAmount := refundBids.TotalBorrowedAmount() + totalSubAmount = totalSubAmount.Add(refundInterestAmount).Add(refundBorrowedAmount) + } + + // lister's profit (without winner) + // = collected amount - (refund's interest + refund's borrowed amount) + listing = listing.SubCollectedAmount(totalSubAmount) + + // pay interest to winner & refund to other bids + err = k.RefundBids(ctx, refundBids, listing.LiquidatedAt) + if err != nil { + return err + } + return nil +} + +func (k Keeper) RefundBids(ctx sdk.Context, refundBids types.NftBids, time time.Time) error { + for _, bid := range refundBids { + err := k.SafeCloseBidWithAllInterest(ctx, bid, time) + if err != nil { + return err + } + } + return nil +} + +// todo add test +func (k Keeper) ForfeitDepositsFromBids(ctx sdk.Context, bids types.NftBids, listing types.Listing) (sdk.Coin, error) { + result := sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()) + for _, bid := range bids { + // not pay bidder amount, collected deposit + collectedAmount, err := k.SafeCloseBidCollectDeposit(ctx, bid) + if err != nil { + return result, err + } + if collectedAmount.IsPositive() { + result = result.Add(collectedAmount) + } + } + return result, nil +} diff --git a/x/nftbackedloan/keeper/loan.go b/x/nftbackedloan/keeper/loan.go index fa42a2801..abaf9e7ea 100644 --- a/x/nftbackedloan/keeper/loan.go +++ b/x/nftbackedloan/keeper/loan.go @@ -1,134 +1,74 @@ package keeper import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (k Keeper) GetDebtByNft(ctx sdk.Context, nftIdBytes []byte) types.Loan { - loan := types.Loan{} - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.NftLoanKey(nftIdBytes)) - if bz == nil { - return loan +func (k Keeper) Borrow(ctx sdk.Context, msg *types.MsgBorrow) error { + listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) + if err != nil { + return err } - - k.cdc.MustUnmarshal(bz, &loan) - return loan -} - -func (k Keeper) GetAllDebts(ctx sdk.Context) []types.Loan { - store := ctx.KVStore(k.storeKey) - - loans := []types.Loan{} - it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftLoan)) - defer it.Close() - - for ; it.Valid(); it.Next() { - loan := types.Loan{} - k.cdc.MustUnmarshal(it.Value(), &loan) - - loans = append(loans, loan) + bids := types.NftBids(k.GetBidsByNft(ctx, msg.NftId.IdBytes())) + if len(bids) == 0 { + return types.ErrBidDoesNotExists } - return loans -} - -func (k Keeper) SetDebt(ctx sdk.Context, loan types.Loan) { - bz := k.cdc.MustMarshal(&loan) - store := ctx.KVStore(k.storeKey) - store.Set(types.NftLoanKey(loan.NftId.IdBytes()), bz) -} - -func (k Keeper) DeleteDebt(ctx sdk.Context, nftBytes []byte) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.NftLoanKey(nftBytes)) -} - -// remove debt (loan) from KVStore by using DeleteDebt method with the feature -// to judge if it exists before calling it -func (k Keeper) RemoveDebt(ctx sdk.Context, nftBytes []byte) { - loan := k.GetDebtByNft(ctx, nftBytes) - if !loan.Loan.Amount.IsNil() { - k.DeleteDebt(ctx, nftBytes) + // if re-borrow, repay all borrowed bids + borrowedBid := types.NftBids{} + for _, bid := range bids { + if bid.Loan.Amount.IsPositive() { + borrowedBid = append(borrowedBid, bid) + } } -} - -func (k Keeper) IncreaseDebt(ctx sdk.Context, nftId types.NftIdentifier, amount sdk.Coin) { - currDebt := k.GetDebtByNft(ctx, nftId.IdBytes()) - if sdk.Coin.IsNil(currDebt.Loan) { - currDebt.NftId = nftId - currDebt.Loan = amount - } else { - currDebt.Loan = currDebt.Loan.Add(amount) + if len(borrowedBid) != 0 { + err := k.AutoRepay(ctx, msg.NftId, borrowedBid, msg.Sender, msg.Sender) + if err != nil { + return err + } } - k.SetDebt(ctx, currDebt) -} - -func (k Keeper) DecreaseDebt(ctx sdk.Context, nftId types.NftIdentifier, amount sdk.Coin) { - currDebt := k.GetDebtByNft(ctx, nftId.IdBytes()) - currDebt.Loan = currDebt.Loan.Sub(amount) - k.SetDebt(ctx, currDebt) -} - -func (k Keeper) Borrow(ctx sdk.Context, msg *types.MsgBorrow) error { - return k.ManualBorrow(ctx, msg.NftId, msg.Amount, msg.Sender, msg.Sender) + if !types.IsAbleToBorrow(bids, msg.BorrowBids, listing, ctx.BlockTime()) { + return types.ErrCannotBorrowForLiquidation + } + err = k.ManualBorrow(ctx, msg.NftId, msg.BorrowBids, msg.Sender) + if err != nil { + return err + } + return nil } -func (k Keeper) ManualBorrow(ctx sdk.Context, nft types.NftIdentifier, require sdk.Coin, borrower, receiver string) error { +func (k Keeper) ManualBorrow(ctx sdk.Context, nft types.NftId, borrows []types.BorrowBid, borrower string) error { listing, err := k.GetNftListingByIdBytes(ctx, nft.IdBytes()) if err != nil { return err } - - // check listing token == msg.Amount.Denom - if listing.BidToken != require.Denom { - return types.ErrInvalidBorrowDenom - } - if listing.Owner != borrower { return types.ErrNotNftListingOwner } - // calculate maximum borrow amount for the listing - // bids := k.GetBidsByNft(ctx, nft.IdBytes()) - - bids := types.NftBids(k.GetBidsByNft(ctx, nft.IdBytes())) - - maxDebt := listing.MaxPossibleBorrowAmount(bids, []types.NftBid{}) - - if require.Amount.GT(maxDebt) { - return types.ErrDebtExceedsMaxDebt - } - // todo same deposit re-borrow logic - requireAmount := sdk.NewCoin(require.Denom, require.Amount) - borrowingOrderBids := bids.SortBorrowing() - // todo use BorrowFromBids - for _, bid := range borrowingOrderBids { - if requireAmount.IsZero() { - break + borrowedAmount := sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()) + for _, borrow := range borrows { + if borrow.Amount.Denom != listing.BidDenom { + return types.ErrInvalidBorrowDenom } - - usableAmount := bid.BorrowableAmount() - // bigger msg Amount - if requireAmount.IsGTE(usableAmount) { - borrow := types.Borrowing{ - Amount: sdk.NewCoin(usableAmount.Denom, usableAmount.Amount), - StartAt: ctx.BlockTime(), - PaidInterestAmount: sdk.NewCoin(usableAmount.Denom, sdk.ZeroInt()), - } - bid.Borrowings = append(bid.Borrowings, borrow) - requireAmount = requireAmount.Sub(borrow.Amount) + bidderAddress, err := sdk.AccAddressFromBech32(borrow.Bidder) + if err != nil { + return err + } + bid, err := k.GetBid(ctx, nft.IdBytes(), bidderAddress) + if err != nil { + return err + } + deposit := bid.Deposit + if borrow.Amount.IsGTE(deposit) { + bid.Loan.Amount = deposit + bid.Loan.LastRepaidAt = ctx.BlockTime() + borrowedAmount = borrowedAmount.Add(deposit) } else { - borrow := types.Borrowing{ - Amount: sdk.NewCoin(requireAmount.Denom, requireAmount.Amount), - StartAt: ctx.BlockTime(), - PaidInterestAmount: sdk.NewCoin(requireAmount.Denom, sdk.ZeroInt()), - } - bid.Borrowings = append(bid.Borrowings, borrow) - requireAmount.Amount = sdk.ZeroInt() + bid.Loan.Amount = borrow.Amount + bid.Loan.LastRepaidAt = ctx.BlockTime() + borrowedAmount = borrowedAmount.Add(borrow.Amount) } err = k.SetBid(ctx, bid) if err != nil { @@ -136,140 +76,183 @@ func (k Keeper) ManualBorrow(ctx sdk.Context, nft types.NftIdentifier, require s } } - k.IncreaseDebt(ctx, nft, require) + if !borrowedAmount.IsPositive() { + return types.ErrInvalidBorrowAmount + } - receiverAddress, err := sdk.AccAddressFromBech32(receiver) + borrowerAddress, err := sdk.AccAddressFromBech32(borrower) if err != nil { return err } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, receiverAddress, sdk.Coins{require}) + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, borrowerAddress, sdk.Coins{borrowedAmount}) if err != nil { return err } - // Emit event for paying full bid - ctx.EventManager().EmitTypedEvent(&types.EventBorrow{ + // Emit event for borrow from bids + _ = ctx.EventManager().EmitTypedEvent(&types.EventBorrow{ Borrower: borrower, ClassId: nft.ClassId, - NftId: nft.NftId, - Amount: require.String(), + TokenId: nft.TokenId, + Amount: borrowedAmount.String(), }) return nil } -func (k Keeper) Refinancings(ctx sdk.Context, listing types.NftListing, liquidationBids []types.NftBid) { - for _, v := range liquidationBids { - err := k.Refinancing(ctx, listing, v) - if err != nil { - fmt.Println("Refinancing error: %w", err) - continue - } - } +func (k Keeper) Repay(ctx sdk.Context, msg *types.MsgRepay) error { + return k.ManualRepay(ctx, msg.NftId, msg.RepayBids, msg.Sender) } -func (k Keeper) Refinancing(ctx sdk.Context, listing types.NftListing, bid types.NftBid) error { - err := k.DeleteBid(ctx, bid) +func (k Keeper) ManualRepay(ctx sdk.Context, nft types.NftId, repays []types.BorrowBid, borrower string) error { + listing, err := k.GetNftListingByIdBytes(ctx, nft.IdBytes()) if err != nil { return err } - // todo delete not depend on Debt - k.DecreaseDebt(ctx, listing.NftId, bid.BorrowingAmount()) - liquidationAmount := bid.LiquidationAmount(ctx.BlockTime()) - err = k.ManualBorrow(ctx, listing.NftId, liquidationAmount, listing.Owner, bid.Bidder) + if listing.Owner != borrower { + return types.ErrNotNftListingOwner + } + + sender, err := sdk.AccAddressFromBech32(borrower) if err != nil { return err } + + listerAmount := k.bankKeeper.GetBalance(ctx, sender, listing.BidDenom) + repayAmount := sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()) + for _, repay := range repays { + if repay.Amount.Denom != listing.BidDenom { + return types.ErrInvalidRepayDenom + } + repayAmount = repayAmount.Add(repay.Amount) + } + if listerAmount.Amount.LT(repayAmount.Amount) { + return types.ErrInsufficientBalance + } + + repaidAmount := sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()) + + for _, repay := range repays { + bidderAddress, err := sdk.AccAddressFromBech32(repay.Bidder) + if err != nil { + return err + } + bid, err := k.GetBid(ctx, nft.IdBytes(), bidderAddress) + if err != nil { + return err + } + + if bid.Loan.Amount.IsZero() { + continue + } + + repaidResult := bid.RepayInfo(repay.Amount, ctx.BlockTime()) + bid.Loan.Amount = repaidResult.RemainingAmount + bid.Loan.LastRepaidAt = repaidResult.LastRepaidAt + repaidAmount = repaidAmount.Add(repaidResult.RepaidAmount) + + err = k.SetBid(ctx, bid) + if err != nil { + return err + } + + // send interest to bidder + err = k.SendInterestToBidder(ctx, bid, repaidResult.RepaidInterestAmount) + if err != nil { + return err + } + } + + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.Coins{repaidAmount}) + if err != nil { + return err + } + + // Emit event for repay + _ = ctx.EventManager().EmitTypedEvent(&types.EventRepay{ + Borrower: borrower, + ClassId: nft.ClassId, + TokenId: nft.TokenId, + Amount: repaidAmount.String(), + }) return nil } -func (k Keeper) Repay(ctx sdk.Context, msg *types.MsgRepay) error { - // todo set interest amount in bid info - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) +func (k Keeper) AutoRepay(ctx sdk.Context, nft types.NftId, bids types.NftBids, borrower, receiver string) error { + listing, err := k.GetNftListingByIdBytes(ctx, nft.IdBytes()) if err != nil { return err } - - if listing.Owner != msg.Sender { + if listing.Owner != borrower { return types.ErrNotNftListingOwner } - // check listing token == msg.Amount.Denom - if listing.BidToken != msg.Amount.Denom { - return types.ErrInvalidRepayDenom + sender, err := sdk.AccAddressFromBech32(borrower) + if err != nil { + return err } - sender, err := sdk.AccAddressFromBech32(msg.Sender) + listerAmount := k.bankKeeper.GetBalance(ctx, sender, listing.BidDenom) + repayAmount, err := types.ExistRepayAmountAtTime(bids, listing, ctx.BlockTime()) if err != nil { return err } - - listerAmount := k.bankKeeper.GetBalance(ctx, sender, msg.Amount.Denom) - if listerAmount.Amount.LT(msg.Amount.Amount) { + if listerAmount.Amount.LT(repayAmount.Amount) { return types.ErrInsufficientBalance } - currDebt := k.GetDebtByNft(ctx, msg.NftId.IdBytes()) - - // return err if borrowing didn't happen once before - if currDebt.Loan.IsNil() { - return types.ErrNotBorrowed - } - - bids := types.NftBids(k.GetBidsByNft(ctx, msg.NftId.IdBytes())).SortRepay() - repaidAmount := sdk.NewCoin(msg.Amount.Denom, msg.Amount.Amount) + repaidAmount := sdk.NewCoin(listing.BidDenom, sdk.ZeroInt()) for _, bid := range bids { - if repaidAmount.IsZero() { - break - } - if len(bid.Borrowings) == 0 { + if bid.Loan.Amount.IsZero() { continue } - borrowings := []types.Borrowing{} - for _, borrow := range bid.Borrowings { - if repaidAmount.IsZero() { - break - } - - receipt := borrow.RepayThenGetReceipt(repaidAmount, ctx.BlockTime(), bid.CalcInterestF()) - repaidAmount.Amount = receipt.Charge.Amount - bid.InterestAmount = bid.InterestAmount.Add(receipt.PaidInterestAmount) + repaidInfo := bid.RepayInfoInFull(ctx.BlockTime()) + bid.Loan.Amount = repaidInfo.RemainingAmount + bid.Loan.LastRepaidAt = repaidInfo.LastRepaidAt + repaidAmount = repaidAmount.Add(repaidInfo.RepaidAmount) - if !borrow.IsAllRepaid() { - borrowings = append(borrowings, borrow) - } - } - // clean up Borrowings - bid.Borrowings = borrowings err = k.SetBid(ctx, bid) if err != nil { return err } + + // send interest to bidder + err = k.SendInterestToBidder(ctx, bid, repaidInfo.RepaidInterestAmount) + if err != nil { + return err + } } - debitAmount := msg.Amount.Sub(repaidAmount) - k.DecreaseDebt(ctx, msg.NftId, debitAmount) - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.Coins{debitAmount}) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.Coins{repaidAmount}) if err != nil { return err } - // Emit event for paying full bid - ctx.EventManager().EmitTypedEvent(&types.EventRepay{ - Repayer: msg.Sender, - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - Amount: msg.Amount.String(), + // Emit event for repay + _ = ctx.EventManager().EmitTypedEvent(&types.EventRepay{ + Borrower: borrower, + ClassId: nft.ClassId, + TokenId: nft.TokenId, + Amount: repaidAmount.String(), }) - return nil } -func MaxPossibleBorrowAmount(bids []types.NftBid) sdk.Int { - maxPossibleBorrowAmount := sdk.ZeroInt() - for _, bid := range bids { - maxPossibleBorrowAmount = maxPossibleBorrowAmount.Add(bid.DepositAmount.Amount) +func (k Keeper) SendInterestToBidder(ctx sdk.Context, bid types.Bid, interestAmount sdk.Coin) error { + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) + if err != nil { + return err + } + if interestAmount.IsNil() { + return types.ErrInvalidInterestAmount } - return maxPossibleBorrowAmount + if interestAmount.IsPositive() { + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{sdk.NewCoin(interestAmount.Denom, interestAmount.Amount)}) + if err != nil { + return err + } + } + return nil } diff --git a/x/nftbackedloan/keeper/loan_test.go b/x/nftbackedloan/keeper/loan_test.go index ce2555765..8586d4c01 100644 --- a/x/nftbackedloan/keeper/loan_test.go +++ b/x/nftbackedloan/keeper/loan_test.go @@ -8,595 +8,395 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (suite *KeeperTestSuite) TestDebtBasics() { - debts := []types.Loan{ - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Loan: sdk.NewInt64Coin("uguu", 1000000), - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "2", - }, - Loan: sdk.NewInt64Coin("uguu", 1000000), - }, - } - - for _, debt := range debts { - suite.app.NftmarketKeeper.SetDebt(suite.ctx, debt) - } +func (suite *KeeperTestSuite) TestManualBorrow() { + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - for _, debt := range debts { - loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, debt.NftId.IdBytes()) - suite.Require().Equal(loan, debt) + listing := types.Listing{ + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Owner: owner.String(), + State: types.ListingState_LISTING, + BidDenom: "uguu", + MinDepositRate: sdk.NewDecWithPrec(1, 1), + StartedAt: time.Now(), } - - // check all debts - allDebts := suite.app.NftmarketKeeper.GetAllDebts(suite.ctx) - suite.Require().Len(allDebts, len(debts)) - - // delete all the debts - for _, debt := range debts { - suite.app.NftmarketKeeper.DeleteDebt(suite.ctx, debt.NftId.IdBytes()) + msgBid := types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Price: sdk.NewInt64Coin("uguu", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), + AutomaticPayment: true, + Deposit: sdk.NewInt64Coin("uguu", 1000000), } - // check all debts - allDebts = suite.app.NftmarketKeeper.GetAllDebts(suite.ctx) - suite.Require().Len(allDebts, 0) -} - -func (suite *KeeperTestSuite) TestIncreaseDecreaseDebt() { - nftIdentifier := types.NftIdentifier{ - ClassId: "1", - NftId: "1", - } - - loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Equal(loan.Loan, sdk.Coin{}) - - suite.app.NftmarketKeeper.IncreaseDebt(suite.ctx, nftIdentifier, sdk.NewInt64Coin("uguu", 1000000)) - loan = suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Equal(loan.Loan, sdk.NewInt64Coin("uguu", 1000000)) - - suite.app.NftmarketKeeper.DecreaseDebt(suite.ctx, nftIdentifier, sdk.NewInt64Coin("uguu", 500000)) - loan = suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Equal(loan.Loan, sdk.NewInt64Coin("uguu", 500000)) - - suite.app.NftmarketKeeper.DecreaseDebt(suite.ctx, nftIdentifier, sdk.NewInt64Coin("uguu", 500000)) - loan = suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Equal(loan.Loan, sdk.NewInt64Coin("uguu", 0)) -} - -func (suite *KeeperTestSuite) TestBorrow() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - tests := []struct { testCase string - classId string - nftId string - nftOwner sdk.AccAddress - borrower sdk.AccAddress - prevBids int - originAmount sdk.Coin - amount sdk.Coin - listBefore bool + msgBorrow types.MsgBorrow expectPass bool + expectAmount sdk.Coin }{ { - testCase: "borrow on not listed nft", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - borrower: acc1, - prevBids: 0, - originAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("uguu", 10000000), - listBefore: false, + testCase: "fail with not listing", + msgBorrow: types.MsgBorrow{ + Sender: owner.String(), + // invalid nft id + NftId: types.NftId{ClassId: "class99", TokenId: "nft99"}, + BorrowBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 500000), + }, + }, + }, expectPass: false, - }, + expectAmount: sdk.NewInt64Coin("uguu", 0)}, { - testCase: "borrow request by non owner", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - borrower: acc2, - prevBids: 2, - originAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("uguu", 1), - listBefore: true, - expectPass: false, - }, - { - testCase: "invalid borrow denom", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - borrower: acc1, - prevBids: 2, - originAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("xxxx", 10000000), - listBefore: true, + testCase: "fail with not owner", + msgBorrow: types.MsgBorrow{ + // invalid sender + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + BorrowBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 500000), + }, + }, + }, expectPass: false, + expectAmount: sdk.NewInt64Coin("uguu", 0), }, { - testCase: "more than max debt", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - borrower: acc1, - prevBids: 1, - originAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("uguu", 1000000000), - listBefore: true, + testCase: "fail with invalid denom", + msgBorrow: types.MsgBorrow{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + BorrowBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + // invalid denom + Amount: sdk.NewInt64Coin("uatom", 500000), + }, + }, + }, expectPass: false, + expectAmount: sdk.NewInt64Coin("uguu", 0), }, { - testCase: "successful 1st time borrow", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - borrower: acc1, - prevBids: 2, - originAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("uguu", 10000/2), - listBefore: true, + testCase: "pass with partial borrow", + msgBorrow: types.MsgBorrow{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + BorrowBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 500000), + }, + }, + }, expectPass: true, + expectAmount: sdk.NewInt64Coin("uguu", 500000), }, { - testCase: "successful 2nd time borrow", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - borrower: acc1, - prevBids: 4, - originAmount: sdk.NewInt64Coin("uguu", 10000), - amount: sdk.NewInt64Coin("uguu", 10000/2), - listBefore: true, + testCase: "pass with over borrow", + msgBorrow: types.MsgBorrow{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + BorrowBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 2000000), + }, + }, + }, expectPass: true, + expectAmount: sdk.NewInt64Coin("uguu", 1000000), }, } for _, tc := range tests { suite.SetupTest() - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, + now := time.Now() + suite.ctx = suite.ctx.WithBlockTime(now) + + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: listing.NftId.ClassId, + Name: listing.NftId.ClassId, + Symbol: listing.NftId.ClassId, + Description: listing.NftId.ClassId, + Uri: listing.NftId.ClassId, + }) + _ = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: listing.NftId.ClassId, + Id: listing.NftId.TokenId, + Uri: listing.NftId.TokenId, + UriHash: listing.NftId.TokenId, + }, owner) + + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: listing.Owner, + NftId: listing.NftId, + BidDenom: listing.BidDenom, + MinDepositRate: listing.MinDepositRate, }) - err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) suite.Require().NoError(err) - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.01"), - AutomaticRefinancing: false, - }) - suite.Require().NoError(err) - } - - for i := 0; i < tc.prevBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{msgBid.Price}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{msgBid.Price}) + suite.NoError(err) - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(10000*(i+1))) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - } - - if tc.originAmount.IsPositive() { - err := suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ - Sender: ununifitypes.StringAccAddress(tc.borrower), - NftId: nftIdentifier, - Amount: tc.originAmount, - }) - suite.Require().NoError(err, tc.testCase) - } - - oldBorrowerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") - err = suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ - Sender: ununifitypes.StringAccAddress(tc.borrower), - NftId: nftIdentifier, - Amount: tc.amount, - }) + err = suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &msgBid) + suite.NoError(err) + err = suite.app.NftbackedloanKeeper.ManualBorrow(suite.ctx, tc.msgBorrow.NftId, tc.msgBorrow.BorrowBids, tc.msgBorrow.Sender) if tc.expectPass { - suite.Require().NoError(err, tc.testCase) - - // check borrow balance increase - borrowerNewBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") - suite.Require().True(borrowerNewBalance.Amount.GT(oldBorrowerBalance.Amount)) - - // check debt increase - loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().True(loan.Loan.Amount.IsPositive()) + suite.NoError(err) + balance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "uguu") + suite.Equal(tc.expectAmount, balance) } else { - suite.Require().Error(err) + suite.Error(err) } } } -func (suite *KeeperTestSuite) TestRepay() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) +func (suite *KeeperTestSuite) TestManualRepay() { + owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + + listing := types.Listing{ + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Owner: owner.String(), + State: types.ListingState_LISTING, + BidDenom: "uguu", + MinDepositRate: sdk.NewDecWithPrec(1, 1), + StartedAt: time.Now(), + } + msgBid := types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + Price: sdk.NewInt64Coin("uguu", 10000000), + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.NewDecWithPrec(1, 1), + AutomaticPayment: true, + Deposit: sdk.NewInt64Coin("uguu", 1000000), + } + msgBorrow := types.MsgBorrow{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + BorrowBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 1000000), + }, + }, + } tests := []struct { testCase string - classId string - nftId string - nftOwner sdk.AccAddress - borrower sdk.AccAddress - prevBids int - borrowAmount sdk.Coin - amount sdk.Coin - listBefore bool + msgRepay types.MsgRepay expectPass bool + expectAmount sdk.Coin }{ { - testCase: "repay on not listed nft", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - borrower: acc1, - prevBids: 0, - borrowAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("uguu", 10000000), - listBefore: false, + testCase: "fail with not listing", + msgRepay: types.MsgRepay{ + Sender: owner.String(), + // invalid nft id + NftId: types.NftId{ClassId: "class99", TokenId: "nft99"}, + RepayBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 500000), + }, + }, + }, expectPass: false, - }, + expectAmount: sdk.NewInt64Coin("uguu", 0)}, { - testCase: "repay request by non owner", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - borrower: acc2, - prevBids: 2, - borrowAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("uguu", 1), - listBefore: true, - expectPass: false, - }, - { - testCase: "invalid repay denom", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - borrower: acc1, - prevBids: 2, - borrowAmount: sdk.NewInt64Coin("uguu", 0), - amount: sdk.NewInt64Coin("xxxx", 10000000), - listBefore: true, + testCase: "fail with not owner", + msgRepay: types.MsgRepay{ + // invalid sender + Sender: bidder.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + RepayBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 500000), + }, + }, + }, expectPass: false, + expectAmount: sdk.NewInt64Coin("uguu", 0), }, { - testCase: "repay more than debt", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - borrower: acc1, - prevBids: 1, - borrowAmount: sdk.NewInt64Coin("uguu", 100), - amount: sdk.NewInt64Coin("uguu", 10000), - listBefore: true, + testCase: "fail with invalid denom", + msgRepay: types.MsgRepay{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + RepayBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + // invalid denom + Amount: sdk.NewInt64Coin("uatom", 500000), + }, + }, + }, expectPass: false, + expectAmount: sdk.NewInt64Coin("uguu", 0), }, { - testCase: "successful full repay", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - borrower: acc1, - prevBids: 2, - borrowAmount: sdk.NewInt64Coin("uguu", 100000), - amount: sdk.NewInt64Coin("uguu", 100000), - listBefore: true, + testCase: "pass with partial repay", + msgRepay: types.MsgRepay{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + RepayBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 500000), + }, + }, + }, expectPass: true, + expectAmount: sdk.NewInt64Coin("uguu", 1500000), }, { - testCase: "successful partial repay", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - borrower: acc1, - prevBids: 2, - borrowAmount: sdk.NewInt64Coin("uguu", 100000), - amount: sdk.NewInt64Coin("uguu", 10000), - listBefore: true, + testCase: "pass with over repay", + msgRepay: types.MsgRepay{ + Sender: owner.String(), + NftId: types.NftId{ClassId: "class1", TokenId: "nft1"}, + RepayBids: []types.BorrowBid{ + { + Bidder: bidder.String(), + Amount: sdk.NewInt64Coin("uguu", 2000000), + }, + }, + }, expectPass: true, + expectAmount: sdk.NewInt64Coin("uguu", 1000000), }, } for _, tc := range tests { suite.SetupTest() - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, + now := time.Now() + suite.ctx = suite.ctx.WithBlockTime(now) + + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: listing.NftId.ClassId, + Name: listing.NftId.ClassId, + Symbol: listing.NftId.ClassId, + Description: listing.NftId.ClassId, + Uri: listing.NftId.ClassId, + }) + _ = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: listing.NftId.ClassId, + Id: listing.NftId.TokenId, + Uri: listing.NftId.TokenId, + UriHash: listing.NftId.TokenId, + }, owner) + + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: listing.Owner, + NftId: listing.NftId, + BidDenom: listing.BidDenom, + MinDepositRate: listing.MinDepositRate, }) - err := suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) suite.Require().NoError(err) - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - } - - for i := 0; i < tc.prevBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{msgBid.Price}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{msgBid.Deposit}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, owner, sdk.Coins{msgBid.Deposit}) + suite.NoError(err) - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) + err = suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &msgBid) + suite.NoError(err) - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - } - - if tc.borrowAmount.IsPositive() { - err := suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ - Sender: ununifitypes.StringAccAddress(tc.borrower), - NftId: nftIdentifier, - Amount: tc.borrowAmount, - }) - suite.Require().NoError(err, tc.testCase) - } - - oldRepayerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") - err = suite.app.NftmarketKeeper.Repay(suite.ctx, &types.MsgRepay{ - Sender: ununifitypes.StringAccAddress(tc.borrower), - NftId: nftIdentifier, - Amount: tc.amount, - }) + err = suite.app.NftbackedloanKeeper.ManualBorrow(suite.ctx, msgBorrow.NftId, msgBorrow.BorrowBids, msgBorrow.Sender) + suite.NoError(err) + err = suite.app.NftbackedloanKeeper.ManualRepay(suite.ctx, tc.msgRepay.NftId, tc.msgRepay.RepayBids, tc.msgRepay.Sender) if tc.expectPass { - suite.Require().NoError(err, tc.testCase) - - repayerNewBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.borrower, "uguu") - suite.Require().True(repayerNewBalance.Amount.LT(oldRepayerBalance.Amount)) - - // check debt decrease - loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().True(loan.Loan.Amount.Equal(tc.borrowAmount.Amount.Sub(tc.amount.Amount))) + suite.NoError(err) + balance := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "uguu") + suite.Equal(tc.expectAmount, balance) } else { - suite.Require().Error(err, tc.testCase) + suite.Error(err) } } } -// TestLoanManagement is a test to see if the management of loan data is properly working. -// Specifically, this tests loan situation in HandleFullPaymentPeriodEnding method. -func (suite *KeeperTestSuite) TestLoanManagement() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - bidAmount := sdk.NewCoin("uguu", sdk.NewInt(100)) - depositAmount := sdk.NewCoin("uguu", sdk.NewInt(10)) - nftOwner := acc1 - nftIdentifier := types.NftIdentifier{ClassId: "class1", NftId: "nft1"} - +func (suite *KeeperTestSuite) TestSendInterestToBidder() { + bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + initAmount := sdk.NewInt64Coin("uguu", 1000000) tests := []struct { testCase string - listingState types.ListingState - fullPay bool - multiBid bool - overBorrow bool + bid types.Bid + interest sdk.Coin + expectPass bool + expectAmount sdk.Coin }{ { - testCase: "unit borrow in selling decision listing when highest bid is paid", - listingState: types.ListingState_SELLING_DECISION, - fullPay: true, - multiBid: false, - }, // add successful listing state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status - { - testCase: "unit borrow in selling decision listing when highest bid is not paid and no more bids", - listingState: types.ListingState_SELLING_DECISION, - fullPay: false, - multiBid: false, - }, // status => ListingState_LISTING - // - { - testCase: "multi borrow in selling decision listing when highest bid is not paid, and more bids", - listingState: types.ListingState_SELLING_DECISION, - fullPay: false, - multiBid: true, - overBorrow: true, - }, // status => ListingState_BIDDING - // loan data is removed since only one bid exists. - { - testCase: "multi borrow in selling decision listing when highest bid is not paid, and more bids", - listingState: types.ListingState_SELLING_DECISION, - fullPay: false, - multiBid: true, - overBorrow: true, - }, // status => ListingState_BIDDING - // loan data is removed since only one bid exists. + testCase: "pass with valid interest", + bid: types.Bid{ + Id: types.BidId{ + Bidder: bidder.String(), + }, + }, + interest: sdk.NewInt64Coin("uguu", 1000000), + expectPass: true, + expectAmount: sdk.NewInt64Coin("uguu", 1000000), + }, { - testCase: "borrow in ended listing, when fully paid bid exists", - listingState: types.ListingState_END_LISTING, - fullPay: true, - multiBid: false, - }, // add successful bid state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status, close all the other bids - // and loan data is just removed. + testCase: "fail with 0 interest", + bid: types.Bid{ + Id: types.BidId{ + Bidder: bidder.String(), + }, + }, + interest: sdk.NewInt64Coin("uguu", 0), + expectPass: true, + expectAmount: sdk.NewInt64Coin("uguu", 0), + }, { - testCase: "borrow in ended listing, when fully paid bid does not exist", - listingState: types.ListingState_END_LISTING, - fullPay: false, - multiBid: false, - }, // all the bids closed, pay depositCollected, nft listing delete, transfer nft to fully paid bidder - // and loan data is just removed. + testCase: "fail with nil interest", + bid: types.Bid{ + Id: types.BidId{ + Bidder: bidder.String(), + }, + }, + interest: sdk.Coin{}, + expectPass: false, + expectAmount: sdk.NewInt64Coin("uguu", 0), + }, } for _, tc := range tests { suite.SetupTest() - now := time.Now().UTC() + now := time.Now() suite.ctx = suite.ctx.WithBlockTime(now) - _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{bidAmount}) + err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{initAmount}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{initAmount}) + suite.NoError(err) - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: nftIdentifier.ClassId, - Name: nftIdentifier.ClassId, - Symbol: nftIdentifier.ClassId, - }) - _ = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: nftIdentifier.ClassId, - Id: nftIdentifier.NftId, - }, nftOwner) - - _ = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - listing, _ := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - - if !tc.multiBid { - suite.PlaceAndBorrow(bidAmount, depositAmount, nftIdentifier, nftOwner, tc.fullPay, 10) - } else if tc.overBorrow { - for i := 0; i < 2; i++ { - suite.PlaceAndBorrow(bidAmount, depositAmount, nftIdentifier, nftOwner, tc.fullPay, 10) - } + err = suite.app.NftbackedloanKeeper.SendInterestToBidder(suite.ctx, tc.bid, tc.interest) + if tc.expectPass { + suite.NoError(err) + balance := suite.app.BankKeeper.GetBalance(suite.ctx, bidder, "uguu") + suite.Equal(tc.expectAmount, balance) } else { - suite.PlaceAndBorrow(bidAmount, depositAmount, nftIdentifier, nftOwner, tc.fullPay, 10) - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - - _ = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - DepositAmount: depositAmount, - }) + suite.Error(err) } - - listing.State = tc.listingState - suite.app.NftmarketKeeper.SetNftListing(suite.ctx, listing) - - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) - suite.app.NftmarketKeeper.HandleFullPaymentsPeriodEndings(suite.ctx) - loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - - switch tc.listingState { - case types.ListingState_SELLING_DECISION: - if tc.fullPay { - // afte the fullpay, every loan must be removed - suite.Require().Empty(loan.Loan) - } else { - if tc.multiBid && tc.overBorrow { - suite.Require().Equal(bidAmount.Amount.QuoRaw(10), loan.Loan.Amount, tc.testCase) - } else { - suite.Require().Equal(loan.Loan, sdk.Coin{}, tc.testCase) - } - } - case types.ListingState_END_LISTING: - // under END_LISTING condition, loan must be removed after HandleFullPaymentsPeriodEndings - suite.Require().Empty(loan.Loan) - } - } -} - -// this method is for TestLoanManagement -func (suite *KeeperTestSuite) PlaceAndBorrow(bidAmount sdk.Coin, depositAmount sdk.Coin, nftId types.NftIdentifier, nftOwner sdk.AccAddress, fullPay bool, bidActiveRank uint64) { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftId, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - err = suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftId, - Amount: depositAmount, - }) - suite.Require().NoError(err) - - if fullPay { - err := suite.app.NftmarketKeeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftId, - }) - suite.Require().NoError(err) } } - -func (suite *KeeperTestSuite) Liquidate() { - // TODO: implement it once logic is implemented! -} diff --git a/x/nftbackedloan/keeper/mint.go b/x/nftbackedloan/keeper/mint.go deleted file mode 100644 index c28fae17c..000000000 --- a/x/nftbackedloan/keeper/mint.go +++ /dev/null @@ -1,47 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftbackedloan/types" -) - -func (k Keeper) MintNft(ctx sdk.Context, msg *types.MsgMintNft) error { - classId := msg.ClassId - nftId := msg.NftId - _, exists := k.nftKeeper.GetNFT(ctx, classId, nftId) - if exists { - return nft.ErrNFTExists - } - - _, hasId := k.nftKeeper.GetClass(ctx, classId) - if !hasId { - class := nft.Class{ - Id: classId, - Name: classId, - Symbol: classId, - Description: classId, - Uri: classId, - UriHash: classId, - } - k.nftKeeper.SaveClass(ctx, class) - } - - expNFT := nft.NFT{ - ClassId: classId, - Id: nftId, - Uri: msg.NftUri, - UriHash: msg.NftUriHash, - } - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - err = k.nftKeeper.Mint(ctx, expNFT, sender) - if err != nil { - return err - } - - return nil -} diff --git a/x/nftbackedloan/keeper/msg_server.go b/x/nftbackedloan/keeper/msg_server.go index 762ec1bc8..a15679f1e 100644 --- a/x/nftbackedloan/keeper/msg_server.go +++ b/x/nftbackedloan/keeper/msg_server.go @@ -22,16 +22,6 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -func (k msgServer) MintNft(c context.Context, msg *types.MsgMintNft) (*types.MsgMintNftResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - err := k.keeper.MintNft(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgMintNftResponse{}, nil -} - func (k msgServer) ListNft(c context.Context, msg *types.MsgListNft) (*types.MsgListNftResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -42,13 +32,13 @@ func (k msgServer) ListNft(c context.Context, msg *types.MsgListNft) (*types.Msg return &types.MsgListNftResponse{}, nil } -func (k msgServer) CancelNftListing(c context.Context, msg *types.MsgCancelNftListing) (*types.MsgCancelNftListingResponse, error) { +func (k msgServer) CancelListing(c context.Context, msg *types.MsgCancelListing) (*types.MsgCancelListingResponse, error) { ctx := sdk.UnwrapSDKContext(c) err := k.keeper.CancelNftListing(ctx, msg) if err != nil { return nil, err } - return &types.MsgCancelNftListingResponse{}, nil + return &types.MsgCancelListingResponse{}, nil } func (k msgServer) PlaceBid(c context.Context, msg *types.MsgPlaceBid) (*types.MsgPlaceBidResponse, error) { @@ -71,29 +61,20 @@ func (k msgServer) CancelBid(c context.Context, msg *types.MsgCancelBid) (*types func (k msgServer) SellingDecision(c context.Context, msg *types.MsgSellingDecision) (*types.MsgSellingDecisionResponse, error) { ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.SellingDecision(ctx, msg) + err := k.keeper.SetSellingDecision(ctx, msg) if err != nil { return nil, err } return &types.MsgSellingDecisionResponse{}, nil } -func (k msgServer) EndNftListing(c context.Context, msg *types.MsgEndNftListing) (*types.MsgEndNftListingResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.EndNftListing(ctx, msg) - if err != nil { - return nil, err - } - return &types.MsgEndNftListingResponse{}, nil -} - -func (k msgServer) PayFullBid(c context.Context, msg *types.MsgPayFullBid) (*types.MsgPayFullBidResponse, error) { +func (k msgServer) PayRemainder(c context.Context, msg *types.MsgPayRemainder) (*types.MsgPayRemainderResponse, error) { ctx := sdk.UnwrapSDKContext(c) - err := k.keeper.PayFullBid(ctx, msg) + err := k.keeper.PayRemainder(ctx, msg) if err != nil { return nil, err } - return &types.MsgPayFullBidResponse{}, nil + return &types.MsgPayRemainderResponse{}, nil } func (k msgServer) Borrow(c context.Context, msg *types.MsgBorrow) (*types.MsgBorrowResponse, error) { diff --git a/x/nftbackedloan/keeper/msg_server_test.go b/x/nftbackedloan/keeper/msg_server_test.go index f3f523ba9..af98255d1 100644 --- a/x/nftbackedloan/keeper/msg_server_test.go +++ b/x/nftbackedloan/keeper/msg_server_test.go @@ -17,9 +17,9 @@ package keeper_test // Bid by end time // TODO: test for -// func (m NftListing) CanRefinancing(allBids, expiredBids []NftBid, now time.Time) bool { -// func (m NftListing) CalcAmount(bids []NftBid) sdk.Int { -// func (m NftListing) CalcAmountF(bids []NftBid, conditionF func(bid NftBid) bool) sdk.Int { +// func (m Listing) CanRefinancing(allBids, expiredBids []Bid, now time.Time) bool { +// func (m Listing) CalcAmount(bids []Bid) sdk.Int { +// func (m Listing) CalcAmountF(bids []Bid, conditionF func(bid NftBid) bool) sdk.Int { // TODO: update for panic handling // TODO: more comment on the code diff --git a/x/nftbackedloan/keeper/nft_listed_class.go b/x/nftbackedloan/keeper/nft_listed_class.go index 5ae449f81..e44d53b7c 100644 --- a/x/nftbackedloan/keeper/nft_listed_class.go +++ b/x/nftbackedloan/keeper/nft_listed_class.go @@ -4,10 +4,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" - "github.com/UnUniFi/chain/x/nftfactory/keeper" ) -func (k Keeper) UpdateListedClass(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) UpdateListedClass(ctx sdk.Context, listing types.Listing) { // if listing doesn't exist, delete it from listed calss if _, err := k.GetNftListingByIdBytes(ctx, listing.IdBytes()); err != nil { k.DeleteListingFromListedClass(ctx, listing) @@ -19,7 +18,7 @@ func (k Keeper) UpdateListedClass(ctx sdk.Context, listing types.NftListing) { k.SetListingInListedClass(ctx, listing) case types.ListingState_BIDDING: k.SetListingInListedClass(ctx, listing) - case types.ListingState_END_LISTING: + case types.ListingState_LIQUIDATION: k.DeleteListingFromListedClass(ctx, listing) case types.ListingState_SUCCESSFUL_BID: k.DeleteListingFromListedClass(ctx, listing) @@ -28,14 +27,14 @@ func (k Keeper) UpdateListedClass(ctx sdk.Context, listing types.NftListing) { } } -func (k Keeper) SetListingInListedClass(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) SetListingInListedClass(ctx sdk.Context, listing types.Listing) { store := ctx.KVStore(k.storeKey) bzIdlist := store.Get(types.ClassKey(listing.ClassIdBytes())) if bzIdlist == nil { bz := k.cdc.MustMarshal( &types.ListedClass{ ClassId: listing.NftId.ClassId, - NftIds: []string{listing.NftId.NftId}, + NftIds: []string{listing.NftId.TokenId}, }, ) store.Set(types.ClassKey(listing.ClassIdBytes()), bz) @@ -44,30 +43,30 @@ func (k Keeper) SetListingInListedClass(ctx sdk.Context, listing types.NftListin k.cdc.MustUnmarshal(bzIdlist, &class) // return if the nft_id already exists - index := keeper.SliceIndex(class.NftIds, listing.NftId.NftId) - if index != -1 { - return - } - class.NftIds = append(class.NftIds, listing.NftId.NftId) + // index := keeper.SliceIndex(class.NftIds, listing.NftId.TokenId) + // if index != -1 { + // return + // } + class.NftIds = append(class.NftIds, listing.NftId.TokenId) bz := k.cdc.MustMarshal(&class) store.Set(types.ClassKey(listing.ClassIdBytes()), bz) } } -func (k Keeper) DeleteListingFromListedClass(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) DeleteListingFromListedClass(ctx sdk.Context, listing types.Listing) { store := ctx.KVStore(k.storeKey) bzIdlist := store.Get(types.ClassKey(listing.ClassIdBytes())) class := types.ListedClass{} k.cdc.MustUnmarshal(bzIdlist, &class) - removeIndex := keeper.SliceIndex(class.NftIds, listing.NftId.NftId) - if removeIndex == -1 { - return - } - class.NftIds = keeper.RemoveIndex(class.NftIds, removeIndex) - // if class doens't have any listed nft, just delete class id key from kvstore - if len(class.NftIds) == 0 { + // removeIndex := keeper.SliceIndex(class.NftIds, listing.NftId.TokenId) + // if removeIndex == -1 { + // return + // } + // class.NftIds = keeper.RemoveIndex(class.NftIds, removeIndex) + // if class doesn't have any listed nft, just delete class id key from KVStore + if len(class.NftIds) == 1 && class.NftIds[0] == listing.NftId.TokenId { store.Delete(types.ClassKey(listing.ClassIdBytes())) return } diff --git a/x/nftbackedloan/keeper/nft_listing.go b/x/nftbackedloan/keeper/nft_listing.go index b202165ad..1d78187ea 100644 --- a/x/nftbackedloan/keeper/nft_listing.go +++ b/x/nftbackedloan/keeper/nft_listing.go @@ -5,7 +5,6 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/nft" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -14,21 +13,21 @@ import ( "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func (k Keeper) GetNftListingByIdBytes(ctx sdk.Context, nftIdBytes []byte) (types.NftListing, error) { +func (k Keeper) GetNftListingByIdBytes(ctx sdk.Context, nftIdBytes []byte) (types.Listing, error) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.NftListingKey(nftIdBytes)) if bz == nil { - return types.NftListing{}, types.ErrNftListingDoesNotExist + return types.Listing{}, types.ErrNftListingDoesNotExist } - listing := types.NftListing{} + listing := types.Listing{} k.cdc.MustUnmarshal(bz, &listing) return listing, nil } -func (k Keeper) GetListingsByOwner(ctx sdk.Context, owner sdk.AccAddress) []types.NftListing { +func (k Keeper) GetListingsByOwner(ctx sdk.Context, owner sdk.AccAddress) []types.Listing { store := ctx.KVStore(k.storeKey) - listings := []types.NftListing{} + listings := []types.Listing{} it := sdk.KVStorePrefixIterator(store, types.NftAddressNftListingPrefixKey(owner)) defer it.Close() @@ -64,12 +63,12 @@ func getTimeKey(prefix string, timestamp time.Time) []byte { } // call this method when you want to call SetNftListing -func (k Keeper) SaveNftListing(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) SaveNftListing(ctx sdk.Context, listing types.Listing) { k.SetNftListing(ctx, listing) k.UpdateListedClass(ctx, listing) } -func (k Keeper) SetNftListing(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) SetNftListing(ctx sdk.Context, listing types.Listing) { if oldListing, err := k.GetNftListingByIdBytes(ctx, listing.IdBytes()); err == nil { k.DeleteNftListings(ctx, oldListing) } @@ -86,9 +85,7 @@ func (k Keeper) SetNftListing(ctx sdk.Context, listing types.NftListing) { } store.Set(types.NftAddressNftListingKey(owner, nftIdBytes), nftIdBytes) - if listing.IsActive() { - store.Set(append(getTimeKey(types.KeyPrefixEndTimeNftListing, listing.EndAt), nftIdBytes...), nftIdBytes) - } else if listing.IsFullPayment() { + if listing.IsFullPayment() { store.Set(append(getTimeKey(types.KeyPrefixFullPaymentPeriodListing, listing.FullPaymentEndAt), nftIdBytes...), nftIdBytes) } else if listing.IsSuccessfulBid() { store.Set(append(getTimeKey(types.KeyPrefixSuccessfulBidListing, listing.SuccessfulBidEndAt), nftIdBytes...), nftIdBytes) @@ -96,12 +93,12 @@ func (k Keeper) SetNftListing(ctx sdk.Context, listing types.NftListing) { } // call this method when you want to call DeleteNftListing -func (k Keeper) DeleteNftListings(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) DeleteNftListings(ctx sdk.Context, listing types.Listing) { k.DeleteNftListing(ctx, listing) k.UpdateListedClass(ctx, listing) } -func (k Keeper) DeleteNftListing(ctx sdk.Context, listing types.NftListing) { +func (k Keeper) DeleteNftListing(ctx sdk.Context, listing types.Listing) { nftIdBytes := listing.IdBytes() store := ctx.KVStore(k.storeKey) store.Delete(types.NftListingKey(nftIdBytes)) @@ -113,42 +110,20 @@ func (k Keeper) DeleteNftListing(ctx sdk.Context, listing types.NftListing) { } store.Delete(types.NftAddressNftListingKey(owner, nftIdBytes)) - if listing.IsActive() { - store.Delete(append(getTimeKey(types.KeyPrefixEndTimeNftListing, listing.EndAt), nftIdBytes...)) - } else if listing.IsFullPayment() { + if listing.IsFullPayment() { store.Delete(append(getTimeKey(types.KeyPrefixFullPaymentPeriodListing, listing.FullPaymentEndAt), nftIdBytes...)) } else if listing.IsSuccessfulBid() { store.Delete(append(getTimeKey(types.KeyPrefixSuccessfulBidListing, listing.SuccessfulBidEndAt), nftIdBytes...)) } } -func (k Keeper) GetActiveNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftListing { - store := ctx.KVStore(k.storeKey) - timeKey := getTimeKey(types.KeyPrefixEndTimeNftListing, endTime) - it := store.Iterator([]byte(types.KeyPrefixEndTimeNftListing), storetypes.InclusiveEndBytes(timeKey)) - defer it.Close() - - listings := []types.NftListing{} - for ; it.Valid(); it.Next() { - nftIdBytes := it.Value() - listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) - if err != nil { - fmt.Println("failed to get listing by id bytes: %w", err) - continue - } - - listings = append(listings, listing) - } - return listings -} - -func (k Keeper) GetFullPaymentNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftListing { +func (k Keeper) GetFullPaymentNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.Listing { store := ctx.KVStore(k.storeKey) timeKey := getTimeKey(types.KeyPrefixFullPaymentPeriodListing, endTime) it := store.Iterator([]byte(types.KeyPrefixFullPaymentPeriodListing), storetypes.InclusiveEndBytes(timeKey)) defer it.Close() - listings := []types.NftListing{} + listings := []types.Listing{} for ; it.Valid(); it.Next() { nftIdBytes := it.Value() listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) @@ -162,13 +137,13 @@ func (k Keeper) GetFullPaymentNftListingsEndingAt(ctx sdk.Context, endTime time. return listings } -func (k Keeper) GetSuccessfulBidNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.NftListing { +func (k Keeper) GetSuccessfulBidNftListingsEndingAt(ctx sdk.Context, endTime time.Time) []types.Listing { store := ctx.KVStore(k.storeKey) timeKey := getTimeKey(types.KeyPrefixSuccessfulBidListing, endTime) it := store.Iterator([]byte(types.KeyPrefixSuccessfulBidListing), storetypes.InclusiveEndBytes(timeKey)) defer it.Close() - listings := []types.NftListing{} + listings := []types.Listing{} for ; it.Valid(); it.Next() { nftIdBytes := it.Value() listing, err := k.GetNftListingByIdBytes(ctx, nftIdBytes) @@ -182,14 +157,14 @@ func (k Keeper) GetSuccessfulBidNftListingsEndingAt(ctx sdk.Context, endTime tim return listings } -func (k Keeper) GetAllNftListings(ctx sdk.Context) []types.NftListing { +func (k Keeper) GetAllNftListings(ctx sdk.Context) []types.Listing { store := ctx.KVStore(k.storeKey) it := sdk.KVStorePrefixIterator(store, []byte(types.KeyPrefixNftListing)) defer it.Close() - allListings := []types.NftListing{} + allListings := []types.Listing{} for ; it.Valid(); it.Next() { - var listing types.NftListing + var listing types.Listing k.cdc.MustUnmarshal(it.Value(), &listing) allListings = append(allListings, listing) @@ -199,49 +174,53 @@ func (k Keeper) GetAllNftListings(ctx sdk.Context) []types.NftListing { } func (k Keeper) ListNft(ctx sdk.Context, msg *types.MsgListNft) error { - errorMsg := validateListNftMsg(k, ctx, msg) + errorMsg := ValidateListNftMsg(k, ctx, msg) if errorMsg != nil { return errorMsg } // create listing // todo: make test - owner := k.nftKeeper.GetOwner(ctx, msg.NftId.ClassId, msg.NftId.NftId) - listing := types.NftListing{ - NftId: msg.NftId, - Owner: owner.String(), - ListingType: msg.ListingType, - State: types.ListingState_LISTING, - BidToken: msg.BidToken, - MinimumDepositRate: msg.MinimumDepositRate, - AutomaticRefinancing: msg.AutomaticRefinancing, - StartedAt: ctx.BlockTime(), - CollectedAmount: sdk.NewCoin(msg.BidToken, sdk.ZeroInt()), - // todo: add validation. - // we should to determine maximum bidding period. - MinimumBiddingPeriod: msg.MinimumBiddingPeriod, + owner := k.nftKeeper.GetOwner(ctx, msg.NftId.ClassId, msg.NftId.TokenId) + listing := types.Listing{ + NftId: msg.NftId, + Owner: owner.String(), + State: types.ListingState_LISTING, + BidDenom: msg.BidDenom, + MinDepositRate: msg.MinDepositRate, + StartedAt: ctx.BlockTime(), + CollectedAmount: sdk.NewCoin(msg.BidDenom, sdk.ZeroInt()), + CollectedAmountNegative: false, + MinBidPeriod: msg.MinBidPeriod, + } + + // disable NFT transfer + data, found := k.nftKeeper.GetNftData(ctx, msg.NftId.ClassId, msg.NftId.TokenId) + if !found { + return types.ErrNftDoesNotExists } - k.SaveNftListing(ctx, listing) - - // Send ownership to market module - moduleAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) - err := k.nftKeeper.Transfer(ctx, msg.NftId.ClassId, msg.NftId.NftId, moduleAddr) + data.SendDisabled = true + err := k.nftKeeper.SetNftData(ctx, msg.NftId.ClassId, msg.NftId.TokenId, data) if err != nil { - k.DeleteNftListing(ctx, listing) return err } + k.SaveNftListing(ctx, listing) + + // get the memo data from Tx contains MsgListNft + // k.AfterNftListed(ctx, msg.NftId, GetMemo(ctx.TxBytes(), k.txCfg)) + // Emit event for nft listing - ctx.EventManager().EmitTypedEvent(&types.EventListNft{ + _ = ctx.EventManager().EmitTypedEvent(&types.EventListNft{ Owner: msg.Sender, ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, + TokenId: msg.NftId.TokenId, }) return nil } -func (k Keeper) CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing) error { +func (k Keeper) CancelNftListing(ctx sdk.Context, msg *types.MsgCancelListing) error { // check listing already exists listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) if err != nil { @@ -249,7 +228,7 @@ func (k Keeper) CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing } // // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) + _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.TokenId) if !found { return types.ErrNftDoesNotExists } @@ -262,65 +241,28 @@ func (k Keeper) CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing // The listing of items can only be cancelled after N seconds have elapsed from the time it was placed on the marketplace params := k.GetParamSet(ctx) if listing.StartedAt.Add(time.Duration(params.NftListingCancelRequiredSeconds) * time.Second).After(ctx.BlockTime()) { - return types.ErrNotTimeForCancel + return types.ErrCancelAfterSomeTime } - // // check nft is bidding status + // check bidding status if !listing.IsActive() { return types.ErrStatusCannotCancelListing } - currDebt := k.GetDebtByNft(ctx, msg.NftId.IdBytes()) - - if !currDebt.Loan.IsNil() { - return types.ErrCannotCancelListingWithDebt - } - - // todo implement bid exist cancel listing bids := k.GetBidsByNft(ctx, msg.NftId.IdBytes()) - if len(bids) > 0 { - return types.ErrCannotCancelListingWithBids + for _, bid := range bids { + if bid.IsBorrowed() { + return types.ErrCannotCancelBorrowedListing + } } - // winnerCandidateStartIndex := len(bids) - int(listing.BidActiveRank) - // if winnerCandidateStartIndex < 0 { - // winnerCandidateStartIndex = 0 - // } - // // distribute cancellation fee to winner bidders - // for _, bid := range bids[winnerCandidateStartIndex:] { - // bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - // if err != nil { - // return err - // } - // cancelFee := bid.Amount.Amount.Mul(sdk.NewInt(int64(params.NftListingCancelFeePercentage))).Quo(sdk.NewInt(100)) - // if cancelFee.IsPositive() { - // err = k.bankKeeper.SendCoins(ctx, msg.Sender.AccAddress(), bidder, sdk.Coins{sdk.NewCoin(listing.BidToken, cancelFee)}) - // if err != nil { - // return err - // } - // } - // } - - // // delete all bids and return funds back - // for _, bid := range bids { - // bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - // if err != nil { - // return err - // } - // err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidder, sdk.Coins{bid.Amount}) - // if err != nil { - // return err - // } - // k.DeleteBid(ctx, bid) - // } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err + // enable NFT transfer + data, found := k.nftKeeper.GetNftData(ctx, msg.NftId.ClassId, msg.NftId.TokenId) + if !found { + return types.ErrNftDoesNotExists } - - // Send ownership to original owner - err = k.nftKeeper.Transfer(ctx, msg.NftId.ClassId, msg.NftId.NftId, sender) + data.SendDisabled = false + err = k.nftKeeper.SetNftData(ctx, msg.NftId.ClassId, msg.NftId.TokenId, data) if err != nil { return err } @@ -328,475 +270,45 @@ func (k Keeper) CancelNftListing(ctx sdk.Context, msg *types.MsgCancelNftListing // delete listing k.DeleteNftListings(ctx, listing) - // // Emit event for nft listing cancel - ctx.EventManager().EmitTypedEvent(&types.EventCancelListNfting{ - Owner: msg.Sender, - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -// func (k Keeper) ExpandListingPeriod(ctx sdk.Context, msg *types.MsgExpandListingPeriod) error { -// // check listing already exists -// listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) -// if err != nil { -// return types.ErrNftListingDoesNotExist -// } - -// // Check nft exists -// _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) -// if !found { -// return types.ErrNftDoesNotExists -// } - -// // check ownership of listing -// if listing.Owner != msg.Sender.AccAddress().String() { -// return types.ErrNotNftListingOwner -// } - -// // check nft is bidding status -// if !listing.IsActive() { -// return types.ErrListingIsNotInStatusToBid -// } - -// // pay nft listing extend fee -// params := k.GetParamSet(ctx) -// feeAmount := params.NftListingPeriodExtendFeePerHour.Amount.Mul(sdk.NewInt(int64(params.NftListingExtendSeconds))).Quo(sdk.NewInt(3600)) - -// // distribute nft listing extend fee to winner bidders -// bids := k.GetBidsByNft(ctx, msg.NftId.IdBytes()) -// totalBidAmount := sdk.ZeroInt() - -// winnerCandidateStartIndex := len(bids) - int(listing.BidActiveRank) -// if winnerCandidateStartIndex < 0 { -// winnerCandidateStartIndex = 0 -// } - -// for _, bid := range bids[winnerCandidateStartIndex:] { -// totalBidAmount = totalBidAmount.Add(bid.Amount.Amount) -// } - -// if totalBidAmount.IsPositive() { -// for _, bid := range bids[winnerCandidateStartIndex:] { -// bidder, err := sdk.AccAddressFromBech32(bid.Bidder) -// if err != nil { -// return err -// } -// bidderCommission := bid.Amount.Amount.Mul(feeAmount).Quo(totalBidAmount) -// if bidderCommission.IsPositive() { -// commmission := sdk.NewCoin(params.NftListingPeriodExtendFeePerHour.Denom, bidderCommission) -// err = k.bankKeeper.SendCoins(ctx, msg.Sender.AccAddress(), bidder, sdk.Coins{commmission}) -// if err != nil { -// return err -// } -// } -// } -// } - -// // update listing end time -// listing.EndAt = listing.EndAt.Add(time.Second * time.Duration(params.NftListingExtendSeconds)) -// k.SaveNftListing(ctx, listing) - -// // Emit event for nft listing cancel -// ctx.EventManager().EmitTypedEvent(&types.EventExpandListingPeriod{ -// Owner: msg.Sender.AccAddress().String(), -// ClassId: msg.NftId.ClassId, -// NftId: msg.NftId.NftId, -// }) - -// return nil -// } - -func (k Keeper) SellingDecision(ctx sdk.Context, msg *types.MsgSellingDecision) error { - // check listing already exists - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return types.ErrNftListingDoesNotExist - } - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of listing - if listing.Owner != msg.Sender { - return types.ErrNotNftListingOwner - } - - // check if listing is already ended or on selling decision status - if listing.State != types.ListingState_BIDDING { - return types.ErrListingNeedsToBeBiddingStatus - } - - // check bid exists - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if len(bids) == 0 { - return types.ErrNotExistsBid - } - - params := k.GetParamSet(ctx) - listing.FullPaymentEndAt = ctx.BlockTime().Add(time.Duration(params.NftListingFullPaymentPeriod) * time.Second) - listing.State = types.ListingState_SELLING_DECISION - k.SaveNftListing(ctx, listing) - - // automatic payment if enabled - if len(bids) > 0 { - winnerIndex := len(bids) - 1 - bid := bids[winnerIndex] - if bid.AutomaticPayment { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - fmt.Println(err) - return err - } - - cacheCtx, write := ctx.CacheContext() - err = k.PayFullBid(cacheCtx, &types.MsgPayFullBid{ - Sender: bidder.String(), - NftId: listing.NftId, - }) - if err == nil { - write() - } else { - fmt.Println(err) - } - } - } - - // Emit event for nft listing end - ctx.EventManager().EmitTypedEvent(&types.EventSellingDecision{ - Owner: msg.Sender, - ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, - }) - - return nil -} - -func (k Keeper) EndNftListing(ctx sdk.Context, msg *types.MsgEndNftListing) error { - // check listing already exists - listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) - if err != nil { - return types.ErrNftListingDoesNotExist - } - - // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.NftId) - if !found { - return types.ErrNftDoesNotExists - } - - // check ownership of listing - if listing.Owner != msg.Sender { - return types.ErrNotNftListingOwner - } - - // check if listing is already ended - if listing.State == types.ListingState_END_LISTING || listing.State == types.ListingState_SELLING_DECISION { - return types.ErrListingAlreadyEnded - } - - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if len(bids) == 0 { - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - err = k.nftKeeper.Transfer(ctx, listing.NftId.ClassId, listing.NftId.NftId, sender) - if err != nil { - return err - } - k.DeleteNftListings(ctx, listing) - } else { - params := k.GetParamSet(ctx) - listing.FullPaymentEndAt = ctx.BlockTime().Add(time.Duration(params.NftListingFullPaymentPeriod) * time.Second) - listing.State = types.ListingState_END_LISTING - k.SaveNftListing(ctx, listing) - - // automatic payment after listing ends - for _, bid := range bids { - if bid.AutomaticPayment { - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) - if err != nil { - fmt.Println(err) - continue - } - - cacheCtx, write := ctx.CacheContext() - err = k.PayFullBid(cacheCtx, &types.MsgPayFullBid{ - Sender: bidder.String(), - NftId: listing.NftId, - }) - if err == nil { - write() - } else { - fmt.Println(err) - continue - } - } - } - } + // Call AfterNftUnlistedWithoutPayment to delete NFT ID from the ecosystem-incentive KVStore + // since it's unlisted. + k.AfterNftUnlistedWithoutPayment(ctx, listing.NftId) - // Emit event for nft listing end - ctx.EventManager().EmitTypedEvent(&types.EventEndListNfting{ + // Emit event for nft listing cancel + _ = ctx.EventManager().EmitTypedEvent(&types.EventCancelListing{ Owner: msg.Sender, ClassId: msg.NftId.ClassId, - NftId: msg.NftId.NftId, + TokenId: msg.NftId.TokenId, }) - // Call AfterNftUnlistedWithoutPayment to delete NFT ID from the ecosystem-incentive KVStore - // since it's unlisted. - if _, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()); err != nil { - k.AfterNftUnlistedWithoutPayment(ctx, listing.NftId) - } - return nil } -func (k Keeper) ProcessEndingNftListings(ctx sdk.Context) { - // params := k.GetParamSet(ctx) - // listings := k.GetActiveNftListingsEndingAt(ctx, ctx.BlockTime()) - fmt.Println("---Block time---") - fmt.Println(ctx.BlockTime()) - bids := k.GetActiveNftBiddingsEndingAt(ctx, ctx.BlockTime()) - fmt.Println("---bids---") - fmt.Println(bids) - k.DeleteBidsWithoutBorrowing(ctx, bids) - checkListingsWithBorrowedBids := map[types.NftListing][]types.NftBid{} - for _, bid := range bids { - if !bid.IsBorrowing() { - continue - } - - listing, err := k.GetNftListingByIdBytes(ctx, bid.NftId.IdBytes()) - if err != nil { - fmt.Println("failed to get listing by id bytes: %w", err) - continue - } - if !listing.IsSelling() { - continue - } - checkListingsWithBorrowedBids[listing] = append(checkListingsWithBorrowedBids[listing], bid) - } - - for listing, expiredBorrowedBids := range checkListingsWithBorrowedBids { - bids := k.GetBidsByNft(ctx, listing.NftId.IdBytes()) - if listing.CanRefinancing(bids, expiredBorrowedBids, ctx.BlockTime()) { - fmt.Println("---occur refinaing---") - k.Refinancings(ctx, listing, expiredBorrowedBids) - } else if listing.State == types.ListingState_END_LISTING { - continue - } else { - fmt.Println("---occur endlisting---") - listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - fmt.Println(err) - continue - } - err = k.EndNftListing(ctx, &types.MsgEndNftListing{ - Sender: listingOwner.String(), - NftId: listing.NftId, - }) - if err != nil { - fmt.Println(err) - continue - } - } - } - -} - func (k Keeper) HandleFullPaymentsPeriodEndings(ctx sdk.Context) { - // todo update for v2 params := k.GetParamSet(ctx) - // get listings ended earlier + // get listings at the end of the payment period listings := k.GetFullPaymentNftListingsEndingAt(ctx, ctx.BlockTime()) // handle not fully paid bids for _, listing := range listings { - // todo change bids order which bids order should be ordered first bids := types.NftBids(k.GetBidsByNft(ctx, listing.NftId.IdBytes())) if listing.State == types.ListingState_SELLING_DECISION { - // todo get higher bidding price Bid - HighestBid := bids.GetHighestBid() - // if winner bidder did not pay full bid, nft is listed again after deleting winner bidder - if !HighestBid.IsPaidBidAmount() { - err := k.DeleteBid(ctx, HighestBid) - if err != nil { - fmt.Println(err) - continue - } - if len(bids) == 1 { - listing.State = types.ListingState_LISTING - } else { - listing.State = types.ListingState_BIDDING - } - listing.EndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingExtendSeconds)) - - // Reset the loan data for a lister - // If the bid.PaidAmount is more than loan.Coin.Amount, then just delete the loan data for lister. - // Otherwise, subtract bid.PaidAmount from loaning amount - - // todo change logic - // deposit - borrwoings amount to lister and interst aount to lister - if HighestBid.IsBorrowing() { - loan := k.GetDebtByNft(ctx, listing.IdBytes()) - if loan.Loan.Equal(HighestBid.BorrowingAmount()) { - k.DeleteDebt(ctx, listing.IdBytes()) - } else { - renewedLoanAmount := loan.Loan.Sub(HighestBid.BorrowingAmount()) - loan.Loan.Amount = renewedLoanAmount.Amount - k.SetDebt(ctx, loan) - } - } - } else { - // schedule NFT / token send after X days - listing.SuccessfulBidEndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingNftDeliveryPeriod)) - listing.State = types.ListingState_SUCCESSFUL_BID - // delete the loan data for the nftId which is deleted from the market - k.RemoveDebt(ctx, listing.IdBytes()) - } - k.SaveNftListing(ctx, listing) - } else if listing.State == types.ListingState_END_LISTING { - err := k.LiquidationProcess(ctx, bids, listing, params) + err := k.RunSellingDecisionProcess(ctx, bids, listing, params) if err != nil { - fmt.Println("failed to liquidation process: %w", err) + fmt.Println("failed to selling decision process: %w", err) continue } - } - } -} - -func (k Keeper) LiquidationProcess(ctx sdk.Context, bids types.NftBids, listing types.NftListing, params types.Params) error { - bids = bids.SortLiquidation() - winnerBid := bids.GetWinnerBid() - - cacheCtx, write := ctx.CacheContext() - if winnerBid.IsNil() { - err := k.LiquidationProcessNotExitsWinner(cacheCtx, bids, listing) - if err != nil { - return err - } - k.DeleteNftListings(ctx, listing) - } else { - collectBids, refundBids := bids.MakeCollectBidsAndRefundBids() - err := k.LiquidationProcessExitsWinner(cacheCtx, collectBids, refundBids, listing, winnerBid, ctx.BlockTime(), k.RefundBids) - if err != nil { - return err - } - listing.SuccessfulBidEndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingNftDeliveryPeriod)) - listing.State = types.ListingState_SUCCESSFUL_BID - k.SaveNftListing(ctx, listing) - } - write() - - // delete the loan data for the nftId which is deleted from the market anyway - k.RemoveDebt(ctx, listing.IdBytes()) - return nil -} - -// todo add test -func (k Keeper) LiquidationProcessNotExitsWinner(ctx sdk.Context, bids types.NftBids, listing types.NftListing) error { - listingOwner, err := sdk.AccAddressFromBech32(listing.Owner) - if err != nil { - return err - } - - collectedDeposit, err := k.CollectedDepositFromBids(ctx, bids) - if err != nil { - return nil - } - listing.CollectedAmount = listing.CollectedAmount.Add(collectedDeposit) - - depositCollected := listing.CollectedAmount - // pay fee - loan := k.GetDebtByNft(ctx, listing.IdBytes()) - k.ProcessPaymentWithCommissionFee(ctx, listingOwner, listing.BidToken, depositCollected.Amount, loan.Loan.Amount, listing.NftId) - // transfer nft to listing owner - err = k.nftKeeper.Transfer(ctx, listing.NftId.ClassId, listing.NftId.NftId, listingOwner) - if err != nil { - return err - } - return nil -} - -// todo add test -func (k Keeper) LiquidationProcessExitsWinner( - ctx sdk.Context, collectBids, refundBids types.NftBids, - listing types.NftListing, winnerBid types.NftBid, - now time.Time, - refundF func(ctx sdk.Context, refundBids types.NftBids, totalInterest, surplusAmount sdk.Coin, listing types.NftListing) error) error { - - collectedDeposit, err := k.CollectedDepositFromBids(ctx, collectBids) - if err != nil { - return err - } - if collectedDeposit.IsPositive() { - listing.CollectedAmount = listing.CollectedAmount.Add(collectedDeposit) - } - - surplusAmount := k.GetSurplusAmount(refundBids, winnerBid).Add(listing.CollectedAmount) - totalInterest := refundBids.TotalInterestAmount(now) - if totalInterest.IsNil() { - totalInterest = sdk.NewCoin(listing.BidToken, sdk.ZeroInt()) - } - err = refundF(ctx, refundBids, totalInterest, surplusAmount, listing) - if err != nil { - return err - } - return nil -} - -func (k Keeper) RefundBids(ctx sdk.Context, refundBids types.NftBids, totalInterest, surplusAmount sdk.Coin, listing types.NftListing) error { - if totalInterest.IsLTE(surplusAmount) { - listing.CollectedAmount = listing.CollectedAmount.Sub(totalInterest) - for _, bid := range refundBids { - err := k.SafeCloseBidWithAllInterest(ctx, bid) - if err != nil { - return err - } - } - } else { - for _, bid := range refundBids { - bidderGetInterest := types.CalcPartInterest(totalInterest.Amount, surplusAmount.Amount, bid.TotalInterestAmountDec(ctx.BlockTime())) - err := k.SafeCloseBidWithPartInterest(ctx, bid, sdk.NewCoin(bid.DepositAmount.Denom, bidderGetInterest)) + } else if listing.State == types.ListingState_LIQUIDATION { + err := k.RunLiquidationProcess(ctx, bids, listing, params) if err != nil { - return err - } - } - } - return nil -} - -// todo add test -func (k Keeper) CollectedDepositFromBids(ctx sdk.Context, bids types.NftBids) (sdk.Coin, error) { - result := sdk.Coin{ - Denom: "", - Amount: sdk.ZeroInt(), - } - for _, bid := range bids { - // not pay bidder amount, collected deposit - CollectedAmount, err := k.SafeCloseBidCollectDeposit(ctx, bid) - if err != nil { - return result, err - } - if CollectedAmount.IsPositive() { - if !result.IsPositive() { - result.Amount = CollectedAmount.Amount - result.Denom = CollectedAmount.Denom + fmt.Println("failed to liquidation process: %w", err) continue } - result = result.Add(CollectedAmount) } } - return result, nil } -func (k Keeper) DelieverSuccessfulBids(ctx sdk.Context) { +func (k Keeper) DeliverSuccessfulBids(ctx sdk.Context) { params := k.GetParamSet(ctx) // get listings ended earlier listings := k.GetSuccessfulBidNftListingsEndingAt(ctx, ctx.BlockTime()) @@ -808,7 +320,7 @@ func (k Keeper) DelieverSuccessfulBids(ctx sdk.Context) { continue } bid := bids[0] - bidder, err := sdk.AccAddressFromBech32(bid.Bidder) + bidder, err := sdk.AccAddressFromBech32(bid.Id.Bidder) if err != nil { continue } @@ -818,110 +330,84 @@ func (k Keeper) DelieverSuccessfulBids(ctx sdk.Context) { continue } - cacheCtx, write := ctx.CacheContext() - err = k.nftKeeper.Transfer(cacheCtx, listing.NftId.ClassId, listing.NftId.NftId, bidder) + listerProfit := sdk.ZeroInt() + repayAmount := bid.Loan.Amount.Add(bid.CompoundInterest(listing.LiquidatedAt)) + bidderPaidAmount := bid.Price + listerProfit = listerProfit.Add(bidderPaidAmount.Amount).Sub(repayAmount.Amount) + if listing.CollectedAmountNegative { + listerProfit = listerProfit.Sub(listing.CollectedAmount.Amount) + } else { + listerProfit = listerProfit.Add(listing.CollectedAmount.Amount) + } + + if listerProfit.IsNegative() { + fmt.Println("lister profit is negative") + continue + } + err = k.ProcessPaymentWithCommissionFee(ctx, listingOwner, sdk.NewCoin(listing.BidDenom, listerProfit), listing.NftId) if err != nil { fmt.Println(err) continue - } else { - write() } - loan := k.GetDebtByNft(ctx, listing.IdBytes()) - totalPayAmount := listing.CollectedAmount.Add(bid.BidAmount) - k.ProcessPaymentWithCommissionFee(ctx, listingOwner, totalPayAmount.Denom, totalPayAmount.Amount, loan.Loan.Amount, listing.NftId) - err = k.DeleteBid(ctx, bid) if err != nil { fmt.Println(err) continue } k.DeleteNftListings(ctx, listing) + + cacheCtx, write := ctx.CacheContext() + + data, found := k.nftKeeper.GetNftData(ctx, listing.NftId.ClassId, listing.NftId.TokenId) + if !found { + fmt.Println("nft data not found") + continue + } + data.SendDisabled = false + err = k.nftKeeper.SetNftData(ctx, listing.NftId.ClassId, listing.NftId.TokenId, data) + if err != nil { + fmt.Println(err) + continue + } + err = k.nftKeeper.Transfer(cacheCtx, listing.NftId.ClassId, listing.NftId.TokenId, bidder) + if err != nil { + fmt.Println(err) + continue + } else { + write() + } } } -func (k Keeper) ProcessPaymentWithCommissionFee(ctx sdk.Context, listingOwner sdk.AccAddress, denom string, amount sdk.Int, loanAmount sdk.Int, nftId types.NftIdentifier) { +func (k Keeper) ProcessPaymentWithCommissionFee(ctx sdk.Context, listingOwner sdk.AccAddress, amount sdk.Coin, nftId types.NftId) error { params := k.GetParamSet(ctx) - commissionFee := params.NftListingCommissionFee + commissionRate := params.NftListingCommissionRate cacheCtx, write := ctx.CacheContext() // pay commission fees for nft listing - fee := amount.Mul(sdk.NewInt(int64(commissionFee))).Quo(sdk.NewInt(100)) + fee := sdk.NewDecFromInt(amount.Amount).Mul(commissionRate).RoundInt() if fee.IsPositive() { - feeCoins := sdk.Coins{sdk.NewCoin(denom, fee)} + feeCoins := sdk.Coins{sdk.NewCoin(amount.Denom, fee)} err := k.bankKeeper.SendCoinsFromModuleToModule(cacheCtx, types.ModuleName, ecoincentivetypes.ModuleName, feeCoins) if err != nil { - fmt.Println(err) - return + return err } else { write() } } - if loanAmount.IsNil() { - loanAmount = sdk.ZeroInt() - } - listerPayment := amount.Sub(fee) - listerPayment = listerPayment.Sub(loanAmount) - if !listerPayment.IsZero() { - err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, listingOwner, sdk.Coins{sdk.NewCoin(denom, listerPayment)}) + listerProfit := amount.Amount.Sub(fee) + if listerProfit.IsPositive() { + err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, listingOwner, sdk.Coins{sdk.NewCoin(amount.Denom, listerProfit)}) if err != nil { - fmt.Println(err) - return + return err } else { write() } } - // Call AfterNftPaymentWithCommission hook method to inform the payment is successfuly + // Call AfterNftPaymentWithCommission hook method to inform the payment is successfully // executed. - k.AfterNftPaymentWithCommission(ctx, nftId, sdk.NewCoin(denom, fee)) -} - -// todo: delete -func (k Keeper) TestMint(ctx sdk.Context, addr sdk.AccAddress, classId, nftId string) { - _, exists := k.nftKeeper.GetNFT(ctx, classId, nftId) - if exists { - return - } - const ( - testClassName = "Crypto Kitty" - testClassSymbol = "kitty" - testClassDescription = "Crypto Kitty" - testClassURI = "class uri" - testClassURIHash = "ae702cefd6b6a65fe2f991ad6d9969ed" - testURI = "kitty uri" - testURIHash = "229bfd3c1b431c14a526497873897108" - ) - - _, hasId := k.nftKeeper.GetClass(ctx, classId) - if !hasId { - class := nft.Class{ - Id: classId, - Name: testClassName, - Symbol: testClassSymbol, - Description: testClassDescription, - Uri: testClassURI, - UriHash: testClassURIHash, - } - k.nftKeeper.SaveClass(ctx, class) - fmt.Println("save class") - } - - expNFT := nft.NFT{ - ClassId: classId, - Id: nftId, - Uri: testURI, - } - err := k.nftKeeper.Mint(ctx, expNFT, addr) - if err != nil { - fmt.Println("err occur") - } -} - -// get surplus amount -func (k Keeper) GetSurplusAmount(bids types.NftBids, winBid types.NftBid) sdk.Coin { - if len(bids) == 0 { - return sdk.NewCoin(winBid.BidAmount.Denom, sdk.ZeroInt()) - } - return winBid.BidAmount.Sub(bids.TotalDeposit()) + k.AfterNftPaymentWithCommission(ctx, nftId, sdk.NewCoin(amount.Denom, fee)) + return nil } diff --git a/x/nftbackedloan/keeper/nft_listing_test.go b/x/nftbackedloan/keeper/nft_listing_test.go index ccddee03d..6acb1995f 100644 --- a/x/nftbackedloan/keeper/nft_listing_test.go +++ b/x/nftbackedloan/keeper/nft_listing_test.go @@ -8,200 +8,9 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - ununifitypes "github.com/UnUniFi/chain/deprecated/types" - ecoincentivetypes "github.com/UnUniFi/chain/x/ecosystemincentive/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -// test basic functions of nft listing -func (suite *KeeperTestSuite) TestNftListingBasics() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - now := time.Now().UTC() - future := now.Add(time.Second) - listings := []types.NftListing{ - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "2", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_BIDDING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "3", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_END_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: now, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - { - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "4", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_SELLING_DECISION, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: time.Time{}, - EndAt: now, - FullPaymentEndAt: now, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - { - NftId: types.NftIdentifier{ - ClassId: "2", - NftId: "1", - }, - Owner: owner2.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_SUCCESSFUL_BID, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: time.Time{}, - EndAt: now, - FullPaymentEndAt: now, - SuccessfulBidEndAt: now, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - // { - // NftId: types.NftIdentifier{ - // ClassId: "2", - // NftId: "2", - // }, - // Owner: owner2.String(), - // ListingType: types.ListingType_DIRECT_ASSET_BORROW, - // State: types.ListingState_LIQUIDATION, - // BidToken: "uguu", - // MinimumDepositRate: "0.1", - // StartedAt: time.Time{}, - // EndAt: now, - // FullPaymentEndAt: now, - // SuccessfulBidEndAt: now, - // AutoRelistedCount: 0, - // }, - } - - for _, listing := range listings { - suite.app.NftmarketKeeper.SetNftListing(suite.ctx, listing) - } - - for _, listing := range listings { - gotListing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, listing.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing, gotListing) - } - - // check all listings - allListings := suite.app.NftmarketKeeper.GetAllNftListings(suite.ctx) - suite.Require().Len(allListings, len(listings)) - - // check listing by owner - listingsByOwner := suite.app.NftmarketKeeper.GetListingsByOwner(suite.ctx, owner) - suite.Require().Len(listingsByOwner, 4) - - // check active listings (bidding or listing status ending now) - activeNftListings := suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, now) - suite.Require().Len(activeNftListings, 0) - // check active listings (bidding or listing status ending future time) - activeNftListings = suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, future) - suite.Require().Len(activeNftListings, 2) - - // full payment listings (sell decision or end listing status ending now) - fullPaymentNftListingsEnding := suite.app.NftmarketKeeper.GetFullPaymentNftListingsEndingAt(suite.ctx, now) - suite.Require().Len(fullPaymentNftListingsEnding, 0) - // full payment listings (sell decision or end listing status ending future) - fullPaymentNftListingsEnding = suite.app.NftmarketKeeper.GetFullPaymentNftListingsEndingAt(suite.ctx, future) - suite.Require().Len(fullPaymentNftListingsEnding, 2) - - // successful listing endings (ending now) - successfulNftListingsEnding := suite.app.NftmarketKeeper.GetSuccessfulBidNftListingsEndingAt(suite.ctx, now) - suite.Require().Len(successfulNftListingsEnding, 0) - // successful listing endings (ending future) - successfulNftListingsEnding = suite.app.NftmarketKeeper.GetSuccessfulBidNftListingsEndingAt(suite.ctx, future) - suite.Require().Len(successfulNftListingsEnding, 1) - - // delete all the listings - for _, listing := range listings { - suite.app.NftmarketKeeper.DeleteNftListing(suite.ctx, listing) - } - - // check queries after deleting all - allListings = suite.app.NftmarketKeeper.GetAllNftListings(suite.ctx) - suite.Require().Len(allListings, 0) - - // listings by owner - listingsByOwner = suite.app.NftmarketKeeper.GetListingsByOwner(suite.ctx, owner) - suite.Require().Len(listingsByOwner, 0) - - // queries for active listings - activeNftListings = suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, future) - suite.Require().Len(activeNftListings, 0) - // queries for full payment queue - fullPaymentNftListingsEnding = suite.app.NftmarketKeeper.GetFullPaymentNftListingsEndingAt(suite.ctx, future) - suite.Require().Len(fullPaymentNftListingsEnding, 0) - // queries for successful ending queue - successfulNftListingsEnding = suite.app.NftmarketKeeper.GetSuccessfulBidNftListingsEndingAt(suite.ctx, future) - suite.Require().Len(successfulNftListingsEnding, 0) -} - func (suite *KeeperTestSuite) TestListNft() { acc1 := suite.addrs[0] acc2 := suite.addrs[1] @@ -214,102 +23,102 @@ func (suite *KeeperTestSuite) TestListNft() { nftId string nftOwner sdk.AccAddress lister sdk.AccAddress - bidToken string + BidDenom string mintBefore bool listBefore bool expectPass bool statusListedHook bool }{ { - testCase: "not existing nft", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - lister: acc1, - bidToken: "uguu", - mintBefore: false, - listBefore: false, - expectPass: false, - statusListedHook: false, - }, - { - testCase: "already listed", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - lister: acc1, - bidToken: "uguu", - mintBefore: true, - listBefore: true, - expectPass: false, - statusListedHook: false, - }, - { - testCase: "not owned nft", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - lister: acc2, - bidToken: "uguu", - mintBefore: true, - listBefore: false, - expectPass: false, - statusListedHook: false, - }, - { - testCase: "unsupported bid token", - classId: "class4", - nftId: "nft4", - nftOwner: acc1, - lister: acc1, - bidToken: "xxxx", - mintBefore: true, - listBefore: false, - expectPass: false, - statusListedHook: false, - }, - { - testCase: "successful listing with default active rank", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - lister: acc1, - bidToken: "uguu", - mintBefore: true, - listBefore: false, - expectPass: true, - statusListedHook: false, - }, - { - testCase: "successful listing with non-default active rank", - classId: "class6", - nftId: "nft6", - nftOwner: acc1, - lister: acc1, - bidToken: "uguu", - mintBefore: true, - listBefore: false, - expectPass: true, - statusListedHook: false, - }, - { - testCase: "successful anther owner", - classId: "class7", - nftId: "nft7", - nftOwner: acc2, - lister: acc2, - bidToken: "uguu", - mintBefore: true, - listBefore: false, - expectPass: true, - statusListedHook: false, + testCase: "not existing nft", + classId: "class1", + nftId: "nft1", + nftOwner: acc1, + lister: acc1, + BidDenom: "uguu", + mintBefore: false, + listBefore: false, + expectPass: false, + // statusListedHook: false, + }, + { + testCase: "already listed", + classId: "class2", + nftId: "nft2", + nftOwner: acc1, + lister: acc1, + BidDenom: "uguu", + mintBefore: true, + listBefore: true, + expectPass: false, + // statusListedHook: true, + }, + { + testCase: "not owned nft", + classId: "class3", + nftId: "nft3", + nftOwner: acc1, + lister: acc2, + BidDenom: "uguu", + mintBefore: true, + listBefore: false, + expectPass: false, + // statusListedHook: false, + }, + { + testCase: "unsupported bid token", + classId: "class4", + nftId: "nft4", + nftOwner: acc1, + lister: acc1, + BidDenom: "xxxx", + mintBefore: true, + listBefore: false, + expectPass: false, + // statusListedHook: false, + }, + { + testCase: "successful listing with default active rank", + classId: "class5", + nftId: "nft5", + nftOwner: acc1, + lister: acc1, + BidDenom: "uguu", + mintBefore: true, + listBefore: false, + expectPass: true, + // statusListedHook: true, + }, + { + testCase: "successful listing with non-default active rank", + classId: "class6", + nftId: "nft6", + nftOwner: acc1, + lister: acc1, + BidDenom: "uguu", + mintBefore: true, + listBefore: false, + expectPass: true, + // statusListedHook: true, + }, + { + testCase: "successful anther owner", + classId: "class7", + nftId: "nft7", + nftOwner: acc2, + lister: acc2, + BidDenom: "uguu", + mintBefore: true, + listBefore: false, + expectPass: true, + // statusListedHook: true, }, } for _, tc := range tests { - statusAfterNftListed = false + // statusAfterNftListed = false if tc.mintBefore { - nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ + _ = nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ Id: tc.classId, Name: tc.classId, Symbol: tc.classId, @@ -325,46 +134,41 @@ func (suite *KeeperTestSuite) TestListNft() { suite.Require().NoError(err) } if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.lister), - NftId: types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId}, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: tc.bidToken, - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + // use keeper directly to be executed with hooks structs + err := keeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: tc.lister.String(), + NftId: types.NftId{ClassId: tc.classId, TokenId: tc.nftId}, + BidDenom: tc.BidDenom, + MinDepositRate: sdk.MustNewDecFromStr("0.1"), }) suite.Require().NoError(err) } - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.lister), - NftId: types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId}, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: tc.bidToken, - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + err := keeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: tc.lister.String(), + NftId: types.NftId{ClassId: tc.classId, TokenId: tc.nftId}, + BidDenom: tc.BidDenom, + MinDepositRate: sdk.MustNewDecFromStr("0.1"), }) if tc.expectPass { suite.Require().NoError(err) - // params := keeper.GetParamSet(suite.ctx) // get listing - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, (types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId}).IdBytes()) + listing, err := keeper.GetNftListingByIdBytes(suite.ctx, (types.NftId{ClassId: tc.classId, TokenId: tc.nftId}).IdBytes()) suite.Require().NoError(err) // check ownership is transferred - moduleAddr := suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) + // moduleAddr := suite.app.AccountKeeper.GetModuleAddress(types.ModuleName) nftOwner := nftKeeper.GetOwner(suite.ctx, tc.classId, tc.nftId) - suite.Require().Equal(nftOwner.String(), moduleAddr.String()) + suite.Require().Equal(nftOwner.String(), tc.nftOwner.String()) // check startedAt is set as current time suite.Require().Equal(suite.ctx.BlockTime(), listing.StartedAt) - - // check endAt is set from initial listing duration - // suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingPeriodInitial)), listing.EndAt, tc.testCase) } else { suite.Require().Error(err) } - suite.Require().Equal(tc.statusListedHook, statusAfterNftListed, tc.testCase) + // suite.Require().Equal(tc.statusListedHook, statusAfterNftListed, tc.testCase) } } @@ -374,7 +178,7 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { keeper := suite.keeper nftKeeper := suite.nftKeeper - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) + params := suite.app.NftbackedloanKeeper.GetParamSet(suite.ctx) tests := []struct { testCase string @@ -385,7 +189,6 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { cancelAfter time.Duration numBids int listBefore bool - endedListing bool expectPass bool statusUnlistedHook bool }{ @@ -398,7 +201,6 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), numBids: 0, listBefore: false, - endedListing: false, expectPass: false, statusUnlistedHook: false, }, @@ -411,7 +213,6 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), numBids: 0, listBefore: true, - endedListing: false, expectPass: false, statusUnlistedHook: false, }, @@ -424,20 +225,6 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { cancelAfter: 0, numBids: 0, listBefore: true, - endedListing: false, - expectPass: false, - statusUnlistedHook: false, - }, - { - testCase: "already ended listing", - classId: "class4", - nftId: "nft4", - nftOwner: acc1, - canceller: acc1, - cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), - numBids: 0, - listBefore: true, - endedListing: true, expectPass: false, statusUnlistedHook: false, }, @@ -450,9 +237,8 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), numBids: 0, listBefore: true, - endedListing: false, expectPass: true, - statusUnlistedHook: false, + statusUnlistedHook: true, }, { testCase: "successful cancel with cancel fee", @@ -463,16 +249,15 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { cancelAfter: time.Second * time.Duration(params.NftListingCancelRequiredSeconds+1), numBids: 0, listBefore: true, - endedListing: false, expectPass: true, - statusUnlistedHook: false, + statusUnlistedHook: true, }, } for _, tc := range tests { statusAfterNftUnlistedWithoutPayment = false - nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ + _ = nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ Id: tc.classId, Name: tc.classId, Symbol: tc.classId, @@ -487,14 +272,13 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { }, tc.nftOwner) suite.Require().NoError(err) - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} + nftIdentifier := types.NftId{ClassId: tc.classId, TokenId: tc.nftId} if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: tc.nftOwner.String(), + NftId: nftIdentifier, + BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), }) suite.Require().NoError(err) } @@ -503,37 +287,29 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) + price := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) + deposit := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{price}) suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{price}) suite.NoError(err) - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - } - - if tc.endedListing { - err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, + err := suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: nftIdentifier, + Price: price, + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.MustNewDecFromStr("0.05"), + AutomaticPayment: false, + Deposit: deposit, }) suite.Require().NoError(err) } oldCancellerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.canceller, "uguu") suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(tc.cancelAfter)) - err = keeper.CancelNftListing(suite.ctx, &types.MsgCancelNftListing{ - Sender: ununifitypes.StringAccAddress(tc.canceller), + err = keeper.CancelNftListing(suite.ctx, &types.MsgCancelListing{ + Sender: tc.canceller.String(), NftId: nftIdentifier, }) @@ -565,1816 +341,100 @@ func (suite *KeeperTestSuite) TestCancelNftListing() { } } -// func (suite *KeeperTestSuite) TestExpandListingPeriod() { -// acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - -// // params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - -// tests := []struct { -// testCase string -// classId string -// nftId string -// nftOwner sdk.AccAddress -// executor sdk.AccAddress -// numBids int -// listBefore bool -// endedListing bool -// expectPass bool -// }{ -// { -// testCase: "not existing listing", -// classId: "class1", -// nftId: "nft1", -// nftOwner: acc1, -// executor: acc1, -// numBids: 0, -// listBefore: false, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "not owned nft listing", -// classId: "class2", -// nftId: "nft2", -// nftOwner: acc1, -// executor: acc2, -// numBids: 0, -// listBefore: true, -// endedListing: false, -// expectPass: false, -// }, -// { -// testCase: "already ended nft listing", -// classId: "class3", -// nftId: "nft3", -// nftOwner: acc1, -// executor: acc2, -// numBids: 1, -// listBefore: true, -// endedListing: true, -// expectPass: false, -// }, -// { -// testCase: "successful nft listing period extend", -// classId: "class4", -// nftId: "nft4", -// nftOwner: acc1, -// executor: acc1, -// numBids: 1, -// listBefore: true, -// endedListing: false, -// expectPass: true, -// }, -// } - -// for _, tc := range tests { - -// coin := sdk.NewInt64Coin("uguu", int64(1000000000)) -// err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) -// suite.NoError(err) - -// suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ -// Id: tc.classId, -// Name: tc.classId, -// Symbol: tc.classId, -// Description: tc.classId, -// Uri: tc.classId, -// }) -// err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ -// ClassId: tc.classId, -// Id: tc.nftId, -// Uri: tc.nftId, -// UriHash: tc.nftId, -// }, tc.nftOwner) -// suite.Require().NoError(err) - -// nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} -// if tc.listBefore { -// err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// ListingType: types.ListingType_DIRECT_ASSET_BORROW, -// BidToken: "uguu", -// MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), -// }) -// suite.Require().NoError(err) -// } - -// lastBidder := sdk.AccAddress{} -// for i := 0; i < tc.numBids; i++ { -// bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) -// lastBidder = bidder - -// // init tokens to addr -// coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) -// err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) -// suite.NoError(err) -// err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{coin}) -// suite.NoError(err) - -// err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ -// Sender: ununifitypes.StringAccAddress(bidder), -// NftId: nftIdentifier, -// BidAmount: coin, -// AutomaticPayment: false, -// }) -// suite.Require().NoError(err) -// } - -// if tc.endedListing { -// err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ -// Sender: ununifitypes.StringAccAddress(tc.nftOwner), -// NftId: nftIdentifier, -// }) -// suite.Require().NoError(err) -// } - -// oldListing, _ := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - -// oldExecutorBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.executor, "uguu") -// oldLastBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, lastBidder, "uguu") -// err = suite.app.NftmarketKeeper.ExpandListingPeriod(suite.ctx, &types.MsgExpandListingPeriod{ -// Sender: ununifitypes.StringAccAddress(tc.executor), -// NftId: nftIdentifier, -// }) - -// if tc.expectPass { -// suite.Require().NoError(err) - -// // check fee is paid -// newExecutorBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.executor, "uguu") -// suite.Require().True(newExecutorBalance.Amount.LT(oldExecutorBalance.Amount)) - -// // check winner bidders get extend fee -// newLastBidderBalance := suite.app.BankKeeper.GetBalance(suite.ctx, lastBidder, "uguu") -// suite.Require().True(newLastBidderBalance.Amount.GT(oldLastBidderBalance.Amount)) - -// // check listing endAt is extended -// listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) -// suite.Require().NoError(err) -// suite.Require().True(oldListing.EndAt.Before(listing.EndAt)) -// } else { -// suite.Require().Error(err) -// } -// } -// } - -func (suite *KeeperTestSuite) TestSellingDecision() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - - tests := []struct { - testCase string - classId string - nftId string - nftOwner sdk.AccAddress - executor sdk.AccAddress - numBids int - enoughAutoPay bool - autoPayment bool - listBefore bool - endedListing bool - expectPass bool - }{ - { - testCase: "not existing listing", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - executor: acc1, - numBids: 0, - enoughAutoPay: true, - autoPayment: false, - listBefore: false, - endedListing: false, - expectPass: false, - }, - { - testCase: "not owned nft listing", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - executor: acc2, - numBids: 0, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: false, - expectPass: false, - }, - { - testCase: "already ended nft listing", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - executor: acc2, - numBids: 1, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: true, - expectPass: false, - }, - { - testCase: "successful nft selling decision with automatic payment", - classId: "class4", - nftId: "nft4", - nftOwner: acc1, - executor: acc1, - numBids: 1, - enoughAutoPay: true, - autoPayment: true, - listBefore: true, - endedListing: false, - expectPass: true, - }, - { - testCase: "successful nft selling decision with automatic payment enabled with not enough balance", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - executor: acc1, - numBids: 1, - enoughAutoPay: false, - autoPayment: true, - listBefore: true, - endedListing: false, - expectPass: true, - }, - { - testCase: "successful nft selling decision without automatic payment", - classId: "class6", - nftId: "nft6", - nftOwner: acc1, - executor: acc1, - numBids: 1, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: false, - expectPass: true, - }, - } - - for _, tc := range tests { - suite.SetupTest() - - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) - suite.NoError(err) +func (suite *KeeperTestSuite) TestDeliverSuccessfulBids() { + suite.SetupTest() + keeper := suite.keeper - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, - }) - err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) - suite.Require().NoError(err) + classId := "class1" + nftId := "nf1" + nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + now := time.Now().UTC() - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - } + suite.ctx = suite.ctx.WithBlockTime(now) + price := sdk.NewInt64Coin("uguu", int64(1000000000)) + deposit := sdk.NewInt64Coin("uguu", int64(100000000)) + err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{price}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{price}) + suite.NoError(err) - lastBidder := sdk.AccAddress{} - for i := 0; i < tc.numBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - lastBidder = bidder + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: classId, + Name: classId, + Symbol: classId, + Description: classId, + Uri: classId, + }) + err = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: classId, + Id: nftId, + Uri: nftId, + UriHash: nftId, + }, nftOwner) + suite.Require().NoError(err) - // init tokens to addr - coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - halfCoin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) - mintCoin := coin - if !tc.enoughAutoPay { - mintCoin = sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) - } - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{mintCoin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{mintCoin}) - suite.NoError(err) + nftIdentifier := types.NftId{ClassId: classId, TokenId: nftId} + err = suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: nftOwner.String(), + NftId: nftIdentifier, + BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), + }) + suite.Require().NoError(err) - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: coin, - DepositAmount: halfCoin, - AutomaticPayment: tc.autoPayment, - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - BiddingPeriod: time.Now().Add(time.Hour * 24), - }) - suite.Require().NoError(err) - } + bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - if tc.endedListing { - err := suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - } + // init tokens to addr + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{price}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{price}) + suite.NoError(err) - err = suite.app.NftmarketKeeper.SellingDecision(suite.ctx, &types.MsgSellingDecision{ - Sender: ununifitypes.StringAccAddress(tc.executor), - NftId: nftIdentifier, - }) + err = suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: nftIdentifier, + Price: price, + Expiry: time.Now().Add(time.Hour * 24), + InterestRate: sdk.MustNewDecFromStr("0.05"), + AutomaticPayment: true, + Deposit: deposit, + }) + suite.Require().NoError(err) + err = keeper.PayRemainder(suite.ctx, &types.MsgPayRemainder{ + Sender: bidder.String(), + NftId: nftIdentifier, + }) + suite.Require().NoError(err) - if tc.expectPass { - suite.Require().NoError(err) - if tc.autoPayment { - bid, err := suite.app.NftmarketKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), lastBidder) - suite.Require().NoError(err) - if tc.enoughAutoPay { - // check automatic payment execution when user has enough balance - suite.Require().Equal(bid.PaidAmount.Amount.Add(bid.DepositAmount.Amount), bid.BidAmount.Amount, tc.testCase) - } else { - // check automatic payment when the user does not have enough balance - suite.Require().NotEqual(bid.PaidAmount, bid.BidAmount.Amount) - } - } + listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) + suite.Require().NoError(err) + listing.SuccessfulBidEndAt = now + listing.LiquidatedAt = now + listing.State = types.ListingState_SUCCESSFUL_BID + keeper.SetNftListing(suite.ctx, listing) - // check full payment end time update - listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_SELLING_DECISION) - suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingFullPaymentPeriod)), listing.FullPaymentEndAt) - } else { - suite.Require().Error(err) - } - } -} + suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) + oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") -func (suite *KeeperTestSuite) TestEndNftListing() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + keeper.DeliverSuccessfulBids(suite.ctx) - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) + // check nft transfer + newNftOwner := suite.app.UnUniFiNFTKeeper.GetOwner(suite.ctx, classId, nftId) + suite.Require().NoError(err) + suite.Require().Equal(newNftOwner.String(), bidder.String()) - tests := []struct { - testCase string - classId string - nftId string - nftOwner sdk.AccAddress - executor sdk.AccAddress - numBids int - enoughAutoPay bool - autoPayment bool - listBefore bool - endedListing bool - expectPass bool - statusUnlistedHook bool - }{ - { - testCase: "not existing listing", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - executor: acc1, - numBids: 0, - enoughAutoPay: true, - autoPayment: false, - listBefore: false, - endedListing: false, - expectPass: false, - statusUnlistedHook: false, - }, - { - testCase: "not owned nft listing", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - executor: acc2, - numBids: 0, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: false, - expectPass: false, - statusUnlistedHook: false, - }, - { - testCase: "already ended nft listing", - classId: "class3", - nftId: "nft3", - nftOwner: acc1, - executor: acc2, - numBids: 1, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: true, - expectPass: false, - statusUnlistedHook: false, - }, - { - testCase: "successful nft listing ending when no bid", - classId: "class4", - nftId: "nft4", - nftOwner: acc1, - executor: acc1, - numBids: 0, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: false, - expectPass: true, - statusUnlistedHook: true, - }, - { - testCase: "successful nft listing ending with automatic payment enabled with not enough balance", - classId: "class5", - nftId: "nft5", - nftOwner: acc1, - executor: acc1, - numBids: 1, - enoughAutoPay: false, - autoPayment: true, - listBefore: true, - endedListing: false, - expectPass: true, - statusUnlistedHook: false, - }, - { - testCase: "successful nft listing ending without automatic payment", - classId: "class6", - nftId: "nft6", - nftOwner: acc1, - executor: acc1, - numBids: 4, - enoughAutoPay: true, - autoPayment: false, - listBefore: true, - endedListing: false, - expectPass: true, - statusUnlistedHook: false, - }, - } + // check fee paid + newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") + suite.Require().True(newOwnerBalance.Amount.GT(oldNftOwnerBalance.Amount)) - for _, tc := range tests { - suite.SetupTest() - keeper := suite.keeper - nftKeeper := suite.nftKeeper - statusAfterNftUnlistedWithoutPayment = false + // check bid deleted + bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) + suite.Require().Len(bids, 0) - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) - suite.NoError(err) - - nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, - }) - err = nftKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - if tc.listBefore { - err := suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - } - - lastBidder := sdk.AccAddress{} - for i := 0; i < tc.numBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - lastBidder = bidder - - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - mintCoin := bidAmount - if !tc.enoughAutoPay { - mintCoin = sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) - } - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{mintCoin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{mintCoin}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: tc.autoPayment, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - } - - if tc.endedListing { - err := keeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - } - - err = keeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ - Sender: ununifitypes.StringAccAddress(tc.executor), - NftId: nftIdentifier, - }) - - if tc.expectPass { - suite.Require().NoError(err) - if tc.autoPayment { - bid, err := keeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), lastBidder) - suite.Require().NoError(err) - if tc.enoughAutoPay { - // check automatic payment execution when user has enough balance - suite.Require().Equal(bid.PaidAmount, bid.BidAmount.Amount) - } else { - // check automatic payment when the user does not have enough balance - suite.Require().NotEqual(bid.PaidAmount, bid.BidAmount.Amount) - } - } - - if tc.numBids == 0 { - // successful end when there's no bid - delete listing directly and transfer nft back to owner - _, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Error(err) - } else { - // check full payment end time update - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_END_LISTING) - suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingFullPaymentPeriod)), listing.FullPaymentEndAt) - - // // check non-active bids are cancelled automatically - // bids := suite.app.NftmarketKeeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) - // suite.Require().True(len(bids) <= int(listing.BidActiveRank)) - } - - } else { - suite.Require().Error(err) - } - suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) - } -} - -func (suite *KeeperTestSuite) TestProcessEndingNftListings() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - - tests := []struct { - testCase string - classId string - nftId string - nftOwner sdk.AccAddress - numBids int - relistedCount uint64 - expectedToEnd bool - expectedToBeRemoved bool - statusUnlistedHook bool - }{ - { - testCase: "no bid nft listing extend when relisted count not reached the limit", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - numBids: 0, - relistedCount: 0, - expectedToEnd: false, - expectedToBeRemoved: false, - statusUnlistedHook: false, - }, - // { - // testCase: "no bid nft listing end when relisted count reached", - // classId: "class2", - // nftId: "nft2", - // nftOwner: acc1, - // numBids: 0, - // relistedCount: params.AutoRelistingCountIfNoBid, - // expectedToEnd: true, - // expectedToBeRemoved: true, - // statusUnlistedHook: true, - // }, - // { - // testCase: "bids existing nft listing end when relisted count not reached", - // classId: "class3", - // nftId: "nft3", - // nftOwner: acc1, - // numBids: 1, - // relistedCount: 0, - // expectedToEnd: true, - // expectedToBeRemoved: false, - // statusUnlistedHook: false, - // }, - // { - // testCase: "bids existing nft listing end when relisted count reached", - // classId: "class4", - // nftId: "nft4", - // nftOwner: acc1, - // numBids: 1, - // relistedCount: params.AutoRelistingCountIfNoBid, - // expectedToEnd: true, - // expectedToBeRemoved: false, - // statusUnlistedHook: false, - // }, - } - - for _, tc := range tests { - suite.SetupTest() - keeper := suite.keeper - nftKeeper := suite.nftKeeper - statusAfterNftUnlistedWithoutPayment = false - - now := time.Now().UTC() - suite.ctx = suite.ctx.WithBlockTime(now) - - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.nftOwner, sdk.Coins{coin}) - suite.NoError(err) - - nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, - }) - err = nftKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - listing.AutoRelistedCount = tc.relistedCount - keeper.SetNftListing(suite.ctx, listing) - - for i := 0; i < tc.numBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - } - - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) - keeper.ProcessEndingNftListings(suite.ctx) - - if tc.expectedToBeRemoved { - _, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Error(err, tc.testCase) - } else { - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - - if tc.expectedToEnd { - suite.Require().Equal(listing.State, types.ListingState_END_LISTING, tc.testCase) - } else { - suite.Require().NotEqual(listing.State, types.ListingState_END_LISTING) - } - } - suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) - } -} - -func (suite *KeeperTestSuite) TestActiveNftListingsEndingAtQueueRemovalOnNftListingEnd() { - suite.SetupTest() - - classId := "class1" - nftId := "nf1" - nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - now := time.Now().UTC() - - suite.ctx = suite.ctx.WithBlockTime(now) - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{coin}) - suite.NoError(err) - - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: classId, - Name: classId, - Symbol: classId, - Description: classId, - Uri: classId, - }) - err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: classId, - Id: nftId, - Uri: nftId, - UriHash: nftId, - }, nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} - err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - - listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().True(listing.IsActive()) - - // check number before end listing - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - activeNftListings := suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, now.Add(time.Second*time.Duration(params.NftListingPeriodInitial+1))) - suite.Require().Len(activeNftListings, 1) - - err = suite.app.NftmarketKeeper.EndNftListing(suite.ctx, &types.MsgEndNftListing{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - - // check number after end listing - activeNftListings = suite.app.NftmarketKeeper.GetActiveNftListingsEndingAt(suite.ctx, now.Add(time.Second*time.Duration(params.NftListingPeriodInitial+1))) - suite.Require().Len(activeNftListings, 0) -} - -func (suite *KeeperTestSuite) TestHandleFullPaymentPeriodEndings() { - - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - - tests := []struct { - testCase string - classId string - nftId string - nftOwner sdk.AccAddress - numBids int - listingState types.ListingState - fullPay bool - statusUnlistedHook bool - }{ - { - testCase: "selling decision listing when highest bid is paid", - classId: "class1", - nftId: "nft1", - nftOwner: acc1, - numBids: 2, - listingState: types.ListingState_SELLING_DECISION, - fullPay: true, - statusUnlistedHook: false, - }, // add successful listing state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status - { - testCase: "selling decision listing when highest bid is not paid and no more bids", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - numBids: 1, - listingState: types.ListingState_SELLING_DECISION, - fullPay: false, - statusUnlistedHook: false, - }, // status => ListingState_LISTING - { - testCase: "selling decision listing when highest bid is not paid, and more bids", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - numBids: 2, - listingState: types.ListingState_SELLING_DECISION, - fullPay: false, - statusUnlistedHook: false, - }, // status => ListingState_BIDDING - { - testCase: "ended listing, when fully paid bid exists", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - numBids: 2, - listingState: types.ListingState_END_LISTING, - fullPay: true, - statusUnlistedHook: false, - }, // add successful bid state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status, close all the other bids - { - testCase: "ended listing, when fully paid bid does not exist", - classId: "class2", - nftId: "nft2", - nftOwner: acc1, - numBids: 2, - listingState: types.ListingState_END_LISTING, - fullPay: true, - statusUnlistedHook: false, - }, // all the bids closed, pay depositCollected, nft listing delete, transfer nft to fully paid bidder - } - - for _, tc := range tests { - suite.SetupTest() - keeper := suite.keeper - nftKeeper := suite.nftKeeper - statusAfterNftUnlistedWithoutPayment = false - - now := time.Now().UTC() - suite.ctx = suite.ctx.WithBlockTime(now) - - coin := sdk.NewInt64Coin("uguu", int64(1000000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.nftOwner, sdk.Coins{coin}) - suite.NoError(err) - - nftKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: tc.classId, - Name: tc.classId, - Symbol: tc.classId, - Description: tc.classId, - Uri: tc.classId, - }) - err = nftKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: tc.classId, - Id: tc.nftId, - Uri: tc.nftId, - UriHash: tc.nftId, - }, tc.nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: tc.classId, NftId: tc.nftId} - err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(tc.nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - - for i := 0; i < tc.numBids; i++ { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) - - err := suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - - if tc.fullPay { - err := keeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - } - } - - listing.State = tc.listingState - keeper.SetNftListing(suite.ctx, listing) - - oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.nftOwner, "uguu") - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) - keeper.HandleFullPaymentsPeriodEndings(suite.ctx) - - switch tc.listingState { - case types.ListingState_SELLING_DECISION: - if tc.fullPay { - // add successful listing state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status - listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) - suite.Require().Equal(listing.SuccessfulBidEndAt, suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingNftDeliveryPeriod))) - } else if tc.numBids > 1 { - // status => ListingState_BIDDING - listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_BIDDING) - } else { - // status => ListingState_LISTING - listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_LISTING) - } - case types.ListingState_END_LISTING: - if tc.fullPay { - // add successful bid state with SuccessfulBidEndAt field + types.ListingState_SUCCESSFUL_BID status, close all the other bids - listing, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) - suite.Require().Equal(listing.SuccessfulBidEndAt, suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingNftDeliveryPeriod))) - } else { - // all the bids closed, pay depositCollected, nft listing delete, transfer nft to fully paid bidder - _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Error(err) - - bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Len(bids, 0) - - newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, tc.nftOwner, "uguu") - suite.Require().True(newOwnerBalance.Amount.GT(oldNftOwnerBalance.Amount)) - - nft, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(nft.Owner, tc.nftOwner) - } - } - suite.Require().Equal(tc.statusUnlistedHook, statusAfterNftUnlistedWithoutPayment) - } -} - -func (suite *KeeperTestSuite) TestDelieverSuccessfulBids() { - suite.SetupTest() - keeper := suite.keeper - - classId := "class1" - nftId := "nf1" - nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - now := time.Now().UTC() - - suite.ctx = suite.ctx.WithBlockTime(now) - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000000)) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{bidAmount}) - suite.NoError(err) - - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: classId, - Name: classId, - Symbol: classId, - Description: classId, - Uri: classId, - }) - err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: classId, - Id: nftId, - Uri: nftId, - UriHash: nftId, - }, nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} - err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - // init tokens to addr - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) - - err = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - err = keeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - listing.SuccessfulBidEndAt = now - listing.State = types.ListingState_SUCCESSFUL_BID - keeper.SetNftListing(suite.ctx, listing) - - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) - oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") - - keeper.DelieverSuccessfulBids(suite.ctx) - - // check nft transfer - newNftOwner := suite.app.NFTKeeper.GetOwner(suite.ctx, classId, nftId) - suite.Require().NoError(err) - suite.Require().Equal(newNftOwner.String(), bidder.String()) - - // check fee paid - newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") - suite.Require().True(newOwnerBalance.Amount.GT(oldNftOwnerBalance.Amount)) - - // check bid deleted - bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Len(bids, 0) - - // check nft listing deleted - _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Error(err) + // check nft listing deleted + _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) + suite.Require().Error(err) // check if AfterNftPaymentWithCommission is called suite.Require().True(statusAfterNftPaymentWithCommission) } - -func (suite *KeeperTestSuite) TestProcessPaymentWithCommissionFee() { - tests := []struct { - testCase string - loanAmount sdk.Int - }{ - { - testCase: "zero loan", - loanAmount: sdk.ZeroInt(), - }, - { - testCase: "positive loan", - loanAmount: sdk.NewInt(10), - }, - } - - for _, tc := range tests { - suite.SetupTest() - keeper := suite.keeper - statusAfterNftPaymentWithCommission = false - - amount := sdk.NewInt(1000000) - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{sdk.NewCoin("uguu", amount)}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, minttypes.ModuleName, types.ModuleName, sdk.Coins{sdk.NewCoin("uguu", amount)}) - suite.NoError(err) - - var nftId types.NftIdentifier - keeper.ProcessPaymentWithCommissionFee(suite.ctx, owner, "uguu", amount, tc.loanAmount, nftId) - - params := keeper.GetParamSet(suite.ctx) - fee := amount.Mul(sdk.NewInt(int64(params.NftListingCommissionFee))).Quo(sdk.NewInt(100)) - listingPayment := amount.Sub(fee).Sub(tc.loanAmount) - - // check fee paid to NftTradingFee - tradingFeeModuleAcc := suite.app.AccountKeeper.GetModuleAddress(ecoincentivetypes.ModuleName) - tradingFeeBal := suite.app.BankKeeper.GetBalance(suite.ctx, tradingFeeModuleAcc, "uguu") - suite.Require().Equal(tradingFeeBal, sdk.NewCoin("uguu", fee)) - - // check fee to lister - ownerBal := suite.app.BankKeeper.GetBalance(suite.ctx, owner, "uguu") - suite.Require().Equal(ownerBal, sdk.NewCoin("uguu", listingPayment)) - - // check if AfterNftPaymentWithCommission is called - suite.Require().True(statusAfterNftPaymentWithCommission) - } -} - -func (suite *KeeperTestSuite) TestDelieverSuccessfulBidForPositiveLoan() { - suite.SetupTest() - keeper := suite.keeper - - classId := "class1" - nftId := "nf1" - nftOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - now := time.Now().UTC() - - suite.ctx = suite.ctx.WithBlockTime(now) - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000000)) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000000)) - err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{bidAmount}) - suite.NoError(err) - - suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: classId, - Name: classId, - Symbol: classId, - Description: classId, - Uri: classId, - }) - err = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: classId, - Id: nftId, - Uri: nftId, - UriHash: nftId, - }, nftOwner) - suite.Require().NoError(err) - - nftIdentifier := types.NftIdentifier{ClassId: classId, NftId: nftId} - err = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - suite.Require().NoError(err) - - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - // init tokens to addr - err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - suite.NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - suite.NoError(err) - - err = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: true, - DepositAmount: depositAmount, - }) - suite.Require().NoError(err) - err = keeper.PayFullBid(suite.ctx, &types.MsgPayFullBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - }) - suite.Require().NoError(err) - - listing, err := keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - listing.SuccessfulBidEndAt = now - listing.State = types.ListingState_SUCCESSFUL_BID - keeper.SetNftListing(suite.ctx, listing) - - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second)) - - loanAmount := sdk.NewInt64Coin("uguu", 10) - params := keeper.GetParamSet(suite.ctx) - commissionFee := params.NftListingCommissionFee - feeAmount := bidAmount.Amount.Mul(sdk.NewInt(int64(commissionFee))).Quo(sdk.NewInt(100)) - err = suite.app.NftmarketKeeper.Borrow(suite.ctx, &types.MsgBorrow{ - Sender: nftOwner.Bytes(), - NftId: nftIdentifier, - Amount: loanAmount, - }) - suite.Require().NoError(err) - - oldNftOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") - suite.NotPanics(func() { - keeper.DelieverSuccessfulBids(suite.ctx) - }) - - // check nft transfer - newNftOwner := suite.app.NFTKeeper.GetOwner(suite.ctx, classId, nftId) - suite.Require().NoError(err) - suite.Require().Equal(newNftOwner.String(), bidder.String()) - - // check fee paid - newOwnerBalance := suite.app.BankKeeper.GetBalance(suite.ctx, nftOwner, "uguu") - suite.Require().True(newOwnerBalance.Amount.Equal(oldNftOwnerBalance.Amount.Add(bidAmount.Amount).Sub(feeAmount).Sub(loanAmount.Amount))) - - // check bid deleted - bids := keeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Len(bids, 0) - - // check nft listing deleted - _, err = keeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Error(err) - - suite.Require().True(statusAfterNftPaymentWithCommission) -} - -// TestReListingDataManagement is a test to check if the all data related listing like bid and loan -// works as intended when the list is re-listed by system or even by user's hand -func (suite *KeeperTestSuite) TestReListingDataManagement() { - acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - params := suite.app.NftmarketKeeper.GetParamSet(suite.ctx) - nftIdentifier := types.NftIdentifier{ClassId: "class1", NftId: "nft1"} - nftOwner := acc1 - - tests := []struct { - testCase string - numBids int - listingState types.ListingState - fullPay bool - borrow bool - }{ - { - testCase: "selling decision listing when highest bid is paid and no more bids", - numBids: 1, - listingState: types.ListingState_SELLING_DECISION, - fullPay: true, - borrow: true, - }, // status => ListingState_LISTING - { - testCase: "selling decision listing when highest bid is not paid and no more bids", - numBids: 1, - listingState: types.ListingState_SELLING_DECISION, - borrow: true, - }, // status => ListingState_LISTING - { - testCase: "selling decision listing when highest bid is not paid, and more bids", - numBids: 2, - listingState: types.ListingState_SELLING_DECISION, - borrow: true, - }, // status => ListingState_BIDDING - { - testCase: "end listing when no bids is not paid", - numBids: 1, - listingState: types.ListingState_END_LISTING, - borrow: true, - }, // status => delist - { - testCase: "end listing when no bids is not paid", - numBids: 1, - listingState: types.ListingState_END_LISTING, - fullPay: true, - borrow: true, - }, // status => delist - } - - for _, tc := range tests { - suite.SetupTest() - - now := time.Now().UTC() - suite.ctx = suite.ctx.WithBlockTime(now) - - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000000)) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000000)) - _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, nftOwner, sdk.Coins{bidAmount}) - - _ = suite.app.NFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ - Id: nftIdentifier.ClassId, - Name: nftIdentifier.ClassId, - Symbol: nftIdentifier.ClassId, - }) - _ = suite.app.NFTKeeper.Mint(suite.ctx, nfttypes.NFT{ - ClassId: nftIdentifier.ClassId, - Id: nftIdentifier.NftId, - }, nftOwner) - - _ = suite.app.NftmarketKeeper.ListNft(suite.ctx, &types.MsgListNft{ - Sender: ununifitypes.StringAccAddress(nftOwner), - NftId: nftIdentifier, - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - }) - listing, err := suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - - for i := 0; i < tc.numBids; i++ { - if tc.borrow { - suite.PlaceAndBorrow(bidAmount, depositAmount, nftIdentifier, nftOwner, tc.fullPay, 2) - } else { - bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - // init tokens to addr - bidAmount := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) - depositAmount := sdk.NewInt64Coin("uguu", int64(100000*(i+1))) - _ = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{bidAmount}) - _ = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{bidAmount}) - - _ = suite.app.NftmarketKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ - Sender: ununifitypes.StringAccAddress(bidder), - NftId: nftIdentifier, - BidAmount: bidAmount, - BiddingPeriod: time.Now().Add(time.Hour * 24), - DepositLendingRate: sdk.MustNewDecFromStr("0.05"), - AutomaticPayment: false, - DepositAmount: depositAmount, - }) - } - } - - listing.State = tc.listingState - suite.app.NftmarketKeeper.SetNftListing(suite.ctx, listing) - - suite.ctx = suite.ctx.WithBlockTime(now.Add(time.Second * time.Duration(params.NftListingPeriodInitial+1))) - suite.app.NftmarketKeeper.HandleFullPaymentsPeriodEndings(suite.ctx) - bids := suite.app.NftmarketKeeper.GetBidsByNft(suite.ctx, nftIdentifier.IdBytes()) - loan := suite.app.NftmarketKeeper.GetDebtByNft(suite.ctx, nftIdentifier.IdBytes()) - - // check bids and loan data specifically - switch tc.listingState { - case types.ListingState_SELLING_DECISION: - if tc.numBids > 1 { - // status => ListingState_BIDDING - listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_BIDDING) - suite.Require().NotEmpty(bids) - suite.Require().NotEmpty(loan) - } else if tc.fullPay { - // status => ListingState_SUCCESSFUL_BID - // this simulates the state of re-lisitng from the situation the list is successfully sent to - // a buyer and buyer lists it - listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) - suite.Require().Len(bids, 1) - suite.Require().Empty(loan) - } else { - // status => ListingState_LISTING - listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_LISTING) - suite.Require().Empty(bids) - suite.Require().Empty(loan) - } - case types.ListingState_END_LISTING: - if tc.fullPay { - // pay depositCollected, nft listing delete, transfer nft to fully paid bidder - // this simulates the state of re-listing from the situation the list was handed to buyer - // and that buyer lists - listing, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().NoError(err) - suite.Require().Equal(listing.State, types.ListingState_SUCCESSFUL_BID) - suite.Require().Len(bids, 1) - suite.Require().Empty(loan) - } else { - // all the bids closed, pay depositCollected, nft listing delete - // this simulates the state of re-listing from the situation the list was handed to buyer - _, err = suite.app.NftmarketKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) - suite.Require().Error(err) - suite.Require().Empty(bids) - suite.Require().Empty(loan) - } - } - } -} - -// test LiquidationProcessExitsWinner -func (suite *KeeperTestSuite) TestLiquidationProcessExitsWinner() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - bidder1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - now := time.Now() - refundFCheckerGen := func(testCase string, expRefundBids types.NftBids, expTotalInterest, expSurplusAmount sdk.Coin, expListing types.NftListing) func(ctx sdk.Context, refundBids types.NftBids, totalInterest, surplusAmount sdk.Coin, listing types.NftListing) error { - return func(ctx sdk.Context, refundBids types.NftBids, totalInterest, surplusAmount sdk.Coin, listing types.NftListing) error { - suite.Equal(expRefundBids, refundBids, testCase) - suite.Equal(expTotalInterest, totalInterest, testCase) - suite.Equal(expSurplusAmount, surplusAmount, testCase) - suite.Equal(expListing, listing, testCase) - return nil - } - } - type funcArg struct { - collectBid types.NftBids - refundBid types.NftBids - listing types.NftListing - winnerBid types.NftBid - blockTime time.Time - } - type funcFExp struct { - expRefundBid types.NftBids - expTotalInterest, expSurplusAmount sdk.Coin - expListing types.NftListing - } - tcs := []struct { - testCase string - funcArg funcArg - funcFExp funcFExp - expResult error - }{ - { - "no refund bid and no collect bid", - funcArg{ - collectBid: types.NftBids{}, - refundBid: types.NftBids{}, - listing: types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - winnerBid: types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: bidder1.String(), - }, - }, - blockTime: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - }, - funcFExp{ - expRefundBid: types.NftBids{}, - expTotalInterest: sdk.Coin{"uguu", sdk.NewInt(0)}, - expSurplusAmount: sdk.Coin{"uguu", sdk.NewInt(0)}, - expListing: types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - }, - nil, - }, - { - "refund bid and no collect bid", - funcArg{ - collectBid: types.NftBids{}, - refundBid: types.NftBids{ - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - }, - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(45)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(55)), - }, - }, - listing: types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - winnerBid: types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - }, - }, - blockTime: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - }, - funcFExp{ - expRefundBid: types.NftBids{ - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - }, - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(45)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(55)), - }, - }, - expTotalInterest: sdk.Coin{"uguu", sdk.NewInt(12)}, - expSurplusAmount: sdk.Coin{"uguu", sdk.NewInt(5)}, - expListing: types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - }, - nil, - }, - { - "refund bid and collect bid", - funcArg{ - collectBid: types.NftBids{ - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Bidder: bidder1.String(), - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - }, - }, - refundBid: types.NftBids{ - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - }, - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(45)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(55)), - }, - }, - listing: types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.ZeroInt(), - }, - }, - winnerBid: types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - }, - }, - blockTime: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - }, - funcFExp{ - expRefundBid: types.NftBids{ - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - }, - { - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(45)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), - Borrowings: []types.Borrowing{ - { - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(55)), - }, - }, - expTotalInterest: sdk.Coin{"uguu", sdk.NewInt(12)}, - expSurplusAmount: sdk.Coin{"uguu", sdk.NewInt(55)}, - expListing: types.NftListing{ - NftId: types.NftIdentifier{ - ClassId: "1", - NftId: "1", - }, - Owner: owner.String(), - ListingType: types.ListingType_DIRECT_ASSET_BORROW, - State: types.ListingState_LISTING, - BidToken: "uguu", - MinimumDepositRate: sdk.MustNewDecFromStr("0.1"), - StartedAt: now, - EndAt: now, - FullPaymentEndAt: time.Time{}, - SuccessfulBidEndAt: time.Time{}, - AutoRelistedCount: 0, - CollectedAmount: sdk.Coin{ - Denom: "uguu", - Amount: sdk.NewInt(50), - }, - }, - }, - nil, - }, - } - suite.SetupTest() - for _, tc := range tcs { - err := suite.keeper.LiquidationProcessExitsWinner(suite.ctx, - tc.funcArg.collectBid, tc.funcArg.refundBid, - tc.funcArg.listing, tc.funcArg.winnerBid, - tc.funcArg.blockTime, - refundFCheckerGen(tc.testCase, tc.funcFExp.expRefundBid, tc.funcFExp.expTotalInterest, tc.funcFExp.expSurplusAmount, tc.funcFExp.expListing), - ) - if tc.expResult != nil { - suite.Equal(tc.expResult, err) - } else { - suite.NoError(err) - } - } -} diff --git a/x/nftbackedloan/keeper/sell.go b/x/nftbackedloan/keeper/sell.go new file mode 100644 index 000000000..4a8769828 --- /dev/null +++ b/x/nftbackedloan/keeper/sell.go @@ -0,0 +1,124 @@ +package keeper + +import ( + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +func (k Keeper) SetSellingDecision(ctx sdk.Context, msg *types.MsgSellingDecision) error { + // check listing already exists + listing, err := k.GetNftListingByIdBytes(ctx, msg.NftId.IdBytes()) + if err != nil { + return types.ErrNftListingDoesNotExist + } + + // Check nft exists + _, found := k.nftKeeper.GetNFT(ctx, msg.NftId.ClassId, msg.NftId.TokenId) + if !found { + return types.ErrNftDoesNotExists + } + + // check ownership of listing + if listing.Owner != msg.Sender { + return types.ErrNotNftListingOwner + } + + // check if listing is already ended or on selling decision status + if !listing.IsBidding() { + return types.ErrStatusCannotSelling + } + + // check bid exists + bids := types.NftBids(k.GetBidsByNft(ctx, listing.NftId.IdBytes())) + if len(bids) == 0 { + return types.ErrBidDoesNotExists + } + + // check no borrowing bid + for _, bid := range bids { + if bid.IsBorrowed() { + return types.ErrCannotSellingBorrowedListing + } + } + + params := k.GetParamSet(ctx) + listing.State = types.ListingState_SELLING_DECISION + listing.LiquidatedAt = ctx.BlockTime() + listing.FullPaymentEndAt = ctx.BlockTime().Add(time.Duration(params.NftListingFullPaymentPeriod) * time.Second) + k.SaveNftListing(ctx, listing) + + // automatic payment if enabled + if len(bids) > 0 { + highestBid, err := bids.GetHighestBid() + if err != nil { + return err + } + if highestBid.AutomaticPayment { + bidder, err := sdk.AccAddressFromBech32(highestBid.Id.Bidder) + if err != nil { + return err + } + + cacheCtx, write := ctx.CacheContext() + err = k.PayRemainder(cacheCtx, &types.MsgPayRemainder{ + Sender: bidder.String(), + NftId: listing.NftId, + }) + if err == nil { + write() + } else { + fmt.Println(err) + } + } + } + + // Emit event for nft listing end + _ = ctx.EventManager().EmitTypedEvent(&types.EventSellingDecision{ + Owner: msg.Sender, + ClassId: msg.NftId.ClassId, + TokenId: msg.NftId.TokenId, + }) + + return nil +} + +func (k Keeper) RunSellingDecisionProcess(ctx sdk.Context, bids types.NftBids, listing types.Listing, params types.Params) error { + highestBid, err := bids.GetHighestBid() + if err != nil { + return err + } + // if winner bidder did not pay remainder, nft is listed again after deleting winner bidder + if !highestBid.IsPaidSalePrice() { + borrowedAmount := highestBid.Loan.Amount + forfeitedDeposit, err := k.SafeCloseBidCollectDeposit(ctx, highestBid) + if err != nil { + return err + } + collectedAmount := forfeitedDeposit.Sub(borrowedAmount) + listing = listing.AddCollectedAmount(collectedAmount) + + if len(bids) == 1 { + listing.State = types.ListingState_LISTING + } else { + listing.State = types.ListingState_BIDDING + } + } else { + // close other bids + otherBids := bids.RemoveBid(highestBid) + for _, bid := range otherBids { + err := k.SafeCloseBid(ctx, bid) + if err != nil { + return err + } + } + // schedule NFT & token send after X days + listing.SuccessfulBidEndAt = ctx.BlockTime().Add(time.Second * time.Duration(params.NftListingNftDeliveryPeriod)) + listing.State = types.ListingState_SUCCESSFUL_BID + } + k.SaveNftListing(ctx, listing) + return nil +} diff --git a/x/nftbackedloan/keeper/sell_test.go b/x/nftbackedloan/keeper/sell_test.go new file mode 100644 index 000000000..44be0d829 --- /dev/null +++ b/x/nftbackedloan/keeper/sell_test.go @@ -0,0 +1,186 @@ +package keeper_test + +import ( + "time" + + "github.com/cometbft/cometbft/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + nfttypes "github.com/cosmos/cosmos-sdk/x/nft" + + "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +func (suite *KeeperTestSuite) TestSellingDecision() { + acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + acc2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + + params := suite.app.NftbackedloanKeeper.GetParamSet(suite.ctx) + + tests := []struct { + testCase string + classId string + nftId string + nftOwner sdk.AccAddress + executor sdk.AccAddress + numBids int + enoughAutoPay bool + autoPayment bool + listBefore bool + expectPass bool + }{ + { + testCase: "not existing listing", + classId: "class1", + nftId: "nft1", + nftOwner: acc1, + executor: acc1, + numBids: 0, + enoughAutoPay: true, + autoPayment: false, + listBefore: false, + expectPass: false, + }, + { + testCase: "not owned nft listing", + classId: "class2", + nftId: "nft2", + nftOwner: acc1, + executor: acc2, + numBids: 0, + enoughAutoPay: true, + autoPayment: false, + listBefore: true, + expectPass: false, + }, + { + testCase: "successful nft selling decision with automatic payment", + classId: "class4", + nftId: "nft4", + nftOwner: acc1, + executor: acc1, + numBids: 1, + enoughAutoPay: true, + autoPayment: true, + listBefore: true, + expectPass: true, + }, + { + testCase: "successful nft selling decision with automatic payment enabled with not enough balance", + classId: "class5", + nftId: "nft5", + nftOwner: acc1, + executor: acc1, + numBids: 1, + enoughAutoPay: false, + autoPayment: true, + listBefore: true, + expectPass: true, + }, + { + testCase: "successful nft selling decision without automatic payment", + classId: "class6", + nftId: "nft6", + nftOwner: acc1, + executor: acc1, + numBids: 1, + enoughAutoPay: true, + autoPayment: false, + listBefore: true, + expectPass: true, + }, + } + + for _, tc := range tests { + suite.SetupTest() + + coin := sdk.NewInt64Coin("uguu", int64(1000000000)) + err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{coin}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, tc.executor, sdk.Coins{coin}) + suite.NoError(err) + + _ = suite.app.UnUniFiNFTKeeper.SaveClass(suite.ctx, nfttypes.Class{ + Id: tc.classId, + Name: tc.classId, + Symbol: tc.classId, + Description: tc.classId, + Uri: tc.classId, + }) + err = suite.app.UnUniFiNFTKeeper.Mint(suite.ctx, nfttypes.NFT{ + ClassId: tc.classId, + Id: tc.nftId, + Uri: tc.nftId, + UriHash: tc.nftId, + }, tc.nftOwner) + suite.Require().NoError(err) + + nftIdentifier := types.NftId{ClassId: tc.classId, TokenId: tc.nftId} + if tc.listBefore { + err := suite.app.NftbackedloanKeeper.ListNft(suite.ctx, &types.MsgListNft{ + Sender: tc.nftOwner.String(), + NftId: nftIdentifier, + BidDenom: "uguu", + MinDepositRate: sdk.MustNewDecFromStr("0.1"), + }) + suite.Require().NoError(err) + } + + lastBidder := sdk.AccAddress{} + for i := 0; i < tc.numBids; i++ { + bidder := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) + lastBidder = bidder + + // init tokens to addr + coin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1))) + halfCoin := sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) + mintCoin := coin + if !tc.enoughAutoPay { + mintCoin = sdk.NewInt64Coin("uguu", int64(1000000*(i+1)/2)) + } + err = suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, sdk.Coins{mintCoin}) + suite.NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, bidder, sdk.Coins{mintCoin}) + suite.NoError(err) + + err := suite.app.NftbackedloanKeeper.PlaceBid(suite.ctx, &types.MsgPlaceBid{ + Sender: bidder.String(), + NftId: nftIdentifier, + Price: coin, + Deposit: halfCoin, + AutomaticPayment: tc.autoPayment, + InterestRate: sdk.MustNewDecFromStr("0.1"), + Expiry: time.Now().Add(time.Hour * 24), + }) + suite.Require().NoError(err) + } + + err = suite.app.NftbackedloanKeeper.SetSellingDecision(suite.ctx, &types.MsgSellingDecision{ + Sender: tc.executor.String(), + NftId: nftIdentifier, + }) + + if tc.expectPass { + suite.Require().NoError(err) + if tc.autoPayment { + bid, err := suite.app.NftbackedloanKeeper.GetBid(suite.ctx, nftIdentifier.IdBytes(), lastBidder) + suite.Require().NoError(err) + if tc.enoughAutoPay { + // check automatic payment execution when user has enough balance + suite.Require().Equal(bid.PaidAmount.Amount.Add(bid.Deposit.Amount), bid.Price.Amount, tc.testCase) + } else { + // check automatic payment when the user does not have enough balance + suite.Require().NotEqual(bid.PaidAmount, bid.Price.Amount) + } + } + + // check full payment end time update + listing, err := suite.app.NftbackedloanKeeper.GetNftListingByIdBytes(suite.ctx, nftIdentifier.IdBytes()) + suite.Require().NoError(err) + suite.Require().Equal(listing.State, types.ListingState_SELLING_DECISION) + suite.Require().Equal(suite.ctx.BlockTime().Add(time.Second*time.Duration(params.NftListingFullPaymentPeriod)), listing.FullPaymentEndAt) + } else { + suite.Require().Error(err) + } + } +} diff --git a/x/nftbackedloan/keeper/test/01_selling_decision.sh b/x/nftbackedloan/keeper/test/01_selling_decision.sh new file mode 100644 index 000000000..b573c111f --- /dev/null +++ b/x/nftbackedloan/keeper/test/01_selling_decision.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# block speed +sleep=5 + +init_user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +init_user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user2 +echo "------------bid nft from user2------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 \ +200uguu 50uguu 0.1 7200 --automatic-payment=false --from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep +# selling decision +echo "------------selling decision------------" +ununifid tx nftbackedloan selling-decision \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 + +# pay remainder +echo "------------pay remainder------------" +ununifid tx nftbackedloan pay-remainder \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +# Check nft transfer & balance +user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') + +# -200 +expected_user2_balance=$(($init_user2_balance - 200)) + +if [ "$user2_balance" = "$expected_user2_balance" ]; then + echo "pass: bidder balance is correct: $user2_balance" +else + echo "error: bidder balance is incorrect: $user2_balance" +fi + +sleep $sleep +echo "wait.......... NftListingFullPaymentPeriod: 30" +sleep 30 + +echo "============check nft status successful_bid ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 +echo "wait.......... NftListingNftDeliveryPeriod: 30s" +sleep 30 + +user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +# + 200 - 10 (5% fee) +expected_user1_balance=$(($init_user1_balance + 190)) + +if [ "$user1_balance" = "$expected_user1_balance" ]; then + echo "pass: owner balance is correct: $user1_balance" +else + echo "error: owner balance is incorrect:" + echo "expected: $expected_user1_balance actual: $user1_balance" +fi + +owner=$(ununifid q nft owner ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 -o json | jq .owner | tr -d '"') +# user2 +expected_owner="ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla" + +if [ "$owner" = "$expected_owner" ]; then + echo "pass: Owner is changed to $owner" +else + echo "error: Owner is not changed from $owner" +fi + +echo "------------check nft------------" +ununifid q nft nft ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 diff --git a/x/nftbackedloan/keeper/test/02_selling_decision_not_paid.sh b/x/nftbackedloan/keeper/test/02_selling_decision_not_paid.sh new file mode 100644 index 000000000..9ed1ee6bc --- /dev/null +++ b/x/nftbackedloan/keeper/test/02_selling_decision_not_paid.sh @@ -0,0 +1,132 @@ +#!/bin/sh + +# block speed +sleep=5 + +init_user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +init_user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user2 +echo "------------bid nft from user2------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 \ +200uguu 50uguu 0.1 7200 --automatic-payment=false --from user2 --keyring-backend test --chain-id test --yes + +echo "------------bid nft from user3------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 \ +100uguu 20uguu 0.1 7200 --automatic-payment=false --from user3 --keyring-backend test --chain-id test --yes + +sleep $sleep +# selling decision +echo "------------selling decision------------" +ununifid tx nftbackedloan selling-decision \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "============check nft status selling_decision ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 + +# not pay remainder + +echo "wait.......... NftListingFullPaymentPeriod: 30s" +sleep 30 + +echo "============check nft status listing ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 + +# check bidder balance +user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +# -50 +expected_user2_balance=$(($init_user2_balance - 50)) + +if [ "$user2_balance" = "$expected_user2_balance" ]; then + echo "pass: bidder balance is correct: $user2_balance" +else + echo "error: bidder balance is incorrect" + echo "expected: $expected_user2_balance actual: $user2_balance" +fi + +# check collected amount +response=$(ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 -o json) +amount=$(echo "$response" | jq .listing.collected_amount.amount | tr -d '"') +negative=$(echo "$response" | jq .listing.collected_amount_negative | tr -d '"') +expected_amount="50" +if [ "$amount" = "$expected_amount" ]; then + echo "pass: collect amount is correct: $amount" +else + echo "error: collect amount is incorrect" + echo "expected: $expected_amount actual: $amount" +fi + +if [ "$negative" = "false" ]; then + echo "pass: negative bool is correct: $negative" +else + echo "error: negative bool is incorrect: $negative" +fi + +# selling decision +echo "------------selling decision again------------" +ununifid tx nftbackedloan selling-decision \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "============check nft status selling_decision ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 + +# pay remainder +echo "------------pay remainder------------" +ununifid tx nftbackedloan pay-remainder \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 \ +--from user3 --keyring-backend test --chain-id test --yes + +echo "wait.......... NftListingFullPaymentPeriod: 30s" +sleep 30 + +echo "============check nft status successful_bid ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 +echo "wait.......... NftListingNftDeliveryPeriod: 30s" +sleep 30 + +user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +# + 100 + 50(forfeited deposit) - 7.5 (5% fee) +expected_user1_balance=$(($init_user1_balance + 143)) + +if [ "$user1_balance" = "$expected_user1_balance" ]; then + echo "pass: owner balance is correct: $user1_balance" +else + echo "error: owner balance is incorrect" + echo "expected: $expected_user1_balance actual: $user1_balance" +fi + +owner=$(ununifid q nft owner ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a02 -o json | jq .owner | tr -d '"') +# user3 +expected_owner="ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6" + +if [ "$owner" = "$expected_owner" ]; then + echo "pass: Owner is changed to $owner" +else + echo "error: Owner is not changed from $owner" + echo "expected: $expected_owner actual: $owner" +fi + +echo "------------check nft------------" +ununifid q nft nft ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a01 diff --git a/x/nftbackedloan/keeper/test/03_liquidation.sh b/x/nftbackedloan/keeper/test/03_liquidation.sh new file mode 100644 index 000000000..9c6268a8c --- /dev/null +++ b/x/nftbackedloan/keeper/test/03_liquidation.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# block speed +sleep=5 + +init_user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +init_user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 \ +--bid-token uguu --min-deposit-rate 0.1 --min-bidding-period-hours 0.005 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user2 +echo "------------bid nft from user2------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 \ +200uguu 50uguu 0.1 30 --automatic-payment=false --from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +# borrow +echo "------------borrow------------" +ununifid tx nftbackedloan borrow \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 \ +ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla 40uguu \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "wait.......... Bid expire" +sleep 30 + +echo "============check nft status liquidation ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 + +# pay remainder +echo "------------pay remainder------------" +ununifid tx nftbackedloan pay-remainder \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep +echo "wait.......... NftListingFullPaymentPeriod: 30s" +sleep 30 + +echo "============check nft status successful_bid ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 + +echo "wait.......... NftListingNftDeliveryPeriod: 30s" +sleep 30 + +# check bidder balance +user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +# -200 +expected_user2_balance=$(($init_user2_balance - 200)) + +if [ "$user2_balance" = "$expected_user2_balance" ]; then + echo "pass: bidder balance is correct: $user2_balance" +else + echo "error: bidder balance is incorrect" + echo "expected: $expected_user2_balance actual: $user2_balance" +fi + +user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +# + 40 (borrow) + 160 - 8(fee) = 192 +expected_user1_balance=$(($init_user1_balance + 192)) + +if [ "$user1_balance" = "$expected_user1_balance" ]; then + echo "pass: owner balance is correct: $user1_balance" +else + echo "error: owner balance is incorrect:" + echo "expected: $expected_user1_balance actual: $user1_balance +fi + +owner=$(ununifid q nft owner ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a03 -o json | jq .owner | tr -d '"') +# user2 +expected_owner="ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla" + +if [ "$owner" = "$expected_owner" ]; then + echo "pass: Owner is changed to $owner" +else + echo "error: Owner is not changed from $owner" + echo "expected: $expected_owner actual: $owner" +fi diff --git a/x/nftbackedloan/keeper/test/04_liquidation_not_paid.sh b/x/nftbackedloan/keeper/test/04_liquidation_not_paid.sh new file mode 100644 index 000000000..6567c32bf --- /dev/null +++ b/x/nftbackedloan/keeper/test/04_liquidation_not_paid.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +# block speed +sleep=5 + +init_user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +init_user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a04 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a04 \ +--bid-token uguu --min-deposit-rate 0.1 --min-bidding-period-hours 0.005 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user2 +echo "------------bid nft from user2------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a04 \ +200uguu 50uguu 0.1 30 --automatic-payment=false --from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +# borrow +echo "------------borrow------------" +ununifid tx nftbackedloan borrow \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a04 \ +ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla 40uguu \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +echo "wait.......... Bid expire" +sleep 30 + +echo "============check nft status liquidation ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a04 + +# not pay remainder +echo "wait.......... NftListingFullPaymentPeriod: 30s" +sleep 30 + +# check bidder balance +user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +# -50 +expected_user2_balance=$((init_user2_balance - 50)) + +if [ "$user2_balance" = "$expected_user2_balance" ]; then + echo "pass: bidder balance is correct: $user2_balance" +else + echo "error: bidder balance is incorrect" + echo "expected: $expected_user2_balance actual: $user2_balance +fi + +user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +# + 40 (borrow) + 50 - 40 = 50 +expected_user1_balance=$((init_user1_balance + 50)) + +if [ "$user1_balance" = "$expected_user1_balance" ]; then + echo "pass: owner balance is correct: $user1_balance" +else + echo "error: owner balance is incorrect" + echo "expected: $expected_user1_balance actual: $user1_balance" +fi + +owner=$(ununifid q nft owner ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a04 -o json | jq .owner | tr -d '"') +# user1 +expected_owner="ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w" + +if [ "$owner" = "$expected_owner" ]; then + echo "pass: Owner is changed to $owner" +else + echo "error: Owner is not changed from $owner" + echo "expected: $expected_owner actual: $owner" +fi diff --git a/x/nftbackedloan/keeper/test/05_liquidation_deposit_forfeiture.sh b/x/nftbackedloan/keeper/test/05_liquidation_deposit_forfeiture.sh new file mode 100644 index 000000000..6fc391fcd --- /dev/null +++ b/x/nftbackedloan/keeper/test/05_liquidation_deposit_forfeiture.sh @@ -0,0 +1,111 @@ +#!/bin/sh + +# block speed +sleep=5 + +init_user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +init_user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +init_user3_balance=$(ununifid q bank balances ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6 --denom uguu -o json | jq .amount | tr -d '"') + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 \ +--bid-token uguu --min-deposit-rate 0.1 --min-bidding-period-hours 0.005 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user2 +echo "------------bid nft from user2------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 \ +200uguu 100uguu 0.1 30 --automatic-payment=false --from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user3 (auto payment) +echo "------------bid nft from user3------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 \ +140uguu 20uguu 0.2 36 --from user3 --keyring-backend test --chain-id test --yes + +sleep $sleep + +# borrow +echo "------------borrow------------" +ununifid tx nftbackedloan borrow \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 \ +ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla 100uguu \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +ununifid q nftbackedloan nft-bids ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 + +echo "wait.......... Bid expire" +sleep 30 + +echo "============check nft status liquidation ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 +ununifid q nftbackedloan nft-bids ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 + +# not pay remainder +echo "wait.......... NftListingFullPaymentPeriod: 30s" +sleep 30 + +echo "============check nft status successful_bid ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 + +echo "wait.......... NftListingNftDeliveryPeriod: 30s" +sleep 30 + +# check forfeited bidder balance +user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +# -100 (deposit) +expected_user2_balance=$((init_user2_balance - 100)) + +if [ "$user2_balance" = "$expected_user2_balance" ]; then + echo "pass: forfeited bidder balance is correct: $user2_balance" +else + echo "error: forfeited bidder balance is incorrect" + echo "expected: $expected_user2_balance actual: $user2_balance +fi + +# check win bidder balance +user3_balance=$(ununifid q bank balances ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6 --denom uguu -o json | jq .amount | tr -d '"') +# -140 (bid price) +expected_user3_balance=$((init_user3_balance - 140)) + +if [ "$user3_balance" = "$expected_user3_balance" ]; then + echo "pass: win bidder balance is correct: $user3_balance" +else + echo "error: win bidder balance is incorrect" + echo "expected: $expected_user3_balance actual: $user3_balance +fi + +user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +# + 100 (borrow) + 240 - 100 - 7(fee) = 233 +expected_user1_balance=$((init_user1_balance + 233)) + +if [ "$user1_balance" = "$expected_user1_balance" ]; then + echo "pass: owner balance is correct: $user1_balance" +else + echo "error: owner balance is incorrect" + echo "expected: $expected_user1_balance actual: $user1_balance" +fi + +owner=$(ununifid q nft owner ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a05 -o json | jq .owner | tr -d '"') +# user3 +expected_owner="ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6" + +if [ "$owner" = "$expected_owner" ]; then + echo "pass: Owner is changed to $owner" +else + echo "error: Owner is not changed from $owner" + echo "expected: $expected_owner actual: $owner" +fi diff --git a/x/nftbackedloan/keeper/test/06_liquidation_deposit_refund.sh b/x/nftbackedloan/keeper/test/06_liquidation_deposit_refund.sh new file mode 100644 index 000000000..a51d3fa44 --- /dev/null +++ b/x/nftbackedloan/keeper/test/06_liquidation_deposit_refund.sh @@ -0,0 +1,111 @@ +#!/bin/sh + +# block speed +sleep=5 + +init_user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +init_user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +init_user3_balance=$(ununifid q bank balances ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6 --denom uguu -o json | jq .amount | tr -d '"') + +# mint nft +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# list nft +echo "------------list nft------------" +ununifid tx nftbackedloan list \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 \ +--bid-token uguu --min-deposit-rate 0.1 --min-bidding-period-hours 0.005 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user2 (auto payment) +echo "------------bid nft from user2------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 \ +200uguu 40uguu 0.1 36 --from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep +# bid nft from user3 (auto payment) +echo "------------bid nft from user3------------" +ununifid tx nftbackedloan place-bid \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 \ +140uguu 50uguu 0.2 30 --from user3 --keyring-backend test --chain-id test --yes + +sleep $sleep + +# borrow +echo "------------borrow------------" +ununifid tx nftbackedloan borrow \ +ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 \ +ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6 60uguu \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep +ununifid q nftbackedloan nft-bids ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 + +echo "wait.......... Bid expire" +sleep 30 + +echo "============check nft status liquidation ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 +ununifid q nftbackedloan nft-bids ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 + +# not pay remainder +echo "wait.......... NftListingFullPaymentPeriod: 30s" +sleep 30 + +echo "============check nft status successful_bid ============" +ununifid q nftbackedloan nft-listing ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 + +echo "wait.......... NftListingNftDeliveryPeriod: 30s" +sleep 30 + +# check refund bidder balance +user2_balance=$(ununifid q bank balances ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla --denom uguu -o json | jq .amount | tr -d '"') +# +0 (interest) +expected_user2_balance=$((init_user2_balance + 0)) + +if [ "$user2_balance" = "$expected_user2_balance" ]; then + echo "pass: refund bidder balance is correct: $user2_balance" +else + echo "error: refund bidder balance is incorrect" + echo "expected: $expected_user2_balance actual: $user2_balance +fi + +# check win bidder balance +user3_balance=$(ununifid q bank balances ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6 --denom uguu -o json | jq .amount | tr -d '"') +# -140 (bid price) +expected_user3_balance=$((init_user3_balance - 140)) + +if [ "$user3_balance" = "$expected_user3_balance" ]; then + echo "pass: win bidder balance is correct: $user3_balance" +else + echo "error: win bidder balance is incorrect" + echo "expected: $expected_user3_balance actual: $user3_balance +fi + +user1_balance=$(ununifid q bank balances ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --denom uguu -o json | jq .amount | tr -d '"') +# + 50 (borrow) + 140 - 50 - 4(fee) = 136 +expected_user1_balance=$((init_user1_balance + 136)) + +if [ "$user1_balance" = "$expected_user1_balance" ]; then + echo "pass: owner balance is correct: $user1_balance" +else + echo "error: owner balance is incorrect" + echo "expected: $expected_user1_balance actual: $user1_balance" +fi + +owner=$(ununifid q nft owner ununifi-1AFC3C85B52311F13161F724B284EF900458E3B3 a06 -o json | jq .owner | tr -d '"') +# user3 +expected_owner="ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6" + +if [ "$owner" = "$expected_owner" ]; then + echo "pass: Owner is changed to $owner" +else + echo "error: Owner is not changed from $owner" + echo "expected: $expected_owner actual: $owner" +fi diff --git a/x/nftbackedloan/keeper/test/README.md b/x/nftbackedloan/keeper/test/README.md new file mode 100644 index 000000000..dcb7512f3 --- /dev/null +++ b/x/nftbackedloan/keeper/test/README.md @@ -0,0 +1,49 @@ +# NFT Backed Loan Keeper Test + +Before run debug `build then launch` +When re-run same script, chain needs to be initialized. + +Each `.sh` uses functions of `nft_listing.go` & test the following value. + +## Selling NFT + +### 01_selling_decision + +Successful sale of NFT + +- The lister get Bid price - fee +- The bidder lose Bid price +- The NFT Transfer + +### 02_selling_decision_no_paid + +Decided to sell, but the bidder did not pay. + +- The Deposit forfeiture from 1st bidder +- The collect_amount add forfeited deposit +- The collect_amount is reflected in the next selling_decision +- The NFT Transfer (2nd selling_decision) + +### 03_Liquidation + +- The bidder lose Bid price +- The lister get (Bid price - borrow) - fee +- The NFT Transfer + +### 04_Liquidation_no_paid + +- The bidder lose deposit +- The Lister get (forfeited deposit - borrow) +- The NFT return to lister + +### 05_liquidation_deposit_forfeiture + +- The bidder(user2) lose deposit. +- The bidder(user3) pay bid price & get NFT. +- The owner get price & forfeited deposit. + +### 06_liquidation_deposit_refund + +- The bidder(user2) get refund. +- The bidder(user3) pay bid price & get NFT. +- The owner get price. diff --git a/x/nftbackedloan/keeper/utils.go b/x/nftbackedloan/keeper/utils.go index 936d25bd7..33b8967c6 100644 --- a/x/nftbackedloan/keeper/utils.go +++ b/x/nftbackedloan/keeper/utils.go @@ -1,6 +1,9 @@ package keeper import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/x/nftbackedloan/types" @@ -15,15 +18,15 @@ func Contains(a []string, x string) bool { return false } -func validateListNftMsg(k Keeper, ctx sdk.Context, msg *types.MsgListNft) error { +func ValidateListNftMsg(k Keeper, ctx sdk.Context, msg *types.MsgListNft) error { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return err } - return checkListNft(k, ctx, sender, msg.NftId, msg.BidToken, msg.MinimumDepositRate) + return CheckListNft(k, ctx, sender, msg.NftId, msg.BidDenom, msg.MinDepositRate) } -func checkListNft(k Keeper, ctx sdk.Context, sender sdk.AccAddress, nftId types.NftIdentifier, bidToken string, minimumDepositRate sdk.Dec) error { +func CheckListNft(k Keeper, ctx sdk.Context, sender sdk.AccAddress, nftId types.NftId, bidToken string, minimumDepositRate sdk.Dec) error { // check listing already exists _, err := k.GetNftListingByIdBytes(ctx, nftId.IdBytes()) if err == nil { @@ -31,13 +34,13 @@ func checkListNft(k Keeper, ctx sdk.Context, sender sdk.AccAddress, nftId types. } // Check nft exists - _, found := k.nftKeeper.GetNFT(ctx, nftId.ClassId, nftId.NftId) + _, found := k.nftKeeper.GetNFT(ctx, nftId.ClassId, nftId.TokenId) if !found { return types.ErrNftDoesNotExists } // check ownership of nft - owner := k.nftKeeper.GetOwner(ctx, nftId.ClassId, nftId.NftId) + owner := k.nftKeeper.GetOwner(ctx, nftId.ClassId, nftId.TokenId) if owner.String() != sender.String() { return types.ErrNotNftOwner } @@ -46,9 +49,26 @@ func checkListNft(k Keeper, ctx sdk.Context, sender sdk.AccAddress, nftId types. return types.ErrNotSupportedBidToken } - if minimumDepositRate.GTE(sdk.MustNewDecFromStr("0.5")) { - return types.ErrMinimumDepositRateTooHigh + return nil +} + +func GetMemo(txBytes []byte, txCfg client.TxConfig) string { + /// NOTE: this way requires txConfig by importing it into keeper struct + txData, err := txCfg.TxDecoder()(txBytes) + if err != nil { + fmt.Printf("err: %v\n", err) + + txData, err = txCfg.TxJSONDecoder()(txBytes) + if err != nil { + fmt.Printf("err: %v\n", err) + } } - return nil + txBldr, err := txCfg.WrapTxBuilder(txData) + if err != nil { + return "" + } + memo := txBldr.GetTx().GetMemo() + + return memo } diff --git a/x/nftbackedloan/module.go b/x/nftbackedloan/module.go index eab37177e..2e3956024 100644 --- a/x/nftbackedloan/module.go +++ b/x/nftbackedloan/module.go @@ -1,4 +1,4 @@ -package nftmarket +package nftbackedloan import ( "context" diff --git a/x/nftbackedloan/spec/01_state.md b/x/nftbackedloan/spec/01_state.md index 4f70071af..8e3efeb57 100644 --- a/x/nftbackedloan/spec/01_state.md +++ b/x/nftbackedloan/spec/01_state.md @@ -9,16 +9,13 @@ order: 1 `NftListing` is created when a nft is listed for sell by owner. ```protobuf -enum ListingType { - DIRECT_ASSET_BORROW = 0; - SYNTHETIC_ASSET_CREATION = 1; -} enum ListingState { - SELLING = 0; - BIDDING = 1; - LIQUIDATION = 2; - END_LISTING = 3; - SUCCESSFUL_BID = 4; + UNKNOWN = 0; + LISTING = 1; + BIDDING = 2; + SELLING_DECISION = 3; + LIQUIDATION = 4; + SUCCESSFUL_BID = 5; } message NftIdentifier { @@ -47,10 +44,10 @@ message NftListing { message NftBid { NftIdentifier nft_id = 1 [ (gogoproto.nullable) = false ]; string bidder = 2; - cosmos.base.v1beta1.Coin bid_amount = 3 [ (gogoproto.nullable) = false ]; - cosmos.base.v1beta1.Coin deposit_amount = 4 [ (gogoproto.nullable) = false ]; - google.protobuf.Timestamp bidding_period = 5 [ (gogoproto.nullable) = false ]; - uint64 deposit_lending_rate = 6 [ (gogoproto.nullable) = false ]; + cosmos.base.v1beta1.Coin price = 3 [ (gogoproto.nullable) = false ]; + cosmos.base.v1beta1.Coin deposit = 4 [ (gogoproto.nullable) = false ]; + google.protobuf.Timestamp expiry = 5 [ (gogoproto.nullable) = false ]; + uint64 interest_rate = 6 [ (gogoproto.nullable) = false ]; bool automatic_payment = 7; } ``` diff --git a/x/nftbackedloan/spec/02_messages.md b/x/nftbackedloan/spec/02_messages.md index 096e24c79..6d3d058f0 100644 --- a/x/nftbackedloan/spec/02_messages.md +++ b/x/nftbackedloan/spec/02_messages.md @@ -4,7 +4,7 @@ order: 2 # Messages -In this section we describe the processing of the nftmarket messages. +In this section we describe the processing of the nftbackedloan messages. ## MsgListNft @@ -107,10 +107,10 @@ message MsgEndNftListing { ``` -## MsgPayFullBid +## MsgPayRemainder ```protobuf -message MsgPayFullBid { +message MsgPayRemainder { string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"", (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", diff --git a/x/nftbackedloan/spec/03_events.md b/x/nftbackedloan/spec/03_events.md index c99e982e6..69e294c95 100644 --- a/x/nftbackedloan/spec/03_events.md +++ b/x/nftbackedloan/spec/03_events.md @@ -41,7 +41,7 @@ The `nftmarket` module emits the following events: | Type | Attribute Key | Attribute Value | | ---- | ------------- | --------------- | -## MsgPayFullBid +## MsgPayRemainder | Type | Attribute Key | Attribute Value | | ---- | ------------- | --------------- | diff --git a/x/nftbackedloan/types/bid.go b/x/nftbackedloan/types/bid.go index 93bcc7bac..211f1ce81 100644 --- a/x/nftbackedloan/types/bid.go +++ b/x/nftbackedloan/types/bid.go @@ -5,449 +5,228 @@ import ( time "time" sdk "github.com/cosmos/cosmos-sdk/types" + + osmomath "github.com/UnUniFi/chain/osmomath" ) -func (m NftBid) Equal(b NftBid) bool { - return m.Bidder == b.Bidder && m.NftId == b.NftId && m.BidAmount.Equal(b.BidAmount) +func (m Bid) Equal(b Bid) bool { + if m.IsNil() || b.IsNil() { + if m.IsNil() && b.IsNil() { + return true + } else { + return false + } + } + return m.Id.Bidder == b.Id.Bidder && m.Id.NftId.ClassId == b.Id.NftId.ClassId && m.Id.NftId.TokenId == b.Id.NftId.TokenId && m.Price.Equal(b.Price) } -func (m NftBid) IsLT(b NftBid) bool { - if b.BidAmount.IsLTE(m.BidAmount) { +func (m Bid) IsLT(b Bid) bool { + if b.Price.IsLTE(m.Price) { return false } - if b.DepositAmount.IsLTE(m.DepositAmount) { + if b.Deposit.IsLTE(m.Deposit) { return false } - if b.DepositLendingRate.GTE(m.DepositLendingRate) { + if b.InterestRate.GTE(m.InterestRate) { return false } return true } -func (m NftBid) GetIdToByte() []byte { - return NftBidBytes(m.NftId.ClassId, m.NftId.NftId, m.Bidder) +func (m Bid) GetIdToByte() []byte { + return NftBidBytes(m.Id.NftId.ClassId, m.Id.NftId.TokenId, m.Id.Bidder) } -// todo check test -func (m NftBid) GetIdToString() string { - return string(NftBidBytes(m.NftId.ClassId, m.NftId.NftId, m.Bidder)) +func (m Bid) IsBorrowed() bool { + return m.Loan.Amount.IsPositive() } -func (m NftBid) IsBorrowing() bool { - return len(m.Borrowings) != 0 +func (m Bid) LiquidationAmount(time time.Time) sdk.Coin { + interestAmount := m.CalcCompoundInterest(m.Loan.Amount, m.Loan.LastRepaidAt, time) + return m.Loan.Amount.Add(interestAmount) } -func (m NftBid) LiquidationAmount(endTime time.Time) sdk.Coin { - liquidationAmount := sdk.NewCoin(m.DepositAmount.Denom, sdk.ZeroInt()) - for _, v := range m.Borrowings { - liquidationAmount = liquidationAmount.Add(v.Amount) - liquidationAmount = liquidationAmount.Add(m.CalcInterest(v.Amount, m.DepositLendingRate, v.StartAt, endTime)) - liquidationAmount = liquidationAmount.Sub(v.PaidInterestAmount) - } - return liquidationAmount -} - -func (m NftBid) BorrowingAmount() sdk.Coin { - BorrowingAmount := sdk.NewCoin(m.DepositAmount.Denom, sdk.ZeroInt()) - for _, v := range m.Borrowings { - BorrowingAmount = BorrowingAmount.Add(v.Amount) - BorrowingAmount = BorrowingAmount.Sub(v.PaidInterestAmount) - } - return BorrowingAmount +func (m Bid) CompoundInterest(end time.Time) sdk.Coin { + return m.CalcCompoundInterest(m.Loan.Amount, m.Loan.LastRepaidAt, end) } -func (m NftBid) BorrowableAmount() sdk.Coin { - borrowableAmount := m.DepositAmount - borrowabingAmount := sdk.NewCoin(m.DepositAmount.Denom, sdk.ZeroInt()) - for _, v := range m.Borrowings { - borrowabingAmount = borrowabingAmount.Add(v.Amount) - borrowabingAmount = borrowabingAmount.Sub(v.PaidInterestAmount) +func (m Bid) CalcCompoundInterest(lendCoin sdk.Coin, startTime time.Time, endTime time.Time) sdk.Coin { + lendingDuration := endTime.Sub(startTime) + if lendingDuration <= 0 { + return sdk.NewCoin(lendCoin.Denom, sdk.ZeroInt()) } - return borrowableAmount.Sub(borrowabingAmount) -} - -func (m NftBid) CalcInterest(lendCoin sdk.Coin, lendingRate sdk.Dec, start, end time.Time) sdk.Coin { - lendingDuration := end.Sub(start) oneYearDays := sdk.NewInt(365) oneDayHours := sdk.NewInt(24) - - yearInterest := lendingRate.Mul(sdk.NewDecFromInt(lendCoin.Amount)) durationUnitsYear := sdk.NewDecFromInt(sdk.NewInt(int64(lendingDuration.Hours()))).QuoInt(oneDayHours).QuoInt(oneYearDays) - result := durationUnitsYear.Mul(yearInterest) + e := osmomath.NewDecWithPrec(2718281, 6) // 2.718281 + interestRateBidDec := osmomath.BigDecFromSDKDec(m.InterestRate) + durationBigDec := osmomath.BigDecFromSDKDec(durationUnitsYear) + // compoundInterestRate = exp ^ (interestRate * duration) - 1 + compoundRate := e.Power(interestRateBidDec.Mul(durationBigDec)).Sub(osmomath.OneDec()).SDKDec() + result := sdk.NewDecFromInt(lendCoin.Amount).Mul(compoundRate) return sdk.NewCoin(lendCoin.Denom, result.RoundInt()) } -func (m NftBid) CalcInterestF() func(lendCoin sdk.Coin, start, end time.Time) sdk.Coin { - f := func(rate sdk.Dec) func(lendCoin sdk.Coin, start, end time.Time) sdk.Coin { - return func(lendCoin sdk.Coin, start, end time.Time) sdk.Coin { - return m.CalcInterest(lendCoin, rate, start, end) +func (m Bid) RepayInfo(repayAmount sdk.Coin, repaymentTime time.Time) RepayInfo { + interest := m.CalcCompoundInterest(m.Loan.Amount, m.Loan.LastRepaidAt, repaymentTime) + total := m.Loan.Amount.Add(interest) + + if repayAmount.IsGTE(total) { + remainingAmount := sdk.NewCoin(m.Loan.Amount.Denom, sdk.ZeroInt()) + return RepayInfo{ + RepaidAmount: total, + RepaidInterestAmount: interest, + RemainingAmount: remainingAmount, + LastRepaidAt: repaymentTime, + } + } else { + remainingAmount := total.Sub(repayAmount) + return RepayInfo{ + RepaidAmount: repayAmount, + RepaidInterestAmount: interest, + RemainingAmount: remainingAmount, + LastRepaidAt: repaymentTime, } } - return f(m.DepositLendingRate) } -func (m NftBid) TotalInterestAmount(endTime time.Time) sdk.Coin { - totalInterestAmount := sdk.NewCoin(m.InterestAmount.Denom, m.InterestAmount.Amount) - for _, v := range m.Borrowings { - totalInterestAmount = totalInterestAmount.Add(m.CalcInterest(v.Amount, m.DepositLendingRate, v.StartAt, endTime)) - } - return totalInterestAmount -} +func (m Bid) RepayInfoInFull(repaymentTime time.Time) RepayInfo { + m.RepayInfo(m.Loan.Amount, repaymentTime) + interest := m.CalcCompoundInterest(m.Loan.Amount, m.Loan.LastRepaidAt, repaymentTime) + total := m.Loan.Amount.Add(interest) -func (m NftBid) TotalInterestAmountDec(endTime time.Time) sdk.DecCoin { - totalInterestAmount := sdk.NewDecCoin(m.InterestAmount.Denom, m.InterestAmount.Amount) - for _, v := range m.Borrowings { - interest := m.CalcInterest(v.Amount, m.DepositLendingRate, v.StartAt, endTime) - totalInterestAmount = totalInterestAmount.Add(sdk.NewDecCoin(interest.Denom, interest.Amount)) + remainingAmount := sdk.NewCoin(m.Loan.Amount.Denom, sdk.ZeroInt()) + return RepayInfo{ + RepaidAmount: total, + RepaidInterestAmount: interest, + RemainingAmount: remainingAmount, + LastRepaidAt: repaymentTime, } - return totalInterestAmount } -func (m NftBid) FullPaidAmount() sdk.Coin { - return m.PaidAmount.Add(m.DepositAmount) +func (m Bid) BidderPaidAmount() sdk.Coin { + return m.PaidAmount.Add(m.Deposit) } -func (m NftBid) IsPaidBidAmount() bool { - fullPaidAmount := m.FullPaidAmount() - return fullPaidAmount.Equal(m.BidAmount) +func (m Bid) IsPaidSalePrice() bool { + fullPaidAmount := m.BidderPaidAmount() + return fullPaidAmount.Equal(m.Price) } -func (m NftBid) CanCancel() bool { - return !m.IsBorrowing() +func (m Bid) CanCancel() bool { + return !m.IsBorrowed() } -func (m NftBid) CanReBid() bool { - return !m.IsBorrowing() +func (m Bid) CanReBid() bool { + return !m.IsBorrowed() } -func (m NftBid) IsNil() bool { - return m.Bidder == "" +func (m Bid) IsNil() bool { + return m.Id.Bidder == "" } -type NftBids []NftBid - -func (m NftBids) SortBorrowing() NftBids { - return m.SortLowerLendingRate() -} - -func (m NftBids) SortRepay() NftBids { - return m.SortHigherLendingRate() -} - -func (m NftBids) SortLiquidation() NftBids { - return m.SortDepositAboveAvgBid() -} +type NftBids []Bid -func (m NftBids) SortLowerLendingRate() NftBids { - dest := NftBids{} - dest = append(NftBids{}, m...) +func (m NftBids) SortLowerInterestRate() NftBids { + dest := append(NftBids{}, m...) sort.SliceStable(dest, func(i, j int) bool { - return dest[i].DepositLendingRate.LT(dest[j].DepositLendingRate) + return dest[i].InterestRate.LT(dest[j].InterestRate) }) return dest } -func (m NftBids) SortHigherLendingRate() NftBids { - dest := NftBids{} - dest = append(NftBids{}, m...) +func (m NftBids) SortHigherInterestRate() NftBids { + dest := append(NftBids{}, m...) sort.SliceStable(dest, func(i, j int) bool { - return dest[i].DepositLendingRate.GT(dest[j].DepositLendingRate) + return dest[i].InterestRate.GT(dest[j].InterestRate) }) return dest } -func (m NftBids) SortDepositAboveAvgBid() NftBids { - dest := NftBids{} - if len(m) == 0 { - return dest - } - qDash := m.GetAverageBidAmount() - dest = append(NftBids{}, m...) +func (m NftBids) SortLowerExpiryDate() NftBids { + dest := append(NftBids{}, m...) sort.SliceStable(dest, func(i, j int) bool { - if dest[i].BidAmount.IsLT(qDash) { - return false - } - if dest[j].BidAmount.IsLT(qDash) { - return true - } - return dest[i].DepositAmount.IsGTE(dest[j].DepositAmount) + return dest[i].Expiry.Before(dest[j].Expiry) }) return dest } -func (m NftBids) SortLowerBiddingPeriod() NftBids { - dest := NftBids{} - dest = append(NftBids{}, m...) +func (m NftBids) SortHigherDeposit() NftBids { + dest := append(NftBids{}, m...) sort.SliceStable(dest, func(i, j int) bool { - return dest[i].BiddingPeriod.Before(dest[j].BiddingPeriod) + return dest[i].Deposit.IsGTE(dest[j].Deposit) }) return dest } -func (m NftBids) SortHigherDeposit() NftBids { - dest := NftBids{} - dest = append(NftBids{}, m...) +func (m NftBids) SortHigherPrice() NftBids { + dest := append(NftBids{}, m...) sort.SliceStable(dest, func(i, j int) bool { - return dest[i].DepositAmount.IsGTE(dest[j].DepositAmount) + return dest[i].Price.IsGTE(dest[j].Deposit) }) return dest } -func (m NftBids) GetAverageBidAmount() sdk.Coin { +func (m NftBids) GetHighestBid() (Bid, error) { if len(m) == 0 { - return sdk.Coin{} + return Bid{}, ErrBidDoesNotExists } - denom := m[0].BidAmount.Denom - totalAmount := sdk.NewCoin(denom, sdk.ZeroInt()) + highestBid := m[0] for _, bid := range m { - totalAmount = totalAmount.Add(bid.BidAmount) - } - return sdk.NewCoin(denom, totalAmount.Amount.Quo(sdk.NewInt(int64(len(m))))) -} - -func (m NftBids) GetHighestBid() NftBid { - highestBidder := NftBid{ - BidAmount: sdk.NewCoin(m[0].BidAmount.Denom, sdk.ZeroInt()), - } - for _, bid := range m { - if highestBidder.BidAmount.IsLT(bid.BidAmount) { - highestBidder = bid + if highestBid.Price.IsLT(bid.Price) { + highestBid = bid } } - return highestBidder + return highestBid, nil } -func (m NftBids) GetBidByBidder(bidder string) NftBid { +func (m NftBids) GetBidByBidder(bidder string) Bid { for _, bid := range m { - if bid.Bidder == bidder { + if bid.Id.Bidder == bidder { return bid } } - return NftBid{} + return Bid{} } -func (m NftBids) RemoveBid(targetBid NftBid) NftBids { +func (m NftBids) RemoveBid(targetBid Bid) NftBids { return m.RemoveBids(NftBids{targetBid}) } func (m NftBids) RemoveBids(excludeBids NftBids) NftBids { excludeList := make(map[string]bool) for _, s := range excludeBids { - excludeList[s.Bidder] = true + excludeList[s.Id.Bidder] = true } var newArr NftBids for _, s := range m { - if !excludeList[s.Bidder] { + if !excludeList[s.Id.Bidder] { newArr = append(newArr, s) } } return newArr } -func (m NftBids) MakeExcludeExpiredBids(expiredBids NftBids) NftBids { - return m.RemoveBids(expiredBids) -} - -func (m NftBids) MakeBorrowedBidExcludeExpiredBids(borrowAmount sdk.Coin, start time.Time, expiredBids NftBids) NftBids { - newBids := m.MakeExcludeExpiredBids(expiredBids) - newBids.BorrowFromBids(borrowAmount, start) - return newBids -} -func (m NftBids) MakeCollectBidsAndRefundBids() (NftBids, NftBids) { - collectedBids := NftBids{} - refundBids := NftBids{} - existWinner := false - for _, bid := range m { - if existWinner { - if bid.IsPaidBidAmount() { - existWinner = true - continue - } else { - collectedBids = append(collectedBids, bid) - } - } - refundBids = append(refundBids, bid) - } - return collectedBids, refundBids -} - -// get winner bid -func (m NftBids) GetWinnerBid() NftBid { - for _, bid := range m { - if bid.IsPaidBidAmount() { - return bid - } - } - return NftBid{} -} - -func (m *NftBids) BorrowFromBids(borrowAmount sdk.Coin, start time.Time) { - bids := []NftBid(*m) - for i := 0; i < len(bids); i++ { - bid := &bids[i] - if borrowAmount.IsZero() { - break - } - - usableAmount := bid.BorrowableAmount() - if usableAmount.Amount.IsZero() { - continue - } - - // bigger msg Amount - if borrowAmount.IsGTE(usableAmount) { - borrow := Borrowing{ - Amount: sdk.NewCoin(usableAmount.Denom, usableAmount.Amount), - StartAt: start, - PaidInterestAmount: sdk.NewCoin(usableAmount.Denom, sdk.ZeroInt()), - } - bid.Borrowings = append(bid.Borrowings, borrow) - borrowAmount = borrowAmount.Sub(borrow.Amount) - } else { - borrow := Borrowing{ - Amount: sdk.NewCoin(borrowAmount.Denom, borrowAmount.Amount), - StartAt: start, - PaidInterestAmount: sdk.NewCoin(borrowAmount.Denom, sdk.ZeroInt()), - } - bid.Borrowings = append(bid.Borrowings, borrow) - borrowAmount.Amount = sdk.ZeroInt() - } - // todo: execute func - // k.SetBid(ctx, bid) - - } -} - -func (m NftBids) BorrowableAmount(denom string) sdk.Coin { - coin := sdk.NewCoin(denom, sdk.ZeroInt()) - for _, s := range m { - coin = coin.Add(s.BorrowableAmount()) - } - return coin -} - -func (m NftBids) TotalDeposit() sdk.Coin { +func (m NftBids) TotalBorrowedAmount() sdk.Coin { if len(m) == 0 { return sdk.Coin{} } - coin := sdk.NewCoin(m[0].DepositAmount.Denom, sdk.ZeroInt()) - for _, s := range m { - coin = coin.Add(s.DepositAmount) + coin := sdk.NewCoin(m[0].Loan.Amount.Denom, sdk.ZeroInt()) + for _, bid := range m { + coin = coin.Add(bid.Loan.Amount) } return coin } -func (m NftBids) TotalInterestAmount(end time.Time) sdk.Coin { +func (m NftBids) TotalCompoundInterest(end time.Time) sdk.Coin { if len(m) == 0 { return sdk.Coin{} } - coin := sdk.NewCoin(m[0].DepositAmount.Denom, sdk.ZeroInt()) + coin := sdk.NewCoin(m[0].Loan.Amount.Denom, sdk.ZeroInt()) for _, bid := range m { - coin = coin.Add(bid.TotalInterestAmount(end)) + coin = coin.Add(bid.CalcCompoundInterest(bid.Loan.Amount, bid.Loan.LastRepaidAt, end)) } return coin } - -func (m NftBids) LiquidationAmount(denom string, end time.Time) sdk.Coin { - coin := sdk.NewCoin(denom, sdk.ZeroInt()) - for _, s := range m { - coin = coin.Add(s.LiquidationAmount(end)) - } - return coin -} - -func (m NftBids) FindKickOutBid(newBid NftBid, end time.Time) NftBid { - HigherDepositBids := m.SortHigherDeposit() - kickOutBid := NftBid{} - for _, b := range HigherDepositBids { - if b.IsLT(newBid) { - refundAmount := b.TotalInterestAmount(end) - refundAmount = refundAmount.Add(b.DepositAmount) - if refundAmount.IsLT(newBid.DepositAmount) { - kickOutBid = b - break - } - } - } - return kickOutBid -} - -// todo: add proto then use it -type RepayReceipt struct { - Charge sdk.Coin - PaidInterestAmount sdk.Coin -} - -func (m *Borrowing) RepayThenGetReceipt(payAmount sdk.Coin, payTime time.Time, calcInterestF func(lendCoin sdk.Coin, start, end time.Time) sdk.Coin) RepayReceipt { - principal := m.Amount - interest := calcInterestF(principal, m.StartAt, payTime) - interest = interest.Sub(m.PaidInterestAmount) - paidInterestAmount := sdk.NewCoin(principal.Denom, sdk.ZeroInt()) - total := sdk.NewCoin(principal.Denom, sdk.ZeroInt()) - total = total.Add(principal).Add(interest) - // bigger msg Amount - if payAmount.IsGTE(total) { - // bid.InterestAmount = bid.InterestAmount.Add(interest) - payAmount = payAmount.Sub(total) - paidInterestAmount = paidInterestAmount.Add(interest) - m.Amount.Amount = sdk.ZeroInt() - m.PaidInterestAmount = m.PaidInterestAmount.Add(paidInterestAmount) - } else { - // bigger total Amount - if payAmount.IsGTE(interest) { - // can paid interest - if payAmount.Amount.GT(interest.Amount) { - // all paid interest and part paid principal - - // bid.InterestAmount = bid.InterestAmount.Add(interest) - payAmount = payAmount.Sub(interest) - m.Amount = principal.Sub(payAmount) - m.PaidInterestAmount.Amount = sdk.ZeroInt() - m.StartAt = payTime - - payAmount.Amount = sdk.ZeroInt() - paidInterestAmount = interest - } else { - // all paid interest - // bid.InterestAmount = bid.InterestAmount.Add(interest) - // m.PaidInterestAmount = m.PaidInterestAmount.Add(interest) - m.PaidInterestAmount = m.PaidInterestAmount.Add(interest) - paidInterestAmount = paidInterestAmount.Add(interest) - payAmount = payAmount.Sub(interest) - } - } else { - // can not paid interest - // bid.InterestAmount.Add(payAmount) - paidInterestAmount = payAmount - m.PaidInterestAmount = m.PaidInterestAmount.Add(payAmount) - payAmount.Amount = sdk.ZeroInt() - } - payAmount.Amount = sdk.ZeroInt() - } - return RepayReceipt{ - PaidInterestAmount: paidInterestAmount, - Charge: payAmount, - } -} - -func (m Borrowing) IsAllRepaid() bool { - return m.Amount.IsZero() -} - -func (a Borrowing) Equal(b Borrowing) bool { - return a.Amount.Equal(b.Amount) && - a.PaidInterestAmount.Equal(b.PaidInterestAmount) && - a.StartAt.Location() == b.StartAt.Location() -} - -func CalcPartInterest(total, surplus sdk.Int, interest sdk.DecCoin) sdk.Int { - if total.IsZero() { - return sdk.ZeroInt() - } - decTotalInterest := sdk.NewDecFromInt(total) - decSurplusAmount := sdk.NewDecFromInt(surplus) - rate := interest.Amount.Quo(decTotalInterest) - return decSurplusAmount.Mul(rate).TruncateInt() -} diff --git a/x/nftbackedloan/types/bid_test.go b/x/nftbackedloan/types/bid_test.go index 1f74ec6be..caf33f753 100644 --- a/x/nftbackedloan/types/bid_test.go +++ b/x/nftbackedloan/types/bid_test.go @@ -1,168 +1,51 @@ package types_test import ( - "fmt" "testing" "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" "github.com/UnUniFi/chain/x/nftbackedloan/types" ) -func TestBidEqual(t *testing.T) { +func TestIsBorrowed(t *testing.T) { testCases := []struct { name string - bida types.NftBid - bidb types.NftBid + bid types.Bid expResult bool }{ { - "equal pattern 1", - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - }, - }, - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - }, - }, - true, - }, - { - "equal pattern 2 difference deposit amount", - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, + "Exist Borrowing", + types.Bid{ Id: types.BidId{ - NftId: &types.NftIdentifier{ + NftId: &types.NftId{ ClassId: "a10", - NftId: "a10", + TokenId: "a10", }, Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, - }, - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(52)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), + LastRepaidAt: time.Now(), }, }, true, }, { - "difference bidder", - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, + "No borrowing", + types.Bid{ Id: types.BidId{ - NftId: &types.NftIdentifier{ + NftId: &types.NftId{ ClassId: "a10", - NftId: "a10", + TokenId: "a10", }, Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, - }, - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(52)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(0)), + LastRepaidAt: time.Now(), }, }, false, @@ -171,1103 +54,264 @@ func TestBidEqual(t *testing.T) { for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - result := tc.bida.Equal(tc.bidb) - if tc.expResult == result { - } else { - t.Error(tc.name, "not expect result") - } + result := tc.bid.IsBorrowed() + require.Equal(t, tc.expResult, result) }) } } -func TestCalcInterest(t *testing.T) { +func TestCalcCompoundInterest(t *testing.T) { + now := time.Now() + nextMonth := time.Now().Add(time.Hour * 24 * 30) + nextYear := time.Now().Add(time.Hour * 24 * 365) testCases := []struct { - name string - bida types.NftBid - lendCoin sdk.Coin - lendingRate sdk.Dec - start time.Time - end time.Time - expResult sdk.Coin + name string + bid types.Bid + lendCoin sdk.Coin + startTime time.Time + endTime time.Time + expResult sdk.Coin }{ { - "one year interest", - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, + "Interest test 1 month", + types.Bid{ Id: types.BidId{ - NftId: &types.NftIdentifier{ + NftId: &types.NftId{ ClassId: "a10", - NftId: "a10", + TokenId: "a10", }, Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, - }, - sdk.NewCoin("uguu", sdk.NewInt(100)), - sdk.MustNewDecFromStr("0.1"), - time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC).Add(time.Hour * 24 * 365), - sdk.NewCoin("uguu", sdk.NewInt(10)), - }, - { - "one day interest", - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, - Id: types.BidId{ - NftId: &types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(10000000)), + LastRepaidAt: now, }, }, - sdk.NewCoin("uguu", sdk.NewInt(100000)), - sdk.MustNewDecFromStr("0.1"), - time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC).Add(time.Hour * 24), - sdk.NewCoin("uguu", sdk.NewInt(27)), + sdk.NewCoin("uguu", sdk.NewInt(1000000)), + now, + nextMonth, + // 10000000 * e^(30/365 * 0.1) - 10000000 = 8253 + sdk.NewCoin("uguu", sdk.NewInt(8253)), }, { - "check round off", - types.NftBid{ - NftId: types.NftIdentifier{ - ClassId: "a10", - NftId: "a10", - }, - Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - BiddingPeriod: time.Now(), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - AutomaticPayment: true, - BidTime: time.Now(), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{}, + "Interest test 1 year", + types.Bid{ Id: types.BidId{ - NftId: &types.NftIdentifier{ + NftId: &types.NftId{ ClassId: "a10", - NftId: "a10", + TokenId: "a10", }, Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(10000000)), + LastRepaidAt: now, + }, }, - sdk.NewCoin("uguu", sdk.NewInt(100032)), - sdk.MustNewDecFromStr("0.1"), - time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC).Add(time.Hour * 24), - sdk.NewCoin("uguu", sdk.NewInt(27)), - }, - } - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - result := tc.bida.CalcInterest(tc.lendCoin, tc.lendingRate, tc.start, tc.end) - // fmt.Println(result) - // fmt.Println(tc.expResult) - if tc.expResult.Equal(result) { - } else { - t.Error(tc.name, "not expect result") - } - }) - } -} - -func TestRepayThenGetReceipt(t *testing.T) { - testCases := []struct { - name string - borrowing types.Borrowing - payAmount sdk.Coin - payTime time.Time - interest sdk.Coin - expectReceipt types.RepayReceipt - expectBorrowing types.Borrowing - }{ - { - "pay all principal and interest", - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(1)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - sdk.NewCoin("uguu", sdk.NewInt(201)), - time.Now(), - sdk.NewCoin("uguu", sdk.NewInt(2)), - types.RepayReceipt{ - Charge: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(1)), - }, - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(0)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - { - "pay all interest and pay part of principal", - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(1)), - StartAt: time.Date(1999, 1, 1, 0, 0, 0, 0, time.UTC), - }, - sdk.NewCoin("uguu", sdk.NewInt(20)), - time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - sdk.NewCoin("uguu", sdk.NewInt(12)), - types.RepayReceipt{ - Charge: sdk.NewCoin("uguu", sdk.NewInt(0)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(11)), - }, - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(91)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - { - "pay all interest", - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(1)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - sdk.NewCoin("uguu", sdk.NewInt(10)), - time.Now(), - sdk.NewCoin("uguu", sdk.NewInt(11)), - types.RepayReceipt{ - Charge: sdk.NewCoin("uguu", sdk.NewInt(0)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), - }, - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(11)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - { - "pay part of the interest", - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - sdk.NewCoin("uguu", sdk.NewInt(5)), - time.Now(), - sdk.NewCoin("uguu", sdk.NewInt(10)), - types.RepayReceipt{ - Charge: sdk.NewCoin("uguu", sdk.NewInt(0)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(5)), - }, - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(100)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(5)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, + sdk.NewCoin("uguu", sdk.NewInt(1000000)), + now, + nextYear, + // 10000000 * e^(0.1) - 10000000 = 105171 + sdk.NewCoin("uguu", sdk.NewInt(105171)), }, } for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - f := func(result sdk.Coin) func(lendCoin sdk.Coin, start, end time.Time) sdk.Coin { - return func(lendCoin sdk.Coin, start, end time.Time) sdk.Coin { - return result - } - } - result := tc.borrowing.RepayThenGetReceipt(tc.payAmount, tc.payTime, f(tc.interest)) - // fmt.Println(result) - // fmt.Println(tc.expectReceipt) - if tc.expectReceipt.Charge.Equal(result.Charge) && tc.expectReceipt.PaidInterestAmount.Equal(result.PaidInterestAmount) { - } else { - t.Error(tc.name, "not expect result") - } - if tc.expectBorrowing.Equal(tc.borrowing) { - } else { - fmt.Println("tc.borrowing") - fmt.Println(tc.borrowing) - fmt.Println("tc.expectBorrowing") - fmt.Println(tc.expectBorrowing) - t.Error(tc.name, "not expect borrow") - } + result := tc.bid.CalcCompoundInterest(tc.lendCoin, tc.startTime, tc.endTime) + require.Equal(t, tc.expResult, result) }) } } -func TestSortLiquidation(t *testing.T) { - - // test SortLiquidation in NftBids +func TestRepayInfo(t *testing.T) { + now := time.Now() + nextYear := time.Now().Add(time.Hour * 24 * 365) testCases := []struct { - name string - bids types.NftBids - expect types.NftBids + name string + bid types.Bid + repayAmount sdk.Coin + repaymentTime time.Time + expResult types.RepayInfo }{ { - "higher bidder", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - }, - }, - { - "higher deposit", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - }, - { - "higher deposit and greater than qDash", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), + "Repay partial", + types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + LastRepaidAt: now, }, }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, + sdk.NewCoin("uguu", sdk.NewInt(200000)), + nextYear, + types.RepayInfo{ + RepaidAmount: sdk.NewCoin("uguu", sdk.NewInt(200000)), + RepaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(105171)), + // 1105171 - 200000 = 905171 + RemainingAmount: sdk.NewCoin("uguu", sdk.NewInt(905171)), + LastRepaidAt: nextYear, }, }, { - "higher deposit and greater than qDash 2", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), + "Repay over amount", + types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + LastRepaidAt: now, }, }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, + sdk.NewCoin("uguu", sdk.NewInt(1200000)), + nextYear, + types.RepayInfo{ + RepaidAmount: sdk.NewCoin("uguu", sdk.NewInt(1105171)), + RepaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(105171)), + RemainingAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), + LastRepaidAt: nextYear, }, }, } for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - result := tc.bids.SortLiquidation() - for i := 0; i < len(result); i++ { - if result[i].BidAmount.Equal(tc.expect[i].BidAmount) && result[i].DepositAmount.Equal(tc.expect[i].DepositAmount) { - } else { - t.Error(tc.name, "not expect result") - t.Log(i) - t.Log(result[i].BidAmount, tc.expect[i].BidAmount) - t.Log(result[i].DepositAmount, tc.expect[i].DepositAmount) - } - } + result := tc.bid.RepayInfo(tc.repayAmount, tc.repaymentTime) + require.Equal(t, tc.expResult, result) }) } - } -func TestGetAverageBidAmount(t *testing.T) { +func TestIsPaidSalePrice(t *testing.T) { testCases := []struct { - name string - bids types.NftBids - expect sdk.Coin + name string + bid types.Bid + expResult bool }{ { - "empty", - types.NftBids{}, - sdk.Coin{}, - }, - { - "one", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - }, - }, - sdk.NewCoin("uguu", sdk.NewInt(100)), - }, - { - "two", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(200)), + "Paid", + types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, + Price: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + Deposit: sdk.NewCoin("uguu", sdk.NewInt(200000)), + PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(800000)), }, - sdk.NewCoin("uguu", sdk.NewInt(150)), + true, }, { - "three", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(200)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(300)), + "Not paid", + types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", }, + Price: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + Deposit: sdk.NewCoin("uguu", sdk.NewInt(200000)), + PaidAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), }, - sdk.NewCoin("uguu", sdk.NewInt(200)), + false, }, } for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - result := tc.bids.GetAverageBidAmount() - if result.Equal(tc.expect) { - } else { - t.Error(tc.name, "not expect result") - t.Log(result, tc.expect) - } + result := tc.bid.IsPaidSalePrice() + require.Equal(t, tc.expResult, result) }) } } -// test SortHigherDeposit -func TestSortHigherDeposit(t *testing.T) { +func TestTotalBorrowedAmount(t *testing.T) { testCases := []struct { - name string - bids types.NftBids - expect types.NftBids + name string + bids types.NftBids + expResult sdk.Coin }{ { - "one", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, + "Total borrow amount", types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - }, - { - "two", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - }, - { - "three", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - }, - }, - { - "four", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - }, - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(20)), + types.Bid{ + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + }, }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(2)), + types.Bid{ + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(2000000)), + }, }, }, + sdk.NewCoin("uguu", sdk.NewInt(3000000)), }, } for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - result := tc.bids.SortHigherDeposit() - for i := 0; i < len(result); i++ { - if result[i].BidAmount.Equal(tc.expect[i].BidAmount) && result[i].DepositAmount.Equal(tc.expect[i].DepositAmount) { - } else { - t.Error(tc.name, "not expect result") - t.Log(i) - t.Log(result[i].BidAmount, tc.expect[i].BidAmount) - t.Log(result[i].DepositAmount, tc.expect[i].DepositAmount) - } - } + result := tc.bids.TotalBorrowedAmount() + require.Equal(t, tc.expResult, result) }) } } -func TestBidIsLT(t *testing.T) { +func TestTotalCompoundInterest(t *testing.T) { + now := time.Now() + nextYear := time.Now().Add(time.Hour * 24 * 365) testCases := []struct { - name string - bid1 types.NftBid - bid2 types.NftBid - expect bool - }{ - { - "bid1 LT bid2", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(52)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - }, - true, - }, - { - "lower bid amount", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(52)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - }, - false, - }, - { - "lower deposit", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(49)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - }, - false, - }, - { - "bigger lending rate", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(52)), - DepositLendingRate: sdk.MustNewDecFromStr("0.3"), - }, - false, - }, - { - "same bid", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - false, - }, - { - "same bid amount and deposit", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.3"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - false, - }, - { - "same bid amount", - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(49)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.2"), - }, - false, - }, - } - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - result := tc.bid1.IsLT(tc.bid2) - if result != tc.expect { - t.Error(tc.name, "not expect result") - t.Log(result, tc.expect) - t.Log(tc.bid1.BidAmount, tc.bid1.DepositAmount, tc.bid1.DepositLendingRate) - t.Log(tc.bid2.BidAmount, tc.bid2.DepositAmount, tc.bid2.DepositLendingRate) - } - }) - } -} - -// test bids.FindKickOutBid -func TestFindKickOutBid(t *testing.T) { - type TestArg struct { - end time.Time - bid types.NftBid - } - testCases := []struct { - name string - bids types.NftBids - arg TestArg - expect types.NftBid + name string + bids types.NftBids + expResult sdk.Coin }{ { - "empty bids", - types.NftBids{}, - TestArg{ - end: time.Now(), - bid: types.NftBid{}, - }, - types.NftBid{}, - }, - { - "not exists kick out bid", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - TestArg{ - end: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - bid: types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.01"), - }, - }, - types.NftBid{}, - }, - { - "not exists kick out bid", - types.NftBids{ - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(45)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(10)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - TestArg{ - end: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - bid: types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(99)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.01"), - }, - }, - types.NftBid{}, - }, - { - "exists kick out bid only one", - types.NftBids{ - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - TestArg{ - end: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - bid: types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(101)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(51).Add(sdk.NewInt(12))), - DepositLendingRate: sdk.MustNewDecFromStr("0.01"), - }, - }, - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - { - "hit first bid for multiple bids", - types.NftBids{ - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - Bidder: "bidder2", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - Bidder: "bidder3", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - TestArg{ - end: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - bid: types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(101)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(51).Add(sdk.NewInt(12))), - DepositLendingRate: sdk.MustNewDecFromStr("0.01"), - }, - }, - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - { - "hit middle bid for multiple bids", + "Total borrow amount", types.NftBids{ - types.NftBid{ - Bidder: "bidder2", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - Bidder: "bidder3", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, + types.Bid{ + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + LastRepaidAt: now, }, }, - }, - TestArg{ - end: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - bid: types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(101)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(51).Add(sdk.NewInt(12))), - DepositLendingRate: sdk.MustNewDecFromStr("0.01"), - }, - }, - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - { - "hit last bid for multiple bids", - types.NftBids{ - types.NftBid{ - Bidder: "bidder2", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(102)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - Bidder: "bidder3", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(103)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), - }, - }, - }, - }, - TestArg{ - end: time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC), - bid: types.NftBid{ - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(101)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(51).Add(sdk.NewInt(12))), - DepositLendingRate: sdk.MustNewDecFromStr("0.01"), - }, - }, - types.NftBid{ - Bidder: "bidder1", - BidAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), - DepositAmount: sdk.NewCoin("uguu", sdk.NewInt(50)), - DepositLendingRate: sdk.MustNewDecFromStr("0.1"), - InterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - Borrowings: []types.Borrowing{ - types.Borrowing{ - Amount: sdk.NewCoin("uguu", sdk.NewInt(10)), - PaidInterestAmount: sdk.NewCoin("uguu", sdk.NewInt(0)), - StartAt: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + types.Bid{ + InterestRate: sdk.NewDecWithPrec(2, 1), + Loan: types.Loan{ + Amount: sdk.NewCoin("uguu", sdk.NewInt(1000000)), + LastRepaidAt: now, }, }, }, + // 105171 + 221403 = 326574 + sdk.NewCoin("uguu", sdk.NewInt(326574)), }, } for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - result := tc.bids.FindKickOutBid(tc.arg.bid, tc.arg.end) - if !result.Equal(tc.expect) { - t.Error(tc.name, "not expect result") - t.Log(result, tc.expect) - } + result := tc.bids.TotalCompoundInterest(nextYear) + require.Equal(t, tc.expResult, result) }) } } - -func TestCalcPartInterest(t *testing.T) { - var result sdk.Int - result = types.CalcPartInterest(sdk.NewInt(100), sdk.NewInt(10), sdk.NewDecCoin("uguu", sdk.NewInt(50))) - if !sdk.NewInt(5).Equal(result) { - t.Error("not expect result") - } - - result = types.CalcPartInterest(sdk.NewInt(100), sdk.NewInt(10), sdk.NewDecCoin("uguu", sdk.NewInt(0))) - if !sdk.NewInt(0).Equal(result) { - t.Error("not expect result") - } - - result = types.CalcPartInterest(sdk.NewInt(100), sdk.NewInt(0), sdk.NewDecCoin("uguu", sdk.NewInt(10))) - if !sdk.NewInt(0).Equal(result) { - t.Error("not expect result") - } - - result = types.CalcPartInterest(sdk.NewInt(100), sdk.NewInt(0), sdk.NewDecCoin("uguu", sdk.NewInt(0))) - if !sdk.NewInt(0).Equal(result) { - t.Error("not expect result") - } - - result = types.CalcPartInterest(sdk.NewInt(0), sdk.NewInt(0), sdk.NewDecCoin("uguu", sdk.NewInt(0))) - if !sdk.NewInt(0).Equal(result) { - t.Error("not expect result") - } -} diff --git a/x/nftbackedloan/types/codec.go b/x/nftbackedloan/types/codec.go index 726537698..02d9a5751 100644 --- a/x/nftbackedloan/types/codec.go +++ b/x/nftbackedloan/types/codec.go @@ -13,11 +13,11 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgListNft{}, - &MsgCancelNftListing{}, + &MsgCancelListing{}, &MsgPlaceBid{}, &MsgCancelBid{}, - &MsgEndNftListing{}, - &MsgPayFullBid{}, + // &MsgEndNftListing{}, + &MsgPayRemainder{}, &MsgBorrow{}, &MsgRepay{}, ) diff --git a/x/nftbackedloan/types/errors.go b/x/nftbackedloan/types/errors.go index 3169c7d00..37dca07d2 100644 --- a/x/nftbackedloan/types/errors.go +++ b/x/nftbackedloan/types/errors.go @@ -5,44 +5,40 @@ import ( ) var ( - ErrNftListingAlreadyExists = sdkerrors.Register(ModuleName, 1, "nft listing already exist") - ErrNftListingDoesNotExist = sdkerrors.Register(ModuleName, 2, "nft listing does not exist") - ErrBidDoesNotExists = sdkerrors.Register(ModuleName, 3, "nft bid does not exist") - ErrNotSupportedBidToken = sdkerrors.Register(ModuleName, 4, "not supported bid token") - ErrNftDoesNotExists = sdkerrors.Register(ModuleName, 5, "specified nft does not exist") - ErrNotNftOwner = sdkerrors.Register(ModuleName, 6, "not the owner of nft") - ErrNotNftListingOwner = sdkerrors.Register(ModuleName, 7, "not the owner of nft listing") - ErrNftBidAlreadyExists = sdkerrors.Register(ModuleName, 8, "bid already exists on the nft") - ErrNftBidDoesNotExists = sdkerrors.Register(ModuleName, 9, "bid does not exists on the nft") - ErrListingIsNotInStatusToBid = sdkerrors.Register(ModuleName, 10, "listing is not in status to bid") - ErrStatusCannotCancelListing = sdkerrors.Register(ModuleName, 11, "listing is in the status where it can not be cancelled") - ErrListingAlreadyEnded = sdkerrors.Register(ModuleName, 12, "listing already ended") - ErrNftListingNotInBidState = sdkerrors.Register(ModuleName, 13, "listing is not on bid state") - ErrInvalidBidDenom = sdkerrors.Register(ModuleName, 14, "invalid bid denom") - ErrBidAlreadyExists = sdkerrors.Register(ModuleName, 15, "bid already exists") - ErrNftListingNotInSuccessfulBidPhase = sdkerrors.Register(ModuleName, 16, "listing is not in successful bid status") - ErrNftListingNotInLiquidation = sdkerrors.Register(ModuleName, 17, "listing is not in liquidation status") - ErrDebtExceedsMaxDebt = sdkerrors.Register(ModuleName, 18, "debts exceeds maximum debt") - ErrRepayAmountExceedsLoanAmount = sdkerrors.Register(ModuleName, 19, "repay amount exceeds loan amount") - ErrInvalidBorrowDenom = sdkerrors.Register(ModuleName, 20, "invalid borrow denom") - ErrInvalidRepayDenom = sdkerrors.Register(ModuleName, 21, "invalid repay denom") - ErrNotTimeForCancel = sdkerrors.Register(ModuleName, 22, "not time for cancel yet") - ErrInvalidBidAmount = sdkerrors.Register(ModuleName, 23, "invalid bid amount") - ErrCannotCancelListingSingleBid = sdkerrors.Register(ModuleName, 24, "cannot cancel single bid of the listing") - ErrBidCancelIsAllowedAfterSomeTime = sdkerrors.Register(ModuleName, 25, "bid cancel is allowed after some time after bid") - ErrListingNeedsToBeBiddingStatus = sdkerrors.Register(ModuleName, 26, "listing needs to be in BIDDING status") - ErrNotBorrowed = sdkerrors.Register(ModuleName, 27, "not borrowed yet once") - ErrBorrowedDeposit = sdkerrors.Register(ModuleName, 28, "borrowed bid deposit") - ErrCannotCancelBid = sdkerrors.Register(ModuleName, 29, "listing is not in state where bid can be cancelled") - ErrCannotParseDec = sdkerrors.Register(ModuleName, 30, "cannot parse decimal") - ErrNotEnoughDeposit = sdkerrors.Register(ModuleName, 31, "not enough deposit") - ErrBidParamInvalid = sdkerrors.Register(ModuleName, 32, "bid param invalid") - ErrNotExistsBid = sdkerrors.Register(ModuleName, 33, "not exists bid") - ErrCannotCancelListingWithBids = sdkerrors.Register(ModuleName, 34, "cannot cancel listing with bids") - ErrCannotCancelListingWithDebt = sdkerrors.Register(ModuleName, 35, "cannot cancel listing with debt") - ErrInterestAmountTooLarge = sdkerrors.Register(ModuleName, 36, "interest amount too large") - ErrInsufficientBalance = sdkerrors.Register(ModuleName, 37, "insufficient balance") - ErrSmallBiddingPeriod = sdkerrors.Register(ModuleName, 38, "bidding period is too short") - ErrNotExistsNft = sdkerrors.Register(ModuleName, 39, "not exists nft") - ErrMinimumDepositRateTooHigh = sdkerrors.Register(ModuleName, 40, "minimum deposit rate too high") + ErrNftListingAlreadyExists = sdkerrors.Register(ModuleName, 1, "nft listing already exist") + ErrNftListingDoesNotExist = sdkerrors.Register(ModuleName, 2, "nft listing does not exist") + ErrBidDoesNotExists = sdkerrors.Register(ModuleName, 3, "nft bid does not exist") + ErrNotSupportedBidToken = sdkerrors.Register(ModuleName, 4, "not supported bid token") + ErrNftDoesNotExists = sdkerrors.Register(ModuleName, 5, "specified nft does not exist") + ErrNotNftOwner = sdkerrors.Register(ModuleName, 6, "not the owner of nft") + ErrNotNftListingOwner = sdkerrors.Register(ModuleName, 7, "not the owner of nft listing") + ErrStatusCannotCancelListing = sdkerrors.Register(ModuleName, 8, "listing status does not allow cancel") + ErrStatusEndedListing = sdkerrors.Register(ModuleName, 9, "listing is already ended") + ErrStatusCannotPlaceBid = sdkerrors.Register(ModuleName, 10, "listing status does not allow bid") + ErrStatusCannotCancelBid = sdkerrors.Register(ModuleName, 11, "listing status does not allow cancel bid") + ErrStatusCannotSelling = sdkerrors.Register(ModuleName, 12, "listing status does not allow selling") + ErrInvalidPriceDenom = sdkerrors.Register(ModuleName, 13, "invalid price denom") + ErrInvalidPriceAmount = sdkerrors.Register(ModuleName, 14, "invalid price amount") + ErrInvalidDepositDenom = sdkerrors.Register(ModuleName, 15, "invalid deposit denom") + ErrInvalidDepositAmount = sdkerrors.Register(ModuleName, 16, "invalid deposit amount") + ErrInvalidBorrowDenom = sdkerrors.Register(ModuleName, 17, "invalid borrow denom") + ErrInvalidBorrowAmount = sdkerrors.Register(ModuleName, 18, "invalid borrow amount") + ErrInvalidRepayDenom = sdkerrors.Register(ModuleName, 19, "invalid repay denom") + ErrInvalidRepayAmount = sdkerrors.Register(ModuleName, 20, "invalid repay amount") + ErrInvalidInterestAmount = sdkerrors.Register(ModuleName, 21, "invalid interest amount") + ErrCancelAfterSomeTime = sdkerrors.Register(ModuleName, 22, "cancel allowed after some time") + ErrRebidAfterSomeTime = sdkerrors.Register(ModuleName, 23, "rebid allowed after some time") + ErrCannotCancelListingSingleBid = sdkerrors.Register(ModuleName, 24, "cannot cancel only 1 bid of the listing") + ErrCannotChangeBidBorrowed = sdkerrors.Register(ModuleName, 25, "cannot change borrowed bid") + ErrCannotCancelBorrowedListing = sdkerrors.Register(ModuleName, 26, "cannot cancel borrowed listing") + ErrCannotSellingBorrowedListing = sdkerrors.Register(ModuleName, 27, "cannot sell borrowed listing") + ErrCannotBorrowForLiquidation = sdkerrors.Register(ModuleName, 28, "borrow is not allowed for liquidation") + ErrCannotReBidForLiquidation = sdkerrors.Register(ModuleName, 29, "rebid is not allowed for liquidation") + ErrCannotCancelBidForLiquidation = sdkerrors.Register(ModuleName, 30, "cancel bid is not allowed for liquidation") + ErrInsufficientBalance = sdkerrors.Register(ModuleName, 31, "insufficient balance") + ErrSmallExpiryPeriod = sdkerrors.Register(ModuleName, 32, "bidding period is too short") + ErrCannotLiquidation = sdkerrors.Register(ModuleName, 33, "cannot liquidation") + ErrNegativeCollectedAmount = sdkerrors.Register(ModuleName, 34, "negative collected amount") + ErrNegativeProfit = sdkerrors.Register(ModuleName, 35, "negative profit") + ErrOwnerCannotPlaceBid = sdkerrors.Register(ModuleName, 36, "owner cannot place bid") ) diff --git a/x/nftbackedloan/types/event.pb.go b/x/nftbackedloan/types/event.pb.go new file mode 100644 index 000000000..075dcf4d1 --- /dev/null +++ b/x/nftbackedloan/types/event.pb.go @@ -0,0 +1,3040 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ununifi/nftbackedloan/event.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type EventListNft struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventListNft) Reset() { *m = EventListNft{} } +func (m *EventListNft) String() string { return proto.CompactTextString(m) } +func (*EventListNft) ProtoMessage() {} +func (*EventListNft) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{0} +} +func (m *EventListNft) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventListNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventListNft.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventListNft) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventListNft.Merge(m, src) +} +func (m *EventListNft) XXX_Size() int { + return m.Size() +} +func (m *EventListNft) XXX_DiscardUnknown() { + xxx_messageInfo_EventListNft.DiscardUnknown(m) +} + +var xxx_messageInfo_EventListNft proto.InternalMessageInfo + +func (m *EventListNft) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *EventListNft) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventListNft) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +type EventCancelListing struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventCancelListing) Reset() { *m = EventCancelListing{} } +func (m *EventCancelListing) String() string { return proto.CompactTextString(m) } +func (*EventCancelListing) ProtoMessage() {} +func (*EventCancelListing) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{1} +} +func (m *EventCancelListing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCancelListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCancelListing.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventCancelListing) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCancelListing.Merge(m, src) +} +func (m *EventCancelListing) XXX_Size() int { + return m.Size() +} +func (m *EventCancelListing) XXX_DiscardUnknown() { + xxx_messageInfo_EventCancelListing.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCancelListing proto.InternalMessageInfo + +func (m *EventCancelListing) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *EventCancelListing) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventCancelListing) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +type EventSellingDecision struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventSellingDecision) Reset() { *m = EventSellingDecision{} } +func (m *EventSellingDecision) String() string { return proto.CompactTextString(m) } +func (*EventSellingDecision) ProtoMessage() {} +func (*EventSellingDecision) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{2} +} +func (m *EventSellingDecision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSellingDecision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSellingDecision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventSellingDecision) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSellingDecision.Merge(m, src) +} +func (m *EventSellingDecision) XXX_Size() int { + return m.Size() +} +func (m *EventSellingDecision) XXX_DiscardUnknown() { + xxx_messageInfo_EventSellingDecision.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSellingDecision proto.InternalMessageInfo + +func (m *EventSellingDecision) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *EventSellingDecision) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventSellingDecision) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +type EventEndListing struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventEndListing) Reset() { *m = EventEndListing{} } +func (m *EventEndListing) String() string { return proto.CompactTextString(m) } +func (*EventEndListing) ProtoMessage() {} +func (*EventEndListing) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{3} +} +func (m *EventEndListing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventEndListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventEndListing.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventEndListing) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventEndListing.Merge(m, src) +} +func (m *EventEndListing) XXX_Size() int { + return m.Size() +} +func (m *EventEndListing) XXX_DiscardUnknown() { + xxx_messageInfo_EventEndListing.DiscardUnknown(m) +} + +var xxx_messageInfo_EventEndListing proto.InternalMessageInfo + +func (m *EventEndListing) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *EventEndListing) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventEndListing) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +type EventPlaceBid struct { + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventPlaceBid) Reset() { *m = EventPlaceBid{} } +func (m *EventPlaceBid) String() string { return proto.CompactTextString(m) } +func (*EventPlaceBid) ProtoMessage() {} +func (*EventPlaceBid) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{4} +} +func (m *EventPlaceBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPlaceBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPlaceBid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPlaceBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPlaceBid.Merge(m, src) +} +func (m *EventPlaceBid) XXX_Size() int { + return m.Size() +} +func (m *EventPlaceBid) XXX_DiscardUnknown() { + xxx_messageInfo_EventPlaceBid.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPlaceBid proto.InternalMessageInfo + +func (m *EventPlaceBid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *EventPlaceBid) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventPlaceBid) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +func (m *EventPlaceBid) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +type EventCancelBid struct { + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventCancelBid) Reset() { *m = EventCancelBid{} } +func (m *EventCancelBid) String() string { return proto.CompactTextString(m) } +func (*EventCancelBid) ProtoMessage() {} +func (*EventCancelBid) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{5} +} +func (m *EventCancelBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventCancelBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventCancelBid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventCancelBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCancelBid.Merge(m, src) +} +func (m *EventCancelBid) XXX_Size() int { + return m.Size() +} +func (m *EventCancelBid) XXX_DiscardUnknown() { + xxx_messageInfo_EventCancelBid.DiscardUnknown(m) +} + +var xxx_messageInfo_EventCancelBid proto.InternalMessageInfo + +func (m *EventCancelBid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *EventCancelBid) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventCancelBid) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +type EventPayRemainder struct { + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventPayRemainder) Reset() { *m = EventPayRemainder{} } +func (m *EventPayRemainder) String() string { return proto.CompactTextString(m) } +func (*EventPayRemainder) ProtoMessage() {} +func (*EventPayRemainder) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{6} +} +func (m *EventPayRemainder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPayRemainder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPayRemainder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPayRemainder) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPayRemainder.Merge(m, src) +} +func (m *EventPayRemainder) XXX_Size() int { + return m.Size() +} +func (m *EventPayRemainder) XXX_DiscardUnknown() { + xxx_messageInfo_EventPayRemainder.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPayRemainder proto.InternalMessageInfo + +func (m *EventPayRemainder) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *EventPayRemainder) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventPayRemainder) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +type EventBorrow struct { + Borrower string `protobuf:"bytes,1,opt,name=borrower,proto3" json:"borrower,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventBorrow) Reset() { *m = EventBorrow{} } +func (m *EventBorrow) String() string { return proto.CompactTextString(m) } +func (*EventBorrow) ProtoMessage() {} +func (*EventBorrow) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{7} +} +func (m *EventBorrow) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBorrow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBorrow.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventBorrow) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBorrow.Merge(m, src) +} +func (m *EventBorrow) XXX_Size() int { + return m.Size() +} +func (m *EventBorrow) XXX_DiscardUnknown() { + xxx_messageInfo_EventBorrow.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBorrow proto.InternalMessageInfo + +func (m *EventBorrow) GetBorrower() string { + if m != nil { + return m.Borrower + } + return "" +} + +func (m *EventBorrow) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventBorrow) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +func (m *EventBorrow) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +type EventRepay struct { + Borrower string `protobuf:"bytes,1,opt,name=borrower,proto3" json:"borrower,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventRepay) Reset() { *m = EventRepay{} } +func (m *EventRepay) String() string { return proto.CompactTextString(m) } +func (*EventRepay) ProtoMessage() {} +func (*EventRepay) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{8} +} +func (m *EventRepay) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventRepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventRepay.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventRepay) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventRepay.Merge(m, src) +} +func (m *EventRepay) XXX_Size() int { + return m.Size() +} +func (m *EventRepay) XXX_DiscardUnknown() { + xxx_messageInfo_EventRepay.DiscardUnknown(m) +} + +var xxx_messageInfo_EventRepay proto.InternalMessageInfo + +func (m *EventRepay) GetBorrower() string { + if m != nil { + return m.Borrower + } + return "" +} + +func (m *EventRepay) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventRepay) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +func (m *EventRepay) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +type EventLiquidate struct { + Liquidator string `protobuf:"bytes,1,opt,name=liquidator,proto3" json:"liquidator,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` +} + +func (m *EventLiquidate) Reset() { *m = EventLiquidate{} } +func (m *EventLiquidate) String() string { return proto.CompactTextString(m) } +func (*EventLiquidate) ProtoMessage() {} +func (*EventLiquidate) Descriptor() ([]byte, []int) { + return fileDescriptor_b6a94a215b488842, []int{9} +} +func (m *EventLiquidate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventLiquidate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventLiquidate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventLiquidate) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventLiquidate.Merge(m, src) +} +func (m *EventLiquidate) XXX_Size() int { + return m.Size() +} +func (m *EventLiquidate) XXX_DiscardUnknown() { + xxx_messageInfo_EventLiquidate.DiscardUnknown(m) +} + +var xxx_messageInfo_EventLiquidate proto.InternalMessageInfo + +func (m *EventLiquidate) GetLiquidator() string { + if m != nil { + return m.Liquidator + } + return "" +} + +func (m *EventLiquidate) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *EventLiquidate) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +func init() { + proto.RegisterType((*EventListNft)(nil), "ununifi.nftbackedloan.EventListNft") + proto.RegisterType((*EventCancelListing)(nil), "ununifi.nftbackedloan.EventCancelListing") + proto.RegisterType((*EventSellingDecision)(nil), "ununifi.nftbackedloan.EventSellingDecision") + proto.RegisterType((*EventEndListing)(nil), "ununifi.nftbackedloan.EventEndListing") + proto.RegisterType((*EventPlaceBid)(nil), "ununifi.nftbackedloan.EventPlaceBid") + proto.RegisterType((*EventCancelBid)(nil), "ununifi.nftbackedloan.EventCancelBid") + proto.RegisterType((*EventPayRemainder)(nil), "ununifi.nftbackedloan.EventPayRemainder") + proto.RegisterType((*EventBorrow)(nil), "ununifi.nftbackedloan.EventBorrow") + proto.RegisterType((*EventRepay)(nil), "ununifi.nftbackedloan.EventRepay") + proto.RegisterType((*EventLiquidate)(nil), "ununifi.nftbackedloan.EventLiquidate") +} + +func init() { proto.RegisterFile("ununifi/nftbackedloan/event.proto", fileDescriptor_b6a94a215b488842) } + +var fileDescriptor_b6a94a215b488842 = []byte{ + // 439 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x14, 0x85, 0x63, 0x7e, 0x4a, 0x19, 0xfe, 0x84, 0x15, 0x50, 0x9a, 0x85, 0x81, 0xac, 0x58, 0x65, + 0x54, 0xf1, 0x06, 0x81, 0x22, 0x2a, 0x55, 0x08, 0x05, 0x75, 0x53, 0x09, 0xca, 0x78, 0xe6, 0xda, + 0xbd, 0xaa, 0x7d, 0x6f, 0xf0, 0x8c, 0x13, 0xf2, 0x16, 0x3c, 0x16, 0xcb, 0x2e, 0x59, 0xa2, 0xe4, + 0x45, 0x90, 0x67, 0x9c, 0xa8, 0x74, 0x59, 0x99, 0xee, 0xe6, 0xf8, 0x1c, 0x9d, 0xcf, 0x33, 0x57, + 0xba, 0xe2, 0x55, 0x4d, 0x35, 0x61, 0x86, 0x92, 0x32, 0x97, 0x2a, 0x7d, 0x0e, 0xa6, 0x60, 0x45, + 0x12, 0xe6, 0x40, 0x6e, 0x3c, 0xab, 0xd8, 0x71, 0xfc, 0xac, 0x8d, 0x8c, 0xff, 0x89, 0x0c, 0xfb, + 0x39, 0xe7, 0xec, 0x13, 0xb2, 0x39, 0x85, 0xf0, 0xf0, 0x45, 0xce, 0x9c, 0x17, 0x20, 0xbd, 0x4a, + 0xeb, 0x4c, 0x3a, 0x2c, 0xc1, 0x3a, 0x55, 0xce, 0xda, 0x40, 0x72, 0x35, 0x60, 0xea, 0x4a, 0x39, + 0x64, 0xda, 0xf8, 0x9a, 0x6d, 0xc9, 0x56, 0xa6, 0xca, 0x82, 0x9c, 0xef, 0xa7, 0xe0, 0xd4, 0xbe, + 0xd4, 0x8c, 0x1b, 0x7f, 0x2f, 0xf8, 0xa7, 0x81, 0x1c, 0x44, 0xb0, 0x46, 0x27, 0xe2, 0xe1, 0x41, + 0xf3, 0xdf, 0x47, 0x68, 0xdd, 0xc7, 0xcc, 0xc5, 0x7d, 0x71, 0x97, 0x17, 0x04, 0xd5, 0x20, 0x7a, + 0x19, 0xbd, 0xbe, 0x3f, 0x0d, 0x22, 0xde, 0x13, 0xbb, 0xba, 0x50, 0xd6, 0x9e, 0xa2, 0x19, 0xdc, + 0xf2, 0xc6, 0x3d, 0xaf, 0x0f, 0x4d, 0x63, 0x39, 0x3e, 0x07, 0x6a, 0xac, 0xdb, 0xc1, 0xf2, 0xfa, + 0xd0, 0x8c, 0xbe, 0x89, 0xd8, 0x77, 0xbf, 0x55, 0xa4, 0xa1, 0x68, 0x08, 0x48, 0x79, 0xa7, 0x84, + 0x54, 0xf4, 0x3d, 0xe1, 0x33, 0x14, 0x05, 0x52, 0xfe, 0x0e, 0x34, 0x5a, 0x64, 0xea, 0x94, 0xf1, + 0x45, 0x3c, 0xf1, 0x8c, 0x03, 0x32, 0xff, 0xe3, 0x0a, 0xb5, 0x78, 0xe4, 0xeb, 0x3f, 0x15, 0x4a, + 0xc3, 0x04, 0x4d, 0xfc, 0x5c, 0xec, 0xa4, 0x68, 0xcc, 0xb6, 0xbd, 0x55, 0xd7, 0xab, 0x6f, 0xda, + 0x54, 0xc9, 0x35, 0xb9, 0xc1, 0x9d, 0xd0, 0x16, 0xd4, 0xe8, 0xab, 0x78, 0x7c, 0x69, 0x36, 0x9d, + 0x73, 0x47, 0x4a, 0x3c, 0x0d, 0xd7, 0x52, 0xcb, 0x29, 0x94, 0x0a, 0xa9, 0xa9, 0xea, 0x16, 0xb1, + 0x10, 0x0f, 0x3c, 0x62, 0xc2, 0x55, 0xc5, 0x8b, 0x78, 0x28, 0x76, 0x53, 0x7f, 0xda, 0xd6, 0x6f, + 0x75, 0xc7, 0x6f, 0x37, 0x17, 0xc2, 0x83, 0xa7, 0x30, 0x53, 0xcb, 0x1b, 0xe4, 0x66, 0xed, 0xcc, + 0x8e, 0xf0, 0x7b, 0x8d, 0x46, 0x39, 0x88, 0x13, 0x21, 0x8a, 0x56, 0xf0, 0x86, 0x7e, 0xe9, 0xcb, + 0xf5, 0xf8, 0x93, 0x0f, 0xbf, 0x56, 0x49, 0x74, 0xb1, 0x4a, 0xa2, 0x3f, 0xab, 0x24, 0xfa, 0xb9, + 0x4e, 0x7a, 0x17, 0xeb, 0xa4, 0xf7, 0x7b, 0x9d, 0xf4, 0x4e, 0xc6, 0x39, 0xba, 0xb3, 0x3a, 0x1d, + 0x6b, 0x2e, 0xe5, 0x31, 0x1d, 0x13, 0xbe, 0x47, 0xa9, 0xcf, 0x14, 0x92, 0xfc, 0x71, 0x65, 0x19, + 0xba, 0xe5, 0x0c, 0x6c, 0xba, 0xe3, 0x97, 0xcc, 0x9b, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf5, + 0xb5, 0xa4, 0x25, 0x32, 0x05, 0x00, 0x00, +} + +func (m *EventListNft) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventListNft) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventListNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventCancelListing) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventCancelListing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCancelListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventSellingDecision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventSellingDecision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSellingDecision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventEndListing) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventEndListing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventEndListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventPlaceBid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPlaceBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventCancelBid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventCancelBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventCancelBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventPayRemainder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPayRemainder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPayRemainder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBorrow) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventBorrow) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Borrower) > 0 { + i -= len(m.Borrower) + copy(dAtA[i:], m.Borrower) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Borrower))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventRepay) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventRepay) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventRepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Borrower) > 0 { + i -= len(m.Borrower) + copy(dAtA[i:], m.Borrower) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Borrower))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventLiquidate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventLiquidate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventLiquidate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Liquidator) > 0 { + i -= len(m.Liquidator) + copy(dAtA[i:], m.Liquidator) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Liquidator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventListNft) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventCancelListing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventSellingDecision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventEndListing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventPlaceBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventCancelBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventPayRemainder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventBorrow) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Borrower) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventRepay) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Borrower) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventLiquidate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Liquidator) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventListNft) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventListNft: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventListNft: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventCancelListing) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventCancelListing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCancelListing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventSellingDecision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventSellingDecision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSellingDecision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventEndListing) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventEndListing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventEndListing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPlaceBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPlaceBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventCancelBid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventCancelBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventCancelBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPayRemainder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPayRemainder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPayRemainder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBorrow) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventBorrow: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBorrow: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Borrower", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Borrower = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventRepay) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventRepay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventRepay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Borrower", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Borrower = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventLiquidate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventLiquidate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventLiquidate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Liquidator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Liquidator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/nftbackedloan/types/expected_keepers.go b/x/nftbackedloan/types/expected_keepers.go index 4ebfe7ac5..b6ac757ef 100644 --- a/x/nftbackedloan/types/expected_keepers.go +++ b/x/nftbackedloan/types/expected_keepers.go @@ -4,6 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" nfttypes "github.com/cosmos/cosmos-sdk/x/nft" + + "github.com/UnUniFi/chain/x/nft/types" ) // AccountKeeper expected interface for the account keeper (noalias) @@ -44,10 +46,11 @@ type NftKeeper interface { GetBalance(ctx sdk.Context, classID string, owner sdk.AccAddress) uint64 GetTotalSupply(ctx sdk.Context, classID string) uint64 HasNFT(ctx sdk.Context, classID, id string) bool + GetNftData(ctx sdk.Context, classId string, id string) (types.NftData, bool) + SetNftData(ctx sdk.Context, classId string, id string, data types.NftData) error } -type NftmarketHooks interface { - AfterNftListed(ctx sdk.Context, nftIdentifier NftIdentifier, txMemo string) - AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftIdentifier, fee sdk.Coin) - AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftIdentifier) +type NftbackedloanHooks interface { + AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftId, fee sdk.Coin) + AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftId) } diff --git a/x/nftbackedloan/types/genesis.pb.go b/x/nftbackedloan/types/genesis.pb.go index cd3b8d192..558d3cbc5 100644 --- a/x/nftbackedloan/types/genesis.pb.go +++ b/x/nftbackedloan/types/genesis.pb.go @@ -26,11 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the nftbackedloan module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - Listings []NftListing `protobuf:"bytes,2,rep,name=listings,proto3" json:"listings"` - Bids []NftBid `protobuf:"bytes,3,rep,name=bids,proto3" json:"bids"` - CancelledBids []NftBid `protobuf:"bytes,4,rep,name=cancelled_bids,json=cancelledBids,proto3" json:"cancelled_bids"` - Loans []Loan `protobuf:"bytes,5,rep,name=loans,proto3" json:"loans"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` + Listings []Listing `protobuf:"bytes,2,rep,name=listings,proto3" json:"listings"` + Bids []Bid `protobuf:"bytes,3,rep,name=bids,proto3" json:"bids"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -73,34 +71,20 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetListings() []NftListing { +func (m *GenesisState) GetListings() []Listing { if m != nil { return m.Listings } return nil } -func (m *GenesisState) GetBids() []NftBid { +func (m *GenesisState) GetBids() []Bid { if m != nil { return m.Bids } return nil } -func (m *GenesisState) GetCancelledBids() []NftBid { - if m != nil { - return m.CancelledBids - } - return nil -} - -func (m *GenesisState) GetLoans() []Loan { - if m != nil { - return m.Loans - } - return nil -} - func init() { proto.RegisterType((*GenesisState)(nil), "ununifi.nftbackedloan.GenesisState") } @@ -110,29 +94,27 @@ func init() { } var fileDescriptor_a0c5ac60742c0e46 = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0x4a, 0xc3, 0x30, - 0x18, 0xc0, 0xdb, 0xfd, 0x43, 0x32, 0xe7, 0xa1, 0x38, 0x28, 0x93, 0x75, 0x73, 0x5e, 0xe6, 0xa5, - 0x81, 0x79, 0x18, 0x78, 0xac, 0xa0, 0x22, 0x43, 0x64, 0xb2, 0x8b, 0x17, 0x49, 0xdb, 0x34, 0x0b, - 0xb6, 0x49, 0x59, 0x52, 0x70, 0x6f, 0xe1, 0x63, 0xed, 0xb8, 0xa3, 0xa7, 0x29, 0xdb, 0x1b, 0xf8, - 0x04, 0xd2, 0xa4, 0x0c, 0x26, 0x1b, 0x78, 0xcb, 0x07, 0xbf, 0xdf, 0x2f, 0x1f, 0x7c, 0xe0, 0x22, - 0x63, 0x19, 0xa3, 0x11, 0x85, 0x2c, 0x92, 0x3e, 0x0a, 0xde, 0x70, 0x18, 0x73, 0xc4, 0x20, 0xc1, - 0x0c, 0x0b, 0x2a, 0xdc, 0x74, 0xc6, 0x25, 0xb7, 0x9a, 0x05, 0xe4, 0xee, 0x40, 0xad, 0x53, 0xc2, - 0x09, 0x57, 0x04, 0xcc, 0x5f, 0x1a, 0x6e, 0x75, 0x08, 0xe7, 0x24, 0xc6, 0x50, 0x4d, 0x7e, 0x16, - 0x41, 0x49, 0x13, 0x2c, 0x24, 0x4a, 0xd2, 0x02, 0xb8, 0xdc, 0xff, 0xe5, 0xce, 0xa4, 0xd1, 0xde, - 0x57, 0x09, 0x1c, 0xdf, 0xe9, 0x55, 0x9e, 0x25, 0x92, 0xd8, 0x1a, 0x81, 0x5a, 0x8a, 0x66, 0x28, - 0x11, 0xb6, 0xd9, 0x35, 0xfb, 0xf5, 0x41, 0xdb, 0xdd, 0xbb, 0x9a, 0xfb, 0xa4, 0x20, 0xaf, 0xb9, - 0x58, 0x75, 0x8c, 0x9f, 0x55, 0xa7, 0x31, 0x47, 0x49, 0x7c, 0xdd, 0xd3, 0x6a, 0x6f, 0x5c, 0x34, - 0xac, 0x1b, 0x70, 0x14, 0x53, 0x21, 0x29, 0x23, 0xc2, 0x2e, 0x75, 0xcb, 0xfd, 0xfa, 0xe0, 0xfc, - 0x40, 0xef, 0x31, 0x92, 0x23, 0x4d, 0x7a, 0x95, 0xbc, 0x39, 0xde, 0x8a, 0xd6, 0x10, 0x54, 0x7c, - 0x1a, 0x0a, 0xbb, 0xac, 0x02, 0xed, 0xc3, 0x01, 0x8f, 0x86, 0x85, 0xac, 0x04, 0xeb, 0x01, 0x9c, - 0x04, 0x88, 0x05, 0x38, 0x8e, 0x71, 0xf8, 0xaa, 0x12, 0x95, 0xff, 0x27, 0x1a, 0x5b, 0xd5, 0xcb, - 0x5b, 0x43, 0x50, 0xcd, 0x19, 0x61, 0x57, 0x55, 0xe2, 0xec, 0x40, 0x62, 0xc4, 0x11, 0x2b, 0x02, - 0x9a, 0xf7, 0xee, 0x17, 0x6b, 0xc7, 0x5c, 0xae, 0x1d, 0xf3, 0x7b, 0xed, 0x98, 0x1f, 0x1b, 0xc7, - 0x58, 0x6e, 0x1c, 0xe3, 0x73, 0xe3, 0x18, 0x2f, 0x2e, 0xa1, 0x72, 0x9a, 0xf9, 0x6e, 0xc0, 0x13, - 0x38, 0x61, 0x13, 0x46, 0x6f, 0x29, 0x0c, 0xa6, 0x88, 0x32, 0xf8, 0xfe, 0xe7, 0x72, 0x72, 0x9e, - 0x62, 0xe1, 0xd7, 0xd4, 0xc9, 0xae, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6e, 0xbf, 0x82, 0x2b, - 0x52, 0x02, 0x00, 0x00, + // 305 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0xb1, 0x4a, 0x03, 0x31, + 0x18, 0x07, 0xf0, 0x8b, 0x2d, 0x45, 0xae, 0xba, 0x1c, 0x16, 0xca, 0x81, 0x69, 0x39, 0x97, 0xba, + 0x24, 0x50, 0x9d, 0x9c, 0xe4, 0x06, 0x75, 0xe8, 0x20, 0x95, 0x2e, 0x6e, 0xb9, 0x36, 0x4d, 0x3f, + 0xbc, 0x4b, 0x8e, 0x26, 0x07, 0xf6, 0x2d, 0x7c, 0xac, 0x8e, 0x1d, 0x1c, 0x9c, 0x8a, 0xf4, 0xde, + 0xc0, 0x27, 0x90, 0x26, 0x87, 0x50, 0xb9, 0x6e, 0x09, 0xfc, 0xfe, 0xff, 0xef, 0xe3, 0xf3, 0xaf, + 0x0a, 0x59, 0x48, 0x98, 0x03, 0x95, 0x73, 0x93, 0xb0, 0xe9, 0x1b, 0x9f, 0xa5, 0x8a, 0x49, 0x2a, + 0xb8, 0xe4, 0x1a, 0x34, 0xc9, 0x97, 0xca, 0xa8, 0xa0, 0x53, 0x21, 0x72, 0x80, 0xc2, 0x0b, 0xa1, + 0x84, 0xb2, 0x82, 0xee, 0x5f, 0x0e, 0x87, 0x3d, 0xa1, 0x94, 0x48, 0x39, 0xb5, 0xbf, 0xa4, 0x98, + 0x53, 0x03, 0x19, 0xd7, 0x86, 0x65, 0x79, 0x05, 0xa2, 0xfa, 0x91, 0x39, 0x5b, 0xb2, 0xac, 0x9a, + 0x18, 0x5e, 0xd7, 0x9b, 0x83, 0x9f, 0xa3, 0xd1, 0x27, 0xf2, 0xcf, 0x1e, 0xdd, 0xba, 0x2f, 0x86, + 0x19, 0x1e, 0x8c, 0xfc, 0x96, 0xeb, 0xea, 0xa2, 0x3e, 0x1a, 0xb4, 0x87, 0x97, 0xa4, 0x76, 0x7d, + 0xf2, 0x6c, 0x51, 0xdc, 0x59, 0x6f, 0x7b, 0xde, 0xcf, 0xb6, 0x77, 0xbe, 0x62, 0x59, 0x7a, 0x17, + 0xb9, 0x68, 0x34, 0xae, 0x3a, 0x82, 0x7b, 0xff, 0x34, 0x05, 0x6d, 0x40, 0x0a, 0xdd, 0x3d, 0xe9, + 0x37, 0x06, 0xed, 0x21, 0x3e, 0xd2, 0x37, 0x72, 0x2c, 0x6e, 0xee, 0x0b, 0xc7, 0x7f, 0xa9, 0xe0, + 0xd6, 0x6f, 0x26, 0x30, 0xd3, 0xdd, 0x86, 0x4d, 0x87, 0x47, 0xd2, 0x31, 0xcc, 0xaa, 0xa4, 0xd5, + 0xf1, 0xd3, 0x7a, 0x87, 0xd1, 0x66, 0x87, 0xd1, 0xf7, 0x0e, 0xa3, 0x8f, 0x12, 0x7b, 0x9b, 0x12, + 0x7b, 0x5f, 0x25, 0xf6, 0x5e, 0x89, 0x00, 0xb3, 0x28, 0x12, 0x32, 0x55, 0x19, 0x9d, 0xc8, 0x89, + 0x84, 0x07, 0xa0, 0xd3, 0x05, 0x03, 0x49, 0xdf, 0xff, 0x9d, 0xcb, 0xac, 0x72, 0xae, 0x93, 0x96, + 0xbd, 0xd3, 0xcd, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x89, 0xe2, 0xa7, 0x27, 0xeb, 0x01, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -155,34 +137,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Loans) > 0 { - for iNdEx := len(m.Loans) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Loans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.CancelledBids) > 0 { - for iNdEx := len(m.CancelledBids) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CancelledBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } if len(m.Bids) > 0 { for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { { @@ -255,18 +209,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.CancelledBids) > 0 { - for _, e := range m.CancelledBids { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Loans) > 0 { - for _, e := range m.Loans { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -367,7 +309,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Listings = append(m.Listings, NftListing{}) + m.Listings = append(m.Listings, Listing{}) if err := m.Listings[len(m.Listings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -401,79 +343,11 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Bids = append(m.Bids, NftBid{}) + m.Bids = append(m.Bids, Bid{}) if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelledBids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CancelledBids = append(m.CancelledBids, NftBid{}) - if err := m.CancelledBids[len(m.CancelledBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loans", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Loans = append(m.Loans, Loan{}) - if err := m.Loans[len(m.Loans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/nftbackedloan/types/hooks.go b/x/nftbackedloan/types/hooks.go index 28d3aac5d..1e22512cf 100644 --- a/x/nftbackedloan/types/hooks.go +++ b/x/nftbackedloan/types/hooks.go @@ -2,30 +2,23 @@ package types import sdk "github.com/cosmos/cosmos-sdk/types" -// MultiNftmarketHooks combine multiple nftmarket hooks, all hook functions are run in array sequence -type MultiNftmarketHooks []NftmarketHooks +// MultiNftmarketHooks combine multiple nftbackedloan hooks, all hook functions are run in array sequence +type MultiNftbackedloanHooks []NftbackedloanHooks // NewMultiNftmarketHooks returns a new MultiNftmarketHooks -func NewMultiNftmarketHooks(hooks ...NftmarketHooks) MultiNftmarketHooks { +func NewMultiNftbackedloanHooks(hooks ...NftbackedloanHooks) MultiNftbackedloanHooks { return hooks } -// AfterNftListed runs after a nft is listed -func (h MultiNftmarketHooks) AfterNftListed(ctx sdk.Context, nftIdentifier NftIdentifier, txMemo string) { - for i := range h { - h[i].AfterNftListed(ctx, nftIdentifier, txMemo) - } -} - // AfterNftPaymentWithCommission runs after a nft is sold and paid properly -func (h MultiNftmarketHooks) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftIdentifier, fee sdk.Coin) { +func (h MultiNftbackedloanHooks) AfterNftPaymentWithCommission(ctx sdk.Context, nftIdentifier NftId, fee sdk.Coin) { for i := range h { h[i].AfterNftPaymentWithCommission(ctx, nftIdentifier, fee) } } // AfterNftUnlistedWithoutPayment runs after a nft is unlisted without any payment -func (h MultiNftmarketHooks) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftIdentifier) { +func (h MultiNftbackedloanHooks) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftIdentifier NftId) { for i := range h { h[i].AfterNftUnlistedWithoutPayment(ctx, nftIdentifier) } diff --git a/x/nftbackedloan/types/hooks_test.go b/x/nftbackedloan/types/hooks_test.go index 1ef2a64a9..108d0ab22 100644 --- a/x/nftbackedloan/types/hooks_test.go +++ b/x/nftbackedloan/types/hooks_test.go @@ -22,7 +22,7 @@ type KeeperTestSuite struct { addrs []sdk.AccAddress } -func (suite *KeeperTestSuite) SetupTest(hooks types.NftmarketHooks) { +func (suite *KeeperTestSuite) SetupTest(hooks types.NftbackedloanHooks) { isCheckTx := false app := simapp.Setup(suite.T(), ([]wasm.Option{})...) @@ -32,7 +32,7 @@ func (suite *KeeperTestSuite) SetupTest(hooks types.NftmarketHooks) { suite.app = app if hooks != nil { - suite.app.NftmarketKeeper.SetHooks(hooks) + suite.app.NftbackedloanKeeper.SetHooks(hooks) } } @@ -40,36 +40,36 @@ func TestKeeperSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } -func dummyAfterNftListedEvent(nftId types.NftIdentifier) sdk.Event { +func dummyAfterNftListedEvent(nftId types.NftId) sdk.Event { return sdk.NewEvent( "afterNftListed", sdk.NewAttribute("nftId", nftId.String()), ) } -func dummyAfterNftPaymentWithCommissionEvent(nftId types.NftIdentifier) sdk.Event { +func dummyAfterNftPaymentWithCommissionEvent(nftId types.NftId) sdk.Event { return sdk.NewEvent( "afterNftPaymentWithCommission", sdk.NewAttribute("nftId", nftId.String()), ) } -func dummyAfterNftUnlistedWithoutPaymentEvent(nftId types.NftIdentifier) sdk.Event { +func dummyAfterNftUnlistedWithoutPaymentEvent(nftId types.NftId) sdk.Event { return sdk.NewEvent( "afterNftUnlistedWithoutPayment", sdk.NewAttribute("nftId", nftId.String()), ) } -// dummyNftmarketHook is a struct satisfying the nftmarket hook interface, -// that maintains a counter for how many times its been succesfully called, +// dummyNftmarketHook is a struct satisfying the nftbackedloan hook interface, +// that maintains a counter for how many times its been successfully called, // and a boolean for whether it should panic during its execution. type dummyNftmarketHook struct { successCounter int shouldPanic bool } -func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftIdentifier, txMemo string) { +func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftId, txMemo string) { if hook.shouldPanic { panic("dummyNftmarketHook AfterNftListed is panicking") } @@ -78,7 +78,7 @@ func (hook *dummyNftmarketHook) AfterNftListed(ctx sdk.Context, nftId types.NftI ctx.EventManager().EmitEvent(dummyAfterNftListedEvent(nftId)) } -func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, nftId types.NftIdentifier, fee sdk.Coin) { +func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, nftId types.NftId, fee sdk.Coin) { if hook.shouldPanic { panic("dummyNftmarketHook AfterNftPaymentWithCommission is panicking") } @@ -87,7 +87,7 @@ func (hook *dummyNftmarketHook) AfterNftPaymentWithCommission(ctx sdk.Context, n ctx.EventManager().EmitEvent(dummyAfterNftPaymentWithCommissionEvent(nftId)) } -func (hook *dummyNftmarketHook) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftId types.NftIdentifier) { +func (hook *dummyNftmarketHook) AfterNftUnlistedWithoutPayment(ctx sdk.Context, nftId types.NftId) { if hook.shouldPanic { panic("dummyNftmarketHook AfterNftUnlistedWithoutPayment is panicking") } @@ -101,14 +101,14 @@ func (hook *dummyNftmarketHook) Clone() *dummyNftmarketHook { return &newHook } -var _ types.NftmarketHooks = &dummyNftmarketHook{} +var _ types.NftbackedloanHooks = &dummyNftmarketHook{} func (suite *KeeperTestSuite) TestHooksPanicRecovery() { panicHook := dummyNftmarketHook{shouldPanic: true} noPanicHook := dummyNftmarketHook{shouldPanic: false} - nftId := types.NftIdentifier{ + nftId := types.NftId{ ClassId: "dummyhook", - NftId: "dummyhook", + TokenId: "dummyhook", } tests := []struct { @@ -116,34 +116,30 @@ func (suite *KeeperTestSuite) TestHooksPanicRecovery() { expectedCounterValues []int lenEvents int }{ - {[]dummyNftmarketHook{noPanicHook}, []int{3}, 3}, + {[]dummyNftmarketHook{noPanicHook}, []int{2}, 2}, {[]dummyNftmarketHook{panicHook}, []int{0}, 0}, } for tcIndex, tc := range tests { suite.SetupTest(nil) - hookRefs := []types.NftmarketHooks{} + hookRefs := []types.NftbackedloanHooks{} for _, hook := range tc.hooks { hookRefs = append(hookRefs, hook.Clone()) } - // insert dummy hook struct as part of NftmarketHooks - hooks := types.NewMultiNftmarketHooks(hookRefs...) - // suite.app.NftmarketKeeper.SetHooks(hooks) + // insert dummy hook struct as part of NftbackedloanHooks + hooks := types.NewMultiNftbackedloanHooks(hookRefs...) + // suite.app.NftbackedloanKeeper.SetHooks(hooks) if tc.lenEvents == 0 { suite.Panics(func() { - hooks.AfterNftListed(suite.ctx, nftId, "test") - hooks.AfterNftPaymentWithCommission(suite.ctx, nftId, sdk.Coin{Denom: "uguu", Amount: sdk.OneInt()}) hooks.AfterNftUnlistedWithoutPayment(suite.ctx, nftId) }) } else { suite.NotPanics(func() { - hooks.AfterNftListed(suite.ctx, nftId, "test") - hooks.AfterNftPaymentWithCommission(suite.ctx, nftId, sdk.Coin{Denom: "uguu", Amount: sdk.OneInt()}) hooks.AfterNftUnlistedWithoutPayment(suite.ctx, nftId) diff --git a/x/nftbackedloan/types/keys.go b/x/nftbackedloan/types/keys.go index 81d81ad58..bd4f7c8a3 100644 --- a/x/nftbackedloan/types/keys.go +++ b/x/nftbackedloan/types/keys.go @@ -7,14 +7,14 @@ import ( const ( // ModuleName defines the module name - ModuleName = "nftmarket" + ModuleName = "nftbackedloan" // Module account for nft trading fee collection // use ecosystem-incentive module account for now // [unused] NftTradingFee = "nfttradingfee" // StoreKey defines the primary module store key - StoreKey = "ununifinftmarket" + StoreKey = "_" + ModuleName // RouterKey is the message route for nftmarket RouterKey = ModuleName @@ -125,9 +125,9 @@ func NftBidBytesToBidId(NftBidBytes []byte) BidId { } return BidId{ - NftId: &NftIdentifier{ + NftId: &NftId{ ClassId: stringList[0], - NftId: stringList[1], + TokenId: stringList[1], }, Bidder: stringList[2], } diff --git a/x/nftbackedloan/types/loan.go b/x/nftbackedloan/types/loan.go new file mode 100644 index 000000000..dcc44b2d6 --- /dev/null +++ b/x/nftbackedloan/types/loan.go @@ -0,0 +1,268 @@ +package types + +import ( + time "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" +) + +func MinSettlementAmount(bids []Bid, listing Listing) (types.Coin, error) { + if len(bids) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + bidsSortedByPrice := NftBids(bids).SortHigherPrice() + return FindMinSettlementAmount(bidsSortedByPrice, listing) +} + +func FindMinSettlementAmount(bidsSortedByPrice []Bid, listing Listing) (types.Coin, error) { + if len(bidsSortedByPrice) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + minimumSettlementAmount := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + forfeitedDeposit := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + + for _, bid := range bidsSortedByPrice { + if minimumSettlementAmount.IsZero() || bid.Price.Add(forfeitedDeposit).IsLT(minimumSettlementAmount) { + minimumSettlementAmount = bid.Price.Add(forfeitedDeposit) + } + forfeitedDeposit = forfeitedDeposit.Add(bid.Deposit) + } + + // If higher than the total deposits, the minimum settlement amount is the total deposits. + if forfeitedDeposit.IsLT(minimumSettlementAmount) { + minimumSettlementAmount = forfeitedDeposit + } + + return minimumSettlementAmount, nil +} + +// arg: bids sorted by higher deposit & liquidation time +// return: win bid, deposit collect bids, refund bids, error +func LiquidationBid(bidsSortedByDeposit []Bid, listing Listing, time time.Time) (Bid, []Bid, []Bid, error) { + + if len(bidsSortedByDeposit) == 0 { + return Bid{}, nil, nil, ErrBidDoesNotExists + } + settlementAmount, _ := ExistRepayAmountAtLiquidation(bidsSortedByDeposit, listing, time) + forfeitedDeposit := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + var winnerBid Bid + notInspectedBidsSortedByDeposit := NftBids(bidsSortedByDeposit) + forfeitedBids := []Bid{} + refundBids := []Bid{} + + // prevention of infinite loops + highestBid, err := notInspectedBidsSortedByDeposit.GetHighestBid() + if err != nil { + return Bid{}, nil, nil, err + } + if highestBid.Price.IsLT(settlementAmount) { + return Bid{}, nil, nil, ErrCannotLiquidation + } + + // loop until all bids are handled + for len(notInspectedBidsSortedByDeposit) > 0 { + for _, bid := range notInspectedBidsSortedByDeposit { + // if the win bid is found, other bids are refunded. + if !winnerBid.IsNil() { + refundBids = append(refundBids, bid) + notInspectedBidsSortedByDeposit = notInspectedBidsSortedByDeposit.RemoveBid(bid) + continue + } + // skip, if the bid is paid & the bid amount + forfeited deposit < settlement amount + if bid.Price.Add(forfeitedDeposit).IsLT(settlementAmount) { + continue + } + // if liquidation is available, the bid is win or collect + if bid.IsPaidSalePrice() { + winnerBid = bid + } else { + forfeitedDeposit = forfeitedDeposit.Add(bid.Deposit) + forfeitedBids = append(forfeitedBids, bid) + } + notInspectedBidsSortedByDeposit = notInspectedBidsSortedByDeposit.RemoveBid(bid) + } + } + + // if the win bid is not found (no one paid case) + if winnerBid.IsNil() { + // No error, if liquidation is available + if settlementAmount.IsLTE(forfeitedDeposit) { + return Bid{}, forfeitedBids, nil, nil + } + // With Error, if liquidation is not available + return Bid{}, forfeitedBids, refundBids, ErrCannotLiquidation + } + return winnerBid, forfeitedBids, refundBids, nil +} + +func ForfeitedBidsAndRefundBids(bidsSortedByDeposit []Bid, winnerBid Bid) ([]Bid, []Bid) { + isDecidedWinningBid := false + forfeitedBids := []Bid{} + refundBids := []Bid{} + for _, bid := range bidsSortedByDeposit { + if bid.Id.Bidder == winnerBid.Id.Bidder { + isDecidedWinningBid = true + continue + } + if isDecidedWinningBid { + refundBids = append(refundBids, bid) + continue + } + if bid.IsPaidSalePrice() { + refundBids = append(refundBids, bid) + } else { + forfeitedBids = append(forfeitedBids, bid) + } + } + return forfeitedBids, refundBids +} + +func ExpectedRepayAmount(bids []Bid, borrowBids []BorrowBid, listing Listing, time time.Time) (sdk.Coin, error) { + if len(bids) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + expectedRepayAmount := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + for _, borrowBid := range borrowBids { + for _, nftBid := range bids { + if borrowBid.Bidder == nftBid.Id.Bidder { + if nftBid.Deposit.Denom != borrowBid.Amount.Denom { + return types.Coin{}, ErrInvalidBorrowDenom + } + + if borrowBid.Amount.IsLTE(nftBid.Deposit) { + expectedInterest := nftBid.CalcCompoundInterest(borrowBid.Amount, time, nftBid.Expiry) + expectedRepayAmount = expectedRepayAmount.Add(borrowBid.Amount).Add(expectedInterest) + } else { + // if borrow larger than deposit, then borrow all deposit + expectedInterest := nftBid.CalcCompoundInterest(nftBid.Deposit, time, nftBid.Expiry) + expectedRepayAmount = expectedRepayAmount.Add(nftBid.Deposit).Add(expectedInterest) + } + } + } + } + if expectedRepayAmount.IsZero() { + return types.Coin{}, ErrInvalidRepayAmount + } + return expectedRepayAmount, nil +} + +func ExistRepayAmount(bids []Bid, listing Listing) (sdk.Coin, error) { + if len(bids) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + existRepayAmount := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + for _, nftBid := range bids { + existInterest := nftBid.CalcCompoundInterest(nftBid.Loan.Amount, nftBid.Loan.LastRepaidAt, nftBid.Expiry) + existRepayAmount = existRepayAmount.Add(nftBid.Loan.Amount).Add(existInterest) + } + return existRepayAmount, nil +} + +func ExistRepayAmountAtTime(bids []Bid, listing Listing, time time.Time) (sdk.Coin, error) { + if len(bids) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + existRepayAmount := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + for _, nftBid := range bids { + existInterest := nftBid.CalcCompoundInterest(nftBid.Loan.Amount, nftBid.Loan.LastRepaidAt, time) + existRepayAmount = existRepayAmount.Add(nftBid.Loan.Amount).Add(existInterest) + } + return existRepayAmount, nil +} + +func ExistRepayAmountAtLiquidation(bids []Bid, listing Listing, liquidationTime time.Time) (sdk.Coin, error) { + if len(bids) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + existRepayAmount := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + for _, nftBid := range bids { + if nftBid.IsPaidSalePrice() { + existInterest := nftBid.CalcCompoundInterest(nftBid.Loan.Amount, nftBid.Loan.LastRepaidAt, liquidationTime) + existRepayAmount = existRepayAmount.Add(nftBid.Loan.Amount).Add(existInterest) + } + existRepayAmount = existRepayAmount.Add(nftBid.Loan.Amount) + } + return existRepayAmount, nil +} + +func MaxBorrowAmount(bids []Bid, listing Listing, time time.Time) (types.Coin, error) { + if len(bids) == 0 { + return types.Coin{}, ErrBidDoesNotExists + } + minSettlement, err := MinSettlementAmount(bids, listing) + if err != nil { + return types.Coin{}, err + } + bidsSortedByRate := NftBids(bids).SortLowerInterestRate() + borrowAmount := types.NewCoin(listing.BidDenom, sdk.NewInt(0)) + + for _, bid := range bidsSortedByRate { + expectedInterest := bid.CalcCompoundInterest(bid.Deposit, time, bid.Expiry) + repayAmount := bid.Deposit.Add(expectedInterest) + if repayAmount.IsLT(minSettlement) { + minSettlement = minSettlement.Sub(repayAmount) + borrowAmount = borrowAmount.Add(bid.Deposit) + } else { + discountAmount := minSettlement.Amount.Mul(bid.Deposit.Amount).Quo(repayAmount.Amount) + borrowAmount = borrowAmount.Add(types.NewCoin(borrowAmount.Denom, discountAmount)) + break + } + } + return borrowAmount, nil +} + +func IsAbleToBorrow(bids []Bid, borrowBids []BorrowBid, listing Listing, time time.Time) bool { + minimumSettlementAmount, err := MinSettlementAmount(bids, listing) + if err != nil { + return false + } + expectedRepayAmount, err := ExpectedRepayAmount(bids, borrowBids, listing, time) + if err != nil { + return false + } + return expectedRepayAmount.IsLTE(minimumSettlementAmount) +} + +func IsAbleToCancelBid(cancellingBidId BidId, bids []Bid, listing Listing) bool { + // check if not borrowed before this func + var afterCanceledBids []Bid + for _, bid := range bids { + if bid.Id.Bidder != cancellingBidId.Bidder { + afterCanceledBids = append(afterCanceledBids, bid) + } + } + minimumSettlementAmount, err := MinSettlementAmount(afterCanceledBids, listing) + if err != nil { + return false + } + existRepayAmount, err := ExistRepayAmount(bids, listing) + if err != nil { + return false + } + return existRepayAmount.IsLTE(minimumSettlementAmount) +} + +func IsAbleToReBid(bids []Bid, oldBidId BidId, newBid Bid, listing Listing) bool { + // check if not borrowed before this func + if oldBidId.Bidder != newBid.Id.Bidder { + return false + } + + var afterUpdatedBids []Bid + for _, bid := range bids { + if bid.Id.Bidder != oldBidId.Bidder { + afterUpdatedBids = append(afterUpdatedBids, bid) + } + } + afterUpdatedBids = append(afterUpdatedBids, newBid) + minimumSettlementAmount, err := MinSettlementAmount(afterUpdatedBids, listing) + if err != nil { + return false + } + existRepayAmount, err := ExistRepayAmount(bids, listing) + if err != nil { + return false + } + return existRepayAmount.IsLTE(minimumSettlementAmount) +} diff --git a/x/nftbackedloan/types/loan_test.go b/x/nftbackedloan/types/loan_test.go new file mode 100644 index 000000000..6ad1c868f --- /dev/null +++ b/x/nftbackedloan/types/loan_test.go @@ -0,0 +1,1170 @@ +package types_test + +import ( + "testing" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +func TestMinSettlementAmount(t *testing.T) { + listing := types.Listing{ + BidDenom: "uatom", + } + testCases := []struct { + name string + bids []types.Bid + expResult sdk.Coin + expError bool + }{ + { + name: "empty bid error", + bids: []types.Bid{}, + expResult: sdk.Coin{}, + expError: true, + }, + { + name: "one bid", + bids: []types.Bid{ + { + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + }, + }, + expResult: sdk.NewInt64Coin("uatom", 30), + expError: false, + }, + { + name: "two bids, totalDeposit < price", + bids: []types.Bid{ + { + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + }, + { + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + }, + }, + expResult: sdk.NewInt64Coin("uatom", 80), + expError: false, + }, + { + name: "three bids & price < totalDeposit", + bids: []types.Bid{ + { + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + }, + { + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 40), + }, + { + Price: sdk.NewInt64Coin("uatom", 105), + Deposit: sdk.NewInt64Coin("uatom", 45), + }, + }, + expResult: sdk.NewInt64Coin("uatom", 105), + expError: false, + }, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result, err := types.MinSettlementAmount(tc.bids, listing) + if tc.expError { + require.Error(t, err) + } + if !tc.expError { + if err != nil { + t.Errorf("unexpected error: %v", err) + } + } + require.Equal(t, tc.expResult, result) + }) + } +} + +func TestLiquidationBid(t *testing.T) { + now := time.Now() + nextYear := now.Add(time.Hour * 24 * 365) + listing := types.Listing{ + BidDenom: "uatom", + } + testCases := []struct { + name string + bids []types.Bid + expResult types.Bid + expError bool + }{ + { + name: "empty bid", + bids: []types.Bid{}, + expResult: types.Bid{}, + expError: true, + }, + { + name: "one bid, paid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 70), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + }, + expError: false, + }, + { + name: "one bid, no paid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{}, + expError: false, + }, + { + name: "two bids, 2 paid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 70), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + PaidAmount: sdk.NewInt64Coin("uatom", 150), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 30), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + }, + expError: false, + }, + { + name: "two bids, unpaid top bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 70), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 30), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + }, + expError: false, + }, + { + name: "two bids, 2 paid (check deposit)", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 40), + PaidAmount: sdk.NewInt64Coin("uatom", 60), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 15), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 150), + Deposit: sdk.NewInt64Coin("uatom", 20), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + }, + expError: false, + }, + { + name: "no paid pass liquidation", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 40), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{}, + expError: false, + }, + { + name: "cannot liquidate error", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 100), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 100), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 50), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{}, + expError: true, + }, + { + name: "(not occur) no winner bid error", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 60), + PaidAmount: sdk.NewInt64Coin("uatom", 40), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 60), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 90), + Deposit: sdk.NewInt64Coin("uatom", 40), + PaidAmount: sdk.NewInt64Coin("uatom", 50), + InterestRate: sdk.NewDecWithPrec(1, 1), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 40), + LastRepaidAt: now, + }, + }, + }, + expResult: types.Bid{}, + expError: true, + }, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + bidsSortedByDeposit := types.NftBids(tc.bids).SortHigherDeposit() + result, _, _, err := types.LiquidationBid(bidsSortedByDeposit, listing, nextYear) + if tc.expError { + require.Error(t, err) + } + if !tc.expError { + if err != nil { + t.Errorf("unexpected error: %v", err) + } + } + require.Equal(t, tc.expResult.Id.Bidder, result.Id.Bidder) + }) + } +} + +func TestForForfeitedBidsAndRefundBids(t *testing.T) { + testCases := []struct { + name string + bids []types.Bid + winnerBid types.Bid + expResult []int + }{ + { + name: "two bids, paid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 70), + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + PaidAmount: sdk.NewInt64Coin("uatom", 150), + }, + }, + winnerBid: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + }, + expResult: []int{0, 1}, + }, + { + name: "two bids, unpaid top bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100), + Deposit: sdk.NewInt64Coin("uatom", 30), + PaidAmount: sdk.NewInt64Coin("uatom", 70), + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + PaidAmount: sdk.NewInt64Coin("uatom", 0), + }, + }, + winnerBid: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + }, + expResult: []int{1, 0}, + }, + } + for _, tc := range testCases { + bidsSortedByDeposit := types.NftBids(tc.bids).SortHigherDeposit() + forfeitedBids, refundBids := types.ForfeitedBidsAndRefundBids(bidsSortedByDeposit, tc.winnerBid) + if tc.expResult[0] != len(forfeitedBids) { + t.Errorf("forfeitedBids expected length %d, got %d", tc.expResult[0], len(forfeitedBids)) + } + if tc.expResult[1] != len(refundBids) { + t.Errorf("refundBids expected length %d, got %d", tc.expResult[1], len(refundBids)) + } + } +} + +func TestExpectedRepayAmount(t *testing.T) { + now := time.Now() + nextMonth := now.Add(time.Hour * 24 * 30) + listing := types.Listing{ + BidDenom: "uatom", + } + testCases := []struct { + name string + bids []types.Bid + borrowBids []types.BorrowBid + expResult sdk.Coin + }{ + { + name: "empty bid", + bids: []types.Bid{}, + borrowBids: []types.BorrowBid{}, + expResult: sdk.Coin{}, + }, + { + name: "one bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(1, 1), + Expiry: nextMonth, + }, + }, + borrowBids: []types.BorrowBid{ + { + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + Amount: sdk.NewInt64Coin("uatom", 20000000), + }, + }, + // 20000000 * e^(0.1 * 30/365) = 20165061 + expResult: sdk.NewInt64Coin("uatom", 20165061), + }, + { + name: "2 bid & over borrow", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(1, 1), + Expiry: nextMonth, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(1, 1), + Expiry: nextMonth, + }, + }, + borrowBids: []types.BorrowBid{ + { + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + Amount: sdk.NewInt64Coin("uatom", 20000000), + }, + { + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + Amount: sdk.NewInt64Coin("uatom", 70000000), + }, + }, + // if over borrow, borrow amount is deposit amount + // 50000000 * e^(0.1 * 30/365) = 50412652 + expResult: sdk.NewInt64Coin("uatom", 50412652), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result, err := types.ExpectedRepayAmount(tc.bids, tc.borrowBids, listing, now) + if err != nil { + if tc.name != "empty bid" { + t.Errorf("unexpected error: %v", err) + } + } + if !result.IsEqual(tc.expResult) { + t.Errorf("expected %s, got %s", tc.expResult, result) + } + }) + } +} + +func TestExistRepayAmount(t *testing.T) { + now := time.Now() + nextMonth := now.Add(time.Hour * 24 * 30) + listing := types.Listing{ + BidDenom: "uatom", + } + testCases := []struct { + name string + bids []types.Bid + expResult sdk.Coin + }{ + { + name: "empty bid", + bids: []types.Bid{}, + expResult: sdk.Coin{}, + }, + { + name: "one bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(1, 1), + // Additional 1 minute for time error correction + Expiry: nextMonth, + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20000000), + LastRepaidAt: now, + }, + }, + }, + // 20000000 * e^(0.1 * 30/365) = 20165061 + expResult: sdk.NewInt64Coin("uatom", 20165061), + }, + { + name: "2 bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(1, 1), + // Additional 1 minute for time error correction + Expiry: nextMonth, + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 20000000), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 40000000), + InterestRate: sdk.NewDecWithPrec(1, 1), + // Additional 1 minute for time error correction + Expiry: nextMonth, + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 40000000), + LastRepaidAt: now, + }, + }, + }, + // 60000000 * e^(0.1 * 30/365) = 60495183 + expResult: sdk.NewInt64Coin("uatom", 60495183), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result, err := types.ExistRepayAmount(tc.bids, listing) + if err != nil { + if tc.name != "empty bid" { + t.Errorf("unexpected error: %v", err) + } + } + if !result.IsEqual(tc.expResult) { + t.Errorf("expected %s, got %s", tc.expResult, result) + } + }) + } +} + +func TestMaxBorrowAmount(t *testing.T) { + now := time.Now() + listing := types.Listing{ + BidDenom: "uatom", + } + testCases := []struct { + name string + bids []types.Bid + expResult sdk.Coin + }{ + { + name: "empty bid", + bids: []types.Bid{}, + expResult: sdk.Coin{}, + }, + { + name: "one bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 24 * 30), + }, + }, + // 30000000 / e^(0.05 * 30/365) = 29876965 + expResult: sdk.NewInt64Coin("uatom", 29876965), + }, + { + name: "2 bid", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 24 * 30), + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 80000000), + InterestRate: sdk.NewDecWithPrec(1, 1), // 10% + Expiry: now.Add(time.Hour * 24 * 10), + }, + }, + // 30000000 + (110000000 - 30123541) / e^(0.1 * 10/365) = + expResult: sdk.NewInt64Coin("uatom", 109657918), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result, err := types.MaxBorrowAmount(tc.bids, listing, now) + if err != nil { + if tc.name != "empty bid" { + t.Errorf("unexpected error: %v", err) + } + } + if !result.IsEqual(tc.expResult) { + t.Errorf("expected %s, got %s", tc.expResult, result) + } + }) + } +} + +func TestIsAbleToBorrow(t *testing.T) { + now := time.Now() + listing := types.Listing{ + BidDenom: "uatom", + } + bids := []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 72), + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 80000000), + InterestRate: sdk.NewDecWithPrec(1, 1), // 10% + Expiry: now.Add(time.Hour * 24), + }, + } + testCases := []struct { + name string + borrowBids []types.BorrowBid + expResult bool + }{ + { + name: "able to borrow", + borrowBids: []types.BorrowBid{ + { + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + Amount: sdk.NewInt64Coin("uatom", 30000000), + }, + { + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + Amount: sdk.NewInt64Coin("uatom", 20000000), + }, + }, + expResult: true, + }, + { + name: "unable to borrow", + borrowBids: []types.BorrowBid{ + { + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + Amount: sdk.NewInt64Coin("uatom", 30000000), + }, + { + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + Amount: sdk.NewInt64Coin("uatom", 80000000), + }, + }, + expResult: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result := types.IsAbleToBorrow(bids, tc.borrowBids, listing, now) + if result != tc.expResult { + t.Errorf("expected %v, got %v", tc.expResult, result) + } + }) + } +} + +func TestIsAbleToCancelBid(t *testing.T) { + now := time.Now() + listing := types.Listing{ + BidDenom: "uatom", + } + testCases := []struct { + name string + bids []types.Bid + cancelBid types.BidId + expResult bool + }{ + { + name: "able to cancel", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 72), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 0), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 80000000), + InterestRate: sdk.NewDecWithPrec(1, 1), // 10% + Expiry: now.Add(time.Hour * 24), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 0), + LastRepaidAt: now, + }, + }, + }, + cancelBid: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + expResult: true, + }, + { + name: "unable to cancel", + bids: []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 72), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 0), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 80000000), + InterestRate: sdk.NewDecWithPrec(1, 1), // 10% + Expiry: now.Add(time.Hour * 24), + Loan: types.Loan{ + // borrow 100% of deposit + Amount: sdk.NewInt64Coin("uatom", 80000000), + LastRepaidAt: now, + }, + }, + }, + cancelBid: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + expResult: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result := types.IsAbleToCancelBid(tc.cancelBid, tc.bids, listing) + if result != tc.expResult { + t.Errorf("expected %v, got %v", tc.expResult, result) + } + }) + } +} + +func TestIsAbleToReBid(t *testing.T) { + now := time.Now() + listing := types.Listing{ + BidDenom: "uatom", + } + bids := []types.Bid{ + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 100000000), + Deposit: sdk.NewInt64Coin("uatom", 30000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 72), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 0), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 70000000), + InterestRate: sdk.NewDecWithPrec(1, 1), // 10% + Expiry: now.Add(time.Hour * 24), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 70000000), + LastRepaidAt: now, + }, + }, + { + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi1y3t7sp0nfe2nfda7r9gf628g6ym6e7d44evfv6", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 80000000), + InterestRate: sdk.NewDecWithPrec(1, 1), // 10% + Expiry: now.Add(time.Hour * 24), + Loan: types.Loan{ + // borrow 100% of deposit + Amount: sdk.NewInt64Coin("uatom", 80000000), + LastRepaidAt: now, + }, + }, + } + + testCases := []struct { + name string + oldBidId types.BidId + newBid types.Bid + expResult bool + }{ + { + name: "able to re-bid", + oldBidId: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + newBid: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 200000000), + Deposit: sdk.NewInt64Coin("uatom", 50000000), + InterestRate: sdk.NewDecWithPrec(5, 2), // 5% + Expiry: now.Add(time.Hour * 72), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 0), + LastRepaidAt: now, + }, + }, + expResult: true, + }, + { + name: "unable to re-bid", + oldBidId: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + newBid: types.Bid{ + Id: types.BidId{ + NftId: &types.NftId{ + ClassId: "a10", + TokenId: "a10", + }, + Bidder: "ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w", + }, + Price: sdk.NewInt64Coin("uatom", 200), + Deposit: sdk.NewInt64Coin("uatom", 50), + InterestRate: sdk.NewDecWithPrec(5, 3), // 0.5% + Expiry: now.Add(time.Hour * 72), + Loan: types.Loan{ + Amount: sdk.NewInt64Coin("uatom", 0), + LastRepaidAt: now, + }, + }, + expResult: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result := types.IsAbleToReBid(bids, tc.oldBidId, tc.newBid, listing) + if result != tc.expResult { + t.Errorf("expected %v, got %v", tc.expResult, result) + } + }) + } +} diff --git a/x/nftbackedloan/types/msgs.go b/x/nftbackedloan/types/msgs.go index 145dd8cf8..b8646598d 100644 --- a/x/nftbackedloan/types/msgs.go +++ b/x/nftbackedloan/types/msgs.go @@ -6,76 +6,26 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgMintNft{} - -func NewMsgMintNft(sender string, classId, nftId, uri, uriHash string) MsgMintNft { - return MsgMintNft{ - Sender: sender, - ClassId: classId, - NftId: nftId, - NftUri: uri, - NftUriHash: uriHash, - } -} - -// Route return the message type used for routing the message. -func (msg MsgMintNft) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgMintNft) Type() string { return "mint_nft" } - -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgMintNft) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgMintNft) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgMintNft) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(msg.Sender) - return []sdk.AccAddress{addr} -} - // ensure Msg interface compliance at compile time var _ sdk.Msg = &MsgListNft{} // todo: Implementation fields // BidToken, MinBid, BidHook, ListingType -func NewMsgListNft(sender string, nftId NftIdentifier, bidToken string, minimumDepositRate sdk.Dec, autoRefi bool, minBiddingPeriod time.Duration) MsgListNft { +func NewMsgListNft(sender string, nftId NftId, bidDenom string, minDepositRate sdk.Dec, minBidPeriod time.Duration) MsgListNft { return MsgListNft{ - Sender: sender, - NftId: nftId, - BidToken: bidToken, - MinimumDepositRate: minimumDepositRate, - ListingType: ListingType_DIRECT_ASSET_BORROW, - AutomaticRefinancing: autoRefi, - MinimumBiddingPeriod: minBiddingPeriod, + Sender: sender, + NftId: nftId, + BidDenom: bidDenom, + MinDepositRate: minDepositRate, + MinBidPeriod: minBidPeriod, } } -// Route return the message type used for routing the message. -func (msg MsgListNft) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgListNft) Type() string { return "list_nft" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgListNft) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgListNft) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgListNft) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -83,34 +33,22 @@ func (msg MsgListNft) GetSigners() []sdk.AccAddress { } // ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgCancelNftListing{} +var _ sdk.Msg = &MsgCancelListing{} -func NewMsgCancelNftListing(sender string, nftId NftIdentifier) MsgCancelNftListing { - return MsgCancelNftListing{ +func NewMsgCancelNftListing(sender string, nftId NftId) MsgCancelListing { + return MsgCancelListing{ Sender: sender, NftId: nftId, } } -// Route return the message type used for routing the message. -func (msg MsgCancelNftListing) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgCancelNftListing) Type() string { return "cancel_nft_listing" } - // ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgCancelNftListing) ValidateBasic() error { +func (msg MsgCancelListing) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgCancelNftListing) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. -func (msg MsgCancelNftListing) GetSigners() []sdk.AccAddress { +func (msg MsgCancelListing) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } @@ -119,36 +57,24 @@ func (msg MsgCancelNftListing) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgPlaceBid{} // todo -func NewMsgPlaceBid(sender string, nftId NftIdentifier, bidAmount, depositAmount sdk.Coin, - deposit_lending_rate sdk.Dec, bidding_period time.Time, automaticPayment bool) MsgPlaceBid { +func NewMsgPlaceBid(sender string, nftId NftId, price, deposit sdk.Coin, + interestRate sdk.Dec, expiry time.Time, automaticPayment bool) MsgPlaceBid { return MsgPlaceBid{ - Sender: sender, - NftId: nftId, - BidAmount: bidAmount, - AutomaticPayment: automaticPayment, - BiddingPeriod: bidding_period, - DepositLendingRate: deposit_lending_rate, - DepositAmount: depositAmount, + Sender: sender, + NftId: nftId, + Price: price, + AutomaticPayment: automaticPayment, + Expiry: expiry, + InterestRate: interestRate, + Deposit: deposit, } } -// Route return the message type used for routing the message. -func (msg MsgPlaceBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgPlaceBid) Type() string { return "place_bid" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgPlaceBid) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgPlaceBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgPlaceBid) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -158,30 +84,18 @@ func (msg MsgPlaceBid) GetSigners() []sdk.AccAddress { // ensure Msg interface compliance at compile time var _ sdk.Msg = &MsgCancelBid{} -func NewMsgCancelBid(sender string, nftId NftIdentifier) MsgCancelBid { +func NewMsgCancelBid(sender string, nftId NftId) MsgCancelBid { return MsgCancelBid{ Sender: sender, NftId: nftId, } } -// Route return the message type used for routing the message. -func (msg MsgCancelBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgCancelBid) Type() string { return "cancel_bid" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgCancelBid) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgCancelBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgCancelBid) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -191,98 +105,62 @@ func (msg MsgCancelBid) GetSigners() []sdk.AccAddress { // ensure Msg interface compliance at compile time var _ sdk.Msg = &MsgSellingDecision{} -func NewMsgSellingDecision(sender string, nftId NftIdentifier) MsgSellingDecision { +func NewMsgSellingDecision(sender string, nftId NftId) MsgSellingDecision { return MsgSellingDecision{ Sender: sender, NftId: nftId, } } -// Route return the message type used for routing the message. -func (msg MsgSellingDecision) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgSellingDecision) Type() string { return "nft_selling_decision" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgSellingDecision) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgSellingDecision) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgSellingDecision) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -// ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgEndNftListing{} - -func NewMsgEndNftListing(sender string, nftId NftIdentifier) MsgEndNftListing { - return MsgEndNftListing{ - Sender: sender, - NftId: nftId, - } -} +// // ensure Msg interface compliance at compile time +// var _ sdk.Msg = &MsgEndNftListing{} -// Route return the message type used for routing the message. -func (msg MsgEndNftListing) Route() string { return RouterKey } +// func NewMsgEndNftListing(sender string, nftId NftIdentifier) MsgEndNftListing { +// return MsgEndNftListing{ +// Sender: sender, +// NftId: nftId, +// } +// } -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgEndNftListing) Type() string { return "end_nft_listing" } +// // ValidateBasic does a simple validation check that doesn't require access to state. +// func (msg MsgEndNftListing) ValidateBasic() error { +// return nil +// } -// ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgEndNftListing) ValidateBasic() error { - return nil -} - -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgEndNftListing) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners returns the addresses of signers that must sign. -func (msg MsgEndNftListing) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(msg.Sender) - return []sdk.AccAddress{addr} -} +// // GetSigners returns the addresses of signers that must sign. +// func (msg MsgEndNftListing) GetSigners() []sdk.AccAddress { +// addr, _ := sdk.AccAddressFromBech32(msg.Sender) +// return []sdk.AccAddress{addr} +// } // ensure Msg interface compliance at compile time -var _ sdk.Msg = &MsgPayFullBid{} +var _ sdk.Msg = &MsgPayRemainder{} -func NewMsgPayFullBid(sender string, nftId NftIdentifier) MsgPayFullBid { - return MsgPayFullBid{ +func NewMsgPayRemainder(sender string, nftId NftId) MsgPayRemainder { + return MsgPayRemainder{ Sender: sender, NftId: nftId, } } -// Route return the message type used for routing the message. -func (msg MsgPayFullBid) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgPayFullBid) Type() string { return "pay_full_bid" } - // ValidateBasic does a simple validation check that doesn't require access to state. -func (msg MsgPayFullBid) ValidateBasic() error { +func (msg MsgPayRemainder) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgPayFullBid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. -func (msg MsgPayFullBid) GetSigners() []sdk.AccAddress { +func (msg MsgPayRemainder) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } @@ -290,31 +168,19 @@ func (msg MsgPayFullBid) GetSigners() []sdk.AccAddress { // ensure Msg interface compliance at compile time var _ sdk.Msg = &MsgBorrow{} -func NewMsgBorrow(sender string, nftId NftIdentifier, amount sdk.Coin) MsgBorrow { +func NewMsgBorrow(sender string, nftId NftId, borrowBids []BorrowBid) MsgBorrow { return MsgBorrow{ - Sender: sender, - NftId: nftId, - Amount: amount, + Sender: sender, + NftId: nftId, + BorrowBids: borrowBids, } } -// Route return the message type used for routing the message. -func (msg MsgBorrow) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgBorrow) Type() string { return "borrow" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgBorrow) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgBorrow) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgBorrow) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) @@ -324,31 +190,19 @@ func (msg MsgBorrow) GetSigners() []sdk.AccAddress { // ensure Msg interface compliance at compile time var _ sdk.Msg = &MsgRepay{} -func NewMsgRepay(sender string, nftId NftIdentifier, amount sdk.Coin) MsgRepay { +func NewMsgRepay(sender string, nftId NftId, repayBids []BorrowBid) MsgRepay { return MsgRepay{ - Sender: sender, - NftId: nftId, - Amount: amount, + Sender: sender, + NftId: nftId, + RepayBids: repayBids, } } -// Route return the message type used for routing the message. -func (msg MsgRepay) Route() string { return RouterKey } - -// Type returns a human-readable string for the message, intended for utilization within tags. -func (msg MsgRepay) Type() string { return "repay" } - // ValidateBasic does a simple validation check that doesn't require access to state. func (msg MsgRepay) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgRepay) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgRepay) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) diff --git a/x/nftbackedloan/types/nft_listing.go b/x/nftbackedloan/types/nft_listing.go index b9ce37bf2..8adeda777 100644 --- a/x/nftbackedloan/types/nft_listing.go +++ b/x/nftbackedloan/types/nft_listing.go @@ -1,84 +1,83 @@ package types -import ( - time "time" +import sdk "github.com/cosmos/cosmos-sdk/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (m NftListing) IdBytes() []byte { +func (m Listing) IdBytes() []byte { return m.NftId.IdBytes() } -func (m NftListing) ClassIdBytes() []byte { +func (m Listing) ClassIdBytes() []byte { return m.NftId.ClassIdBytes() } -func (m NftListing) IsActive() bool { +func (m Listing) IsActive() bool { return m.State == ListingState_LISTING || m.State == ListingState_BIDDING } -func (m NftListing) IsFullPayment() bool { - return m.State == ListingState_SELLING_DECISION || m.State == ListingState_END_LISTING +func (m Listing) IsFullPayment() bool { + return m.State == ListingState_SELLING_DECISION || m.State == ListingState_LIQUIDATION } -func (m NftListing) IsSuccessfulBid() bool { +func (m Listing) IsSuccessfulBid() bool { return m.State == ListingState_SUCCESSFUL_BID } -func (ni NftIdentifier) IdBytes() []byte { - return NftBytes(ni.ClassId, ni.NftId) +func (ni NftId) IdBytes() []byte { + return NftBytes(ni.ClassId, ni.TokenId) } -func (ni NftIdentifier) ClassIdBytes() []byte { +func (ni NftId) ClassIdBytes() []byte { return []byte(ni.ClassId) } -func (b NftBid) IdBytes() []byte { - return b.NftId.IdBytes() +func (b Bid) IdBytes() []byte { + return b.Id.NftId.IdBytes() } -func (m NftListing) CanRefinancing(allBids, expiredBids []NftBid, now time.Time) bool { - if !m.AutomaticRefinancing { - return false - } - usableAmount := m.MaxPossibleBorrowAmount(allBids, expiredBids) - liquidationAmount := NftBids(expiredBids).LiquidationAmount(m.BidToken, now) - if liquidationAmount.Amount.GT(usableAmount) { - return false - } - return true +func (m Listing) IsBidding() bool { + return m.State == ListingState_BIDDING } -func (m NftListing) CalcAmount(bids []NftBid) sdk.Int { - return m.CalcAmountF(bids, func(NftBid) bool { return false }) +func (m Listing) IsEnded() bool { + return m.State == ListingState_SELLING_DECISION || m.State == ListingState_LIQUIDATION || m.State == ListingState_SUCCESSFUL_BID } -func (m NftListing) CalcAmountF(bids []NftBid, conditionF func(bid NftBid) bool) sdk.Int { - DepositAmount := sdk.ZeroInt() - for _, bid := range bids { - if conditionF(bid) { - continue - } - DepositAmount = DepositAmount.Add(bid.DepositAmount.Amount) - } - return DepositAmount +func (m Listing) CanCancelBid() bool { + return m.CanBid() } -func (m NftListing) MaxPossibleBorrowAmount(bids, expiredBids []NftBid) sdk.Int { - newBids := NftBids(bids).MakeExcludeExpiredBids(expiredBids) - borrowableAmount := newBids.BorrowableAmount(m.BidToken) - return borrowableAmount.Amount +func (m Listing) CanBid() bool { + return m.State == ListingState_LISTING || m.State == ListingState_BIDDING } -func (m NftListing) IsSelling() bool { - return m.State == ListingState_LISTING || m.State == ListingState_BIDDING +func (m Listing) IsNegativeCollectedAmount() bool { + return m.CollectedAmountNegative } -func (m NftListing) CanCancelBid() bool { - return m.CanBid() +func (m Listing) AddCollectedAmount(amount sdk.Coin) Listing { + if m.CollectedAmountNegative { + if m.CollectedAmount.IsLTE(amount) { + m.CollectedAmount = amount.Sub(m.CollectedAmount) + m.CollectedAmountNegative = false + } else { + m.CollectedAmount = m.CollectedAmount.Sub(amount) + } + } else { + m.CollectedAmount = m.CollectedAmount.Add(amount) + } + return m } -func (m NftListing) CanBid() bool { - return m.State == ListingState_LISTING || m.State == ListingState_BIDDING +func (m Listing) SubCollectedAmount(amount sdk.Coin) Listing { + if m.CollectedAmountNegative { + m.CollectedAmount = m.CollectedAmount.Add(amount) + } else { + if m.CollectedAmount.IsLTE(amount) { + m.CollectedAmount = amount.Sub(m.CollectedAmount) + m.CollectedAmountNegative = true + } else { + m.CollectedAmount = m.CollectedAmount.Sub(amount) + } + } + return m } diff --git a/x/nftbackedloan/types/nft_listing_test.go b/x/nftbackedloan/types/nft_listing_test.go new file mode 100644 index 000000000..99a337aed --- /dev/null +++ b/x/nftbackedloan/types/nft_listing_test.go @@ -0,0 +1,150 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/UnUniFi/chain/x/nftbackedloan/types" +) + +func TestAddCollectedAmount(t *testing.T) { + testCases := []struct { + name string + listing types.Listing + amount sdk.Coin + expCoin sdk.Coin + expNegative bool + }{ + { + "Add 0 to positive", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: false, + }, + sdk.NewCoin("uguu", sdk.NewInt(0)), + sdk.NewCoin("uguu", sdk.NewInt(100)), + false, + }, + { + "Add 0 to negative", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(60)), + CollectedAmountNegative: true, + }, + sdk.NewCoin("uguu", sdk.NewInt(0)), + sdk.NewCoin("uguu", sdk.NewInt(60)), + true, + }, + { + "Add to positive", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: false, + }, + sdk.NewCoin("uguu", sdk.NewInt(100)), + sdk.NewCoin("uguu", sdk.NewInt(200)), + false, + }, + { + "Add to negative (add < negative)", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: true, + }, + sdk.NewCoin("uguu", sdk.NewInt(50)), + sdk.NewCoin("uguu", sdk.NewInt(50)), + true, + }, + { + "Add to negative (add > negative)", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: true, + }, + sdk.NewCoin("uguu", sdk.NewInt(200)), + sdk.NewCoin("uguu", sdk.NewInt(100)), + false, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + result := tc.listing.AddCollectedAmount(tc.amount) + require.Equal(t, tc.expCoin, result.CollectedAmount) + require.Equal(t, tc.expNegative, result.CollectedAmountNegative) + }) + } +} + +func TestSubCollectedAmount(t *testing.T) { + testCases := []struct { + name string + listing types.Listing + amount sdk.Coin + expCoin sdk.Coin + expNegative bool + }{ + { + "Sub 0 from positive", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: false, + }, + sdk.NewCoin("uguu", sdk.NewInt(0)), + sdk.NewCoin("uguu", sdk.NewInt(100)), + false, + }, + { + "Sub 0 from negative", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(60)), + CollectedAmountNegative: true, + }, + sdk.NewCoin("uguu", sdk.NewInt(0)), + sdk.NewCoin("uguu", sdk.NewInt(60)), + true, + }, + { + "Sub from negative", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: true, + }, + sdk.NewCoin("uguu", sdk.NewInt(100)), + sdk.NewCoin("uguu", sdk.NewInt(200)), + true, + }, + { + "sub from positive (sub < positive)", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: false, + }, + sdk.NewCoin("uguu", sdk.NewInt(50)), + sdk.NewCoin("uguu", sdk.NewInt(50)), + false, + }, + { + "sub from positive (sub > positive)", + types.Listing{ + CollectedAmount: sdk.NewCoin("uguu", sdk.NewInt(100)), + CollectedAmountNegative: false, + }, + sdk.NewCoin("uguu", sdk.NewInt(150)), + sdk.NewCoin("uguu", sdk.NewInt(50)), + true, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + result := tc.listing.SubCollectedAmount(tc.amount) + require.Equal(t, tc.expCoin, result.CollectedAmount) + require.Equal(t, tc.expNegative, result.CollectedAmountNegative) + }) + } +} diff --git a/x/nftbackedloan/types/nftbackedloan.pb.go b/x/nftbackedloan/types/nftbackedloan.pb.go index 4ab7d0927..d4db40ec5 100644 --- a/x/nftbackedloan/types/nftbackedloan.pb.go +++ b/x/nftbackedloan/types/nftbackedloan.pb.go @@ -31,58 +31,33 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type ListingType int32 - -const ( - ListingType_DIRECT_ASSET_BORROW ListingType = 0 - ListingType_SYNTHETIC_ASSET_CREATION ListingType = 1 - ListingType_LATE_SHIPPING ListingType = 2 -) - -var ListingType_name = map[int32]string{ - 0: "DIRECT_ASSET_BORROW", - 1: "SYNTHETIC_ASSET_CREATION", - 2: "LATE_SHIPPING", -} - -var ListingType_value = map[string]int32{ - "DIRECT_ASSET_BORROW": 0, - "SYNTHETIC_ASSET_CREATION": 1, - "LATE_SHIPPING": 2, -} - -func (x ListingType) String() string { - return proto.EnumName(ListingType_name, int32(x)) -} - -func (ListingType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{0} -} - type ListingState int32 const ( - ListingState_LISTING ListingState = 0 - ListingState_BIDDING ListingState = 1 - ListingState_SELLING_DECISION ListingState = 2 - ListingState_END_LISTING ListingState = 3 - ListingState_SUCCESSFUL_BID ListingState = 4 + ListingState_UNKNOWN ListingState = 0 + ListingState_LISTING ListingState = 1 + ListingState_BIDDING ListingState = 2 + ListingState_SELLING_DECISION ListingState = 3 + ListingState_LIQUIDATION ListingState = 4 + ListingState_SUCCESSFUL_BID ListingState = 5 ) var ListingState_name = map[int32]string{ - 0: "LISTING", - 1: "BIDDING", - 2: "SELLING_DECISION", - 3: "END_LISTING", - 4: "SUCCESSFUL_BID", + 0: "UNKNOWN", + 1: "LISTING", + 2: "BIDDING", + 3: "SELLING_DECISION", + 4: "LIQUIDATION", + 5: "SUCCESSFUL_BID", } var ListingState_value = map[string]int32{ - "LISTING": 0, - "BIDDING": 1, - "SELLING_DECISION": 2, - "END_LISTING": 3, - "SUCCESSFUL_BID": 4, + "UNKNOWN": 0, + "LISTING": 1, + "BIDDING": 2, + "SELLING_DECISION": 3, + "LIQUIDATION": 4, + "SUCCESSFUL_BID": 5, } func (x ListingState) String() string { @@ -90,26 +65,26 @@ func (x ListingState) String() string { } func (ListingState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{1} + return fileDescriptor_9e729891a263bcae, []int{0} } -type NftIdentifier struct { +type NftId struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + TokenId string `protobuf:"bytes,2,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` } -func (m *NftIdentifier) Reset() { *m = NftIdentifier{} } -func (m *NftIdentifier) String() string { return proto.CompactTextString(m) } -func (*NftIdentifier) ProtoMessage() {} -func (*NftIdentifier) Descriptor() ([]byte, []int) { +func (m *NftId) Reset() { *m = NftId{} } +func (m *NftId) String() string { return proto.CompactTextString(m) } +func (*NftId) ProtoMessage() {} +func (*NftId) Descriptor() ([]byte, []int) { return fileDescriptor_9e729891a263bcae, []int{0} } -func (m *NftIdentifier) XXX_Unmarshal(b []byte) error { +func (m *NftId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *NftIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *NftId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_NftIdentifier.Marshal(b, m, deterministic) + return xxx_messageInfo_NftId.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -119,35 +94,35 @@ func (m *NftIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *NftIdentifier) XXX_Merge(src proto.Message) { - xxx_messageInfo_NftIdentifier.Merge(m, src) +func (m *NftId) XXX_Merge(src proto.Message) { + xxx_messageInfo_NftId.Merge(m, src) } -func (m *NftIdentifier) XXX_Size() int { +func (m *NftId) XXX_Size() int { return m.Size() } -func (m *NftIdentifier) XXX_DiscardUnknown() { - xxx_messageInfo_NftIdentifier.DiscardUnknown(m) +func (m *NftId) XXX_DiscardUnknown() { + xxx_messageInfo_NftId.DiscardUnknown(m) } -var xxx_messageInfo_NftIdentifier proto.InternalMessageInfo +var xxx_messageInfo_NftId proto.InternalMessageInfo -func (m *NftIdentifier) GetClassId() string { +func (m *NftId) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *NftIdentifier) GetNftId() string { +func (m *NftId) GetTokenId() string { if m != nil { - return m.NftId + return m.TokenId } return "" } type BidId struct { - NftId *NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` + NftId *NftId `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` } func (m *BidId) Reset() { *m = BidId{} } @@ -183,7 +158,7 @@ func (m *BidId) XXX_DiscardUnknown() { var xxx_messageInfo_BidId proto.InternalMessageInfo -func (m *BidId) GetNftId() *NftIdentifier { +func (m *BidId) GetNftId() *NftId { if m != nil { return m.NftId } @@ -197,58 +172,6 @@ func (m *BidId) GetBidder() string { return "" } -type Loan struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Loan types.Coin `protobuf:"bytes,2,opt,name=loan,proto3" json:"loan"` -} - -func (m *Loan) Reset() { *m = Loan{} } -func (m *Loan) String() string { return proto.CompactTextString(m) } -func (*Loan) ProtoMessage() {} -func (*Loan) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{2} -} -func (m *Loan) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Loan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Loan.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Loan) XXX_Merge(src proto.Message) { - xxx_messageInfo_Loan.Merge(m, src) -} -func (m *Loan) XXX_Size() int { - return m.Size() -} -func (m *Loan) XXX_DiscardUnknown() { - xxx_messageInfo_Loan.DiscardUnknown(m) -} - -var xxx_messageInfo_Loan proto.InternalMessageInfo - -func (m *Loan) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *Loan) GetLoan() types.Coin { - if m != nil { - return m.Loan - } - return types.Coin{} -} - type ListedClass struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftIds []string `protobuf:"bytes,2,rep,name=nft_ids,json=nftIds,proto3" json:"nft_ids,omitempty"` @@ -258,7 +181,7 @@ func (m *ListedClass) Reset() { *m = ListedClass{} } func (m *ListedClass) String() string { return proto.CompactTextString(m) } func (*ListedClass) ProtoMessage() {} func (*ListedClass) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{3} + return fileDescriptor_9e729891a263bcae, []int{2} } func (m *ListedClass) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -311,7 +234,7 @@ func (m *NftInfo) Reset() { *m = NftInfo{} } func (m *NftInfo) String() string { return proto.CompactTextString(m) } func (*NftInfo) ProtoMessage() {} func (*NftInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{4} + return fileDescriptor_9e729891a263bcae, []int{3} } func (m *NftInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -361,35 +284,33 @@ func (m *NftInfo) GetUriHash() string { return "" } -type NftListing struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - ListingType ListingType `protobuf:"varint,3,opt,name=listing_type,json=listingType,proto3,enum=ununifi.nftbackedloan.ListingType" json:"listing_type,omitempty"` - State ListingState `protobuf:"varint,4,opt,name=state,proto3,enum=ununifi.nftbackedloan.ListingState" json:"state,omitempty"` - BidToken string `protobuf:"bytes,5,opt,name=bid_token,json=bidToken,proto3" json:"bid_token,omitempty"` - MinimumDepositRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=minimum_deposit_rate,json=minimumDepositRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_deposit_rate"` - AutomaticRefinancing bool `protobuf:"varint,7,opt,name=automatic_refinancing,json=automaticRefinancing,proto3" json:"automatic_refinancing,omitempty"` - StartedAt time.Time `protobuf:"bytes,8,opt,name=started_at,json=startedAt,proto3,stdtime" json:"started_at" yaml:"started_at"` - EndAt time.Time `protobuf:"bytes,9,opt,name=end_at,json=endAt,proto3,stdtime" json:"end_at" yaml:"end_at"` - FullPaymentEndAt time.Time `protobuf:"bytes,10,opt,name=full_payment_end_at,json=fullPaymentEndAt,proto3,stdtime" json:"full_payment_end_at" yaml:"full_payment_end_at"` - SuccessfulBidEndAt time.Time `protobuf:"bytes,11,opt,name=successful_bid_end_at,json=successfulBidEndAt,proto3,stdtime" json:"successful_bid_end_at" yaml:"successful_bid_end_at"` - AutoRelistedCount uint64 `protobuf:"varint,12,opt,name=auto_relisted_count,json=autoRelistedCount,proto3" json:"auto_relisted_count,omitempty"` - CollectedAmount types.Coin `protobuf:"bytes,13,opt,name=collected_amount,json=collectedAmount,proto3" json:"collected_amount"` - MinimumBiddingPeriod time.Duration `protobuf:"bytes,14,opt,name=minimum_bidding_period,json=minimumBiddingPeriod,proto3,stdduration" json:"minimum_bidding_period"` -} - -func (m *NftListing) Reset() { *m = NftListing{} } -func (m *NftListing) String() string { return proto.CompactTextString(m) } -func (*NftListing) ProtoMessage() {} -func (*NftListing) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{5} +type Listing struct { + NftId NftId `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + State ListingState `protobuf:"varint,3,opt,name=state,proto3,enum=ununifi.nftbackedloan.ListingState" json:"state,omitempty"` + BidDenom string `protobuf:"bytes,4,opt,name=bid_denom,json=bidDenom,proto3" json:"bid_denom,omitempty"` + MinDepositRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=min_deposit_rate,json=minDepositRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_deposit_rate"` + MinBidPeriod time.Duration `protobuf:"bytes,6,opt,name=min_bid_period,json=minBidPeriod,proto3,stdduration" json:"min_bid_period"` + StartedAt time.Time `protobuf:"bytes,7,opt,name=started_at,json=startedAt,proto3,stdtime" json:"started_at" yaml:"started_at"` + LiquidatedAt time.Time `protobuf:"bytes,8,opt,name=liquidated_at,json=liquidatedAt,proto3,stdtime" json:"liquidated_at" yaml:"liquidated_at"` + FullPaymentEndAt time.Time `protobuf:"bytes,9,opt,name=full_payment_end_at,json=fullPaymentEndAt,proto3,stdtime" json:"full_payment_end_at" yaml:"full_payment_end_at"` + SuccessfulBidEndAt time.Time `protobuf:"bytes,10,opt,name=successful_bid_end_at,json=successfulBidEndAt,proto3,stdtime" json:"successful_bid_end_at" yaml:"successful_bid_end_at"` + CollectedAmount types.Coin `protobuf:"bytes,11,opt,name=collected_amount,json=collectedAmount,proto3" json:"collected_amount"` + CollectedAmountNegative bool `protobuf:"varint,12,opt,name=collected_amount_negative,json=collectedAmountNegative,proto3" json:"collected_amount_negative,omitempty"` +} + +func (m *Listing) Reset() { *m = Listing{} } +func (m *Listing) String() string { return proto.CompactTextString(m) } +func (*Listing) ProtoMessage() {} +func (*Listing) Descriptor() ([]byte, []int) { + return fileDescriptor_9e729891a263bcae, []int{4} } -func (m *NftListing) XXX_Unmarshal(b []byte) error { +func (m *Listing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *NftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Listing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_NftListing.Marshal(b, m, deterministic) + return xxx_messageInfo_Listing.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -399,127 +320,120 @@ func (m *NftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *NftListing) XXX_Merge(src proto.Message) { - xxx_messageInfo_NftListing.Merge(m, src) +func (m *Listing) XXX_Merge(src proto.Message) { + xxx_messageInfo_Listing.Merge(m, src) } -func (m *NftListing) XXX_Size() int { +func (m *Listing) XXX_Size() int { return m.Size() } -func (m *NftListing) XXX_DiscardUnknown() { - xxx_messageInfo_NftListing.DiscardUnknown(m) +func (m *Listing) XXX_DiscardUnknown() { + xxx_messageInfo_Listing.DiscardUnknown(m) } -var xxx_messageInfo_NftListing proto.InternalMessageInfo +var xxx_messageInfo_Listing proto.InternalMessageInfo -func (m *NftListing) GetNftId() NftIdentifier { +func (m *Listing) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } -func (m *NftListing) GetOwner() string { +func (m *Listing) GetOwner() string { if m != nil { return m.Owner } return "" } -func (m *NftListing) GetListingType() ListingType { - if m != nil { - return m.ListingType - } - return ListingType_DIRECT_ASSET_BORROW -} - -func (m *NftListing) GetState() ListingState { +func (m *Listing) GetState() ListingState { if m != nil { return m.State } - return ListingState_LISTING + return ListingState_UNKNOWN } -func (m *NftListing) GetBidToken() string { +func (m *Listing) GetBidDenom() string { if m != nil { - return m.BidToken + return m.BidDenom } return "" } -func (m *NftListing) GetAutomaticRefinancing() bool { +func (m *Listing) GetMinBidPeriod() time.Duration { if m != nil { - return m.AutomaticRefinancing + return m.MinBidPeriod } - return false + return 0 } -func (m *NftListing) GetStartedAt() time.Time { +func (m *Listing) GetStartedAt() time.Time { if m != nil { return m.StartedAt } return time.Time{} } -func (m *NftListing) GetEndAt() time.Time { +func (m *Listing) GetLiquidatedAt() time.Time { if m != nil { - return m.EndAt + return m.LiquidatedAt } return time.Time{} } -func (m *NftListing) GetFullPaymentEndAt() time.Time { +func (m *Listing) GetFullPaymentEndAt() time.Time { if m != nil { return m.FullPaymentEndAt } return time.Time{} } -func (m *NftListing) GetSuccessfulBidEndAt() time.Time { +func (m *Listing) GetSuccessfulBidEndAt() time.Time { if m != nil { return m.SuccessfulBidEndAt } return time.Time{} } -func (m *NftListing) GetAutoRelistedCount() uint64 { - if m != nil { - return m.AutoRelistedCount - } - return 0 -} - -func (m *NftListing) GetCollectedAmount() types.Coin { +func (m *Listing) GetCollectedAmount() types.Coin { if m != nil { return m.CollectedAmount } return types.Coin{} } -func (m *NftListing) GetMinimumBiddingPeriod() time.Duration { +func (m *Listing) GetCollectedAmountNegative() bool { if m != nil { - return m.MinimumBiddingPeriod + return m.CollectedAmountNegative } - return 0 + return false } -type Borrowing struct { - Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` - PaidInterestAmount types.Coin `protobuf:"bytes,2,opt,name=paid_interest_amount,json=paidInterestAmount,proto3" json:"paid_interest_amount"` - StartAt time.Time `protobuf:"bytes,3,opt,name=start_at,json=startAt,proto3,stdtime" json:"start_at"` +type Bid struct { + Id BidId `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` + Price types.Coin `protobuf:"bytes,2,opt,name=price,proto3" json:"price"` + Deposit types.Coin `protobuf:"bytes,3,opt,name=deposit,proto3" json:"deposit"` + PaidAmount types.Coin `protobuf:"bytes,4,opt,name=paid_amount,json=paidAmount,proto3" json:"paid_amount"` + Expiry time.Time `protobuf:"bytes,5,opt,name=expiry,proto3,stdtime" json:"expiry"` + InterestRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=interest_rate,json=interestRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_rate"` + AutomaticPayment bool `protobuf:"varint,7,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` + CreatedAt time.Time `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at" yaml:"create_at"` + // borrow info + Loan Loan `protobuf:"bytes,9,opt,name=loan,proto3" json:"loan"` } -func (m *Borrowing) Reset() { *m = Borrowing{} } -func (m *Borrowing) String() string { return proto.CompactTextString(m) } -func (*Borrowing) ProtoMessage() {} -func (*Borrowing) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{6} +func (m *Bid) Reset() { *m = Bid{} } +func (m *Bid) String() string { return proto.CompactTextString(m) } +func (*Bid) ProtoMessage() {} +func (*Bid) Descriptor() ([]byte, []int) { + return fileDescriptor_9e729891a263bcae, []int{5} } -func (m *Borrowing) XXX_Unmarshal(b []byte) error { +func (m *Bid) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Borrowing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Bid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Borrowing.Marshal(b, m, deterministic) + return xxx_messageInfo_Bid.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -529,68 +443,91 @@ func (m *Borrowing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Borrowing) XXX_Merge(src proto.Message) { - xxx_messageInfo_Borrowing.Merge(m, src) +func (m *Bid) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bid.Merge(m, src) } -func (m *Borrowing) XXX_Size() int { +func (m *Bid) XXX_Size() int { return m.Size() } -func (m *Borrowing) XXX_DiscardUnknown() { - xxx_messageInfo_Borrowing.DiscardUnknown(m) +func (m *Bid) XXX_DiscardUnknown() { + xxx_messageInfo_Bid.DiscardUnknown(m) } -var xxx_messageInfo_Borrowing proto.InternalMessageInfo +var xxx_messageInfo_Bid proto.InternalMessageInfo -func (m *Borrowing) GetAmount() types.Coin { +func (m *Bid) GetId() BidId { if m != nil { - return m.Amount + return m.Id + } + return BidId{} +} + +func (m *Bid) GetPrice() types.Coin { + if m != nil { + return m.Price + } + return types.Coin{} +} + +func (m *Bid) GetDeposit() types.Coin { + if m != nil { + return m.Deposit } return types.Coin{} } -func (m *Borrowing) GetPaidInterestAmount() types.Coin { +func (m *Bid) GetPaidAmount() types.Coin { if m != nil { - return m.PaidInterestAmount + return m.PaidAmount } return types.Coin{} } -func (m *Borrowing) GetStartAt() time.Time { +func (m *Bid) GetExpiry() time.Time { if m != nil { - return m.StartAt + return m.Expiry } return time.Time{} } -type NftBid struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` - BidAmount types.Coin `protobuf:"bytes,3,opt,name=bid_amount,json=bidAmount,proto3" json:"bid_amount"` - DepositAmount types.Coin `protobuf:"bytes,4,opt,name=deposit_amount,json=depositAmount,proto3" json:"deposit_amount"` - PaidAmount types.Coin `protobuf:"bytes,5,opt,name=paid_amount,json=paidAmount,proto3" json:"paid_amount"` - BiddingPeriod time.Time `protobuf:"bytes,6,opt,name=bidding_period,json=biddingPeriod,proto3,stdtime" json:"bidding_period"` - DepositLendingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=deposit_lending_rate,json=depositLendingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"deposit_lending_rate"` - AutomaticPayment bool `protobuf:"varint,8,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` - BidTime time.Time `protobuf:"bytes,9,opt,name=bid_time,json=bidTime,proto3,stdtime" json:"bid_time" yaml:"bid_time"` - InterestAmount types.Coin `protobuf:"bytes,10,opt,name=interest_amount,json=interestAmount,proto3" json:"interest_amount"` - // lister borrowing bidder info - Borrowings []Borrowing `protobuf:"bytes,11,rep,name=borrowings,proto3" json:"borrowings"` - // todo remove nft_id,bidder then use it - Id BidId `protobuf:"bytes,12,opt,name=id,proto3" json:"id"` -} - -func (m *NftBid) Reset() { *m = NftBid{} } -func (m *NftBid) String() string { return proto.CompactTextString(m) } -func (*NftBid) ProtoMessage() {} -func (*NftBid) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{7} +func (m *Bid) GetAutomaticPayment() bool { + if m != nil { + return m.AutomaticPayment + } + return false +} + +func (m *Bid) GetCreatedAt() time.Time { + if m != nil { + return m.CreatedAt + } + return time.Time{} +} + +func (m *Bid) GetLoan() Loan { + if m != nil { + return m.Loan + } + return Loan{} } -func (m *NftBid) XXX_Unmarshal(b []byte) error { + +type Loan struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + LastRepaidAt time.Time `protobuf:"bytes,2,opt,name=last_repaid_at,json=lastRepaidAt,proto3,stdtime" json:"last_repaid_at"` +} + +func (m *Loan) Reset() { *m = Loan{} } +func (m *Loan) String() string { return proto.CompactTextString(m) } +func (*Loan) ProtoMessage() {} +func (*Loan) Descriptor() ([]byte, []int) { + return fileDescriptor_9e729891a263bcae, []int{6} +} +func (m *Loan) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *NftBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Loan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_NftBid.Marshal(b, m, deterministic) + return xxx_messageInfo_Loan.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -600,128 +537,101 @@ func (m *NftBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *NftBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_NftBid.Merge(m, src) +func (m *Loan) XXX_Merge(src proto.Message) { + xxx_messageInfo_Loan.Merge(m, src) } -func (m *NftBid) XXX_Size() int { +func (m *Loan) XXX_Size() int { return m.Size() } -func (m *NftBid) XXX_DiscardUnknown() { - xxx_messageInfo_NftBid.DiscardUnknown(m) +func (m *Loan) XXX_DiscardUnknown() { + xxx_messageInfo_Loan.DiscardUnknown(m) } -var xxx_messageInfo_NftBid proto.InternalMessageInfo +var xxx_messageInfo_Loan proto.InternalMessageInfo -func (m *NftBid) GetNftId() NftIdentifier { +func (m *Loan) GetAmount() types.Coin { if m != nil { - return m.NftId + return m.Amount } - return NftIdentifier{} + return types.Coin{} } -func (m *NftBid) GetBidder() string { +func (m *Loan) GetLastRepaidAt() time.Time { if m != nil { - return m.Bidder + return m.LastRepaidAt } - return "" + return time.Time{} } -func (m *NftBid) GetBidAmount() types.Coin { - if m != nil { - return m.BidAmount - } - return types.Coin{} +type Liquidation struct { + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + LiquidationDate time.Time `protobuf:"bytes,2,opt,name=liquidation_date,json=liquidationDate,proto3,stdtime" json:"liquidation_date"` } -func (m *NftBid) GetDepositAmount() types.Coin { - if m != nil { - return m.DepositAmount - } - return types.Coin{} +func (m *Liquidation) Reset() { *m = Liquidation{} } +func (m *Liquidation) String() string { return proto.CompactTextString(m) } +func (*Liquidation) ProtoMessage() {} +func (*Liquidation) Descriptor() ([]byte, []int) { + return fileDescriptor_9e729891a263bcae, []int{7} } - -func (m *NftBid) GetPaidAmount() types.Coin { - if m != nil { - return m.PaidAmount - } - return types.Coin{} +func (m *Liquidation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (m *NftBid) GetBiddingPeriod() time.Time { - if m != nil { - return m.BiddingPeriod +func (m *Liquidation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Liquidation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return time.Time{} } - -func (m *NftBid) GetAutomaticPayment() bool { - if m != nil { - return m.AutomaticPayment - } - return false +func (m *Liquidation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Liquidation.Merge(m, src) } - -func (m *NftBid) GetBidTime() time.Time { - if m != nil { - return m.BidTime - } - return time.Time{} +func (m *Liquidation) XXX_Size() int { + return m.Size() } +func (m *Liquidation) XXX_DiscardUnknown() { + xxx_messageInfo_Liquidation.DiscardUnknown(m) +} + +var xxx_messageInfo_Liquidation proto.InternalMessageInfo -func (m *NftBid) GetInterestAmount() types.Coin { +func (m *Liquidation) GetAmount() types.Coin { if m != nil { - return m.InterestAmount + return m.Amount } return types.Coin{} } -func (m *NftBid) GetBorrowings() []Borrowing { +func (m *Liquidation) GetLiquidationDate() time.Time { if m != nil { - return m.Borrowings + return m.LiquidationDate } - return nil + return time.Time{} } -func (m *NftBid) GetId() BidId { - if m != nil { - return m.Id - } - return BidId{} +type Liquidations struct { + Liquidation *Liquidation `protobuf:"bytes,1,opt,name=liquidation,proto3" json:"liquidation,omitempty"` + NextLiquidation []Liquidation `protobuf:"bytes,2,rep,name=next_liquidation,json=nextLiquidation,proto3" json:"next_liquidation"` } -type Params struct { - MinStakingForListing github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=min_staking_for_listing,json=minStakingForListing,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_staking_for_listing" yaml:"min_staking_for_listing"` - DefaultBidActiveRank uint64 `protobuf:"varint,2,opt,name=default_bid_active_rank,json=defaultBidActiveRank,proto3" json:"default_bid_active_rank,omitempty"` - BidTokens []string `protobuf:"bytes,3,rep,name=bid_tokens,json=bidTokens,proto3" json:"bid_tokens,omitempty"` - AutoRelistingCountIfNoBid uint64 `protobuf:"varint,4,opt,name=auto_relisting_count_if_no_bid,json=autoRelistingCountIfNoBid,proto3" json:"auto_relisting_count_if_no_bid,omitempty"` - NftListingDelaySeconds uint64 `protobuf:"varint,5,opt,name=nft_listing_delay_seconds,json=nftListingDelaySeconds,proto3" json:"nft_listing_delay_seconds,omitempty"` - NftListingPeriodInitial uint64 `protobuf:"varint,6,opt,name=nft_listing_period_initial,json=nftListingPeriodInitial,proto3" json:"nft_listing_period_initial,omitempty"` - NftListingCancelRequiredSeconds uint64 `protobuf:"varint,7,opt,name=nft_listing_cancel_required_seconds,json=nftListingCancelRequiredSeconds,proto3" json:"nft_listing_cancel_required_seconds,omitempty"` - NftListingCancelFeePercentage uint64 `protobuf:"varint,8,opt,name=nft_listing_cancel_fee_percentage,json=nftListingCancelFeePercentage,proto3" json:"nft_listing_cancel_fee_percentage,omitempty"` - NftListingGapTime uint64 `protobuf:"varint,9,opt,name=nft_listing_gap_time,json=nftListingGapTime,proto3" json:"nft_listing_gap_time,omitempty"` - BidCancelRequiredSeconds uint64 `protobuf:"varint,10,opt,name=bid_cancel_required_seconds,json=bidCancelRequiredSeconds,proto3" json:"bid_cancel_required_seconds,omitempty"` - BidTokenDisburseSecondsAfterCancel uint64 `protobuf:"varint,11,opt,name=bid_token_disburse_seconds_after_cancel,json=bidTokenDisburseSecondsAfterCancel,proto3" json:"bid_token_disburse_seconds_after_cancel,omitempty"` - NftListingFullPaymentPeriod uint64 `protobuf:"varint,12,opt,name=nft_listing_full_payment_period,json=nftListingFullPaymentPeriod,proto3" json:"nft_listing_full_payment_period,omitempty"` - NftListingNftDeliveryPeriod uint64 `protobuf:"varint,13,opt,name=nft_listing_nft_delivery_period,json=nftListingNftDeliveryPeriod,proto3" json:"nft_listing_nft_delivery_period,omitempty"` - NftCreatorSharePercentage uint64 `protobuf:"varint,14,opt,name=nft_creator_share_percentage,json=nftCreatorSharePercentage,proto3" json:"nft_creator_share_percentage,omitempty"` - MarketAdministrator string `protobuf:"bytes,15,opt,name=market_administrator,json=marketAdministrator,proto3" json:"market_administrator,omitempty"` - NftListingCommissionFee uint64 `protobuf:"varint,16,opt,name=nft_listing_commission_fee,json=nftListingCommissionFee,proto3" json:"nft_listing_commission_fee,omitempty"` - NftListingExtendSeconds uint64 `protobuf:"varint,17,opt,name=nft_listing_extend_seconds,json=nftListingExtendSeconds,proto3" json:"nft_listing_extend_seconds,omitempty"` - NftListingPeriodExtendFeePerHour types.Coin `protobuf:"bytes,18,opt,name=nft_listing_period_extend_fee_per_hour,json=nftListingPeriodExtendFeePerHour,proto3" json:"nft_listing_period_extend_fee_per_hour"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { +func (m *Liquidations) Reset() { *m = Liquidations{} } +func (m *Liquidations) String() string { return proto.CompactTextString(m) } +func (*Liquidations) ProtoMessage() {} +func (*Liquidations) Descriptor() ([]byte, []int) { return fileDescriptor_9e729891a263bcae, []int{8} } -func (m *Params) XXX_Unmarshal(b []byte) error { +func (m *Liquidations) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Liquidations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) + return xxx_messageInfo_Liquidations.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -731,5788 +641,1003 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) +func (m *Liquidations) XXX_Merge(src proto.Message) { + xxx_messageInfo_Liquidations.Merge(m, src) } -func (m *Params) XXX_Size() int { +func (m *Liquidations) XXX_Size() int { return m.Size() } -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) +func (m *Liquidations) XXX_DiscardUnknown() { + xxx_messageInfo_Liquidations.DiscardUnknown(m) } -var xxx_messageInfo_Params proto.InternalMessageInfo +var xxx_messageInfo_Liquidations proto.InternalMessageInfo -func (m *Params) GetDefaultBidActiveRank() uint64 { +func (m *Liquidations) GetLiquidation() *Liquidation { if m != nil { - return m.DefaultBidActiveRank + return m.Liquidation } - return 0 + return nil } -func (m *Params) GetBidTokens() []string { +func (m *Liquidations) GetNextLiquidation() []Liquidation { if m != nil { - return m.BidTokens + return m.NextLiquidation } return nil } -func (m *Params) GetAutoRelistingCountIfNoBid() uint64 { - if m != nil { - return m.AutoRelistingCountIfNoBid - } - return 0 +type RepayInfo struct { + RepaidAmount types.Coin `protobuf:"bytes,1,opt,name=repaid_amount,json=repaidAmount,proto3" json:"repaid_amount"` + RepaidInterestAmount types.Coin `protobuf:"bytes,2,opt,name=repaid_interest_amount,json=repaidInterestAmount,proto3" json:"repaid_interest_amount"` + RemainingAmount types.Coin `protobuf:"bytes,3,opt,name=remaining_amount,json=remainingAmount,proto3" json:"remaining_amount"` + LastRepaidAt time.Time `protobuf:"bytes,4,opt,name=last_repaid_at,json=lastRepaidAt,proto3,stdtime" json:"last_repaid_at"` } -func (m *Params) GetNftListingDelaySeconds() uint64 { - if m != nil { - return m.NftListingDelaySeconds - } - return 0 +func (m *RepayInfo) Reset() { *m = RepayInfo{} } +func (m *RepayInfo) String() string { return proto.CompactTextString(m) } +func (*RepayInfo) ProtoMessage() {} +func (*RepayInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_9e729891a263bcae, []int{9} } - -func (m *Params) GetNftListingPeriodInitial() uint64 { - if m != nil { - return m.NftListingPeriodInitial +func (m *RepayInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RepayInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RepayInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return 0 } +func (m *RepayInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RepayInfo.Merge(m, src) +} +func (m *RepayInfo) XXX_Size() int { + return m.Size() +} +func (m *RepayInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RepayInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RepayInfo proto.InternalMessageInfo -func (m *Params) GetNftListingCancelRequiredSeconds() uint64 { +func (m *RepayInfo) GetRepaidAmount() types.Coin { if m != nil { - return m.NftListingCancelRequiredSeconds + return m.RepaidAmount } - return 0 + return types.Coin{} } -func (m *Params) GetNftListingCancelFeePercentage() uint64 { +func (m *RepayInfo) GetRepaidInterestAmount() types.Coin { if m != nil { - return m.NftListingCancelFeePercentage + return m.RepaidInterestAmount } - return 0 + return types.Coin{} } -func (m *Params) GetNftListingGapTime() uint64 { +func (m *RepayInfo) GetRemainingAmount() types.Coin { if m != nil { - return m.NftListingGapTime + return m.RemainingAmount } - return 0 + return types.Coin{} } -func (m *Params) GetBidCancelRequiredSeconds() uint64 { +func (m *RepayInfo) GetLastRepaidAt() time.Time { if m != nil { - return m.BidCancelRequiredSeconds + return m.LastRepaidAt } - return 0 + return time.Time{} } -func (m *Params) GetBidTokenDisburseSecondsAfterCancel() uint64 { - if m != nil { - return m.BidTokenDisburseSecondsAfterCancel - } - return 0 -} - -func (m *Params) GetNftListingFullPaymentPeriod() uint64 { - if m != nil { - return m.NftListingFullPaymentPeriod - } - return 0 +func init() { + proto.RegisterEnum("ununifi.nftbackedloan.ListingState", ListingState_name, ListingState_value) + proto.RegisterType((*NftId)(nil), "ununifi.nftbackedloan.NftId") + proto.RegisterType((*BidId)(nil), "ununifi.nftbackedloan.BidId") + proto.RegisterType((*ListedClass)(nil), "ununifi.nftbackedloan.ListedClass") + proto.RegisterType((*NftInfo)(nil), "ununifi.nftbackedloan.NftInfo") + proto.RegisterType((*Listing)(nil), "ununifi.nftbackedloan.Listing") + proto.RegisterType((*Bid)(nil), "ununifi.nftbackedloan.Bid") + proto.RegisterType((*Loan)(nil), "ununifi.nftbackedloan.Loan") + proto.RegisterType((*Liquidation)(nil), "ununifi.nftbackedloan.Liquidation") + proto.RegisterType((*Liquidations)(nil), "ununifi.nftbackedloan.Liquidations") + proto.RegisterType((*RepayInfo)(nil), "ununifi.nftbackedloan.RepayInfo") } -func (m *Params) GetNftListingNftDeliveryPeriod() uint64 { - if m != nil { - return m.NftListingNftDeliveryPeriod - } - return 0 +func init() { + proto.RegisterFile("ununifi/nftbackedloan/nftbackedloan.proto", fileDescriptor_9e729891a263bcae) } -func (m *Params) GetNftCreatorSharePercentage() uint64 { - if m != nil { - return m.NftCreatorSharePercentage +var fileDescriptor_9e729891a263bcae = []byte{ + // 1186 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0x13, 0x47, + 0x14, 0xce, 0x26, 0xfe, 0x49, 0x8e, 0x4d, 0xb2, 0x4c, 0x03, 0x38, 0x81, 0x3a, 0xd1, 0x56, 0x42, + 0xb4, 0x15, 0xb6, 0x00, 0xa1, 0x0a, 0x44, 0xa5, 0xda, 0xd9, 0x00, 0x4b, 0x23, 0x43, 0xed, 0x58, + 0x54, 0xbd, 0x59, 0x8d, 0x77, 0xc7, 0xce, 0x88, 0xdd, 0x19, 0xb3, 0x3b, 0x0b, 0xe4, 0x19, 0x7a, + 0xc3, 0x55, 0xdb, 0xb7, 0xe8, 0x4d, 0x1f, 0xa0, 0x97, 0x48, 0xbd, 0x41, 0xbd, 0xaa, 0x7a, 0x41, + 0x2b, 0x78, 0x83, 0x3e, 0x41, 0x35, 0x3f, 0x6b, 0x9b, 0x94, 0x80, 0x69, 0x7b, 0x65, 0x9f, 0x39, + 0xe7, 0xfb, 0xbe, 0xb3, 0x73, 0x7e, 0x76, 0xe1, 0xe3, 0x8c, 0x65, 0x8c, 0x0e, 0x69, 0x93, 0x0d, + 0xc5, 0x00, 0x07, 0x0f, 0x48, 0x18, 0x71, 0xcc, 0x5e, 0xb7, 0x1a, 0xe3, 0x84, 0x0b, 0x8e, 0x4e, + 0x99, 0xd0, 0xc6, 0x6b, 0xce, 0xcd, 0xf5, 0x11, 0x1f, 0x71, 0x15, 0xd1, 0x94, 0xff, 0x74, 0xf0, + 0xe6, 0xd6, 0x88, 0xf3, 0x51, 0x44, 0x9a, 0xca, 0x1a, 0x64, 0xc3, 0xa6, 0xa0, 0x31, 0x49, 0x05, + 0x8e, 0xc7, 0x26, 0xa0, 0x7e, 0x34, 0x20, 0xcc, 0x12, 0x2c, 0x28, 0x67, 0xb9, 0x3f, 0xe0, 0x69, + 0xcc, 0xd3, 0xe6, 0x00, 0xa7, 0xa4, 0xf9, 0xe8, 0xd2, 0x80, 0x08, 0x7c, 0xa9, 0x19, 0x70, 0x9a, + 0xfb, 0x37, 0xb4, 0xdf, 0xd7, 0xca, 0xda, 0xd0, 0x2e, 0xe7, 0x73, 0x28, 0x76, 0x86, 0xc2, 0x0b, + 0xd1, 0x06, 0x2c, 0x07, 0x11, 0x4e, 0x53, 0x9f, 0x86, 0x35, 0x6b, 0xdb, 0xba, 0xb0, 0xd2, 0x2d, + 0x2b, 0x5b, 0xbb, 0x04, 0x7f, 0x40, 0x98, 0x74, 0x2d, 0x6a, 0x97, 0xb2, 0xbd, 0xd0, 0xd9, 0x87, + 0x62, 0x9b, 0x86, 0x5e, 0x88, 0xae, 0x40, 0x89, 0x0d, 0x45, 0x0e, 0xae, 0x5c, 0x3e, 0xd7, 0x78, + 0xe3, 0x0d, 0x34, 0x94, 0x58, 0xb7, 0xc8, 0x94, 0xe6, 0x69, 0x28, 0x0d, 0x68, 0x18, 0x92, 0xc4, + 0xd0, 0x1a, 0xcb, 0x69, 0x41, 0x65, 0x8f, 0xa6, 0x82, 0x84, 0x3b, 0x32, 0x83, 0xb7, 0xa5, 0x76, + 0x06, 0xca, 0x5a, 0x36, 0xad, 0x2d, 0x6e, 0x2f, 0x49, 0x0a, 0xc5, 0x9c, 0x3a, 0x37, 0xa1, 0x2c, + 0xa5, 0xd8, 0x90, 0xa3, 0x55, 0x58, 0x9c, 0x00, 0x17, 0x69, 0x88, 0x6c, 0x58, 0xca, 0x12, 0x6a, + 0x24, 0xe5, 0x5f, 0x29, 0x90, 0x25, 0xd4, 0x3f, 0xc0, 0xe9, 0x41, 0x6d, 0x49, 0x0b, 0x64, 0x09, + 0xbd, 0x8d, 0xd3, 0x03, 0xe7, 0xbb, 0x32, 0x94, 0x65, 0x2e, 0x94, 0x8d, 0xd0, 0xb5, 0xf7, 0x79, + 0xc6, 0x76, 0xe1, 0xd9, 0x8b, 0xad, 0x85, 0xfc, 0x49, 0xd7, 0xa1, 0xc8, 0x1f, 0xb3, 0xc9, 0x83, + 0x6a, 0x03, 0x5d, 0x83, 0x62, 0x2a, 0xb0, 0x20, 0x4a, 0x74, 0xf5, 0xf2, 0x47, 0xc7, 0xf0, 0x19, + 0xfd, 0x9e, 0x0c, 0xed, 0x6a, 0x04, 0x3a, 0x0b, 0x2b, 0x03, 0x1a, 0xfa, 0x21, 0x61, 0x3c, 0xae, + 0x15, 0x14, 0xe9, 0xf2, 0x80, 0x86, 0xae, 0xb4, 0xd1, 0x10, 0xec, 0x98, 0x32, 0x3f, 0x24, 0x63, + 0x9e, 0x52, 0xe1, 0x27, 0x52, 0xa2, 0x28, 0x63, 0xda, 0x37, 0x64, 0x52, 0xbf, 0xbf, 0xd8, 0x3a, + 0x3f, 0xa2, 0xe2, 0x20, 0x1b, 0x34, 0x02, 0x1e, 0x9b, 0x7e, 0x30, 0x3f, 0x17, 0xd3, 0xf0, 0x41, + 0x53, 0x1c, 0x8e, 0x49, 0xda, 0x70, 0x49, 0xf0, 0xeb, 0x4f, 0x17, 0xc1, 0xb4, 0x8b, 0x4b, 0x82, + 0xee, 0x6a, 0x4c, 0x99, 0xab, 0x49, 0xbb, 0x32, 0x09, 0x0f, 0xe4, 0x89, 0x2f, 0x13, 0x19, 0x93, + 0x84, 0xf2, 0xb0, 0x56, 0x52, 0x17, 0xb3, 0xd1, 0xd0, 0x0d, 0xdb, 0xc8, 0x1b, 0xb6, 0xe1, 0x9a, + 0x86, 0x6d, 0x2f, 0xcb, 0x04, 0x7e, 0xf8, 0x63, 0xcb, 0xea, 0x56, 0x63, 0xca, 0xda, 0x34, 0xbc, + 0xa7, 0x80, 0xe8, 0x6b, 0x80, 0x54, 0xe0, 0x44, 0x90, 0xd0, 0xc7, 0xa2, 0x56, 0x56, 0x34, 0x9b, + 0xff, 0xa0, 0xd9, 0xcf, 0x07, 0xa3, 0xfd, 0xa1, 0xe4, 0xf9, 0xeb, 0xc5, 0xd6, 0xc9, 0x43, 0x1c, + 0x47, 0xd7, 0x9d, 0x29, 0xd6, 0x79, 0x2a, 0xc9, 0x57, 0xcc, 0x41, 0x4b, 0x20, 0x0c, 0x27, 0x22, + 0xfa, 0x30, 0xa3, 0x21, 0x36, 0xe4, 0xcb, 0xef, 0x24, 0xdf, 0x36, 0xe4, 0xeb, 0x9a, 0xfc, 0x35, + 0xb8, 0xe6, 0xaf, 0x4e, 0xcf, 0x5a, 0x02, 0x3d, 0x84, 0x0f, 0x86, 0x59, 0x14, 0xf9, 0x63, 0x7c, + 0x18, 0x13, 0x26, 0x7c, 0xc2, 0x94, 0xd0, 0xca, 0x3b, 0x85, 0xce, 0x1b, 0xa1, 0x4d, 0x2d, 0xf4, + 0x06, 0x12, 0x2d, 0x67, 0x4b, 0xcf, 0x3d, 0xed, 0xd8, 0x65, 0x52, 0xf2, 0x31, 0x9c, 0x4a, 0xb3, + 0x20, 0x20, 0x69, 0x3a, 0xcc, 0x22, 0x55, 0x01, 0x23, 0x0a, 0xef, 0x14, 0xbd, 0x60, 0x44, 0xcf, + 0x99, 0xab, 0x7b, 0x13, 0x8d, 0x96, 0x45, 0x53, 0x5f, 0x9b, 0x86, 0x5a, 0xf8, 0x0e, 0xd8, 0x01, + 0x8f, 0x22, 0x12, 0xa8, 0xeb, 0x88, 0x79, 0xc6, 0x44, 0xad, 0x62, 0xaa, 0x6e, 0x5a, 0x45, 0xae, + 0xa1, 0x86, 0x59, 0x43, 0x8d, 0x1d, 0x4e, 0x99, 0x99, 0x85, 0xb5, 0x09, 0xb0, 0xa5, 0x70, 0xe8, + 0x3a, 0x6c, 0x1c, 0xe5, 0xf2, 0x19, 0x19, 0x61, 0x41, 0x1f, 0x91, 0x5a, 0x75, 0xdb, 0xba, 0xb0, + 0xdc, 0x3d, 0x73, 0x04, 0xd3, 0x31, 0x6e, 0xe7, 0x97, 0x02, 0x2c, 0xb5, 0x69, 0x88, 0x2e, 0x4f, + 0xa6, 0xfb, 0xf8, 0x81, 0x54, 0x2b, 0xca, 0x24, 0x21, 0x37, 0xc0, 0x55, 0x28, 0x8e, 0x13, 0x1a, + 0x10, 0x35, 0x8d, 0x73, 0x24, 0xae, 0xa3, 0xd1, 0x35, 0x28, 0x9b, 0x91, 0x52, 0x03, 0x3b, 0x07, + 0x30, 0x8f, 0x47, 0x5f, 0x40, 0x65, 0x8c, 0xe9, 0xe4, 0xc2, 0x0a, 0xf3, 0xc1, 0x41, 0x62, 0xcc, + 0x5d, 0xdd, 0x80, 0x12, 0x79, 0x32, 0xa6, 0xc9, 0xa1, 0x9a, 0xe4, 0xb7, 0x57, 0x58, 0x0d, 0x99, + 0xaa, 0xa0, 0xc1, 0xc8, 0x21, 0xa0, 0x4c, 0x90, 0x84, 0xa4, 0x66, 0x1d, 0x94, 0xfe, 0x87, 0x75, + 0x50, 0xcd, 0x29, 0xd5, 0x32, 0xf8, 0x14, 0x4e, 0xe2, 0x4c, 0xf0, 0x18, 0x0b, 0x1a, 0xe4, 0x4d, + 0xac, 0x06, 0x79, 0xb9, 0x6b, 0x4f, 0x1c, 0xa6, 0x87, 0xd1, 0x7d, 0x80, 0x20, 0x21, 0xf3, 0x4f, + 0xe4, 0x39, 0xd3, 0xb3, 0xb6, 0xee, 0x59, 0x8d, 0x9d, 0x4e, 0xbb, 0xe1, 0x6a, 0x09, 0x74, 0x15, + 0x0a, 0xb2, 0xe4, 0x66, 0xf6, 0xce, 0x1e, 0xb7, 0x51, 0x39, 0xce, 0xef, 0x58, 0x85, 0x3b, 0xdf, + 0x5a, 0x50, 0x90, 0x87, 0xe8, 0x33, 0x28, 0x99, 0x1a, 0x59, 0xf3, 0xd5, 0xc8, 0x84, 0xa3, 0x3b, + 0xb0, 0x1a, 0x61, 0x79, 0xbb, 0x44, 0x17, 0x5a, 0x98, 0xe6, 0x9a, 0xaf, 0x4e, 0x55, 0x89, 0xed, + 0x2a, 0x68, 0x4b, 0x38, 0xdf, 0x5b, 0xf2, 0x05, 0xa8, 0x17, 0x0c, 0xe5, 0xff, 0x21, 0xa9, 0xbb, + 0x60, 0x47, 0x53, 0x1e, 0x5f, 0xee, 0xab, 0xf7, 0x4a, 0x6b, 0x6d, 0x06, 0xed, 0x62, 0x41, 0x9c, + 0x1f, 0x2d, 0xa8, 0xce, 0x64, 0x96, 0xa2, 0x3b, 0x50, 0x99, 0x89, 0x31, 0xf9, 0x39, 0xc7, 0xbe, + 0xc8, 0x26, 0x91, 0x2a, 0x51, 0xab, 0x3b, 0x0b, 0x46, 0x3d, 0xb0, 0x19, 0x79, 0x22, 0xfc, 0x59, + 0x42, 0xf9, 0x56, 0x9f, 0x9f, 0x70, 0xa1, 0xbb, 0x26, 0x19, 0x66, 0x8e, 0x9d, 0x9f, 0x17, 0x61, + 0x45, 0x5e, 0xec, 0xa1, 0xfa, 0x16, 0x70, 0xe1, 0x44, 0x5e, 0xa0, 0xf7, 0xba, 0xd0, 0xaa, 0x46, + 0x99, 0x59, 0xec, 0xc3, 0x69, 0xc3, 0x32, 0x19, 0x2a, 0x43, 0x37, 0xe7, 0x42, 0x59, 0xd7, 0x70, + 0xcf, 0xa0, 0x5b, 0x79, 0x0b, 0xd9, 0x09, 0x89, 0x31, 0x65, 0x94, 0x8d, 0x72, 0xc2, 0x39, 0x17, + 0xcd, 0xda, 0x04, 0xd8, 0x3a, 0xae, 0x1d, 0x0b, 0xff, 0xb6, 0x1d, 0x3f, 0x19, 0xcb, 0x9a, 0x4f, + 0x3f, 0x41, 0x50, 0x05, 0xca, 0xfd, 0xce, 0x97, 0x9d, 0xbb, 0xf7, 0x3b, 0xf6, 0x82, 0x34, 0xf6, + 0xbc, 0xde, 0xbe, 0xd7, 0xb9, 0x65, 0x5b, 0xd2, 0x68, 0x7b, 0xae, 0x2b, 0x8d, 0x45, 0xb4, 0x0e, + 0x76, 0x6f, 0x77, 0x6f, 0xcf, 0xeb, 0xdc, 0xf2, 0xdd, 0xdd, 0x1d, 0xaf, 0xe7, 0xdd, 0xed, 0xd8, + 0x4b, 0x68, 0x0d, 0x2a, 0x7b, 0xde, 0x57, 0x7d, 0xcf, 0x6d, 0xed, 0xcb, 0x83, 0x02, 0x42, 0xb0, + 0xda, 0xeb, 0xef, 0xec, 0xec, 0xf6, 0x7a, 0x37, 0xfb, 0x7b, 0x7e, 0xdb, 0x73, 0xed, 0x62, 0xfb, + 0xf6, 0xb3, 0x97, 0x75, 0xeb, 0xf9, 0xcb, 0xba, 0xf5, 0xe7, 0xcb, 0xba, 0xf5, 0xf4, 0x55, 0x7d, + 0xe1, 0xf9, 0xab, 0xfa, 0xc2, 0x6f, 0xaf, 0xea, 0x0b, 0xdf, 0x34, 0x66, 0x36, 0x55, 0x9f, 0xf5, + 0x19, 0xbd, 0x49, 0x9b, 0xc1, 0x01, 0xa6, 0xac, 0xf9, 0xe4, 0xc8, 0x67, 0xb9, 0xda, 0x5a, 0x83, + 0x92, 0x7a, 0xce, 0x2b, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x34, 0xcb, 0xe2, 0xe3, 0xbc, 0x0b, + 0x00, 0x00, +} + +func (m *NftId) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return 0 + return dAtA[:n], nil } -func (m *Params) GetMarketAdministrator() string { - if m != nil { - return m.MarketAdministrator - } - return "" +func (m *NftId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Params) GetNftListingCommissionFee() uint64 { - if m != nil { - return m.NftListingCommissionFee +func (m *NftId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x12 } - return 0 -} - -func (m *Params) GetNftListingExtendSeconds() uint64 { - if m != nil { - return m.NftListingExtendSeconds + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa } - return 0 + return len(dAtA) - i, nil } -func (m *Params) GetNftListingPeriodExtendFeePerHour() types.Coin { - if m != nil { - return m.NftListingPeriodExtendFeePerHour +func (m *BidId) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return types.Coin{} -} - -type EventListNft struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + return dAtA[:n], nil } -func (m *EventListNft) Reset() { *m = EventListNft{} } -func (m *EventListNft) String() string { return proto.CompactTextString(m) } -func (*EventListNft) ProtoMessage() {} -func (*EventListNft) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{9} -} -func (m *EventListNft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventListNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventListNft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventListNft) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventListNft.Merge(m, src) -} -func (m *EventListNft) XXX_Size() int { - return m.Size() -} -func (m *EventListNft) XXX_DiscardUnknown() { - xxx_messageInfo_EventListNft.DiscardUnknown(m) +func (m *BidId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -var xxx_messageInfo_EventListNft proto.InternalMessageInfo - -func (m *EventListNft) GetOwner() string { - if m != nil { - return m.Owner +func (m *BidId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0x12 } - return "" -} - -func (m *EventListNft) GetClassId() string { - if m != nil { - return m.ClassId + if m.NftId != nil { + { + size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return "" + return len(dAtA) - i, nil } -func (m *EventListNft) GetNftId() string { - if m != nil { - return m.NftId +func (m *ListedClass) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -type EventCancelListNfting struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +func (m *ListedClass) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventCancelListNfting) Reset() { *m = EventCancelListNfting{} } -func (m *EventCancelListNfting) String() string { return proto.CompactTextString(m) } -func (*EventCancelListNfting) ProtoMessage() {} -func (*EventCancelListNfting) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{10} -} -func (m *EventCancelListNfting) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventCancelListNfting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventCancelListNfting.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (m *ListedClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftIds) > 0 { + for iNdEx := len(m.NftIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.NftIds[iNdEx]) + copy(dAtA[i:], m.NftIds[iNdEx]) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftIds[iNdEx]))) + i-- + dAtA[i] = 0x12 } - return b[:n], nil - } -} -func (m *EventCancelListNfting) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCancelListNfting.Merge(m, src) -} -func (m *EventCancelListNfting) XXX_Size() int { - return m.Size() -} -func (m *EventCancelListNfting) XXX_DiscardUnknown() { - xxx_messageInfo_EventCancelListNfting.DiscardUnknown(m) -} - -var xxx_messageInfo_EventCancelListNfting proto.InternalMessageInfo - -func (m *EventCancelListNfting) GetOwner() string { - if m != nil { - return m.Owner } - return "" -} - -func (m *EventCancelListNfting) GetClassId() string { - if m != nil { - return m.ClassId + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa } - return "" + return len(dAtA) - i, nil } -func (m *EventCancelListNfting) GetNftId() string { - if m != nil { - return m.NftId +func (m *NftInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -type EventExpandListingPeriod struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +func (m *NftInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventExpandListingPeriod) Reset() { *m = EventExpandListingPeriod{} } -func (m *EventExpandListingPeriod) String() string { return proto.CompactTextString(m) } -func (*EventExpandListingPeriod) ProtoMessage() {} -func (*EventExpandListingPeriod) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{11} -} -func (m *EventExpandListingPeriod) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventExpandListingPeriod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventExpandListingPeriod.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (m *NftInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x1a } -} -func (m *EventExpandListingPeriod) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventExpandListingPeriod.Merge(m, src) -} -func (m *EventExpandListingPeriod) XXX_Size() int { - return m.Size() -} -func (m *EventExpandListingPeriod) XXX_DiscardUnknown() { - xxx_messageInfo_EventExpandListingPeriod.DiscardUnknown(m) -} - -var xxx_messageInfo_EventExpandListingPeriod proto.InternalMessageInfo - -func (m *EventExpandListingPeriod) GetOwner() string { - if m != nil { - return m.Owner + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x12 } - return "" -} - -func (m *EventExpandListingPeriod) GetClassId() string { - if m != nil { - return m.ClassId + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa } - return "" + return len(dAtA) - i, nil } -func (m *EventExpandListingPeriod) GetNftId() string { - if m != nil { - return m.NftId +func (m *Listing) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -type EventSellingDecision struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +func (m *Listing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventSellingDecision) Reset() { *m = EventSellingDecision{} } -func (m *EventSellingDecision) String() string { return proto.CompactTextString(m) } -func (*EventSellingDecision) ProtoMessage() {} -func (*EventSellingDecision) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{12} -} -func (m *EventSellingDecision) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventSellingDecision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventSellingDecision.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err +func (m *Listing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CollectedAmountNegative { + i-- + if m.CollectedAmountNegative { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - return b[:n], nil + i-- + dAtA[i] = 0x60 } -} -func (m *EventSellingDecision) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventSellingDecision.Merge(m, src) -} -func (m *EventSellingDecision) XXX_Size() int { - return m.Size() -} -func (m *EventSellingDecision) XXX_DiscardUnknown() { - xxx_messageInfo_EventSellingDecision.DiscardUnknown(m) -} - -var xxx_messageInfo_EventSellingDecision proto.InternalMessageInfo - -func (m *EventSellingDecision) GetOwner() string { - if m != nil { - return m.Owner + { + size, err := m.CollectedAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" -} - -func (m *EventSellingDecision) GetClassId() string { - if m != nil { - return m.ClassId + i-- + dAtA[i] = 0x5a + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.SuccessfulBidEndAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SuccessfulBidEndAt):]) + if err3 != nil { + return 0, err3 } - return "" + i -= n3 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x52 + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.FullPaymentEndAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.FullPaymentEndAt):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x4a + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LiquidatedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LiquidatedAt):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x42 + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StartedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartedAt):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x3a + n7, err7 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MinBidPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinBidPeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x32 + { + size := m.MinDepositRate.Size() + i -= size + if _, err := m.MinDepositRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.BidDenom) > 0 { + i -= len(m.BidDenom) + copy(dAtA[i:], m.BidDenom) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.BidDenom))) + i-- + dAtA[i] = 0x22 + } + if m.State != 0 { + i = encodeVarintNftbackedloan(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x18 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *EventSellingDecision) GetNftId() string { - if m != nil { - return m.NftId +func (m *Bid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -type EventEndListNfting struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +func (m *Bid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventEndListNfting) Reset() { *m = EventEndListNfting{} } -func (m *EventEndListNfting) String() string { return proto.CompactTextString(m) } -func (*EventEndListNfting) ProtoMessage() {} -func (*EventEndListNfting) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{13} -} -func (m *EventEndListNfting) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventEndListNfting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventEndListNfting.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) +func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Loan.MarshalToSizedBuffer(dAtA[:i]) if err != nil { - return nil, err + return 0, err } - return b[:n], nil + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } -} -func (m *EventEndListNfting) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventEndListNfting.Merge(m, src) -} -func (m *EventEndListNfting) XXX_Size() int { - return m.Size() -} -func (m *EventEndListNfting) XXX_DiscardUnknown() { - xxx_messageInfo_EventEndListNfting.DiscardUnknown(m) -} - -var xxx_messageInfo_EventEndListNfting proto.InternalMessageInfo - -func (m *EventEndListNfting) GetOwner() string { - if m != nil { - return m.Owner + i-- + dAtA[i] = 0x4a + n10, err10 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreatedAt):]) + if err10 != nil { + return 0, err10 } - return "" -} - -func (m *EventEndListNfting) GetClassId() string { - if m != nil { - return m.ClassId + i -= n10 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x42 + if m.AutomaticPayment { + i-- + if m.AutomaticPayment { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 } - return "" -} - -func (m *EventEndListNfting) GetNftId() string { - if m != nil { - return m.NftId + { + size := m.InterestRate.Size() + i -= size + if _, err := m.InterestRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" -} - -type EventPlaceBid struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventPlaceBid) Reset() { *m = EventPlaceBid{} } -func (m *EventPlaceBid) String() string { return proto.CompactTextString(m) } -func (*EventPlaceBid) ProtoMessage() {} -func (*EventPlaceBid) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{14} -} -func (m *EventPlaceBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPlaceBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPlaceBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + i-- + dAtA[i] = 0x32 + n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Expiry, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x2a + { + size, err := m.PaidAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { - return nil, err + return 0, err } - return b[:n], nil + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } -} -func (m *EventPlaceBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPlaceBid.Merge(m, src) -} -func (m *EventPlaceBid) XXX_Size() int { - return m.Size() -} -func (m *EventPlaceBid) XXX_DiscardUnknown() { - xxx_messageInfo_EventPlaceBid.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPlaceBid proto.InternalMessageInfo - -func (m *EventPlaceBid) GetBidder() string { - if m != nil { - return m.Bidder + i-- + dAtA[i] = 0x22 + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" -} - -func (m *EventPlaceBid) GetClassId() string { - if m != nil { - return m.ClassId + i-- + dAtA[i] = 0x1a + { + size, err := m.Price.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" -} - -func (m *EventPlaceBid) GetNftId() string { - if m != nil { - return m.NftId + i-- + dAtA[i] = 0x12 + { + size, err := m.Id.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *EventPlaceBid) GetAmount() string { - if m != nil { - return m.Amount +func (m *Loan) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -type EventCancelBid struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +func (m *Loan) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventCancelBid) Reset() { *m = EventCancelBid{} } -func (m *EventCancelBid) String() string { return proto.CompactTextString(m) } -func (*EventCancelBid) ProtoMessage() {} -func (*EventCancelBid) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{15} -} -func (m *EventCancelBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventCancelBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventCancelBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) +func (m *Loan) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastRepaidAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRepaidAt):]) + if err16 != nil { + return 0, err16 + } + i -= n16 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n16)) + i-- + dAtA[i] = 0x12 + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { - return nil, err + return 0, err } - return b[:n], nil + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *EventCancelBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCancelBid.Merge(m, src) -} -func (m *EventCancelBid) XXX_Size() int { - return m.Size() -} -func (m *EventCancelBid) XXX_DiscardUnknown() { - xxx_messageInfo_EventCancelBid.DiscardUnknown(m) -} - -var xxx_messageInfo_EventCancelBid proto.InternalMessageInfo -func (m *EventCancelBid) GetBidder() string { - if m != nil { - return m.Bidder +func (m *Liquidation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -func (m *EventCancelBid) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" +func (m *Liquidation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventCancelBid) GetNftId() string { - if m != nil { - return m.NftId +func (m *Liquidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n18, err18 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LiquidationDate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LiquidationDate):]) + if err18 != nil { + return 0, err18 } - return "" -} - -type EventPayFullBid struct { - Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *EventPayFullBid) Reset() { *m = EventPayFullBid{} } -func (m *EventPayFullBid) String() string { return proto.CompactTextString(m) } -func (*EventPayFullBid) ProtoMessage() {} -func (*EventPayFullBid) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{16} -} -func (m *EventPayFullBid) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPayFullBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPayFullBid.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + i -= n18 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n18)) + i-- + dAtA[i] = 0x12 + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { - return nil, err + return 0, err } - return b[:n], nil + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } -} -func (m *EventPayFullBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPayFullBid.Merge(m, src) -} -func (m *EventPayFullBid) XXX_Size() int { - return m.Size() -} -func (m *EventPayFullBid) XXX_DiscardUnknown() { - xxx_messageInfo_EventPayFullBid.DiscardUnknown(m) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -var xxx_messageInfo_EventPayFullBid proto.InternalMessageInfo - -func (m *EventPayFullBid) GetBidder() string { - if m != nil { - return m.Bidder +func (m *Liquidations) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -func (m *EventPayFullBid) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" +func (m *Liquidations) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventPayFullBid) GetNftId() string { - if m != nil { - return m.NftId +func (m *Liquidations) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NextLiquidation) > 0 { + for iNdEx := len(m.NextLiquidation) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NextLiquidation[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - return "" -} - -type EventBorrow struct { - Borrower string `protobuf:"bytes,1,opt,name=borrower,proto3" json:"borrower,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventBorrow) Reset() { *m = EventBorrow{} } -func (m *EventBorrow) String() string { return proto.CompactTextString(m) } -func (*EventBorrow) ProtoMessage() {} -func (*EventBorrow) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{17} -} -func (m *EventBorrow) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventBorrow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventBorrow.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + if m.Liquidation != nil { + { + size, err := m.Liquidation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return b[:n], nil + i-- + dAtA[i] = 0xa } -} -func (m *EventBorrow) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventBorrow.Merge(m, src) -} -func (m *EventBorrow) XXX_Size() int { - return m.Size() -} -func (m *EventBorrow) XXX_DiscardUnknown() { - xxx_messageInfo_EventBorrow.DiscardUnknown(m) + return len(dAtA) - i, nil } -var xxx_messageInfo_EventBorrow proto.InternalMessageInfo - -func (m *EventBorrow) GetBorrower() string { - if m != nil { - return m.Borrower +func (m *RepayInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -func (m *EventBorrow) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" +func (m *RepayInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventBorrow) GetNftId() string { - if m != nil { - return m.NftId +func (m *RepayInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n21, err21 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastRepaidAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRepaidAt):]) + if err21 != nil { + return 0, err21 } - return "" -} - -func (m *EventBorrow) GetAmount() string { - if m != nil { - return m.Amount + i -= n21 + i = encodeVarintNftbackedloan(dAtA, i, uint64(n21)) + i-- + dAtA[i] = 0x22 + { + size, err := m.RemainingAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" -} - -type EventRepay struct { - Repayer string `protobuf:"bytes,1,opt,name=repayer,proto3" json:"repayer,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventRepay) Reset() { *m = EventRepay{} } -func (m *EventRepay) String() string { return proto.CompactTextString(m) } -func (*EventRepay) ProtoMessage() {} -func (*EventRepay) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{18} -} -func (m *EventRepay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventRepay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventRepay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + i-- + dAtA[i] = 0x1a + { + size, err := m.RepaidInterestAmount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { - return nil, err + return 0, err } - return b[:n], nil + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } -} -func (m *EventRepay) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventRepay.Merge(m, src) -} -func (m *EventRepay) XXX_Size() int { - return m.Size() -} -func (m *EventRepay) XXX_DiscardUnknown() { - xxx_messageInfo_EventRepay.DiscardUnknown(m) -} - -var xxx_messageInfo_EventRepay proto.InternalMessageInfo - -func (m *EventRepay) GetRepayer() string { - if m != nil { - return m.Repayer + i-- + dAtA[i] = 0x12 + { + size, err := m.RepaidAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) } - return "" + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *EventRepay) GetClassId() string { - if m != nil { - return m.ClassId +func encodeVarintNftbackedloan(dAtA []byte, offset int, v uint64) int { + offset -= sovNftbackedloan(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return "" + dAtA[offset] = uint8(v) + return base } - -func (m *EventRepay) GetNftId() string { - if m != nil { - return m.NftId +func (m *NftId) Size() (n int) { + if m == nil { + return 0 } - return "" -} - -func (m *EventRepay) GetAmount() string { - if m != nil { - return m.Amount + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } - return "" -} - -type EventLiquidate struct { - Liquidator string `protobuf:"bytes,1,opt,name=liquidator,proto3" json:"liquidator,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) + } + return n } -func (m *EventLiquidate) Reset() { *m = EventLiquidate{} } -func (m *EventLiquidate) String() string { return proto.CompactTextString(m) } -func (*EventLiquidate) ProtoMessage() {} -func (*EventLiquidate) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{19} -} -func (m *EventLiquidate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventLiquidate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventLiquidate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventLiquidate) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventLiquidate.Merge(m, src) -} -func (m *EventLiquidate) XXX_Size() int { - return m.Size() -} -func (m *EventLiquidate) XXX_DiscardUnknown() { - xxx_messageInfo_EventLiquidate.DiscardUnknown(m) -} - -var xxx_messageInfo_EventLiquidate proto.InternalMessageInfo - -func (m *EventLiquidate) GetLiquidator() string { - if m != nil { - return m.Liquidator - } - return "" -} - -func (m *EventLiquidate) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *EventLiquidate) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -type PaymentStatus struct { - NftId NftIdentifier `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - AutomaticPayment bool `protobuf:"varint,4,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` - PaidAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=paid_amount,json=paidAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"paid_amount" yaml:"paid_amount"` - BidTime time.Time `protobuf:"bytes,6,opt,name=bid_time,json=bidTime,proto3,stdtime" json:"bid_time" yaml:"bid_time"` - State ListingState `protobuf:"varint,7,opt,name=state,proto3,enum=ununifi.nftbackedloan.ListingState" json:"state,omitempty"` - AllPaid bool `protobuf:"varint,8,opt,name=all_paid,json=allPaid,proto3" json:"all_paid,omitempty"` -} - -func (m *PaymentStatus) Reset() { *m = PaymentStatus{} } -func (m *PaymentStatus) String() string { return proto.CompactTextString(m) } -func (*PaymentStatus) ProtoMessage() {} -func (*PaymentStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{20} -} -func (m *PaymentStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PaymentStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PaymentStatus.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PaymentStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_PaymentStatus.Merge(m, src) -} -func (m *PaymentStatus) XXX_Size() int { - return m.Size() -} -func (m *PaymentStatus) XXX_DiscardUnknown() { - xxx_messageInfo_PaymentStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_PaymentStatus proto.InternalMessageInfo - -func (m *PaymentStatus) GetNftId() NftIdentifier { - if m != nil { - return m.NftId - } - return NftIdentifier{} -} - -func (m *PaymentStatus) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -func (m *PaymentStatus) GetAmount() types.Coin { - if m != nil { - return m.Amount +func (m *BidId) Size() (n int) { + if m == nil { + return 0 } - return types.Coin{} -} - -func (m *PaymentStatus) GetAutomaticPayment() bool { - if m != nil { - return m.AutomaticPayment + var l int + _ = l + if m.NftId != nil { + l = m.NftId.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) } - return false -} - -func (m *PaymentStatus) GetBidTime() time.Time { - if m != nil { - return m.BidTime + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } - return time.Time{} + return n } -func (m *PaymentStatus) GetState() ListingState { - if m != nil { - return m.State +func (m *ListedClass) Size() (n int) { + if m == nil { + return 0 } - return ListingState_LISTING -} - -func (m *PaymentStatus) GetAllPaid() bool { - if m != nil { - return m.AllPaid + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } - return false -} - -type Liquidation struct { - Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` - LiquidationDate time.Time `protobuf:"bytes,2,opt,name=liquidation_date,json=liquidationDate,proto3,stdtime" json:"liquidation_date"` -} - -func (m *Liquidation) Reset() { *m = Liquidation{} } -func (m *Liquidation) String() string { return proto.CompactTextString(m) } -func (*Liquidation) ProtoMessage() {} -func (*Liquidation) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{21} -} -func (m *Liquidation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Liquidation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Liquidation.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + if len(m.NftIds) > 0 { + for _, s := range m.NftIds { + l = len(s) + n += 1 + l + sovNftbackedloan(uint64(l)) } - return b[:n], nil - } -} -func (m *Liquidation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Liquidation.Merge(m, src) -} -func (m *Liquidation) XXX_Size() int { - return m.Size() -} -func (m *Liquidation) XXX_DiscardUnknown() { - xxx_messageInfo_Liquidation.DiscardUnknown(m) -} - -var xxx_messageInfo_Liquidation proto.InternalMessageInfo - -func (m *Liquidation) GetAmount() types.Coin { - if m != nil { - return m.Amount } - return types.Coin{} + return n } -func (m *Liquidation) GetLiquidationDate() time.Time { - if m != nil { - return m.LiquidationDate +func (m *NftInfo) Size() (n int) { + if m == nil { + return 0 } - return time.Time{} -} - -type Liquidations struct { - Liquidation *Liquidation `protobuf:"bytes,1,opt,name=liquidation,proto3" json:"liquidation,omitempty"` - NextLiquidation []Liquidation `protobuf:"bytes,2,rep,name=next_liquidation,json=nextLiquidation,proto3" json:"next_liquidation"` -} - -func (m *Liquidations) Reset() { *m = Liquidations{} } -func (m *Liquidations) String() string { return proto.CompactTextString(m) } -func (*Liquidations) ProtoMessage() {} -func (*Liquidations) Descriptor() ([]byte, []int) { - return fileDescriptor_9e729891a263bcae, []int{22} -} -func (m *Liquidations) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Liquidations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Liquidations.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } -} -func (m *Liquidations) XXX_Merge(src proto.Message) { - xxx_messageInfo_Liquidations.Merge(m, src) -} -func (m *Liquidations) XXX_Size() int { - return m.Size() -} -func (m *Liquidations) XXX_DiscardUnknown() { - xxx_messageInfo_Liquidations.DiscardUnknown(m) -} - -var xxx_messageInfo_Liquidations proto.InternalMessageInfo - -func (m *Liquidations) GetLiquidation() *Liquidation { - if m != nil { - return m.Liquidation + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } - return nil -} - -func (m *Liquidations) GetNextLiquidation() []Liquidation { - if m != nil { - return m.NextLiquidation + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } - return nil -} - -func init() { - proto.RegisterEnum("ununifi.nftbackedloan.ListingType", ListingType_name, ListingType_value) - proto.RegisterEnum("ununifi.nftbackedloan.ListingState", ListingState_name, ListingState_value) - proto.RegisterType((*NftIdentifier)(nil), "ununifi.nftbackedloan.NftIdentifier") - proto.RegisterType((*BidId)(nil), "ununifi.nftbackedloan.BidId") - proto.RegisterType((*Loan)(nil), "ununifi.nftbackedloan.Loan") - proto.RegisterType((*ListedClass)(nil), "ununifi.nftbackedloan.ListedClass") - proto.RegisterType((*NftInfo)(nil), "ununifi.nftbackedloan.NftInfo") - proto.RegisterType((*NftListing)(nil), "ununifi.nftbackedloan.NftListing") - proto.RegisterType((*Borrowing)(nil), "ununifi.nftbackedloan.borrowing") - proto.RegisterType((*NftBid)(nil), "ununifi.nftbackedloan.NftBid") - proto.RegisterType((*Params)(nil), "ununifi.nftbackedloan.Params") - proto.RegisterType((*EventListNft)(nil), "ununifi.nftbackedloan.EventListNft") - proto.RegisterType((*EventCancelListNfting)(nil), "ununifi.nftbackedloan.EventCancelListNfting") - proto.RegisterType((*EventExpandListingPeriod)(nil), "ununifi.nftbackedloan.EventExpandListingPeriod") - proto.RegisterType((*EventSellingDecision)(nil), "ununifi.nftbackedloan.EventSellingDecision") - proto.RegisterType((*EventEndListNfting)(nil), "ununifi.nftbackedloan.EventEndListNfting") - proto.RegisterType((*EventPlaceBid)(nil), "ununifi.nftbackedloan.EventPlaceBid") - proto.RegisterType((*EventCancelBid)(nil), "ununifi.nftbackedloan.EventCancelBid") - proto.RegisterType((*EventPayFullBid)(nil), "ununifi.nftbackedloan.EventPayFullBid") - proto.RegisterType((*EventBorrow)(nil), "ununifi.nftbackedloan.EventBorrow") - proto.RegisterType((*EventRepay)(nil), "ununifi.nftbackedloan.EventRepay") - proto.RegisterType((*EventLiquidate)(nil), "ununifi.nftbackedloan.EventLiquidate") - proto.RegisterType((*PaymentStatus)(nil), "ununifi.nftbackedloan.PaymentStatus") - proto.RegisterType((*Liquidation)(nil), "ununifi.nftbackedloan.Liquidation") - proto.RegisterType((*Liquidations)(nil), "ununifi.nftbackedloan.Liquidations") -} - -func init() { - proto.RegisterFile("ununifi/nftbackedloan/nftbackedloan.proto", fileDescriptor_9e729891a263bcae) + return n } -var fileDescriptor_9e729891a263bcae = []byte{ - // 2067 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4d, 0x6f, 0x1b, 0xc9, - 0xd1, 0x16, 0x45, 0x8a, 0xa4, 0x8a, 0x96, 0x44, 0xb5, 0x69, 0x9b, 0x92, 0x6d, 0x4a, 0xef, 0xec, - 0x0b, 0xc7, 0xd9, 0x60, 0x49, 0x58, 0x46, 0x10, 0x6c, 0x36, 0xc9, 0x86, 0x5f, 0xb2, 0xb8, 0x21, - 0x68, 0x65, 0x48, 0x67, 0xb3, 0x9b, 0x45, 0x06, 0xcd, 0x99, 0x1e, 0xaa, 0xa1, 0x61, 0x0f, 0x35, - 0xd3, 0x63, 0x5b, 0x97, 0x5c, 0x73, 0xdd, 0x43, 0x80, 0xe4, 0x5f, 0x04, 0x01, 0xf2, 0x23, 0xf6, - 0xb8, 0xc8, 0x69, 0x91, 0x83, 0x93, 0xd8, 0xe7, 0x5c, 0xf6, 0x17, 0x04, 0xfd, 0x31, 0xe4, 0x88, - 0x91, 0xd6, 0x94, 0xc1, 0x9c, 0xcc, 0x56, 0x55, 0x3d, 0xd5, 0xd5, 0x55, 0xf5, 0x74, 0xf5, 0x18, - 0xbe, 0x1f, 0xb1, 0x88, 0x51, 0x97, 0xd6, 0x98, 0xcb, 0x87, 0xd8, 0x3e, 0x25, 0x8e, 0xe7, 0x63, - 0x76, 0x71, 0x55, 0x9d, 0x04, 0x3e, 0xf7, 0xd1, 0x2d, 0xad, 0x5a, 0xbd, 0x20, 0xdc, 0x2d, 0x8d, - 0xfc, 0x91, 0x2f, 0x35, 0x6a, 0xe2, 0x97, 0x52, 0xde, 0xdd, 0x1b, 0xf9, 0xfe, 0xc8, 0x23, 0x35, - 0xb9, 0x1a, 0x46, 0x6e, 0x8d, 0xd3, 0x31, 0x09, 0x39, 0x1e, 0x4f, 0xb4, 0x42, 0x65, 0x5e, 0xc1, - 0x89, 0x02, 0xcc, 0xa9, 0xcf, 0x62, 0xb9, 0xed, 0x87, 0x63, 0x3f, 0xac, 0x0d, 0x71, 0x48, 0x6a, - 0xcf, 0x1f, 0x0d, 0x09, 0xc7, 0x8f, 0x6a, 0xb6, 0x4f, 0x63, 0xf9, 0x8e, 0x92, 0x5b, 0xca, 0xb3, - 0x5a, 0x28, 0x91, 0x51, 0x87, 0x8d, 0x9e, 0xcb, 0x3b, 0x0e, 0x61, 0x9c, 0xba, 0x94, 0x04, 0x68, - 0x07, 0xf2, 0xb6, 0x87, 0xc3, 0xd0, 0xa2, 0x4e, 0x39, 0xb5, 0x9f, 0x7a, 0xb8, 0x6e, 0xe6, 0xe4, - 0xba, 0xe3, 0xa0, 0x5b, 0x90, 0x65, 0x2e, 0x17, 0x82, 0x55, 0x29, 0x58, 0x63, 0xc2, 0xd2, 0xf8, - 0x02, 0xd6, 0x1a, 0xd4, 0xe9, 0x38, 0xe8, 0xa3, 0xa9, 0x5c, 0x18, 0x16, 0x0e, 0xfe, 0xbf, 0x7a, - 0xe9, 0x29, 0x54, 0x2f, 0x38, 0xd4, 0x28, 0xe8, 0x36, 0x64, 0x87, 0xd4, 0x71, 0x48, 0xa0, 0xc1, - 0xf5, 0xca, 0xf8, 0x1d, 0x64, 0xba, 0x3e, 0x66, 0xa8, 0xfe, 0x2e, 0xe0, 0x8d, 0xcc, 0x57, 0xaf, - 0xf6, 0x56, 0x62, 0x17, 0x8f, 0x21, 0x23, 0x54, 0xa4, 0x83, 0xc2, 0xc1, 0x4e, 0x55, 0x1f, 0x84, - 0x38, 0xb5, 0xaa, 0x3e, 0xb5, 0x6a, 0xd3, 0xa7, 0x4c, 0x5b, 0x49, 0x65, 0xa3, 0x0e, 0x85, 0x2e, - 0x0d, 0x39, 0x71, 0x9a, 0xe2, 0x14, 0xbe, 0xeb, 0x78, 0xee, 0x40, 0x4e, 0xed, 0x30, 0x2c, 0xaf, - 0xee, 0xa7, 0x45, 0x08, 0xd2, 0x6d, 0x68, 0x1c, 0x42, 0x4e, 0xec, 0x8a, 0xb9, 0x3e, 0xda, 0x84, - 0xd5, 0xa9, 0xe1, 0x2a, 0x75, 0x50, 0x11, 0xd2, 0x51, 0x40, 0x75, 0xc8, 0xe2, 0xa7, 0x70, 0x10, - 0x05, 0xd4, 0x3a, 0xc1, 0xe1, 0x49, 0x39, 0xad, 0x1c, 0x44, 0x01, 0x3d, 0xc2, 0xe1, 0x89, 0xf1, - 0x87, 0x3c, 0x40, 0xcf, 0xe5, 0x62, 0x3b, 0x94, 0x8d, 0x96, 0x71, 0x22, 0x25, 0x58, 0xf3, 0x5f, - 0xb0, 0xe9, 0x99, 0xab, 0x05, 0x6a, 0xc3, 0x0d, 0x4f, 0xf9, 0xb0, 0xf8, 0xf9, 0x84, 0xc8, 0x6d, - 0x6c, 0x1e, 0x18, 0x57, 0xc0, 0xeb, 0xed, 0x0c, 0xce, 0x27, 0xc4, 0x2c, 0x78, 0xb3, 0x05, 0xfa, - 0x10, 0xd6, 0x42, 0x8e, 0x39, 0x29, 0x67, 0xa4, 0xfd, 0x7b, 0xdf, 0x6d, 0xdf, 0x17, 0xaa, 0xa6, - 0xb2, 0x40, 0x77, 0x61, 0x7d, 0x48, 0x1d, 0x8b, 0xfb, 0xa7, 0x84, 0x95, 0xd7, 0xe4, 0xde, 0xf2, - 0x43, 0xea, 0x0c, 0xc4, 0x1a, 0x31, 0x28, 0x8d, 0x29, 0xa3, 0xe3, 0x68, 0x6c, 0x39, 0x64, 0xe2, - 0x87, 0x94, 0x5b, 0x81, 0x70, 0x93, 0x15, 0x7a, 0x8d, 0x9f, 0x88, 0xf8, 0xfe, 0xfe, 0x6a, 0xef, - 0xc1, 0x88, 0xf2, 0x93, 0x68, 0x58, 0xb5, 0xfd, 0xb1, 0xae, 0x78, 0xfd, 0xcf, 0x07, 0xa1, 0x73, - 0x5a, 0x13, 0x71, 0x85, 0xd5, 0x16, 0xb1, 0xff, 0xf6, 0xd7, 0x0f, 0x40, 0xd7, 0x41, 0x8b, 0xd8, - 0x26, 0xd2, 0xc8, 0x2d, 0x05, 0x6c, 0x8a, 0xcd, 0x3c, 0x86, 0x5b, 0x38, 0xe2, 0xfe, 0x18, 0x73, - 0x6a, 0x5b, 0x01, 0x71, 0x29, 0xc3, 0xcc, 0xa6, 0x6c, 0x54, 0xce, 0xed, 0xa7, 0x1e, 0xe6, 0xcd, - 0xd2, 0x54, 0x68, 0xce, 0x64, 0xe8, 0xd7, 0x00, 0x21, 0xc7, 0x01, 0x27, 0x8e, 0x85, 0x79, 0x39, - 0x2f, 0x13, 0xb4, 0x5b, 0x55, 0x7d, 0x5c, 0x8d, 0xfb, 0xb8, 0x3a, 0x88, 0x1b, 0xbd, 0x71, 0x5f, - 0x6c, 0xfb, 0xdb, 0x57, 0x7b, 0xdb, 0xe7, 0x78, 0xec, 0xfd, 0xd8, 0x98, 0xd9, 0x1a, 0x5f, 0xfe, - 0x63, 0x2f, 0x65, 0xae, 0xeb, 0x3f, 0xd4, 0x39, 0xea, 0x42, 0x96, 0x30, 0x89, 0xba, 0xfe, 0x56, - 0xd4, 0x1d, 0x8d, 0xba, 0xa1, 0x50, 0x95, 0x9d, 0x42, 0x5c, 0x23, 0x4c, 0xa0, 0x9d, 0xc1, 0x4d, - 0x37, 0xf2, 0x3c, 0x6b, 0x82, 0xcf, 0xc7, 0x84, 0x71, 0x4b, 0x43, 0xc3, 0x5b, 0xa1, 0x1f, 0x68, - 0xe8, 0x5d, 0x05, 0x7d, 0x09, 0x88, 0xf2, 0x53, 0x14, 0x92, 0x63, 0x25, 0x68, 0x4b, 0x97, 0x2f, - 0xe0, 0x56, 0x18, 0xd9, 0x36, 0x09, 0x43, 0x37, 0xf2, 0x2c, 0x91, 0x67, 0xed, 0xb4, 0xf0, 0x56, - 0xa7, 0x0f, 0xb5, 0xd3, 0x7b, 0xfa, 0x94, 0x2e, 0x83, 0x51, 0x6e, 0xd1, 0x4c, 0xd6, 0xa0, 0x8e, - 0x72, 0x5c, 0x85, 0x9b, 0x22, 0x57, 0x56, 0x40, 0x3c, 0xd9, 0xd1, 0x96, 0xed, 0x47, 0x8c, 0x97, - 0x6f, 0xec, 0xa7, 0x1e, 0x66, 0xcc, 0x6d, 0x21, 0x32, 0xb5, 0xa4, 0x29, 0x04, 0xe8, 0x13, 0x28, - 0xda, 0xbe, 0xe7, 0x11, 0x5b, 0x66, 0x62, 0x2c, 0x95, 0x37, 0x16, 0xe3, 0x8e, 0xad, 0xa9, 0x61, - 0x5d, 0xda, 0xa1, 0xcf, 0xe0, 0x76, 0x5c, 0xb4, 0x82, 0xd8, 0x44, 0x6f, 0x4d, 0x48, 0x40, 0x7d, - 0xa7, 0xbc, 0xa9, 0x11, 0xe7, 0xa3, 0x6e, 0x69, 0x8e, 0x6f, 0xe4, 0x05, 0xe2, 0x9f, 0x44, 0x50, - 0x71, 0xdd, 0x37, 0x14, 0xc2, 0xb1, 0x04, 0x30, 0xbe, 0x49, 0xc1, 0xfa, 0xd0, 0x0f, 0x02, 0xff, - 0x85, 0x28, 0xbc, 0x1f, 0x41, 0x56, 0x6f, 0x35, 0xb5, 0xd8, 0x56, 0xb5, 0x3a, 0xfa, 0x25, 0x94, - 0x26, 0x98, 0x3a, 0x16, 0x65, 0x9c, 0x04, 0x24, 0xe4, 0x71, 0xc4, 0x0b, 0xb2, 0x25, 0x12, 0xc6, - 0x1d, 0x6d, 0xab, 0x83, 0xfe, 0x18, 0xf2, 0xb2, 0x6e, 0x45, 0x72, 0xd3, 0x6f, 0x4d, 0xae, 0x8c, - 0x53, 0x26, 0x2f, 0x27, 0xad, 0xea, 0xdc, 0xf8, 0x4b, 0x16, 0xb2, 0x3d, 0x97, 0x37, 0xa8, 0xb3, - 0x0c, 0xb6, 0xbb, 0xe2, 0x8a, 0x41, 0x3f, 0x03, 0x10, 0xe5, 0xa3, 0xe3, 0x4d, 0x2f, 0x16, 0xaf, - 0x20, 0x28, 0x1d, 0xe6, 0x21, 0x6c, 0xc6, 0x44, 0xa4, 0x31, 0x32, 0x8b, 0x61, 0x6c, 0x68, 0x33, - 0x8d, 0xf3, 0x73, 0x28, 0xc8, 0x0c, 0x68, 0x90, 0xb5, 0xc5, 0x40, 0x40, 0xd8, 0x68, 0x84, 0x5f, - 0xc0, 0xe6, 0x5c, 0x75, 0x65, 0xaf, 0x71, 0xec, 0x1b, 0xc3, 0x64, 0x5d, 0x09, 0x9e, 0x8d, 0xc3, - 0xf2, 0x08, 0x93, 0xa0, 0x92, 0x67, 0x73, 0xcb, 0xe0, 0x59, 0x8d, 0xdc, 0x55, 0xc0, 0x92, 0x67, - 0x7f, 0x00, 0xdb, 0x33, 0x9e, 0xd5, 0x54, 0x22, 0x99, 0x33, 0x6f, 0x16, 0xa7, 0x02, 0xcd, 0x24, - 0xc8, 0x84, 0xbc, 0xbc, 0x21, 0xe8, 0x98, 0x2c, 0xc0, 0x83, 0x77, 0x35, 0x6f, 0x6c, 0x29, 0xde, - 0x88, 0x2d, 0x15, 0x55, 0xe4, 0xc4, 0xcd, 0x42, 0xc7, 0x04, 0x1d, 0xc1, 0xd6, 0x7c, 0xf1, 0xc3, - 0x62, 0x39, 0xd8, 0xa4, 0x17, 0x0b, 0xff, 0x10, 0x60, 0xda, 0x91, 0x61, 0xb9, 0xb0, 0x9f, 0x7e, - 0x58, 0x38, 0xd8, 0xbf, 0xa2, 0x60, 0xa7, 0x8a, 0x71, 0x3e, 0x67, 0x96, 0xe8, 0x40, 0x8e, 0x0b, - 0x37, 0xe4, 0x26, 0xee, 0x5d, 0x61, 0x2f, 0x67, 0x2f, 0x6d, 0xbb, 0x4a, 0x1d, 0xe3, 0xdf, 0xeb, - 0x90, 0x3d, 0xc6, 0x01, 0x1e, 0x87, 0xe8, 0xf7, 0x29, 0xb8, 0x33, 0xa6, 0xcc, 0x0a, 0x39, 0x3e, - 0x15, 0xe9, 0x73, 0xfd, 0xc0, 0xd2, 0x37, 0xb4, 0x9a, 0x41, 0x1a, 0xc7, 0xd7, 0xc8, 0x62, 0x87, - 0xf1, 0x6f, 0x5f, 0xed, 0x55, 0xd4, 0x11, 0x5e, 0x01, 0x6b, 0x48, 0x8e, 0xea, 0x2b, 0xc1, 0xa1, - 0x1f, 0xc4, 0xb3, 0xca, 0x0f, 0xe1, 0x8e, 0x43, 0x5c, 0x1c, 0x79, 0x5c, 0x32, 0x35, 0xb6, 0x39, - 0x7d, 0x4e, 0xac, 0x00, 0xb3, 0x53, 0xd9, 0x8b, 0x19, 0xb3, 0xa4, 0xc5, 0x0d, 0xea, 0xd4, 0xa5, - 0xd0, 0xc4, 0xec, 0x14, 0xdd, 0x57, 0x9d, 0x29, 0xe7, 0x80, 0xb0, 0x9c, 0x96, 0x53, 0xd5, 0x7a, - 0x3c, 0x08, 0x84, 0xa8, 0x0e, 0x95, 0x04, 0xa1, 0x8b, 0xad, 0x48, 0x46, 0xb7, 0xa8, 0x6b, 0x31, - 0x5f, 0x38, 0x92, 0x8d, 0x98, 0x31, 0x77, 0x66, 0xdc, 0x4e, 0xd9, 0x48, 0x92, 0x7b, 0xc7, 0xed, - 0xf9, 0x82, 0x56, 0x3e, 0x84, 0x1d, 0x41, 0x2b, 0xb1, 0xbd, 0x43, 0x3c, 0x7c, 0x6e, 0x85, 0xc4, - 0xf6, 0x99, 0x13, 0xca, 0x0e, 0xcc, 0x98, 0xb7, 0xd9, 0x74, 0xe6, 0x6a, 0x09, 0x71, 0x5f, 0x49, - 0xd1, 0x47, 0xb0, 0x9b, 0x34, 0x55, 0x0d, 0x67, 0x51, 0x46, 0x39, 0xc5, 0x9e, 0x6c, 0xbc, 0x8c, - 0x79, 0x67, 0x66, 0xab, 0xba, 0xaa, 0xa3, 0xc4, 0xa8, 0x0b, 0xef, 0x25, 0x8d, 0x6d, 0xcc, 0x6c, - 0xe2, 0x59, 0x01, 0x39, 0x8b, 0x68, 0x40, 0x9c, 0xe9, 0x0e, 0x72, 0x12, 0x65, 0x6f, 0x86, 0xd2, - 0x94, 0x8a, 0xa6, 0xd6, 0x8b, 0xb7, 0x72, 0x04, 0xff, 0x77, 0x09, 0x9a, 0x4b, 0x88, 0xd8, 0x95, - 0x4d, 0x18, 0xc7, 0x23, 0x22, 0x5b, 0x29, 0x63, 0xde, 0x9f, 0xc7, 0x3a, 0x24, 0xe4, 0x78, 0xaa, - 0x84, 0x6a, 0x50, 0x4a, 0x22, 0x8d, 0xf0, 0x64, 0xd6, 0x63, 0x19, 0x73, 0x7b, 0x66, 0xfc, 0x04, - 0x4f, 0x64, 0xd3, 0xfc, 0x14, 0xee, 0x8a, 0x14, 0x5d, 0x15, 0x00, 0x48, 0xbb, 0xf2, 0x90, 0x3a, - 0x97, 0xef, 0xbc, 0x0f, 0xdf, 0x9b, 0x66, 0xd8, 0x72, 0x68, 0x38, 0x8c, 0x82, 0x90, 0xc4, 0xd6, - 0x16, 0x76, 0x39, 0x09, 0x34, 0xb6, 0x1c, 0x0f, 0x32, 0xa6, 0x11, 0xa7, 0xbf, 0xa5, 0x95, 0x35, - 0x52, 0x5d, 0xa8, 0x2a, 0x1f, 0xa8, 0x05, 0x7b, 0xc9, 0x20, 0x2e, 0xcc, 0x26, 0x9a, 0x17, 0xd5, - 0xa5, 0x7f, 0x77, 0x16, 0xcf, 0xe1, 0x6c, 0x4c, 0xd1, 0xfc, 0x37, 0x87, 0x22, 0x7e, 0x3b, 0xc4, - 0xa3, 0xcf, 0x49, 0x70, 0x1e, 0xa3, 0x6c, 0xcc, 0xa3, 0xf4, 0x5c, 0xde, 0xd2, 0x3a, 0x1a, 0xe5, - 0x63, 0xb8, 0x27, 0x2c, 0xed, 0x80, 0x60, 0xee, 0x07, 0x56, 0x78, 0x82, 0x83, 0x0b, 0x59, 0xd9, - 0x54, 0x15, 0xca, 0x5c, 0xde, 0x54, 0x2a, 0x7d, 0xa1, 0x91, 0xc8, 0xc8, 0x23, 0x28, 0x8d, 0x71, - 0x70, 0x4a, 0xb8, 0x85, 0x1d, 0x71, 0xff, 0x87, 0x3c, 0x10, 0x6a, 0xe5, 0x2d, 0x79, 0x87, 0xdd, - 0x54, 0xb2, 0x7a, 0x52, 0x34, 0x5f, 0x99, 0xb6, 0x3f, 0x1e, 0xd3, 0x30, 0xa4, 0x3e, 0x13, 0x25, - 0x51, 0x2e, 0xce, 0x57, 0x66, 0x73, 0x2a, 0x3f, 0x24, 0x64, 0xde, 0x98, 0xbc, 0xe4, 0x62, 0xae, - 0x8a, 0xf3, 0xb9, 0x3d, 0x6f, 0xdc, 0x96, 0xf2, 0x38, 0x9d, 0x67, 0xf0, 0xe0, 0x92, 0x9e, 0xd0, - 0x18, 0xba, 0x1e, 0xad, 0x13, 0x3f, 0x0a, 0xca, 0x68, 0x31, 0x66, 0xdd, 0x9f, 0x6f, 0x20, 0xe5, - 0x4f, 0x15, 0xed, 0x91, 0x1f, 0x05, 0xc6, 0xaf, 0xe0, 0x46, 0xfb, 0x39, 0x61, 0x52, 0xab, 0xe7, - 0xf2, 0xd9, 0x9b, 0x26, 0x95, 0x7c, 0xd3, 0x24, 0xdf, 0x6d, 0xab, 0x57, 0x3d, 0x6b, 0xd3, 0xc9, - 0x67, 0xad, 0x05, 0xb7, 0x24, 0xae, 0xaa, 0x29, 0x8d, 0x2e, 0xb8, 0x6c, 0x59, 0x0e, 0x86, 0x50, - 0x96, 0x0e, 0xda, 0x2f, 0x27, 0x98, 0x39, 0x17, 0x82, 0x5c, 0x9a, 0x8f, 0xdf, 0x42, 0x49, 0xfa, - 0xe8, 0x13, 0xcf, 0x93, 0xfc, 0x65, 0x53, 0x91, 0xe7, 0xa5, 0xe1, 0x7f, 0x01, 0x48, 0xc5, 0xa0, - 0x02, 0x58, 0xf2, 0x09, 0x9d, 0xc1, 0x86, 0x44, 0x3f, 0xf6, 0xb0, 0x4d, 0x04, 0x5b, 0xcf, 0x26, - 0xb8, 0xd4, 0x85, 0x09, 0xee, 0xda, 0xd0, 0x02, 0x29, 0x31, 0xab, 0xad, 0xc7, 0x53, 0xb0, 0xf1, - 0x39, 0x6c, 0x26, 0xb2, 0xbe, 0x54, 0x9f, 0xc6, 0x6f, 0x60, 0x4b, 0x85, 0x83, 0xcf, 0x05, 0xdb, - 0x2c, 0x17, 0x3c, 0x84, 0x82, 0x04, 0x6f, 0xc8, 0xe9, 0x01, 0xed, 0x42, 0x5e, 0xcd, 0x11, 0x53, - 0xe8, 0xe9, 0x7a, 0x89, 0xa7, 0x35, 0x01, 0x90, 0x4e, 0x4d, 0x32, 0xc1, 0xe7, 0xa8, 0x0c, 0xb9, - 0x40, 0xfc, 0x98, 0xba, 0x8c, 0x97, 0x4b, 0xf4, 0x38, 0xd4, 0xf9, 0xe9, 0xd2, 0xb3, 0x88, 0x3a, - 0x62, 0x6c, 0xac, 0x00, 0x78, 0x7a, 0xe1, 0xc7, 0x8e, 0x13, 0x7f, 0x79, 0x87, 0xa3, 0xfc, 0x57, - 0x1a, 0x36, 0xf4, 0x55, 0xd0, 0xe7, 0x98, 0x47, 0xe1, 0xff, 0xf2, 0xf1, 0x31, 0x7b, 0xaf, 0xa5, - 0xaf, 0xf7, 0x5e, 0xbb, 0x74, 0x5c, 0xce, 0x5c, 0x31, 0x2e, 0x93, 0xff, 0x7e, 0x5a, 0xac, 0x37, - 0x5a, 0xd7, 0x1e, 0xfe, 0x90, 0x1a, 0xfe, 0x12, 0x50, 0xc6, 0x85, 0xf7, 0x47, 0x72, 0x2a, 0xcf, - 0x2e, 0x69, 0x2a, 0x9f, 0x7e, 0x46, 0xca, 0x5d, 0xfb, 0x33, 0xd2, 0x0e, 0xe4, 0xb1, 0xbc, 0xfa, - 0xa9, 0xa3, 0x1f, 0x12, 0x39, 0x2c, 0x6e, 0x79, 0xea, 0x18, 0x7f, 0x4c, 0x41, 0x21, 0xae, 0x21, - 0x41, 0x88, 0xef, 0xfc, 0x6c, 0x7e, 0x0a, 0x45, 0x6f, 0x86, 0x63, 0x89, 0x92, 0xd4, 0x4f, 0xe6, - 0xc5, 0x1e, 0x5d, 0x5b, 0x09, 0xeb, 0x16, 0xe6, 0xc4, 0xf8, 0x73, 0x0a, 0x6e, 0x24, 0x76, 0x16, - 0xa2, 0x4f, 0xa0, 0x90, 0xd0, 0xd1, 0xfb, 0xbb, 0xfa, 0x6b, 0xdc, 0x54, 0x53, 0x6e, 0x34, 0x65, - 0x26, 0x8d, 0x51, 0x1f, 0x8a, 0x8c, 0xbc, 0x14, 0x17, 0xf4, 0x0c, 0x70, 0x55, 0x3e, 0x4f, 0x16, - 0x05, 0x5c, 0x31, 0xb7, 0x04, 0x42, 0xe2, 0xcf, 0xef, 0x7f, 0xaa, 0x3e, 0x91, 0xc6, 0xdf, 0xfd, - 0xee, 0xc0, 0xcd, 0x56, 0xc7, 0x6c, 0x37, 0x07, 0x56, 0xbd, 0xdf, 0x6f, 0x0f, 0xac, 0xc6, 0x53, - 0xd3, 0x7c, 0xfa, 0x69, 0x71, 0x05, 0xdd, 0x83, 0x72, 0xff, 0xb3, 0xde, 0xe0, 0xa8, 0x3d, 0xe8, - 0x34, 0xb5, 0xac, 0x69, 0xb6, 0xeb, 0x83, 0xce, 0xd3, 0x5e, 0x31, 0x85, 0xb6, 0x61, 0xa3, 0x5b, - 0x1f, 0xb4, 0xad, 0xfe, 0x51, 0xe7, 0xf8, 0xb8, 0xd3, 0x7b, 0x52, 0x5c, 0x7d, 0xdf, 0x16, 0x27, - 0x31, 0x4b, 0x2b, 0x2a, 0x40, 0xae, 0xdb, 0xe9, 0x0f, 0x84, 0x70, 0x45, 0x2c, 0x1a, 0x9d, 0x56, - 0x4b, 0x2c, 0x52, 0xa8, 0x04, 0xc5, 0x7e, 0xbb, 0xdb, 0xed, 0xf4, 0x9e, 0x58, 0xad, 0x76, 0xb3, - 0xd3, 0x17, 0x90, 0xab, 0x68, 0x0b, 0x0a, 0xed, 0x5e, 0xcb, 0x8a, 0x6d, 0xd2, 0x08, 0xc1, 0x66, - 0xff, 0x59, 0xb3, 0xd9, 0xee, 0xf7, 0x0f, 0x9f, 0x75, 0xad, 0x46, 0xa7, 0x55, 0xcc, 0x34, 0x8e, - 0xbe, 0x7a, 0x5d, 0x49, 0x7d, 0xfd, 0xba, 0x92, 0xfa, 0xe7, 0xeb, 0x4a, 0xea, 0xcb, 0x37, 0x95, - 0x95, 0xaf, 0xdf, 0x54, 0x56, 0xbe, 0x79, 0x53, 0x59, 0xf9, 0xbc, 0x9a, 0xe8, 0x8b, 0x67, 0xec, - 0x19, 0xa3, 0x87, 0xb4, 0x66, 0x9f, 0x60, 0xca, 0x6a, 0x2f, 0xe7, 0xfe, 0x0b, 0x40, 0xf6, 0xc8, - 0x30, 0x2b, 0x13, 0xfd, 0xf8, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x01, 0xe4, 0xf3, 0x28, - 0x18, 0x00, 0x00, -} - -func (m *NftIdentifier) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *Listing) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *NftIdentifier) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftIdentifier) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BidId) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BidId) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BidId) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x12 - } - if m.NftId != nil { - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Loan) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Loan) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Loan) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Loan.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ListedClass) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListedClass) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListedClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftIds) > 0 { - for iNdEx := len(m.NftIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.NftIds[iNdEx]) - copy(dAtA[i:], m.NftIds[iNdEx]) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NftInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NftInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.UriHash) > 0 { - i -= len(m.UriHash) - copy(dAtA[i:], m.UriHash) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.UriHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.Uri) > 0 { - i -= len(m.Uri) - copy(dAtA[i:], m.Uri) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Uri))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NftListing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NftListing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n4, err4 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MinimumBiddingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinimumBiddingPeriod):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x72 - { - size, err := m.CollectedAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x6a - if m.AutoRelistedCount != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.AutoRelistedCount)) - i-- - dAtA[i] = 0x60 - } - n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.SuccessfulBidEndAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SuccessfulBidEndAt):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x5a - n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.FullPaymentEndAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.FullPaymentEndAt):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x52 - n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.EndAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.EndAt):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0x4a - n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StartedAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartedAt):]) - if err9 != nil { - return 0, err9 - } - i -= n9 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n9)) - i-- - dAtA[i] = 0x42 - if m.AutomaticRefinancing { - i-- - if m.AutomaticRefinancing { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - { - size := m.MinimumDepositRate.Size() - i -= size - if _, err := m.MinimumDepositRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - if len(m.BidToken) > 0 { - i -= len(m.BidToken) - copy(dAtA[i:], m.BidToken) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.BidToken))) - i-- - dAtA[i] = 0x2a + l = m.NftId.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } if m.State != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x20 + n += 1 + sovNftbackedloan(uint64(m.State)) } - if m.ListingType != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.ListingType)) - i-- - dAtA[i] = 0x18 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Borrowing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Borrowing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Borrowing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StartAt, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartAt):]) - if err11 != nil { - return 0, err11 - } - i -= n11 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n11)) - i-- - dAtA[i] = 0x1a - { - size, err := m.PaidInterestAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NftBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NftBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NftBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Id.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - if len(m.Borrowings) > 0 { - for iNdEx := len(m.Borrowings) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Borrowings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - } - { - size, err := m.InterestAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.BidTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BidTime):]) - if err16 != nil { - return 0, err16 - } - i -= n16 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n16)) - i-- - dAtA[i] = 0x4a - if m.AutomaticPayment { - i-- - if m.AutomaticPayment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - { - size := m.DepositLendingRate.Size() - i -= size - if _, err := m.DepositLendingRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - n17, err17 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.BiddingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BiddingPeriod):]) - if err17 != nil { - return 0, err17 - } - i -= n17 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n17)) - i-- - dAtA[i] = 0x32 - { - size, err := m.PaidAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size, err := m.DepositAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size, err := m.BidAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftListingPeriodExtendFeePerHour.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - if m.NftListingExtendSeconds != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingExtendSeconds)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.NftListingCommissionFee != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingCommissionFee)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.MarketAdministrator) > 0 { - i -= len(m.MarketAdministrator) - copy(dAtA[i:], m.MarketAdministrator) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.MarketAdministrator))) - i-- - dAtA[i] = 0x7a - } - if m.NftCreatorSharePercentage != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftCreatorSharePercentage)) - i-- - dAtA[i] = 0x70 - } - if m.NftListingNftDeliveryPeriod != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingNftDeliveryPeriod)) - i-- - dAtA[i] = 0x68 - } - if m.NftListingFullPaymentPeriod != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingFullPaymentPeriod)) - i-- - dAtA[i] = 0x60 - } - if m.BidTokenDisburseSecondsAfterCancel != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.BidTokenDisburseSecondsAfterCancel)) - i-- - dAtA[i] = 0x58 - } - if m.BidCancelRequiredSeconds != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.BidCancelRequiredSeconds)) - i-- - dAtA[i] = 0x50 - } - if m.NftListingGapTime != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingGapTime)) - i-- - dAtA[i] = 0x48 - } - if m.NftListingCancelFeePercentage != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingCancelFeePercentage)) - i-- - dAtA[i] = 0x40 - } - if m.NftListingCancelRequiredSeconds != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingCancelRequiredSeconds)) - i-- - dAtA[i] = 0x38 - } - if m.NftListingPeriodInitial != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingPeriodInitial)) - i-- - dAtA[i] = 0x30 - } - if m.NftListingDelaySeconds != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.NftListingDelaySeconds)) - i-- - dAtA[i] = 0x28 - } - if m.AutoRelistingCountIfNoBid != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.AutoRelistingCountIfNoBid)) - i-- - dAtA[i] = 0x20 - } - if len(m.BidTokens) > 0 { - for iNdEx := len(m.BidTokens) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BidTokens[iNdEx]) - copy(dAtA[i:], m.BidTokens[iNdEx]) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.BidTokens[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.DefaultBidActiveRank != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.DefaultBidActiveRank)) - i-- - dAtA[i] = 0x10 - } - { - size := m.MinStakingForListing.Size() - i -= size - if _, err := m.MinStakingForListing.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EventListNft) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventListNft) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventListNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventCancelListNfting) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventCancelListNfting) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventCancelListNfting) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventExpandListingPeriod) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventExpandListingPeriod) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventExpandListingPeriod) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventSellingDecision) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventSellingDecision) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventSellingDecision) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventEndListNfting) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventEndListNfting) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventEndListNfting) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventPlaceBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPlaceBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventCancelBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventCancelBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventCancelBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventPayFullBid) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPayFullBid) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPayFullBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventBorrow) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventBorrow) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Borrower) > 0 { - i -= len(m.Borrower) - copy(dAtA[i:], m.Borrower) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Borrower))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventRepay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventRepay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventRepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Repayer) > 0 { - i -= len(m.Repayer) - copy(dAtA[i:], m.Repayer) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Repayer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventLiquidate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventLiquidate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventLiquidate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Liquidator) > 0 { - i -= len(m.Liquidator) - copy(dAtA[i:], m.Liquidator) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Liquidator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PaymentStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PaymentStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PaymentStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AllPaid { - i-- - if m.AllPaid { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.State != 0 { - i = encodeVarintNftbackedloan(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x38 - } - n23, err23 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.BidTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BidTime):]) - if err23 != nil { - return 0, err23 - } - i -= n23 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n23)) - i-- - dAtA[i] = 0x32 - { - size := m.PaidAmount.Size() - i -= size - if _, err := m.PaidAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.AutomaticPayment { - i-- - if m.AutomaticPayment { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintNftbackedloan(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Liquidation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Liquidation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Liquidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n26, err26 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LiquidationDate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LiquidationDate):]) - if err26 != nil { - return 0, err26 - } - i -= n26 - i = encodeVarintNftbackedloan(dAtA, i, uint64(n26)) - i-- - dAtA[i] = 0x12 - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Liquidations) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Liquidations) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Liquidations) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NextLiquidation) > 0 { - for iNdEx := len(m.NextLiquidation) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NextLiquidation[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Liquidation != nil { - { - size, err := m.Liquidation.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNftbackedloan(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintNftbackedloan(dAtA []byte, offset int, v uint64) int { - offset -= sovNftbackedloan(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *NftIdentifier) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *BidId) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NftId != nil { - l = m.NftId.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *Loan) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = m.Loan.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - return n -} - -func (m *ListedClass) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - if len(m.NftIds) > 0 { - for _, s := range m.NftIds { - l = len(s) - n += 1 + l + sovNftbackedloan(uint64(l)) - } - } - return n -} - -func (m *NftInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.Uri) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.UriHash) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *NftListing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - if m.ListingType != 0 { - n += 1 + sovNftbackedloan(uint64(m.ListingType)) - } - if m.State != 0 { - n += 1 + sovNftbackedloan(uint64(m.State)) - } - l = len(m.BidToken) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = m.MinimumDepositRate.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - if m.AutomaticRefinancing { - n += 2 - } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartedAt) - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.EndAt) - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.FullPaymentEndAt) - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SuccessfulBidEndAt) - n += 1 + l + sovNftbackedloan(uint64(l)) - if m.AutoRelistedCount != 0 { - n += 1 + sovNftbackedloan(uint64(m.AutoRelistedCount)) - } - l = m.CollectedAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinimumBiddingPeriod) - n += 1 + l + sovNftbackedloan(uint64(l)) - return n -} - -func (m *Borrowing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Amount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = m.PaidInterestAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartAt) - n += 1 + l + sovNftbackedloan(uint64(l)) - return n -} - -func (m *NftBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = m.BidAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = m.DepositAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = m.PaidAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BiddingPeriod) - n += 1 + l + sovNftbackedloan(uint64(l)) - l = m.DepositLendingRate.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - if m.AutomaticPayment { - n += 2 - } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BidTime) - n += 1 + l + sovNftbackedloan(uint64(l)) - l = m.InterestAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - if len(m.Borrowings) > 0 { - for _, e := range m.Borrowings { - l = e.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - } - } - l = m.Id.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MinStakingForListing.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - if m.DefaultBidActiveRank != 0 { - n += 1 + sovNftbackedloan(uint64(m.DefaultBidActiveRank)) - } - if len(m.BidTokens) > 0 { - for _, s := range m.BidTokens { - l = len(s) - n += 1 + l + sovNftbackedloan(uint64(l)) - } - } - if m.AutoRelistingCountIfNoBid != 0 { - n += 1 + sovNftbackedloan(uint64(m.AutoRelistingCountIfNoBid)) - } - if m.NftListingDelaySeconds != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingDelaySeconds)) - } - if m.NftListingPeriodInitial != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingPeriodInitial)) - } - if m.NftListingCancelRequiredSeconds != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingCancelRequiredSeconds)) - } - if m.NftListingCancelFeePercentage != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingCancelFeePercentage)) - } - if m.NftListingGapTime != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingGapTime)) - } - if m.BidCancelRequiredSeconds != 0 { - n += 1 + sovNftbackedloan(uint64(m.BidCancelRequiredSeconds)) - } - if m.BidTokenDisburseSecondsAfterCancel != 0 { - n += 1 + sovNftbackedloan(uint64(m.BidTokenDisburseSecondsAfterCancel)) - } - if m.NftListingFullPaymentPeriod != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingFullPaymentPeriod)) - } - if m.NftListingNftDeliveryPeriod != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftListingNftDeliveryPeriod)) - } - if m.NftCreatorSharePercentage != 0 { - n += 1 + sovNftbackedloan(uint64(m.NftCreatorSharePercentage)) - } - l = len(m.MarketAdministrator) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - if m.NftListingCommissionFee != 0 { - n += 2 + sovNftbackedloan(uint64(m.NftListingCommissionFee)) - } - if m.NftListingExtendSeconds != 0 { - n += 2 + sovNftbackedloan(uint64(m.NftListingExtendSeconds)) - } - l = m.NftListingPeriodExtendFeePerHour.Size() - n += 2 + l + sovNftbackedloan(uint64(l)) - return n -} - -func (m *EventListNft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventCancelListNfting) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventExpandListingPeriod) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventSellingDecision) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventEndListNfting) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventPlaceBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventCancelBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventPayFullBid) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventBorrow) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Borrower) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventRepay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Repayer) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *EventLiquidate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Liquidator) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - return n -} - -func (m *PaymentStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NftId.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovNftbackedloan(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - if m.AutomaticPayment { - n += 2 - } - l = m.PaidAmount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BidTime) - n += 1 + l + sovNftbackedloan(uint64(l)) - if m.State != 0 { - n += 1 + sovNftbackedloan(uint64(m.State)) - } - if m.AllPaid { - n += 2 - } - return n -} - -func (m *Liquidation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Amount.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LiquidationDate) - n += 1 + l + sovNftbackedloan(uint64(l)) - return n -} - -func (m *Liquidations) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Liquidation != nil { - l = m.Liquidation.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - } - if len(m.NextLiquidation) > 0 { - for _, e := range m.NextLiquidation { - l = e.Size() - n += 1 + l + sovNftbackedloan(uint64(l)) - } - } - return n -} - -func sovNftbackedloan(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozNftbackedloan(x uint64) (n int) { - return sovNftbackedloan(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *NftIdentifier) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftIdentifier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftIdentifier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BidId) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BidId: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BidId: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NftId == nil { - m.NftId = &NftIdentifier{} - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Loan) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Loan: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Loan: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Loan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListedClass) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListedClass: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListedClass: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftIds = append(m.NftIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NftInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UriHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NftListing) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftListing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftListing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ListingType", wireType) - } - m.ListingType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ListingType |= ListingType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= ListingState(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BidToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumDepositRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinimumDepositRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticRefinancing", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AutomaticRefinancing = bool(v != 0) - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartedAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StartedAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.EndAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FullPaymentEndAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.FullPaymentEndAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SuccessfulBidEndAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.SuccessfulBidEndAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutoRelistedCount", wireType) - } - m.AutoRelistedCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AutoRelistedCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CollectedAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CollectedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumBiddingPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.MinimumBiddingPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Borrowing) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: borrowing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: borrowing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaidInterestAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PaidInterestAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartAt", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StartAt, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NftBid) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NftBid: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NftBid: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DepositAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaidAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PaidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BiddingPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.BiddingPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositLendingRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DepositLendingRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticPayment", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AutomaticPayment = bool(v != 0) - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.BidTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterestAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InterestAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Borrowings", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Borrowings = append(m.Borrowings, Borrowing{}) - if err := m.Borrowings[len(m.Borrowings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStakingForListing", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinStakingForListing.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultBidActiveRank", wireType) - } - m.DefaultBidActiveRank = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DefaultBidActiveRank |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BidTokens = append(m.BidTokens, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutoRelistingCountIfNoBid", wireType) - } - m.AutoRelistingCountIfNoBid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AutoRelistingCountIfNoBid |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingDelaySeconds", wireType) - } - m.NftListingDelaySeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingDelaySeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingPeriodInitial", wireType) - } - m.NftListingPeriodInitial = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingPeriodInitial |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingCancelRequiredSeconds", wireType) - } - m.NftListingCancelRequiredSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingCancelRequiredSeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingCancelFeePercentage", wireType) - } - m.NftListingCancelFeePercentage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingCancelFeePercentage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingGapTime", wireType) - } - m.NftListingGapTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingGapTime |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BidCancelRequiredSeconds", wireType) - } - m.BidCancelRequiredSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BidCancelRequiredSeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTokenDisburseSecondsAfterCancel", wireType) - } - m.BidTokenDisburseSecondsAfterCancel = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BidTokenDisburseSecondsAfterCancel |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingFullPaymentPeriod", wireType) - } - m.NftListingFullPaymentPeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingFullPaymentPeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingNftDeliveryPeriod", wireType) - } - m.NftListingNftDeliveryPeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingNftDeliveryPeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftCreatorSharePercentage", wireType) - } - m.NftCreatorSharePercentage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftCreatorSharePercentage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketAdministrator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MarketAdministrator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingCommissionFee", wireType) - } - m.NftListingCommissionFee = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingCommissionFee |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingExtendSeconds", wireType) - } - m.NftListingExtendSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NftListingExtendSeconds |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 18: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftListingPeriodExtendFeePerHour", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NftListingPeriodExtendFeePerHour.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventListNft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventListNft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventListNft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventCancelListNfting) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventCancelListNfting: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventCancelListNfting: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF + l = len(m.BidDenom) + if l > 0 { + n += 1 + l + sovNftbackedloan(uint64(l)) } - return nil -} -func (m *EventExpandListingPeriod) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventExpandListingPeriod: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventExpandListingPeriod: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + l = m.MinDepositRate.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinBidPeriod) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartedAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LiquidatedAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.FullPaymentEndAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SuccessfulBidEndAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.CollectedAmount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + if m.CollectedAmountNegative { + n += 2 } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *Bid) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = m.Id.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.Price.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.Deposit.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.PaidAmount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.InterestRate.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + if m.AutomaticPayment { + n += 2 + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.Loan.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + return n } -func (m *EventSellingDecision) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventSellingDecision: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventSellingDecision: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + +func (m *Loan) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRepaidAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + return n +} + +func (m *Liquidation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LiquidationDate) + n += 1 + l + sovNftbackedloan(uint64(l)) + return n +} + +func (m *Liquidations) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Liquidation != nil { + l = m.Liquidation.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + } + if len(m.NextLiquidation) > 0 { + for _, e := range m.NextLiquidation { + l = e.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *RepayInfo) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = m.RepaidAmount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.RepaidInterestAmount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = m.RemainingAmount.Size() + n += 1 + l + sovNftbackedloan(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastRepaidAt) + n += 1 + l + sovNftbackedloan(uint64(l)) + return n +} + +func sovNftbackedloan(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNftbackedloan(x uint64) (n int) { + return sovNftbackedloan(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *EventEndListNfting) Unmarshal(dAtA []byte) error { +func (m *NftId) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6535,45 +1660,13 @@ func (m *EventEndListNfting) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventEndListNfting: wiretype end group for non-group") + return fmt.Errorf("proto: NftId: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventEndListNfting: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NftId: illegal tag %d (wire type %d)", fieldNum, wire) } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -6605,9 +1698,9 @@ func (m *EventEndListNfting) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6635,7 +1728,7 @@ func (m *EventEndListNfting) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6658,7 +1751,7 @@ func (m *EventEndListNfting) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { +func (m *BidId) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6681,17 +1774,17 @@ func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventPlaceBid: wiretype end group for non-group") + return fmt.Errorf("proto: BidId: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventPlaceBid: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BidId: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -6701,27 +1794,31 @@ func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.Bidder = string(dAtA[iNdEx:postIndex]) + if m.NftId == nil { + m.NftId = &NftId{} + } + if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6749,11 +1846,61 @@ func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Bidder = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipNftbackedloan(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNftbackedloan + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListedClass) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListedClass: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListedClass: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6781,11 +1928,11 @@ func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NftIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6813,7 +1960,7 @@ func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = string(dAtA[iNdEx:postIndex]) + m.NftIds = append(m.NftIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -6836,7 +1983,7 @@ func (m *EventPlaceBid) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventCancelBid) Unmarshal(dAtA []byte) error { +func (m *NftInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6859,15 +2006,15 @@ func (m *EventCancelBid) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventCancelBid: wiretype end group for non-group") + return fmt.Errorf("proto: NftInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventCancelBid: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NftInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6895,11 +2042,11 @@ func (m *EventCancelBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Bidder = string(dAtA[iNdEx:postIndex]) + m.Id = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6927,11 +2074,11 @@ func (m *EventCancelBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Uri = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6959,7 +2106,7 @@ func (m *EventCancelBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6982,7 +2129,7 @@ func (m *EventCancelBid) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventPayFullBid) Unmarshal(dAtA []byte) error { +func (m *Listing) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7005,15 +2152,48 @@ func (m *EventPayFullBid) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventPayFullBid: wiretype end group for non-group") + return fmt.Errorf("proto: Listing: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventPayFullBid: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Listing: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNftbackedloan + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNftbackedloan + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7041,11 +2221,30 @@ func (m *EventPayFullBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Bidder = string(dAtA[iNdEx:postIndex]) + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= ListingState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BidDenom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7073,11 +2272,11 @@ func (m *EventPayFullBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.BidDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7105,63 +2304,81 @@ func (m *EventPayFullBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { + if err := m.MinDepositRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBidPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - if (iNdEx + skippy) > l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNftbackedloan + } + if postIndex > l { return io.ErrUnexpectedEOF } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventBorrow) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.MinBidPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err } - if iNdEx >= l { - return io.ErrUnexpectedEOF + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartedAt", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventBorrow: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventBorrow: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + if msglen < 0 { + return ErrInvalidLengthNftbackedloan + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNftbackedloan + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StartedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Borrower", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LiquidatedAt", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7171,29 +2388,30 @@ func (m *EventBorrow) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.Borrower = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LiquidatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FullPaymentEndAt", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7203,29 +2421,30 @@ func (m *EventBorrow) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.FullPaymentEndAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: + case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SuccessfulBidEndAt", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7235,29 +2454,30 @@ func (m *EventBorrow) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.SuccessfulBidEndAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CollectedAmount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7267,24 +2487,45 @@ func (m *EventBorrow) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = string(dAtA[iNdEx:postIndex]) + if err := m.CollectedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CollectedAmountNegative", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CollectedAmountNegative = bool(v != 0) default: iNdEx = preIndex skippy, err := skipNftbackedloan(dAtA[iNdEx:]) @@ -7306,7 +2547,7 @@ func (m *EventBorrow) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventRepay) Unmarshal(dAtA []byte) error { +func (m *Bid) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7329,17 +2570,17 @@ func (m *EventRepay) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventRepay: wiretype end group for non-group") + return fmt.Errorf("proto: Bid: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventRepay: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Bid: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Repayer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7349,29 +2590,30 @@ func (m *EventRepay) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.Repayer = string(dAtA[iNdEx:postIndex]) + if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7381,29 +2623,30 @@ func (m *EventRepay) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7413,29 +2656,30 @@ func (m *EventRepay) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PaidAmount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7445,77 +2689,61 @@ func (m *EventRepay) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftbackedloan(dAtA[iNdEx:]) - if err != nil { + if err := m.PaidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftbackedloan + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventLiquidate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan + if msglen < 0 { + return ErrInvalidLengthNftbackedloan } - if iNdEx >= l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNftbackedloan + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Expiry, dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventLiquidate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventLiquidate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Liquidator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InterestRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -7543,13 +2771,35 @@ func (m *EventLiquidate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Liquidator = string(dAtA[iNdEx:postIndex]) + if err := m.InterestRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AutomaticPayment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AutomaticPayment = bool(v != 0) + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7559,29 +2809,30 @@ func (m *EventLiquidate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: + case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Loan", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7591,23 +2842,24 @@ func (m *EventLiquidate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + if err := m.Loan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -7630,7 +2882,7 @@ func (m *EventLiquidate) Unmarshal(dAtA []byte) error { } return nil } -func (m *PaymentStatus) Unmarshal(dAtA []byte) error { +func (m *Loan) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7653,15 +2905,15 @@ func (m *PaymentStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PaymentStatus: wiretype end group for non-group") + return fmt.Errorf("proto: Loan: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PaymentStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Loan: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7688,45 +2940,13 @@ func (m *PaymentStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftbackedloan - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftbackedloan - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastRepaidAt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7753,35 +2973,65 @@ func (m *PaymentStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastRepaidAt, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticPayment", wireType) + default: + iNdEx = preIndex + skippy, err := skipNftbackedloan(dAtA[iNdEx:]) + if err != nil { + return err } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNftbackedloan } - m.AutomaticPayment = bool(v != 0) - case 5: + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Liquidation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Liquidation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Liquidation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaidAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftbackedloan @@ -7791,29 +3041,28 @@ func (m *PaymentStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftbackedloan } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftbackedloan } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PaidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LiquidationDate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7840,49 +3089,10 @@ func (m *PaymentStatus) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.BidTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LiquidationDate, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= ListingState(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllPaid", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftbackedloan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AllPaid = bool(v != 0) default: iNdEx = preIndex skippy, err := skipNftbackedloan(dAtA[iNdEx:]) @@ -7904,7 +3114,7 @@ func (m *PaymentStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *Liquidation) Unmarshal(dAtA []byte) error { +func (m *Liquidations) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7927,15 +3137,15 @@ func (m *Liquidation) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Liquidation: wiretype end group for non-group") + return fmt.Errorf("proto: Liquidations: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Liquidation: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Liquidations: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Liquidation", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7962,13 +3172,16 @@ func (m *Liquidation) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Liquidation == nil { + m.Liquidation = &Liquidation{} + } + if err := m.Liquidation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidationDate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NextLiquidation", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -7995,7 +3208,8 @@ func (m *Liquidation) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LiquidationDate, dAtA[iNdEx:postIndex]); err != nil { + m.NextLiquidation = append(m.NextLiquidation, Liquidation{}) + if err := m.NextLiquidation[len(m.NextLiquidation)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8020,7 +3234,7 @@ func (m *Liquidation) Unmarshal(dAtA []byte) error { } return nil } -func (m *Liquidations) Unmarshal(dAtA []byte) error { +func (m *RepayInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8043,15 +3257,15 @@ func (m *Liquidations) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Liquidations: wiretype end group for non-group") + return fmt.Errorf("proto: RepayInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Liquidations: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RepayInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Liquidation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RepaidAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8078,16 +3292,13 @@ func (m *Liquidations) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Liquidation == nil { - m.Liquidation = &Liquidation{} - } - if err := m.Liquidation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RepaidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextLiquidation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RepaidInterestAmount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8114,8 +3325,73 @@ func (m *Liquidations) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NextLiquidation = append(m.NextLiquidation, Liquidation{}) - if err := m.NextLiquidation[len(m.NextLiquidation)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RepaidInterestAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemainingAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNftbackedloan + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNftbackedloan + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RemainingAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastRepaidAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNftbackedloan + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNftbackedloan + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNftbackedloan + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastRepaidAt, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/nftbackedloan/types/params.go b/x/nftbackedloan/types/params.go index dae149e8c..aab0cd565 100644 --- a/x/nftbackedloan/types/params.go +++ b/x/nftbackedloan/types/params.go @@ -20,24 +20,13 @@ func NewParams() Params { // DefaultParams returns default params for incentive module func DefaultParams() Params { return Params{ - MinStakingForListing: sdk.ZeroInt(), - DefaultBidActiveRank: 1, - BidTokens: []string{DefaultBidToken}, - AutoRelistingCountIfNoBid: 1, - NftListingDelaySeconds: 10, - NftListingPeriodInitial: 60, - NftListingCancelRequiredSeconds: 20, - NftListingCancelFeePercentage: 5, - NftListingGapTime: 20, - BidCancelRequiredSeconds: 20, - BidTokenDisburseSecondsAfterCancel: 20, - NftListingFullPaymentPeriod: 30, - NftListingNftDeliveryPeriod: 30, - NftCreatorSharePercentage: 5, - MarketAdministrator: "", - NftListingCommissionFee: 5, - NftListingExtendSeconds: 30, - NftListingPeriodExtendFeePerHour: sdk.NewInt64Coin(DefaultBidToken, 1000000), + MinStakingForListing: sdk.ZeroInt(), + BidTokens: []string{DefaultBidToken}, + NftListingCancelRequiredSeconds: 20, + BidCancelRequiredSeconds: 20, + NftListingFullPaymentPeriod: 30, + NftListingNftDeliveryPeriod: 30, + NftListingCommissionRate: sdk.MustNewDecFromStr("0.05"), } } @@ -48,47 +37,25 @@ func ParamKeyTable() paramstype.KeyTable { // Parameter keys var ( - KeyMinStakingForListing = []byte("MinStakingForListing") - KeyDefaultBidActiveRank = []byte("DefaultBidActiveRank") - KeyBidTokens = []byte("BidTokens") - KeyAutoRelistingCountIfNoBid = []byte("AutoRelistingCountIfNoBid") - KeyNftListingDelaySeconds = []byte("NftListingDelaySeconds") - KeyNftListingPeriodInitial = []byte("NftListingPeriodInitial") - KeyNftListingCancelRequiredSeconds = []byte("NftListingCancelRequiredSeconds") - KeyNftListingCancelFeePercentage = []byte("NftListingCancelFeePercentage") - KeyNftListingGapTime = []byte("NftListingGapTime") - KeyBidCancelRequiredSeconds = []byte("BidCancelRequiredSeconds") - KeyBidTokenDisburseSecondsAfterCancel = []byte("BidTokenDisburseSecondsAfterCancel") - KeyNftListingFullPaymentPeriod = []byte("NftListingFullPaymentPeriod") - KeyNftListingNftDeliveryPeriod = []byte("NftListingNftDeliveryPeriod") - KeyNftCreatorSharePercentage = []byte("NftCreatorSharePercentage") - KeyMarketAdministrator = []byte("MarketAdministrator") - KeyNftListingCommissionFee = []byte("NftListingCommissionFee") - KeyNftListingExtendSeconds = []byte("NftListingExtendSeconds") - KeyNftListingPeriodExtendFeePerHour = []byte("NftListingPeriodExtendFeePerHour") + KeyMinStakingForListing = []byte("MinStakingForListing") + KeyBidTokens = []byte("BidTokens") + KeyNftListingCancelRequiredSeconds = []byte("NftListingCancelRequiredSeconds") + KeyBidCancelRequiredSeconds = []byte("BidCancelRequiredSeconds") + KeyNftListingFullPaymentPeriod = []byte("NftListingFullPaymentPeriod") + KeyNftListingNftDeliveryPeriod = []byte("NftListingNftDeliveryPeriod") + KeyNftListingCommissionRate = []byte("NftListingCommissionRate") ) // ParamSetPairs implements the ParamSet interface and returns all the key/value pairs func (p *Params) ParamSetPairs() paramstype.ParamSetPairs { return paramstype.ParamSetPairs{ paramstype.NewParamSetPair(KeyMinStakingForListing, &p.MinStakingForListing, validateMinStakingForListing), - paramstype.NewParamSetPair(KeyDefaultBidActiveRank, &p.DefaultBidActiveRank, validateDefaultBidActiveRank), paramstype.NewParamSetPair(KeyBidTokens, &p.BidTokens, validateBidTokens), - paramstype.NewParamSetPair(KeyAutoRelistingCountIfNoBid, &p.AutoRelistingCountIfNoBid, validateAutoRelistingCountIfNoBid), - paramstype.NewParamSetPair(KeyNftListingDelaySeconds, &p.NftListingDelaySeconds, validateNftListingDelaySeconds), - paramstype.NewParamSetPair(KeyNftListingPeriodInitial, &p.NftListingPeriodInitial, validateNftListingPeriodInitial), paramstype.NewParamSetPair(KeyNftListingCancelRequiredSeconds, &p.NftListingCancelRequiredSeconds, validateNftListingCancelRequiredSeconds), - paramstype.NewParamSetPair(KeyNftListingCancelFeePercentage, &p.NftListingCancelFeePercentage, validateNftListingCancelFeePercentage), - paramstype.NewParamSetPair(KeyNftListingGapTime, &p.NftListingGapTime, validateNftListingGapTime), paramstype.NewParamSetPair(KeyBidCancelRequiredSeconds, &p.BidCancelRequiredSeconds, validateBidCancelRequiredSeconds), - paramstype.NewParamSetPair(KeyBidTokenDisburseSecondsAfterCancel, &p.BidTokenDisburseSecondsAfterCancel, validateBidTokenDisburseSecondsAfterCancel), paramstype.NewParamSetPair(KeyNftListingFullPaymentPeriod, &p.NftListingFullPaymentPeriod, validateNftListingFullPaymentPeriod), paramstype.NewParamSetPair(KeyNftListingNftDeliveryPeriod, &p.NftListingNftDeliveryPeriod, validateNftListingNftDeliveryPeriod), - paramstype.NewParamSetPair(KeyNftCreatorSharePercentage, &p.NftCreatorSharePercentage, validateNftCreatorSharePercentage), - paramstype.NewParamSetPair(KeyMarketAdministrator, &p.MarketAdministrator, validateMarketAdministrator), - paramstype.NewParamSetPair(KeyNftListingCommissionFee, &p.NftListingCommissionFee, validateNftListingCommissionFee), - paramstype.NewParamSetPair(KeyNftListingExtendSeconds, &p.NftListingExtendSeconds, validateNftListingExtendSeconds), - paramstype.NewParamSetPair(KeyNftListingPeriodExtendFeePerHour, &p.NftListingPeriodExtendFeePerHour, validateNftListingPeriodExtendFeePerHour), + paramstype.NewParamSetPair(KeyNftListingCommissionRate, &p.NftListingCommissionRate, validateNftListingCommissionRate), } } @@ -99,46 +66,18 @@ func (p Params) Validate() error { return err } - if err := validateDefaultBidActiveRank(p.DefaultBidActiveRank); err != nil { - return err - } - if err := validateBidTokens(p.BidTokens); err != nil { return err } - if err := validateAutoRelistingCountIfNoBid(p.AutoRelistingCountIfNoBid); err != nil { - return err - } - - if err := validateNftListingDelaySeconds(p.NftListingDelaySeconds); err != nil { - return err - } - - if err := validateNftListingPeriodInitial(p.NftListingPeriodInitial); err != nil { - return err - } - if err := validateNftListingCancelRequiredSeconds(p.BidCancelRequiredSeconds); err != nil { return err } - if err := validateNftListingCancelFeePercentage(p.NftListingCancelFeePercentage); err != nil { - return err - } - - if err := validateNftListingGapTime(p.NftListingGapTime); err != nil { - return err - } - if err := validateBidCancelRequiredSeconds(p.BidCancelRequiredSeconds); err != nil { return err } - if err := validateBidTokenDisburseSecondsAfterCancel(p.BidTokenDisburseSecondsAfterCancel); err != nil { - return err - } - if err := validateNftListingFullPaymentPeriod(p.NftListingFullPaymentPeriod); err != nil { return err } @@ -147,23 +86,7 @@ func (p Params) Validate() error { return err } - if err := validateNftCreatorSharePercentage(p.NftCreatorSharePercentage); err != nil { - return err - } - - if err := validateMarketAdministrator(p.MarketAdministrator); err != nil { - return err - } - - if err := validateNftListingCommissionFee(p.NftListingCommissionFee); err != nil { - return err - } - - if err := validateNftListingExtendSeconds(p.NftListingExtendSeconds); err != nil { - return err - } - - if err := validateNftListingPeriodExtendFeePerHour(p.NftListingPeriodExtendFeePerHour); err != nil { + if err := validateNftListingCommissionRate(p.NftListingCommissionRate); err != nil { return err } @@ -179,15 +102,6 @@ func validateMinStakingForListing(i interface{}) error { return nil } -func validateDefaultBidActiveRank(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - func validateBidTokens(i interface{}) error { _, ok := i.([]string) if !ok { @@ -197,33 +111,6 @@ func validateBidTokens(i interface{}) error { return nil } -func validateAutoRelistingCountIfNoBid(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingDelaySeconds(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingPeriodInitial(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - func validateNftListingCancelRequiredSeconds(i interface{}) error { _, ok := i.(uint64) if !ok { @@ -233,24 +120,6 @@ func validateNftListingCancelRequiredSeconds(i interface{}) error { return nil } -func validateNftListingCancelFeePercentage(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingGapTime(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - func validateBidCancelRequiredSeconds(i interface{}) error { _, ok := i.(uint64) if !ok { @@ -260,15 +129,6 @@ func validateBidCancelRequiredSeconds(i interface{}) error { return nil } -func validateBidTokenDisburseSecondsAfterCancel(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - func validateNftListingFullPaymentPeriod(i interface{}) error { _, ok := i.(uint64) if !ok { @@ -287,46 +147,14 @@ func validateNftListingNftDeliveryPeriod(i interface{}) error { return nil } -func validateNftCreatorSharePercentage(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateMarketAdministrator(i interface{}) error { - _, ok := i.(string) +func validateNftListingCommissionRate(i interface{}) error { + rate, ok := i.(sdk.Dec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - return nil -} - -func validateNftListingCommissionFee(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingExtendSeconds(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -func validateNftListingPeriodExtendFeePerHour(i interface{}) error { - _, ok := i.(sdk.Coin) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) + if rate.IsNil() || rate.IsNegative() || rate.GT(sdk.OneDec()) { + return fmt.Errorf("invalid rate: %s", rate.String()) } return nil diff --git a/x/nftbackedloan/types/params.pb.go b/x/nftbackedloan/types/params.pb.go new file mode 100644 index 000000000..ffe704ddf --- /dev/null +++ b/x/nftbackedloan/types/params.pb.go @@ -0,0 +1,581 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ununifi/nftbackedloan/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Params struct { + MinStakingForListing github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=min_staking_for_listing,json=minStakingForListing,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_staking_for_listing" yaml:"min_staking_for_listing"` + BidTokens []string `protobuf:"bytes,2,rep,name=bid_tokens,json=bidTokens,proto3" json:"bid_tokens,omitempty"` + NftListingCancelRequiredSeconds uint64 `protobuf:"varint,3,opt,name=nft_listing_cancel_required_seconds,json=nftListingCancelRequiredSeconds,proto3" json:"nft_listing_cancel_required_seconds,omitempty"` + BidCancelRequiredSeconds uint64 `protobuf:"varint,4,opt,name=bid_cancel_required_seconds,json=bidCancelRequiredSeconds,proto3" json:"bid_cancel_required_seconds,omitempty"` + NftListingFullPaymentPeriod uint64 `protobuf:"varint,5,opt,name=nft_listing_full_payment_period,json=nftListingFullPaymentPeriod,proto3" json:"nft_listing_full_payment_period,omitempty"` + NftListingNftDeliveryPeriod uint64 `protobuf:"varint,6,opt,name=nft_listing_nft_delivery_period,json=nftListingNftDeliveryPeriod,proto3" json:"nft_listing_nft_delivery_period,omitempty"` + NftListingCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=nft_listing_commission_rate,json=nftListingCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"nft_listing_commission_rate" yaml:"nft_listing_commission_rate"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_09867a85e3b187de, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBidTokens() []string { + if m != nil { + return m.BidTokens + } + return nil +} + +func (m *Params) GetNftListingCancelRequiredSeconds() uint64 { + if m != nil { + return m.NftListingCancelRequiredSeconds + } + return 0 +} + +func (m *Params) GetBidCancelRequiredSeconds() uint64 { + if m != nil { + return m.BidCancelRequiredSeconds + } + return 0 +} + +func (m *Params) GetNftListingFullPaymentPeriod() uint64 { + if m != nil { + return m.NftListingFullPaymentPeriod + } + return 0 +} + +func (m *Params) GetNftListingNftDeliveryPeriod() uint64 { + if m != nil { + return m.NftListingNftDeliveryPeriod + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "ununifi.nftbackedloan.Params") +} + +func init() { + proto.RegisterFile("ununifi/nftbackedloan/params.proto", fileDescriptor_09867a85e3b187de) +} + +var fileDescriptor_09867a85e3b187de = []byte{ + // 496 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xc1, 0x6a, 0xdb, 0x3e, + 0x1c, 0xc7, 0xe3, 0x7f, 0xf3, 0xcf, 0x88, 0x8f, 0xa1, 0x63, 0x5e, 0xc3, 0xec, 0xe0, 0xc1, 0xc8, + 0x65, 0x16, 0x65, 0xb7, 0xc1, 0x2e, 0x5d, 0x08, 0x1b, 0x94, 0x11, 0xdc, 0xf6, 0xb2, 0x8b, 0x90, + 0x6d, 0xd9, 0xfd, 0x11, 0xeb, 0x27, 0xcf, 0x92, 0xcb, 0xf2, 0x04, 0xbb, 0x0e, 0xf6, 0x52, 0x3d, + 0xf6, 0x38, 0x76, 0x08, 0x25, 0x79, 0x83, 0x3e, 0xc1, 0x88, 0xe4, 0x6c, 0x69, 0x58, 0x07, 0x3b, + 0x59, 0xd2, 0xf7, 0xe3, 0x8f, 0xbe, 0x48, 0xb6, 0x1b, 0x36, 0xd8, 0x20, 0xe4, 0x40, 0x30, 0xd7, + 0x09, 0x4b, 0xe7, 0x3c, 0x2b, 0x25, 0x43, 0x52, 0xb1, 0x9a, 0x09, 0x15, 0x55, 0xb5, 0xd4, 0x72, + 0xf0, 0xb8, 0x65, 0xa2, 0x7b, 0xcc, 0xd1, 0x61, 0x21, 0x0b, 0x69, 0x08, 0xb2, 0x19, 0x59, 0xf8, + 0x28, 0x28, 0xa4, 0x2c, 0x4a, 0x4e, 0xcc, 0x2c, 0x69, 0x72, 0xa2, 0x41, 0x70, 0xa5, 0x99, 0xa8, + 0x5a, 0xc0, 0xdf, 0x07, 0xb2, 0xa6, 0x66, 0x1a, 0x24, 0x6e, 0xf3, 0x54, 0x2a, 0x21, 0x15, 0x49, + 0x98, 0xe2, 0xe4, 0xea, 0x38, 0xe1, 0x9a, 0x1d, 0x93, 0x54, 0xc2, 0x36, 0x7f, 0x6a, 0x73, 0x6a, + 0x77, 0xb6, 0x13, 0x1b, 0x85, 0xb7, 0x5d, 0xb7, 0x37, 0x33, 0xcd, 0x07, 0x5f, 0x1c, 0xf7, 0x89, + 0x00, 0xa4, 0x4a, 0xb3, 0x39, 0x60, 0x41, 0x73, 0x59, 0xd3, 0x12, 0x94, 0x06, 0x2c, 0x3c, 0x67, + 0xe4, 0x8c, 0xfb, 0x27, 0xb3, 0xeb, 0x65, 0xd0, 0xf9, 0xb1, 0x0c, 0x5e, 0x14, 0xa0, 0x2f, 0x9b, + 0x24, 0x4a, 0xa5, 0x68, 0x6d, 0xed, 0xe3, 0xa5, 0xca, 0xe6, 0x44, 0x2f, 0x2a, 0xae, 0xa2, 0xf7, + 0xa8, 0xef, 0x96, 0x81, 0xbf, 0x60, 0xa2, 0x7c, 0x1d, 0x3e, 0xa0, 0x0d, 0xe3, 0x43, 0x01, 0x78, + 0x66, 0x83, 0xa9, 0xac, 0x4f, 0xed, 0xf2, 0xe0, 0x99, 0xeb, 0x26, 0x90, 0x51, 0x2d, 0xe7, 0x1c, + 0x95, 0xf7, 0xdf, 0xe8, 0x60, 0xdc, 0x8f, 0xfb, 0x09, 0x64, 0xe7, 0x66, 0x61, 0x70, 0xea, 0x3e, + 0xc7, 0x5c, 0x6f, 0x25, 0x34, 0x65, 0x98, 0xf2, 0x92, 0xd6, 0xfc, 0x53, 0x03, 0x35, 0xcf, 0xa8, + 0xe2, 0xa9, 0xc4, 0x4c, 0x79, 0x07, 0x23, 0x67, 0xdc, 0x8d, 0x03, 0xcc, 0x75, 0xeb, 0x7d, 0x6b, + 0xc0, 0xb8, 0xe5, 0xce, 0x2c, 0x36, 0x78, 0xe3, 0x0e, 0x37, 0x9b, 0x3d, 0x64, 0xe9, 0x1a, 0x8b, + 0x97, 0x40, 0xf6, 0xe7, 0xd7, 0x27, 0x6e, 0xb0, 0x5b, 0x26, 0x6f, 0xca, 0x92, 0x56, 0x6c, 0x21, + 0x38, 0x6a, 0x5a, 0xf1, 0x1a, 0x64, 0xe6, 0xfd, 0x6f, 0x14, 0xc3, 0xdf, 0x45, 0xa6, 0x4d, 0x59, + 0xce, 0x2c, 0x33, 0x33, 0xc8, 0xbe, 0x65, 0x33, 0xce, 0x78, 0x09, 0x57, 0xbc, 0x5e, 0x6c, 0x2d, + 0xbd, 0x7d, 0xcb, 0x87, 0x5c, 0x4f, 0x5a, 0xa6, 0xb5, 0x7c, 0x73, 0xdc, 0xe1, 0xbd, 0x93, 0x91, + 0x42, 0x80, 0x52, 0x20, 0x91, 0xd6, 0x4c, 0x73, 0xef, 0x91, 0xb9, 0xc5, 0xf3, 0x7f, 0xb8, 0xc5, + 0x09, 0x4f, 0xef, 0x96, 0x41, 0x68, 0x6f, 0xf1, 0x2f, 0xea, 0x30, 0xf6, 0x76, 0xce, 0xf9, 0x57, + 0x16, 0x33, 0xcd, 0x4f, 0xde, 0x5d, 0xaf, 0x7c, 0xe7, 0x66, 0xe5, 0x3b, 0xb7, 0x2b, 0xdf, 0xf9, + 0xba, 0xf6, 0x3b, 0x37, 0x6b, 0xbf, 0xf3, 0x7d, 0xed, 0x77, 0x3e, 0x46, 0x3b, 0x0d, 0x2e, 0xf0, + 0x02, 0x61, 0x0a, 0x24, 0xbd, 0x64, 0x80, 0xe4, 0xf3, 0xde, 0xcf, 0x65, 0xda, 0x24, 0x3d, 0xf3, + 0xcd, 0xbe, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xba, 0x4a, 0x8b, 0x82, 0x03, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NftListingCommissionRate.Size() + i -= size + if _, err := m.NftListingCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.NftListingNftDeliveryPeriod != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.NftListingNftDeliveryPeriod)) + i-- + dAtA[i] = 0x30 + } + if m.NftListingFullPaymentPeriod != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.NftListingFullPaymentPeriod)) + i-- + dAtA[i] = 0x28 + } + if m.BidCancelRequiredSeconds != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BidCancelRequiredSeconds)) + i-- + dAtA[i] = 0x20 + } + if m.NftListingCancelRequiredSeconds != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.NftListingCancelRequiredSeconds)) + i-- + dAtA[i] = 0x18 + } + if len(m.BidTokens) > 0 { + for iNdEx := len(m.BidTokens) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BidTokens[iNdEx]) + copy(dAtA[i:], m.BidTokens[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.BidTokens[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + { + size := m.MinStakingForListing.Size() + i -= size + if _, err := m.MinStakingForListing.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MinStakingForListing.Size() + n += 1 + l + sovParams(uint64(l)) + if len(m.BidTokens) > 0 { + for _, s := range m.BidTokens { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + if m.NftListingCancelRequiredSeconds != 0 { + n += 1 + sovParams(uint64(m.NftListingCancelRequiredSeconds)) + } + if m.BidCancelRequiredSeconds != 0 { + n += 1 + sovParams(uint64(m.BidCancelRequiredSeconds)) + } + if m.NftListingFullPaymentPeriod != 0 { + n += 1 + sovParams(uint64(m.NftListingFullPaymentPeriod)) + } + if m.NftListingNftDeliveryPeriod != 0 { + n += 1 + sovParams(uint64(m.NftListingNftDeliveryPeriod)) + } + l = m.NftListingCommissionRate.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStakingForListing", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinStakingForListing.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidTokens = append(m.BidTokens, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NftListingCancelRequiredSeconds", wireType) + } + m.NftListingCancelRequiredSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NftListingCancelRequiredSeconds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BidCancelRequiredSeconds", wireType) + } + m.BidCancelRequiredSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BidCancelRequiredSeconds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NftListingFullPaymentPeriod", wireType) + } + m.NftListingFullPaymentPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NftListingFullPaymentPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NftListingNftDeliveryPeriod", wireType) + } + m.NftListingNftDeliveryPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NftListingNftDeliveryPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftListingCommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NftListingCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/nftbackedloan/types/query.pb.go b/x/nftbackedloan/types/query.pb.go index dde84b22c..cd19a8b35 100644 --- a/x/nftbackedloan/types/query.pb.go +++ b/x/nftbackedloan/types/query.pb.go @@ -7,7 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" @@ -167,7 +166,7 @@ func (m *QueryNftListingRequest) GetNftId() string { } type QueryNftListingResponse struct { - Listing NftListing `protobuf:"bytes,1,opt,name=listing,proto3" json:"listing"` + Listing Listing `protobuf:"bytes,1,opt,name=listing,proto3" json:"listing"` } func (m *QueryNftListingResponse) Reset() { *m = QueryNftListingResponse{} } @@ -203,11 +202,11 @@ func (m *QueryNftListingResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryNftListingResponse proto.InternalMessageInfo -func (m *QueryNftListingResponse) GetListing() NftListing { +func (m *QueryNftListingResponse) GetListing() Listing { if m != nil { return m.Listing } - return NftListing{} + return Listing{} } type QueryListedNftsRequest struct { @@ -351,8 +350,8 @@ func (m *QueryListedClassRequest) GetNftLimit() int32 { } type NftListingDetail struct { - Listing NftListing `protobuf:"bytes,1,opt,name=listing,proto3" json:"listing"` - NftInfo NftInfo `protobuf:"bytes,2,opt,name=nft_info,json=nftInfo,proto3" json:"nft_info"` + Listing Listing `protobuf:"bytes,1,opt,name=listing,proto3" json:"listing"` + NftInfo NftInfo `protobuf:"bytes,2,opt,name=nft_info,json=nftInfo,proto3" json:"nft_info"` } func (m *NftListingDetail) Reset() { *m = NftListingDetail{} } @@ -388,11 +387,11 @@ func (m *NftListingDetail) XXX_DiscardUnknown() { var xxx_messageInfo_NftListingDetail proto.InternalMessageInfo -func (m *NftListingDetail) GetListing() NftListing { +func (m *NftListingDetail) GetListing() Listing { if m != nil { return m.Listing } - return NftListing{} + return Listing{} } func (m *NftListingDetail) GetNftInfo() NftInfo { @@ -590,86 +589,6 @@ func (m *QueryListedClassResponse) GetNftCount() uint64 { return 0 } -type QueryLoansRequest struct { -} - -func (m *QueryLoansRequest) Reset() { *m = QueryLoansRequest{} } -func (m *QueryLoansRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLoansRequest) ProtoMessage() {} -func (*QueryLoansRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{11} -} -func (m *QueryLoansRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLoansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLoansRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryLoansRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoansRequest.Merge(m, src) -} -func (m *QueryLoansRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryLoansRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoansRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLoansRequest proto.InternalMessageInfo - -type QueryLoansResponse struct { - Loans []Loan `protobuf:"bytes,1,rep,name=loans,proto3" json:"loans"` -} - -func (m *QueryLoansResponse) Reset() { *m = QueryLoansResponse{} } -func (m *QueryLoansResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLoansResponse) ProtoMessage() {} -func (*QueryLoansResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{12} -} -func (m *QueryLoansResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLoansResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLoansResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryLoansResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoansResponse.Merge(m, src) -} -func (m *QueryLoansResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryLoansResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoansResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLoansResponse proto.InternalMessageInfo - -func (m *QueryLoansResponse) GetLoans() []Loan { - if m != nil { - return m.Loans - } - return nil -} - type QueryLoanRequest struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` @@ -679,7 +598,7 @@ func (m *QueryLoanRequest) Reset() { *m = QueryLoanRequest{} } func (m *QueryLoanRequest) String() string { return proto.CompactTextString(m) } func (*QueryLoanRequest) ProtoMessage() {} func (*QueryLoanRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{13} + return fileDescriptor_7db9d9524c1d8ab8, []int{11} } func (m *QueryLoanRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -723,15 +642,17 @@ func (m *QueryLoanRequest) GetNftId() string { } type QueryLoanResponse struct { - Loan Loan `protobuf:"bytes,1,opt,name=loan,proto3" json:"loan"` - BorrowingLimit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=borrowing_limit,json=borrowingLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"borrowing_limit" yaml:"borrowing_limit"` + NftId NftId `protobuf:"bytes,1,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + BorrowingAmount types.Coin `protobuf:"bytes,2,opt,name=borrowing_amount,json=borrowingAmount,proto3" json:"borrowing_amount"` + BorrowingLimit types.Coin `protobuf:"bytes,3,opt,name=borrowing_limit,json=borrowingLimit,proto3" json:"borrowing_limit"` + TotalDeposit types.Coin `protobuf:"bytes,4,opt,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit"` } func (m *QueryLoanResponse) Reset() { *m = QueryLoanResponse{} } func (m *QueryLoanResponse) String() string { return proto.CompactTextString(m) } func (*QueryLoanResponse) ProtoMessage() {} func (*QueryLoanResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{14} + return fileDescriptor_7db9d9524c1d8ab8, []int{12} } func (m *QueryLoanResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -760,84 +681,33 @@ func (m *QueryLoanResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLoanResponse proto.InternalMessageInfo -func (m *QueryLoanResponse) GetLoan() Loan { +func (m *QueryLoanResponse) GetNftId() NftId { if m != nil { - return m.Loan + return m.NftId } - return Loan{} -} - -type QueryCDPsListRequest struct { + return NftId{} } -func (m *QueryCDPsListRequest) Reset() { *m = QueryCDPsListRequest{} } -func (m *QueryCDPsListRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCDPsListRequest) ProtoMessage() {} -func (*QueryCDPsListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{15} -} -func (m *QueryCDPsListRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCDPsListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCDPsListRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (m *QueryLoanResponse) GetBorrowingAmount() types.Coin { + if m != nil { + return m.BorrowingAmount } + return types.Coin{} } -func (m *QueryCDPsListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCDPsListRequest.Merge(m, src) -} -func (m *QueryCDPsListRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryCDPsListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCDPsListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCDPsListRequest proto.InternalMessageInfo -type QueryCDPsListResponse struct { +func (m *QueryLoanResponse) GetBorrowingLimit() types.Coin { + if m != nil { + return m.BorrowingLimit + } + return types.Coin{} } -func (m *QueryCDPsListResponse) Reset() { *m = QueryCDPsListResponse{} } -func (m *QueryCDPsListResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCDPsListResponse) ProtoMessage() {} -func (*QueryCDPsListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{16} -} -func (m *QueryCDPsListResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCDPsListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCDPsListResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (m *QueryLoanResponse) GetTotalDeposit() types.Coin { + if m != nil { + return m.TotalDeposit } + return types.Coin{} } -func (m *QueryCDPsListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCDPsListResponse.Merge(m, src) -} -func (m *QueryCDPsListResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryCDPsListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCDPsListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCDPsListResponse proto.InternalMessageInfo type QueryNftBidsRequest struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -848,7 +718,7 @@ func (m *QueryNftBidsRequest) Reset() { *m = QueryNftBidsRequest{} } func (m *QueryNftBidsRequest) String() string { return proto.CompactTextString(m) } func (*QueryNftBidsRequest) ProtoMessage() {} func (*QueryNftBidsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{17} + return fileDescriptor_7db9d9524c1d8ab8, []int{13} } func (m *QueryNftBidsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -892,14 +762,14 @@ func (m *QueryNftBidsRequest) GetNftId() string { } type QueryNftBidsResponse struct { - Bids []NftBid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` + Bids []Bid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` } func (m *QueryNftBidsResponse) Reset() { *m = QueryNftBidsResponse{} } func (m *QueryNftBidsResponse) String() string { return proto.CompactTextString(m) } func (*QueryNftBidsResponse) ProtoMessage() {} func (*QueryNftBidsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{18} + return fileDescriptor_7db9d9524c1d8ab8, []int{14} } func (m *QueryNftBidsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -928,117 +798,13 @@ func (m *QueryNftBidsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryNftBidsResponse proto.InternalMessageInfo -func (m *QueryNftBidsResponse) GetBids() []NftBid { +func (m *QueryNftBidsResponse) GetBids() []Bid { if m != nil { return m.Bids } return nil } -type QueryPaymentStatusRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Bidder string `protobuf:"bytes,3,opt,name=bidder,proto3" json:"bidder,omitempty" yaml:"bidder"` -} - -func (m *QueryPaymentStatusRequest) Reset() { *m = QueryPaymentStatusRequest{} } -func (m *QueryPaymentStatusRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPaymentStatusRequest) ProtoMessage() {} -func (*QueryPaymentStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{19} -} -func (m *QueryPaymentStatusRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPaymentStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPaymentStatusRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryPaymentStatusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPaymentStatusRequest.Merge(m, src) -} -func (m *QueryPaymentStatusRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryPaymentStatusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPaymentStatusRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPaymentStatusRequest proto.InternalMessageInfo - -func (m *QueryPaymentStatusRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryPaymentStatusRequest) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *QueryPaymentStatusRequest) GetBidder() string { - if m != nil { - return m.Bidder - } - return "" -} - -type QueryPaymentStatusResponse struct { - PaymentStatus PaymentStatus `protobuf:"bytes,1,opt,name=paymentStatus,proto3" json:"paymentStatus"` -} - -func (m *QueryPaymentStatusResponse) Reset() { *m = QueryPaymentStatusResponse{} } -func (m *QueryPaymentStatusResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPaymentStatusResponse) ProtoMessage() {} -func (*QueryPaymentStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{20} -} -func (m *QueryPaymentStatusResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPaymentStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPaymentStatusResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryPaymentStatusResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPaymentStatusResponse.Merge(m, src) -} -func (m *QueryPaymentStatusResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryPaymentStatusResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPaymentStatusResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPaymentStatusResponse proto.InternalMessageInfo - -func (m *QueryPaymentStatusResponse) GetPaymentStatus() PaymentStatus { - if m != nil { - return m.PaymentStatus - } - return PaymentStatus{} -} - type QueryBidderBidsRequest struct { Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty" yaml:"bidder"` } @@ -1047,7 +813,7 @@ func (m *QueryBidderBidsRequest) Reset() { *m = QueryBidderBidsRequest{} func (m *QueryBidderBidsRequest) String() string { return proto.CompactTextString(m) } func (*QueryBidderBidsRequest) ProtoMessage() {} func (*QueryBidderBidsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{21} + return fileDescriptor_7db9d9524c1d8ab8, []int{15} } func (m *QueryBidderBidsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1084,14 +850,14 @@ func (m *QueryBidderBidsRequest) GetBidder() string { } type QueryBidderBidsResponse struct { - Bids []NftBid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` + Bids []Bid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` } func (m *QueryBidderBidsResponse) Reset() { *m = QueryBidderBidsResponse{} } func (m *QueryBidderBidsResponse) String() string { return proto.CompactTextString(m) } func (*QueryBidderBidsResponse) ProtoMessage() {} func (*QueryBidderBidsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{22} + return fileDescriptor_7db9d9524c1d8ab8, []int{16} } func (m *QueryBidderBidsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1120,7 +886,7 @@ func (m *QueryBidderBidsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBidderBidsResponse proto.InternalMessageInfo -func (m *QueryBidderBidsResponse) GetBids() []NftBid { +func (m *QueryBidderBidsResponse) GetBids() []Bid { if m != nil { return m.Bids } @@ -1135,7 +901,7 @@ func (m *QueryRewardsRequest) Reset() { *m = QueryRewardsRequest{} } func (m *QueryRewardsRequest) String() string { return proto.CompactTextString(m) } func (*QueryRewardsRequest) ProtoMessage() {} func (*QueryRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{23} + return fileDescriptor_7db9d9524c1d8ab8, []int{17} } func (m *QueryRewardsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1179,7 +945,7 @@ func (m *QueryRewardsResponse) Reset() { *m = QueryRewardsResponse{} } func (m *QueryRewardsResponse) String() string { return proto.CompactTextString(m) } func (*QueryRewardsResponse) ProtoMessage() {} func (*QueryRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{24} + return fileDescriptor_7db9d9524c1d8ab8, []int{18} } func (m *QueryRewardsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1224,7 +990,7 @@ func (m *QueryLiquidationRequest) Reset() { *m = QueryLiquidationRequest func (m *QueryLiquidationRequest) String() string { return proto.CompactTextString(m) } func (*QueryLiquidationRequest) ProtoMessage() {} func (*QueryLiquidationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{25} + return fileDescriptor_7db9d9524c1d8ab8, []int{19} } func (m *QueryLiquidationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1275,7 +1041,7 @@ func (m *QueryLiquidationResponse) Reset() { *m = QueryLiquidationRespon func (m *QueryLiquidationResponse) String() string { return proto.CompactTextString(m) } func (*QueryLiquidationResponse) ProtoMessage() {} func (*QueryLiquidationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7db9d9524c1d8ab8, []int{26} + return fileDescriptor_7db9d9524c1d8ab8, []int{20} } func (m *QueryLiquidationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1323,16 +1089,10 @@ func init() { proto.RegisterType((*QueryListedNftsResponse)(nil), "ununifi.nftbackedloan.QueryListedNftsResponse") proto.RegisterType((*QueryListedClassesResponse)(nil), "ununifi.nftbackedloan.QueryListedClassesResponse") proto.RegisterType((*QueryListedClassResponse)(nil), "ununifi.nftbackedloan.QueryListedClassResponse") - proto.RegisterType((*QueryLoansRequest)(nil), "ununifi.nftbackedloan.QueryLoansRequest") - proto.RegisterType((*QueryLoansResponse)(nil), "ununifi.nftbackedloan.QueryLoansResponse") proto.RegisterType((*QueryLoanRequest)(nil), "ununifi.nftbackedloan.QueryLoanRequest") proto.RegisterType((*QueryLoanResponse)(nil), "ununifi.nftbackedloan.QueryLoanResponse") - proto.RegisterType((*QueryCDPsListRequest)(nil), "ununifi.nftbackedloan.QueryCDPsListRequest") - proto.RegisterType((*QueryCDPsListResponse)(nil), "ununifi.nftbackedloan.QueryCDPsListResponse") proto.RegisterType((*QueryNftBidsRequest)(nil), "ununifi.nftbackedloan.QueryNftBidsRequest") proto.RegisterType((*QueryNftBidsResponse)(nil), "ununifi.nftbackedloan.QueryNftBidsResponse") - proto.RegisterType((*QueryPaymentStatusRequest)(nil), "ununifi.nftbackedloan.QueryPaymentStatusRequest") - proto.RegisterType((*QueryPaymentStatusResponse)(nil), "ununifi.nftbackedloan.QueryPaymentStatusResponse") proto.RegisterType((*QueryBidderBidsRequest)(nil), "ununifi.nftbackedloan.QueryBidderBidsRequest") proto.RegisterType((*QueryBidderBidsResponse)(nil), "ununifi.nftbackedloan.QueryBidderBidsResponse") proto.RegisterType((*QueryRewardsRequest)(nil), "ununifi.nftbackedloan.QueryRewardsRequest") @@ -1344,99 +1104,88 @@ func init() { func init() { proto.RegisterFile("ununifi/nftbackedloan/query.proto", fileDescriptor_7db9d9524c1d8ab8) } var fileDescriptor_7db9d9524c1d8ab8 = []byte{ - // 1471 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xa6, 0x8e, 0x9d, 0xbe, 0x34, 0x10, 0xa6, 0x6d, 0xea, 0xb8, 0xad, 0x9d, 0x0e, 0x2d, - 0x75, 0x53, 0xe2, 0x6d, 0x53, 0x15, 0x4a, 0x8b, 0x40, 0x75, 0x22, 0x68, 0x0a, 0x2d, 0xe9, 0x56, - 0x3d, 0x80, 0x2a, 0x45, 0x6b, 0xef, 0xda, 0x19, 0xd5, 0x9e, 0x75, 0x76, 0xc7, 0x2d, 0x51, 0x15, - 0x09, 0xf5, 0xc0, 0x15, 0xa4, 0x22, 0x38, 0x82, 0xc4, 0xb1, 0x12, 0x42, 0x88, 0x2b, 0x12, 0xc7, - 0x1e, 0x2b, 0xb8, 0x20, 0x0e, 0x11, 0x6a, 0xf9, 0x04, 0xfd, 0x04, 0x68, 0x67, 0xde, 0xae, 0xd7, - 0x7f, 0x76, 0xed, 0x06, 0x38, 0x79, 0xe7, 0xcd, 0xfb, 0xf3, 0x9b, 0xf7, 0x66, 0xde, 0xfb, 0xc9, - 0x70, 0xac, 0xcd, 0xdb, 0x9c, 0xd5, 0x98, 0xce, 0x6b, 0xa2, 0x62, 0x56, 0xef, 0xd8, 0x56, 0xc3, - 0x31, 0xb9, 0xbe, 0xd9, 0xb6, 0xdd, 0xad, 0x52, 0xcb, 0x75, 0x84, 0x43, 0x0e, 0xa2, 0x4a, 0xa9, - 0x4b, 0x25, 0x77, 0xa0, 0xee, 0xd4, 0x1d, 0xa9, 0xa1, 0xfb, 0x5f, 0x4a, 0x39, 0x77, 0xa4, 0xee, - 0x38, 0xf5, 0x86, 0xad, 0x9b, 0x2d, 0xa6, 0x9b, 0x9c, 0x3b, 0xc2, 0x14, 0xcc, 0xe1, 0x1e, 0xee, - 0x16, 0x70, 0x57, 0xae, 0x2a, 0xed, 0x9a, 0x2e, 0x58, 0xd3, 0xf6, 0x84, 0xd9, 0x6c, 0xa1, 0xc2, - 0x42, 0xd5, 0xf1, 0x9a, 0x8e, 0xa7, 0x57, 0x4c, 0xcf, 0x56, 0x20, 0xf4, 0xbb, 0x67, 0x2b, 0xb6, - 0x30, 0xcf, 0xea, 0x2d, 0xb3, 0xce, 0xb8, 0xf4, 0x86, 0xba, 0xf9, 0xa8, 0x6e, 0xa0, 0x55, 0x75, - 0x58, 0xb0, 0x3f, 0xa7, 0xf6, 0xd7, 0x15, 0x46, 0xb5, 0xc0, 0xad, 0x53, 0x83, 0x4f, 0xdd, 0xb5, - 0x52, 0xaa, 0xf4, 0x00, 0x90, 0x1b, 0x3e, 0x8e, 0x35, 0xd3, 0x35, 0x9b, 0x9e, 0x61, 0x6f, 0xb6, - 0x6d, 0x4f, 0x50, 0x03, 0xf6, 0x77, 0x49, 0xbd, 0x96, 0xc3, 0x3d, 0x9b, 0x5c, 0x82, 0x74, 0x4b, - 0x4a, 0xb2, 0xda, 0xbc, 0x56, 0x9c, 0x5a, 0x3a, 0x5a, 0x1a, 0x98, 0xbb, 0x92, 0x32, 0x2b, 0xa7, - 0x1e, 0xef, 0x14, 0xc6, 0x0c, 0x34, 0xa1, 0x57, 0x61, 0x56, 0xfa, 0xbc, 0x5e, 0x13, 0x1f, 0x32, - 0x4f, 0x30, 0x5e, 0xc7, 0x68, 0x64, 0x0e, 0x26, 0xab, 0x0d, 0xd3, 0xf3, 0xd6, 0x99, 0x25, 0x1d, - 0xef, 0x35, 0x32, 0x72, 0xbd, 0x6a, 0x91, 0x83, 0x90, 0xe6, 0x35, 0xe1, 0x6f, 0x8c, 0xcb, 0x8d, - 0x09, 0x5e, 0x13, 0xab, 0x16, 0xbd, 0x0d, 0x87, 0xfa, 0x7c, 0x21, 0xc6, 0xcb, 0x90, 0x69, 0x28, - 0x11, 0x82, 0x3c, 0x16, 0x03, 0xb2, 0x63, 0x8b, 0x40, 0x03, 0x3b, 0xea, 0x21, 0x52, 0x7f, 0xdb, - 0xb6, 0xae, 0xd7, 0x44, 0x90, 0x17, 0xf2, 0x31, 0x4c, 0x38, 0xf7, 0xb8, 0xed, 0x2a, 0x98, 0xe5, - 0xe5, 0xe7, 0x3b, 0x85, 0x7d, 0x5b, 0x66, 0xb3, 0x71, 0x91, 0x4a, 0x31, 0xfd, 0xed, 0xe7, 0x45, - 0xbd, 0xce, 0xc4, 0x46, 0xbb, 0x52, 0xaa, 0x3a, 0x4d, 0xfd, 0x16, 0xbf, 0xc5, 0xd9, 0x7b, 0x4c, - 0xaf, 0x6e, 0x98, 0x8c, 0xeb, 0x62, 0xab, 0x65, 0x7b, 0xa5, 0x9b, 0xc2, 0x65, 0xbc, 0x7e, 0xb9, - 0x5a, 0xbd, 0x6c, 0x59, 0xae, 0xed, 0x79, 0x86, 0xf2, 0x48, 0x2f, 0xc0, 0x5c, 0x24, 0xe8, 0xb2, - 0x7f, 0x7e, 0x3b, 0x8c, 0x7b, 0x18, 0xf6, 0xfa, 0x69, 0x68, 0xb0, 0x26, 0x13, 0x32, 0xf6, 0x84, - 0x31, 0xc9, 0x7d, 0xfc, 0x4d, 0x26, 0xe8, 0x0d, 0x4c, 0x46, 0xc4, 0x72, 0x84, 0xcc, 0x76, 0xb9, - 0x1c, 0xef, 0x71, 0xf9, 0xb5, 0x06, 0x33, 0x9d, 0xfc, 0xac, 0xd8, 0xc2, 0x64, 0x8d, 0xff, 0x20, - 0xb3, 0xe4, 0x5d, 0x98, 0x94, 0xe5, 0xe4, 0x35, 0x47, 0xc6, 0x9c, 0x5a, 0xca, 0xc7, 0xfb, 0x58, - 0xe5, 0x35, 0x27, 0x70, 0xc0, 0xd5, 0x92, 0x5a, 0x5d, 0x67, 0x55, 0xa5, 0xc1, 0xc2, 0xaf, 0xc2, - 0x24, 0x86, 0xf1, 0xaf, 0xe7, 0x9e, 0xe2, 0xd4, 0xd2, 0xc9, 0xa1, 0xf8, 0xd4, 0xc9, 0x30, 0x48, - 0x68, 0x4e, 0xeb, 0x90, 0x1b, 0x54, 0x8b, 0x30, 0x90, 0x4a, 0xa2, 0x1d, 0xc4, 0xd1, 0x63, 0xe2, - 0xf4, 0x57, 0x45, 0x79, 0x30, 0x02, 0x7b, 0xfa, 0xd9, 0x38, 0x64, 0xe3, 0xb4, 0x92, 0x8a, 0x47, - 0x20, 0xc5, 0xcd, 0xa6, 0x8d, 0x8f, 0x42, 0x7e, 0x93, 0x79, 0x98, 0xb2, 0x6c, 0xaf, 0xea, 0xb2, - 0x96, 0xdf, 0x44, 0xb2, 0x7b, 0xe4, 0x56, 0x54, 0x44, 0x66, 0x21, 0xed, 0x6d, 0x35, 0x2b, 0x4e, - 0x23, 0x9b, 0x92, 0x9b, 0xb8, 0x22, 0x33, 0xb0, 0xa7, 0xed, 0xb2, 0xec, 0x84, 0x14, 0xfa, 0x9f, - 0x24, 0x0b, 0x99, 0xb6, 0xcb, 0x36, 0x4c, 0x6f, 0x23, 0x9b, 0x56, 0x91, 0x71, 0x49, 0x96, 0x20, - 0xc5, 0x6b, 0xc2, 0xcb, 0x66, 0xe4, 0xc9, 0x87, 0x54, 0xcf, 0x90, 0xba, 0xc1, 0x55, 0xab, 0x3a, - 0x6d, 0x2e, 0xb2, 0x93, 0xf3, 0x5a, 0x31, 0x25, 0xaf, 0xda, 0xb2, 0xbf, 0xa6, 0xfb, 0xe1, 0x15, - 0x95, 0x01, 0xc7, 0xe4, 0x61, 0xff, 0xb9, 0x86, 0x5d, 0x09, 0x85, 0x98, 0x90, 0x37, 0x61, 0xc2, - 0xf7, 0x1e, 0xa4, 0xfd, 0x70, 0x4c, 0x70, 0xdf, 0x08, 0x4b, 0xaa, 0xf4, 0xe9, 0x0a, 0xcc, 0x84, - 0xee, 0x76, 0xdf, 0x74, 0x7e, 0xd1, 0x22, 0x50, 0x43, 0x50, 0xe7, 0x21, 0xe5, 0x07, 0xc1, 0x27, - 0x31, 0x02, 0x26, 0xa9, 0x4e, 0x36, 0xe1, 0xe5, 0x8a, 0xe3, 0xba, 0xce, 0x3d, 0xc6, 0xeb, 0x91, - 0x47, 0xb8, 0xb7, 0x7c, 0xc5, 0x57, 0xfa, 0x73, 0xa7, 0xf0, 0x5a, 0xa4, 0x8f, 0xe0, 0x24, 0x50, - 0x3f, 0x8b, 0x9e, 0x75, 0x07, 0x7b, 0xc9, 0x2a, 0x17, 0xcf, 0x77, 0x0a, 0xb3, 0xaa, 0x03, 0xf5, - 0xb8, 0xa3, 0xc6, 0x4b, 0xa1, 0x44, 0x3d, 0xea, 0x59, 0x38, 0x20, 0xe1, 0x2f, 0xaf, 0xac, 0x79, - 0xfe, 0x7d, 0x0b, 0x92, 0x7d, 0x08, 0x0e, 0xf6, 0xc8, 0xd5, 0xd1, 0xe8, 0xfb, 0x38, 0x05, 0xae, - 0xd7, 0x44, 0x99, 0x59, 0xde, 0xee, 0x33, 0xf7, 0x11, 0x46, 0x0e, 0x1d, 0x85, 0x05, 0x4d, 0x55, - 0x98, 0x15, 0xd4, 0xf3, 0x68, 0xfc, 0x65, 0x2a, 0x33, 0x2b, 0xc8, 0x9e, 0x6f, 0x40, 0x1f, 0x69, - 0xd8, 0x2d, 0xd7, 0xcc, 0xad, 0xa6, 0xcd, 0xc5, 0x4d, 0x61, 0x8a, 0xf6, 0xee, 0x01, 0x92, 0xdb, - 0x90, 0xae, 0x30, 0xcb, 0xb2, 0x5d, 0xf5, 0x6c, 0xca, 0x2b, 0xcf, 0x77, 0x0a, 0xd3, 0x98, 0x56, - 0x29, 0xdf, 0x55, 0x67, 0x47, 0x9f, 0x94, 0x63, 0x3b, 0xe9, 0x01, 0x8b, 0x49, 0x58, 0x83, 0xe9, - 0x56, 0x74, 0x03, 0x6f, 0xd2, 0xf1, 0xd8, 0xd9, 0x1a, 0xd1, 0xc5, 0xa4, 0x74, 0x3b, 0xa0, 0x77, - 0x71, 0x7e, 0x95, 0x65, 0xf8, 0x68, 0xe9, 0x3a, 0xe7, 0xd4, 0xfe, 0x87, 0x73, 0x1a, 0xd8, 0x9c, - 0xa3, 0x71, 0xff, 0x6d, 0xa5, 0x75, 0xbc, 0x83, 0x86, 0x7d, 0xcf, 0x74, 0x3b, 0x07, 0xc9, 0x42, - 0xc6, 0x54, 0xd1, 0xe5, 0x49, 0x52, 0x46, 0xb0, 0xa4, 0x37, 0xf0, 0xae, 0x85, 0x06, 0x88, 0xe0, - 0x2d, 0xc8, 0xb8, 0x4a, 0x84, 0x20, 0xe6, 0x4a, 0xc8, 0x99, 0x7c, 0x82, 0x55, 0x42, 0x82, 0x55, - 0x5a, 0x76, 0x58, 0xf0, 0x50, 0x03, 0x7d, 0xfa, 0x41, 0x38, 0x74, 0x36, 0xdb, 0xcc, 0x92, 0x1c, - 0x6d, 0xf7, 0x6f, 0x81, 0x85, 0x1d, 0x3f, 0xe2, 0x0c, 0x31, 0x5e, 0x83, 0x7d, 0x8d, 0x8e, 0x38, - 0xb8, 0x09, 0xaf, 0xc6, 0xf5, 0x94, 0x88, 0xaa, 0x84, 0xac, 0x19, 0x5d, 0xe6, 0x4b, 0x3f, 0xce, - 0xc0, 0x84, 0x8c, 0x45, 0x3e, 0xd7, 0x20, 0xad, 0x48, 0x19, 0x39, 0x95, 0x34, 0xac, 0xba, 0x58, - 0x60, 0x6e, 0x61, 0x14, 0x55, 0xec, 0x15, 0x27, 0x1e, 0xfc, 0xfe, 0xf7, 0xc3, 0xf1, 0x02, 0x39, - 0xaa, 0x0f, 0xe6, 0x9e, 0x8a, 0x04, 0x92, 0x47, 0x1a, 0x40, 0x67, 0xfc, 0x92, 0xc5, 0xa4, 0x08, - 0x7d, 0x44, 0x31, 0x57, 0x1a, 0x55, 0x1d, 0x41, 0xbd, 0x23, 0x41, 0x5d, 0x20, 0x6f, 0xe8, 0xb1, - 0x84, 0x78, 0x1d, 0x87, 0xbe, 0x7e, 0x3f, 0xa8, 0xe3, 0xb6, 0x7e, 0x5f, 0xd5, 0x6d, 0x9b, 0x7c, - 0xa3, 0x01, 0x74, 0x98, 0x46, 0x32, 0xda, 0x3e, 0xb2, 0x98, 0x8c, 0xb6, 0x9f, 0xc0, 0xd0, 0x05, - 0x89, 0xf6, 0x38, 0xa1, 0x31, 0x68, 0x1b, 0xd2, 0x64, 0x5d, 0x8e, 0xd4, 0xef, 0x35, 0x98, 0xee, - 0x62, 0x27, 0xe4, 0xcc, 0x88, 0x24, 0x24, 0x24, 0x95, 0xb9, 0xb3, 0x2f, 0x60, 0x81, 0x10, 0x17, - 0x25, 0xc4, 0x93, 0xe4, 0x44, 0x32, 0x44, 0xa4, 0x37, 0xe4, 0x27, 0x0d, 0xa6, 0x22, 0x8e, 0x48, - 0x69, 0x64, 0xa2, 0xa4, 0x10, 0xbe, 0x28, 0xb1, 0xa2, 0x65, 0x89, 0xef, 0x6d, 0x72, 0x71, 0x04, - 0x7c, 0x7d, 0x15, 0x97, 0x63, 0x73, 0x9b, 0x3c, 0xd0, 0x60, 0x42, 0xf2, 0x0e, 0x52, 0x4c, 0x0c, - 0x1f, 0xe1, 0x2b, 0xb9, 0x53, 0x23, 0x68, 0x22, 0xc4, 0xe3, 0x12, 0x62, 0x9e, 0x1c, 0x89, 0x83, - 0x28, 0x43, 0x3f, 0xd4, 0x20, 0xe5, 0xdb, 0x91, 0x93, 0xc3, 0x3c, 0x07, 0x10, 0x8a, 0xc3, 0x15, - 0x11, 0xc1, 0x05, 0x89, 0x60, 0x89, 0x9c, 0x49, 0x42, 0x30, 0xf0, 0x3d, 0x7c, 0xa1, 0xc1, 0x64, - 0xc0, 0x12, 0xc8, 0xe9, 0xa4, 0x80, 0x3d, 0x1c, 0x23, 0xf7, 0xfa, 0x68, 0xca, 0x88, 0xb0, 0x28, - 0x11, 0x52, 0x32, 0x1f, 0x83, 0xb0, 0x6a, 0xb5, 0x3c, 0xf9, 0x70, 0xc9, 0xb7, 0x1a, 0x64, 0x90, - 0x55, 0x90, 0x85, 0x21, 0xdd, 0x21, 0x32, 0x08, 0x73, 0xa7, 0x47, 0xd2, 0x45, 0x38, 0x97, 0x24, - 0x9c, 0xf3, 0xe4, 0x5c, 0x42, 0x1b, 0xf1, 0x87, 0xd5, 0xc0, 0x9c, 0x7d, 0xa7, 0x01, 0x74, 0x06, - 0x62, 0x72, 0x0f, 0xe9, 0x1b, 0xd8, 0xc9, 0x3d, 0xa4, 0x7f, 0xce, 0xd2, 0x73, 0x12, 0xea, 0x22, - 0x39, 0x1d, 0x03, 0x55, 0x4d, 0x6a, 0x44, 0xab, 0x16, 0xdb, 0xe4, 0x57, 0x0d, 0xa6, 0xbb, 0x68, - 0x45, 0x72, 0x33, 0x19, 0xc4, 0xb9, 0x92, 0x9b, 0xc9, 0x40, 0xe2, 0x43, 0xaf, 0x4a, 0xac, 0x2b, - 0xa4, 0x1c, 0x3b, 0x32, 0xa4, 0xd5, 0xba, 0x27, 0xcd, 0x06, 0x25, 0xb7, 0x73, 0x84, 0xaf, 0x34, - 0xc8, 0xe0, 0xc4, 0x4f, 0xbe, 0x07, 0xdd, 0x3c, 0x22, 0xf9, 0x1e, 0xf4, 0x50, 0x08, 0x7a, 0x46, - 0x02, 0x5e, 0x20, 0xc5, 0x18, 0xc0, 0xc8, 0x17, 0xf4, 0xfb, 0xc8, 0x45, 0xb6, 0xc9, 0x0f, 0xb2, - 0x01, 0x86, 0x23, 0x79, 0x58, 0x03, 0xec, 0xa5, 0x17, 0xc3, 0x1a, 0x60, 0x1f, 0x83, 0x18, 0x3a, - 0xf1, 0x22, 0xfc, 0x60, 0x50, 0x42, 0xcb, 0x57, 0x1e, 0x3f, 0xcd, 0x6b, 0x4f, 0x9e, 0xe6, 0xb5, - 0xbf, 0x9e, 0xe6, 0xb5, 0x2f, 0x9f, 0xe5, 0xc7, 0x9e, 0x3c, 0xcb, 0x8f, 0xfd, 0xf1, 0x2c, 0x3f, - 0xf6, 0x49, 0x29, 0x96, 0x15, 0x7e, 0xda, 0x13, 0x43, 0xb2, 0xc4, 0x4a, 0x5a, 0xfe, 0xbf, 0x74, - 0xee, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x7e, 0x32, 0x3e, 0x82, 0x13, 0x00, 0x00, + // 1294 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x26, 0x8e, 0x9d, 0x4e, 0xd2, 0xef, 0x37, 0x0c, 0x69, 0x71, 0x4c, 0xeb, 0x84, 0x81, + 0x2a, 0x69, 0x2a, 0xef, 0xe6, 0x07, 0xa0, 0xd0, 0xa2, 0xa2, 0x38, 0x11, 0x34, 0xa5, 0x04, 0x62, + 0xd4, 0x43, 0x11, 0x52, 0x34, 0xf6, 0xee, 0x3a, 0x23, 0xec, 0x19, 0x67, 0x77, 0xdc, 0x10, 0x45, + 0x91, 0x10, 0x07, 0xce, 0x48, 0x41, 0xe2, 0x08, 0x12, 0x37, 0x90, 0x38, 0x20, 0xfe, 0x88, 0x1e, + 0x2b, 0x90, 0x10, 0xa7, 0x08, 0x25, 0xfc, 0x05, 0xfd, 0x0b, 0xd0, 0xce, 0xbc, 0x5d, 0xdb, 0xb1, + 0x77, 0xed, 0xa6, 0xb7, 0x9d, 0x99, 0xf7, 0xe3, 0x33, 0xef, 0xcd, 0x7b, 0x9f, 0xb7, 0xe8, 0xb5, + 0x26, 0x6f, 0x72, 0xe6, 0x32, 0x8b, 0xbb, 0xb2, 0x4c, 0x2b, 0x5f, 0x38, 0x76, 0x4d, 0x50, 0x6e, + 0xed, 0x35, 0x1d, 0xef, 0xc0, 0x6c, 0x78, 0x42, 0x0a, 0x7c, 0x05, 0x44, 0xcc, 0x0e, 0x91, 0xdc, + 0x54, 0x55, 0x54, 0x85, 0x92, 0xb0, 0x82, 0x2f, 0x2d, 0x9c, 0xbb, 0x56, 0x15, 0xa2, 0x5a, 0x73, + 0x2c, 0xda, 0x60, 0x16, 0xe5, 0x5c, 0x48, 0x2a, 0x99, 0xe0, 0x3e, 0x9c, 0xce, 0xc0, 0xa9, 0x5a, + 0x95, 0x9b, 0xae, 0x25, 0x59, 0xdd, 0xf1, 0x25, 0xad, 0x37, 0x40, 0x60, 0xa1, 0x22, 0xfc, 0xba, + 0xf0, 0xad, 0x32, 0xf5, 0x1d, 0x0d, 0xc2, 0x7a, 0xbc, 0x54, 0x76, 0x24, 0x5d, 0xb2, 0x1a, 0xb4, + 0xca, 0xb8, 0xb2, 0x06, 0xb2, 0xf9, 0x76, 0xd9, 0x50, 0xaa, 0x22, 0x58, 0x78, 0x3e, 0xad, 0xcf, + 0x77, 0x34, 0x46, 0xbd, 0x80, 0x23, 0xd2, 0xfb, 0xd6, 0x0d, 0xea, 0xd1, 0x7a, 0x28, 0x73, 0xb3, + 0xb7, 0x4c, 0xc7, 0x4a, 0x8b, 0x92, 0x29, 0x84, 0xb7, 0x03, 0xac, 0x9f, 0x28, 0xfd, 0x92, 0xb3, + 0xd7, 0x74, 0x7c, 0x49, 0x4a, 0xe8, 0xe5, 0x8e, 0x5d, 0xbf, 0x21, 0xb8, 0xef, 0xe0, 0x3b, 0x28, + 0xad, 0xfd, 0x64, 0x8d, 0x59, 0x63, 0x7e, 0x7c, 0xf9, 0xba, 0xd9, 0x33, 0xbe, 0xa6, 0x56, 0x2b, + 0xa6, 0x9e, 0x9c, 0xcc, 0x0c, 0x95, 0x40, 0x85, 0xdc, 0x47, 0x57, 0x95, 0xcd, 0x2d, 0x57, 0x3e, + 0x60, 0xbe, 0x64, 0xbc, 0x0a, 0xde, 0xf0, 0x34, 0x1a, 0xab, 0xd4, 0xa8, 0xef, 0xef, 0x30, 0x5b, + 0x19, 0xbe, 0x54, 0xca, 0xa8, 0xf5, 0xa6, 0x8d, 0xaf, 0xa0, 0x34, 0x77, 0x65, 0x70, 0x30, 0xac, + 0x0e, 0x46, 0xb9, 0x2b, 0x37, 0x6d, 0xf2, 0x08, 0xbd, 0xd2, 0x65, 0x0b, 0x30, 0xde, 0x45, 0x99, + 0x9a, 0xde, 0x02, 0x90, 0xf9, 0x18, 0x90, 0xa0, 0x08, 0x28, 0x43, 0x25, 0xe2, 0x03, 0xcc, 0xe0, + 0xd8, 0xb1, 0xb7, 0x5c, 0x19, 0x06, 0x05, 0x3f, 0x42, 0xa3, 0x62, 0x9f, 0x3b, 0x9e, 0xc6, 0x58, + 0x5c, 0x7f, 0x76, 0x32, 0x33, 0x71, 0x40, 0xeb, 0xb5, 0xdb, 0x44, 0x6d, 0x93, 0x3f, 0x7e, 0x2f, + 0x58, 0x55, 0x26, 0x77, 0x9b, 0x65, 0xb3, 0x22, 0xea, 0xd6, 0x43, 0xfe, 0x90, 0xb3, 0xf7, 0x99, + 0x55, 0xd9, 0xa5, 0x8c, 0x5b, 0xf2, 0xa0, 0xe1, 0xf8, 0xe6, 0xa7, 0xd2, 0x63, 0xbc, 0xba, 0x56, + 0xa9, 0xac, 0xd9, 0xb6, 0xe7, 0xf8, 0x7e, 0x49, 0x5b, 0x24, 0xab, 0x68, 0xba, 0xcd, 0xe9, 0x7a, + 0x70, 0x79, 0x27, 0xf2, 0xfb, 0x2a, 0xba, 0x14, 0xc4, 0xa0, 0xc6, 0xea, 0x4c, 0x2a, 0xdf, 0xa3, + 0xa5, 0x31, 0x1e, 0x5c, 0xbc, 0xce, 0x24, 0xd9, 0x86, 0x48, 0xb4, 0x69, 0x0e, 0x10, 0xd6, 0x0e, + 0x93, 0xc3, 0xe7, 0x4c, 0x1e, 0x1b, 0x68, 0xb2, 0x15, 0xd8, 0x0d, 0x47, 0x52, 0x56, 0x7b, 0xd1, + 0xb0, 0xe2, 0xf7, 0xd0, 0x98, 0x4a, 0x24, 0x77, 0x85, 0x72, 0x18, 0x6f, 0x60, 0xcb, 0x95, 0x9b, + 0xdc, 0x15, 0xa1, 0x01, 0xae, 0x97, 0xc4, 0xee, 0xb8, 0xa8, 0xce, 0x0b, 0xa4, 0x7c, 0x13, 0x8d, + 0x81, 0x9b, 0xe0, 0x61, 0x8e, 0xcc, 0x8f, 0x2f, 0xcf, 0xc5, 0xdb, 0xee, 0xb8, 0x16, 0x38, 0x89, + 0xd4, 0x49, 0x15, 0xe5, 0x7a, 0x25, 0x22, 0x72, 0xa4, 0x23, 0xe8, 0x84, 0x7e, 0xac, 0x18, 0x3f, + 0xdd, 0x29, 0xd1, 0x16, 0x4a, 0xa1, 0x3e, 0xf9, 0x6a, 0x18, 0x65, 0xe3, 0xa4, 0x92, 0x32, 0x87, + 0x51, 0x8a, 0xd3, 0xba, 0x03, 0xe5, 0xa0, 0xbe, 0xf1, 0x2c, 0x1a, 0xb7, 0x1d, 0xbf, 0xe2, 0xb1, + 0x46, 0xd0, 0x62, 0xb2, 0x23, 0xea, 0xa8, 0x7d, 0x0b, 0x5f, 0x45, 0x69, 0xff, 0xa0, 0x5e, 0x16, + 0xb5, 0x6c, 0x4a, 0x1d, 0xc2, 0x0a, 0x4f, 0xa2, 0x91, 0xa6, 0xc7, 0xb2, 0xa3, 0x6a, 0x33, 0xf8, + 0xc4, 0x59, 0x94, 0x69, 0x7a, 0x6c, 0x97, 0xfa, 0xbb, 0xd9, 0xb4, 0xf6, 0x0c, 0x4b, 0xbc, 0x8c, + 0x52, 0xdc, 0x95, 0x7e, 0x36, 0xa3, 0x6e, 0xde, 0x27, 0x7b, 0x25, 0x25, 0x1b, 0xbe, 0xb3, 0x8a, + 0x68, 0x72, 0x99, 0x1d, 0x9b, 0x35, 0xe6, 0x53, 0xea, 0x9d, 0xad, 0x07, 0x6b, 0xb2, 0x81, 0x26, + 0x75, 0x04, 0x04, 0xe5, 0x17, 0x6f, 0x05, 0x3f, 0x0f, 0xa3, 0x97, 0xda, 0xcc, 0x40, 0x04, 0xdf, + 0x89, 0x84, 0xf5, 0x6b, 0xbd, 0x96, 0x00, 0xd7, 0x86, 0x57, 0xa0, 0x0d, 0xe2, 0xfb, 0x68, 0xb2, + 0x2c, 0x3c, 0x4f, 0xec, 0x33, 0x5e, 0xdd, 0xa1, 0x75, 0x05, 0x5d, 0xbf, 0xd8, 0x69, 0x13, 0x3a, + 0x71, 0xd0, 0xb6, 0x4d, 0x68, 0xdb, 0xe6, 0xba, 0x60, 0x1c, 0x2c, 0xfc, 0x3f, 0x52, 0x5c, 0x53, + 0x7a, 0xf8, 0x1e, 0x6a, 0x6d, 0x41, 0xb5, 0x8d, 0x0c, 0x66, 0xea, 0x7f, 0x91, 0x9e, 0x2a, 0x4a, + 0xbc, 0x81, 0x2e, 0x4b, 0x21, 0x69, 0x6d, 0xc7, 0x76, 0x1a, 0xc2, 0x67, 0x52, 0x25, 0x72, 0x00, + 0x3b, 0x13, 0x4a, 0x6b, 0x43, 0x2b, 0x91, 0x0f, 0xa0, 0xaf, 0x6f, 0xb9, 0xb2, 0xc8, 0x6c, 0xff, + 0xe2, 0x51, 0x7f, 0x80, 0xa6, 0x3a, 0x0d, 0x41, 0xdc, 0xdf, 0x44, 0xa9, 0x32, 0xb3, 0xc3, 0xf2, + 0xc8, 0xc5, 0x44, 0xbd, 0xc8, 0xc2, 0x98, 0x2b, 0x69, 0xf2, 0x18, 0x7a, 0x6e, 0x91, 0xd9, 0xb6, + 0xe3, 0xb5, 0x23, 0xfb, 0x1c, 0xa5, 0xcb, 0x6a, 0x13, 0x9a, 0xee, 0xc6, 0xb3, 0x93, 0x99, 0xcb, + 0xba, 0xe9, 0xea, 0xfd, 0x0b, 0x75, 0x5d, 0xb0, 0x49, 0x3e, 0x86, 0x9e, 0xd2, 0xee, 0xf7, 0x85, + 0x2e, 0x62, 0x41, 0x7c, 0x4b, 0xce, 0x3e, 0xf5, 0x5a, 0xb7, 0xc8, 0xa2, 0x0c, 0xd5, 0xae, 0xd5, + 0x35, 0x52, 0xa5, 0x70, 0x49, 0xb6, 0x21, 0x8e, 0x91, 0x42, 0xf4, 0x7e, 0x33, 0x9e, 0xde, 0x02, + 0x04, 0x7d, 0x13, 0x1d, 0xca, 0x93, 0x0f, 0xa3, 0x46, 0xb9, 0xd7, 0x64, 0xb6, 0x9a, 0x3a, 0x2e, + 0x9e, 0x67, 0x16, 0x75, 0xa9, 0x36, 0x63, 0x80, 0xf1, 0x23, 0x34, 0x51, 0x6b, 0x6d, 0x87, 0x33, + 0xc1, 0xeb, 0xb1, 0xbc, 0xd0, 0x12, 0x55, 0x90, 0x8d, 0x52, 0x87, 0xfa, 0xf2, 0x5f, 0x13, 0x68, + 0x54, 0xf9, 0xc2, 0xdf, 0x18, 0x28, 0xad, 0x47, 0x08, 0x7c, 0x33, 0xa9, 0xc1, 0x76, 0xcc, 0x2c, + 0xb9, 0x85, 0x41, 0x44, 0x35, 0x74, 0x72, 0xe3, 0xeb, 0x3f, 0xff, 0x3d, 0x1e, 0x9e, 0xc1, 0xd7, + 0xad, 0xa4, 0x69, 0x0a, 0xff, 0x62, 0x20, 0xd4, 0xa2, 0x0c, 0x5c, 0x48, 0xf2, 0xd0, 0x35, 0xd6, + 0xe4, 0xcc, 0x41, 0xc5, 0x01, 0xd4, 0x5d, 0x05, 0x6a, 0x15, 0xbf, 0x6d, 0xc5, 0x8e, 0x6f, 0x05, + 0x20, 0x2a, 0xeb, 0x30, 0xcc, 0xe3, 0x91, 0x75, 0xa8, 0xf3, 0x76, 0x84, 0xbf, 0x37, 0x10, 0x6a, + 0xb1, 0x63, 0x32, 0xda, 0xae, 0xe9, 0x26, 0x19, 0x6d, 0x37, 0xe9, 0x92, 0x05, 0x85, 0xf6, 0x0d, + 0x4c, 0x62, 0xd0, 0xd6, 0x94, 0x4a, 0x41, 0xd1, 0xc0, 0x4f, 0x06, 0xba, 0xdc, 0xc1, 0xa8, 0x78, + 0x71, 0x40, 0xe2, 0x8c, 0xa6, 0xa0, 0xdc, 0xd2, 0x73, 0x68, 0x00, 0xc4, 0x82, 0x82, 0x38, 0x87, + 0x6f, 0x24, 0x43, 0x04, 0x4a, 0xc6, 0xbf, 0x19, 0x68, 0xbc, 0xcd, 0x10, 0x36, 0x07, 0x26, 0x77, + 0x8d, 0xf0, 0x79, 0x87, 0x01, 0x52, 0x54, 0xf8, 0xde, 0xc5, 0xb7, 0x07, 0xc0, 0xd7, 0x95, 0x71, + 0xc5, 0x26, 0x47, 0xf8, 0xd8, 0x40, 0xa9, 0x80, 0xf9, 0xf0, 0x5c, 0xa2, 0xf7, 0x16, 0xc5, 0xe6, + 0xe6, 0xfb, 0x0b, 0x02, 0xbe, 0x55, 0x85, 0x6f, 0x19, 0x2f, 0xc6, 0xe1, 0x13, 0x94, 0xfb, 0x3d, + 0x9f, 0xe2, 0x0f, 0x06, 0xca, 0x00, 0x35, 0xe0, 0x85, 0x3e, 0x65, 0xd0, 0xd6, 0xee, 0x73, 0xb7, + 0x06, 0x92, 0x05, 0x78, 0x77, 0x14, 0xbc, 0xb7, 0xf0, 0x4a, 0x42, 0xbd, 0x04, 0x5d, 0xb9, 0x27, + 0xc2, 0x1f, 0x0d, 0x84, 0x5a, 0x6d, 0x3f, 0xb9, 0x58, 0xba, 0x68, 0x29, 0xb9, 0x58, 0xba, 0xd9, + 0x84, 0xac, 0x28, 0xa8, 0x05, 0x7c, 0x2b, 0x06, 0xaa, 0xe6, 0x23, 0x40, 0xab, 0x17, 0x47, 0xf8, + 0x3b, 0x03, 0x65, 0x80, 0x17, 0x92, 0x83, 0xd8, 0xc9, 0x36, 0xc9, 0x41, 0x3c, 0x47, 0x34, 0x64, + 0x51, 0x21, 0x5b, 0xc0, 0xf3, 0x31, 0xc8, 0x80, 0x55, 0xac, 0x43, 0x60, 0xac, 0x23, 0xfc, 0xab, + 0x2a, 0x93, 0xa8, 0x71, 0xf7, 0x2b, 0x93, 0xf3, 0x24, 0xd4, 0xaf, 0x4c, 0xba, 0x78, 0xa6, 0x6f, + 0x5f, 0x6c, 0x63, 0x91, 0x5e, 0xa9, 0x2e, 0xde, 0x7b, 0x72, 0x9a, 0x37, 0x9e, 0x9e, 0xe6, 0x8d, + 0x7f, 0x4e, 0xf3, 0xc6, 0xb7, 0x67, 0xf9, 0xa1, 0xa7, 0x67, 0xf9, 0xa1, 0xbf, 0xcf, 0xf2, 0x43, + 0x9f, 0x99, 0xb1, 0x83, 0xc3, 0x97, 0xe7, 0x7c, 0xa8, 0x41, 0xa2, 0x9c, 0x56, 0xff, 0xcc, 0x2b, + 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x4d, 0x55, 0x81, 0x7a, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1456,12 +1205,9 @@ type QueryClient interface { ListedNfts(ctx context.Context, in *QueryListedNftsRequest, opts ...grpc.CallOption) (*QueryListedNftsResponse, error) ListedClasses(ctx context.Context, in *QueryListedClassesRequest, opts ...grpc.CallOption) (*QueryListedClassesResponse, error) ListedClass(ctx context.Context, in *QueryListedClassRequest, opts ...grpc.CallOption) (*QueryListedClassResponse, error) - Loans(ctx context.Context, in *QueryLoansRequest, opts ...grpc.CallOption) (*QueryLoansResponse, error) Loan(ctx context.Context, in *QueryLoanRequest, opts ...grpc.CallOption) (*QueryLoanResponse, error) - CDPsList(ctx context.Context, in *QueryCDPsListRequest, opts ...grpc.CallOption) (*QueryCDPsListResponse, error) NftBids(ctx context.Context, in *QueryNftBidsRequest, opts ...grpc.CallOption) (*QueryNftBidsResponse, error) BidderBids(ctx context.Context, in *QueryBidderBidsRequest, opts ...grpc.CallOption) (*QueryBidderBidsResponse, error) - PaymentStatus(ctx context.Context, in *QueryPaymentStatusRequest, opts ...grpc.CallOption) (*QueryPaymentStatusResponse, error) Rewards(ctx context.Context, in *QueryRewardsRequest, opts ...grpc.CallOption) (*QueryRewardsResponse, error) Liquidation(ctx context.Context, in *QueryLiquidationRequest, opts ...grpc.CallOption) (*QueryLiquidationResponse, error) } @@ -1519,15 +1265,6 @@ func (c *queryClient) ListedClass(ctx context.Context, in *QueryListedClassReque return out, nil } -func (c *queryClient) Loans(ctx context.Context, in *QueryLoansRequest, opts ...grpc.CallOption) (*QueryLoansResponse, error) { - out := new(QueryLoansResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Query/Loans", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Loan(ctx context.Context, in *QueryLoanRequest, opts ...grpc.CallOption) (*QueryLoanResponse, error) { out := new(QueryLoanResponse) err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Query/Loan", in, out, opts...) @@ -1537,15 +1274,6 @@ func (c *queryClient) Loan(ctx context.Context, in *QueryLoanRequest, opts ...gr return out, nil } -func (c *queryClient) CDPsList(ctx context.Context, in *QueryCDPsListRequest, opts ...grpc.CallOption) (*QueryCDPsListResponse, error) { - out := new(QueryCDPsListResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Query/CDPsList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) NftBids(ctx context.Context, in *QueryNftBidsRequest, opts ...grpc.CallOption) (*QueryNftBidsResponse, error) { out := new(QueryNftBidsResponse) err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Query/NftBids", in, out, opts...) @@ -1564,15 +1292,6 @@ func (c *queryClient) BidderBids(ctx context.Context, in *QueryBidderBidsRequest return out, nil } -func (c *queryClient) PaymentStatus(ctx context.Context, in *QueryPaymentStatusRequest, opts ...grpc.CallOption) (*QueryPaymentStatusResponse, error) { - out := new(QueryPaymentStatusResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Query/PaymentStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Rewards(ctx context.Context, in *QueryRewardsRequest, opts ...grpc.CallOption) (*QueryRewardsResponse, error) { out := new(QueryRewardsResponse) err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Query/Rewards", in, out, opts...) @@ -1598,12 +1317,9 @@ type QueryServer interface { ListedNfts(context.Context, *QueryListedNftsRequest) (*QueryListedNftsResponse, error) ListedClasses(context.Context, *QueryListedClassesRequest) (*QueryListedClassesResponse, error) ListedClass(context.Context, *QueryListedClassRequest) (*QueryListedClassResponse, error) - Loans(context.Context, *QueryLoansRequest) (*QueryLoansResponse, error) Loan(context.Context, *QueryLoanRequest) (*QueryLoanResponse, error) - CDPsList(context.Context, *QueryCDPsListRequest) (*QueryCDPsListResponse, error) NftBids(context.Context, *QueryNftBidsRequest) (*QueryNftBidsResponse, error) BidderBids(context.Context, *QueryBidderBidsRequest) (*QueryBidderBidsResponse, error) - PaymentStatus(context.Context, *QueryPaymentStatusRequest) (*QueryPaymentStatusResponse, error) Rewards(context.Context, *QueryRewardsRequest) (*QueryRewardsResponse, error) Liquidation(context.Context, *QueryLiquidationRequest) (*QueryLiquidationResponse, error) } @@ -1627,24 +1343,15 @@ func (*UnimplementedQueryServer) ListedClasses(ctx context.Context, req *QueryLi func (*UnimplementedQueryServer) ListedClass(ctx context.Context, req *QueryListedClassRequest) (*QueryListedClassResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListedClass not implemented") } -func (*UnimplementedQueryServer) Loans(ctx context.Context, req *QueryLoansRequest) (*QueryLoansResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Loans not implemented") -} func (*UnimplementedQueryServer) Loan(ctx context.Context, req *QueryLoanRequest) (*QueryLoanResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Loan not implemented") } -func (*UnimplementedQueryServer) CDPsList(ctx context.Context, req *QueryCDPsListRequest) (*QueryCDPsListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CDPsList not implemented") -} func (*UnimplementedQueryServer) NftBids(ctx context.Context, req *QueryNftBidsRequest) (*QueryNftBidsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NftBids not implemented") } func (*UnimplementedQueryServer) BidderBids(ctx context.Context, req *QueryBidderBidsRequest) (*QueryBidderBidsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BidderBids not implemented") } -func (*UnimplementedQueryServer) PaymentStatus(ctx context.Context, req *QueryPaymentStatusRequest) (*QueryPaymentStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PaymentStatus not implemented") -} func (*UnimplementedQueryServer) Rewards(ctx context.Context, req *QueryRewardsRequest) (*QueryRewardsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Rewards not implemented") } @@ -1746,24 +1453,6 @@ func _Query_ListedClass_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Query_Loans_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLoansRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Loans(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftbackedloan.Query/Loans", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Loans(ctx, req.(*QueryLoansRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_Loan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryLoanRequest) if err := dec(in); err != nil { @@ -1782,24 +1471,6 @@ func _Query_Loan_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } -func _Query_CDPsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCDPsListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CDPsList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftbackedloan.Query/CDPsList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CDPsList(ctx, req.(*QueryCDPsListRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_NftBids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryNftBidsRequest) if err := dec(in); err != nil { @@ -1836,24 +1507,6 @@ func _Query_BidderBids_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _Query_PaymentStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPaymentStatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).PaymentStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftbackedloan.Query/PaymentStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PaymentStatus(ctx, req.(*QueryPaymentStatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_Rewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryRewardsRequest) if err := dec(in); err != nil { @@ -1914,18 +1567,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ListedClass", Handler: _Query_ListedClass_Handler, }, - { - MethodName: "Loans", - Handler: _Query_Loans_Handler, - }, { MethodName: "Loan", Handler: _Query_Loan_Handler, }, - { - MethodName: "CDPsList", - Handler: _Query_CDPsList_Handler, - }, { MethodName: "NftBids", Handler: _Query_NftBids_Handler, @@ -1934,10 +1579,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "BidderBids", Handler: _Query_BidderBids_Handler, }, - { - MethodName: "PaymentStatus", - Handler: _Query_PaymentStatus_Handler, - }, { MethodName: "Rewards", Handler: _Query_Rewards_Handler, @@ -2371,7 +2012,7 @@ func (m *QueryListedClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryLoansRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryLoanRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2381,94 +2022,34 @@ func (m *QueryLoansRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLoansRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryLoanRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLoansRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryLoanRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryLoansResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryLoansResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLoansResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Loans) > 0 { - for iNdEx := len(m.Loans) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Loans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryLoanRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryLoanRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLoanRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryLoanResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryLoanResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2489,17 +2070,37 @@ func (m *QueryLoanResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size := m.BorrowingLimit.Size() + size, err := m.TotalDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.BorrowingLimit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } i -= size - if _, err := m.BorrowingLimit.MarshalTo(dAtA[i:]); err != nil { + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.BorrowingAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 { - size, err := m.Loan.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2511,52 +2112,6 @@ func (m *QueryLoanResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryCDPsListRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryCDPsListRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryCDPsListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryCDPsListResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryCDPsListResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryCDPsListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *QueryNftBidsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2631,83 +2186,6 @@ func (m *QueryNftBidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryPaymentStatusRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryPaymentStatusRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPaymentStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Bidder) > 0 { - i -= len(m.Bidder) - copy(dAtA[i:], m.Bidder) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Bidder))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryPaymentStatusResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryPaymentStatusResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPaymentStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.PaymentStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryBidderBidsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3097,30 +2575,6 @@ func (m *QueryListedClassResponse) Size() (n int) { return n } -func (m *QueryLoansRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryLoansResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Loans) > 0 { - for _, e := range m.Loans { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - func (m *QueryLoanRequest) Size() (n int) { if m == nil { return 0 @@ -3144,28 +2598,14 @@ func (m *QueryLoanResponse) Size() (n int) { } var l int _ = l - l = m.Loan.Size() + l = m.NftId.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.BorrowingAmount.Size() n += 1 + l + sovQuery(uint64(l)) l = m.BorrowingLimit.Size() n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryCDPsListRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryCDPsListResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l + l = m.TotalDeposit.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -3201,20 +2641,12 @@ func (m *QueryNftBidsResponse) Size() (n int) { return n } -func (m *QueryPaymentStatusRequest) Size() (n int) { +func (m *QueryBidderBidsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } l = len(m.Bidder) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -3222,46 +2654,22 @@ func (m *QueryPaymentStatusRequest) Size() (n int) { return n } -func (m *QueryPaymentStatusResponse) Size() (n int) { +func (m *QueryBidderBidsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.PaymentStatus.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } return n } -func (m *QueryBidderBidsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Bidder) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBidderBidsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Bids) > 0 { - for _, e := range m.Bids { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryRewardsRequest) Size() (n int) { +func (m *QueryRewardsRequest) Size() (n int) { if m == nil { return 0 } @@ -4485,140 +3893,6 @@ func (m *QueryListedClassResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLoansRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLoansRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoansRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryLoansResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryLoansResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoansResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loans", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Loans = append(m.Loans, Loan{}) - if err := m.Loans[len(m.Loans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryLoanRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4764,7 +4038,7 @@ func (m *QueryLoanResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loan", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4791,15 +4065,15 @@ func (m *QueryLoanResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Loan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NftId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BorrowingLimit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BorrowingAmount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4809,213 +4083,30 @@ func (m *QueryLoanResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BorrowingLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BorrowingAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryCDPsListRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryCDPsListRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCDPsListRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryCDPsListResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryCDPsListResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCDPsListResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNftBidsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNftBidsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNftBidsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BorrowingLimit", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5025,77 +4116,28 @@ func (m *QueryNftBidsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { + if err := m.BorrowingLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNftBidsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNftBidsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNftBidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5122,8 +4164,7 @@ func (m *QueryNftBidsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Bids = append(m.Bids, NftBid{}) - if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TotalDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5148,7 +4189,7 @@ func (m *QueryNftBidsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPaymentStatusRequest) Unmarshal(dAtA []byte) error { +func (m *QueryNftBidsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5171,10 +4212,10 @@ func (m *QueryPaymentStatusRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPaymentStatusRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNftBidsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPaymentStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNftBidsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5241,38 +4282,6 @@ func (m *QueryPaymentStatusRequest) Unmarshal(dAtA []byte) error { } m.NftId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bidder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5294,7 +4303,7 @@ func (m *QueryPaymentStatusRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPaymentStatusResponse) Unmarshal(dAtA []byte) error { +func (m *QueryNftBidsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5317,15 +4326,15 @@ func (m *QueryPaymentStatusResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPaymentStatusResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryNftBidsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPaymentStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryNftBidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PaymentStatus", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5352,7 +4361,8 @@ func (m *QueryPaymentStatusResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PaymentStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Bids = append(m.Bids, Bid{}) + if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5517,7 +4527,7 @@ func (m *QueryBidderBidsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Bids = append(m.Bids, NftBid{}) + m.Bids = append(m.Bids, Bid{}) if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/nftbackedloan/types/query.pb.gw.go b/x/nftbackedloan/types/query.pb.gw.go index 6c68a5a3d..771b3db1c 100644 --- a/x/nftbackedloan/types/query.pb.gw.go +++ b/x/nftbackedloan/types/query.pb.gw.go @@ -275,24 +275,6 @@ func local_request_Query_ListedClass_0(ctx context.Context, marshaler runtime.Ma } -func request_Query_Loans_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoansRequest - var metadata runtime.ServerMetadata - - msg, err := client.Loans(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Loans_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoansRequest - var metadata runtime.ServerMetadata - - msg, err := server.Loans(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_Loan_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryLoanRequest var metadata runtime.ServerMetadata @@ -369,24 +351,6 @@ func local_request_Query_Loan_0(ctx context.Context, marshaler runtime.Marshaler } -func request_Query_CDPsList_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCDPsListRequest - var metadata runtime.ServerMetadata - - msg, err := client.CDPsList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_CDPsList_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCDPsListRequest - var metadata runtime.ServerMetadata - - msg, err := server.CDPsList(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_NftBids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryNftBidsRequest var metadata runtime.ServerMetadata @@ -517,104 +481,6 @@ func local_request_Query_BidderBids_0(ctx context.Context, marshaler runtime.Mar } -func request_Query_PaymentStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPaymentStatusRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - val, ok = pathParams["bidder"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") - } - - protoReq.Bidder, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) - } - - msg, err := client.PaymentStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_PaymentStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPaymentStatusRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - val, ok = pathParams["bidder"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") - } - - protoReq.Bidder, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) - } - - msg, err := server.PaymentStatus(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_Rewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryRewardsRequest var metadata runtime.ServerMetadata @@ -866,29 +732,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_Loans_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Loans_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Loans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Loan_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -912,29 +755,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_CDPsList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_CDPsList_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CDPsList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_NftBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -981,29 +801,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_PaymentStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_PaymentStatus_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_PaymentStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Rewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1191,26 +988,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_Loans_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Loans_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Loans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Loan_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1231,26 +1008,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_CDPsList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_CDPsList_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CDPsList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_NftBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1291,26 +1048,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_PaymentStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_PaymentStatus_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_PaymentStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Rewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1357,25 +1094,19 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NftListing_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "nft_listing", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ListedNfts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "listed_nfts"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NftListing_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "nft-listing", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ListedClasses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "listed_classes"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ListedNfts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "listed-nfts"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ListedClass_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "listed_class", "class_id", "nft_limit"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ListedClasses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "listed-classes"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Loans_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "loans"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ListedClass_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "listed-class", "class_id", "nft_limit"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Loan_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "loans", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_CDPsList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftbackedloan", "cdps_list"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_NftBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "nft_bids", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_BidderBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftbackedloan", "bidder_bids", "bidder"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NftBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftbackedloan", "nft-bids", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PaymentStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"ununifi", "nftbackedloan", "payment_status", "class_id", "nft_id", "bidder"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BidderBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftbackedloan", "bidder-bids", "bidder"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Rewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftbackedloan", "rewards", "address"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1393,18 +1124,12 @@ var ( forward_Query_ListedClass_0 = runtime.ForwardResponseMessage - forward_Query_Loans_0 = runtime.ForwardResponseMessage - forward_Query_Loan_0 = runtime.ForwardResponseMessage - forward_Query_CDPsList_0 = runtime.ForwardResponseMessage - forward_Query_NftBids_0 = runtime.ForwardResponseMessage forward_Query_BidderBids_0 = runtime.ForwardResponseMessage - forward_Query_PaymentStatus_0 = runtime.ForwardResponseMessage - forward_Query_Rewards_0 = runtime.ForwardResponseMessage forward_Query_Liquidation_0 = runtime.ForwardResponseMessage diff --git a/x/nftbackedloan/types/tx.pb.go b/x/nftbackedloan/types/tx.pb.go index 974eb625c..ae19ba248 100644 --- a/x/nftbackedloan/types/tx.pb.go +++ b/x/nftbackedloan/types/tx.pb.go @@ -36,134 +36,19 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgMintNft struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - NftUri string `protobuf:"bytes,4,opt,name=nft_uri,json=nftUri,proto3" json:"nft_uri,omitempty"` - NftUriHash string `protobuf:"bytes,5,opt,name=nft_uri_hash,json=nftUriHash,proto3" json:"nft_uri_hash,omitempty"` -} - -func (m *MsgMintNft) Reset() { *m = MsgMintNft{} } -func (m *MsgMintNft) String() string { return proto.CompactTextString(m) } -func (*MsgMintNft) ProtoMessage() {} -func (*MsgMintNft) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{0} -} -func (m *MsgMintNft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintNft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintNft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMintNft) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNft.Merge(m, src) -} -func (m *MsgMintNft) XXX_Size() int { - return m.Size() -} -func (m *MsgMintNft) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNft.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintNft proto.InternalMessageInfo - -func (m *MsgMintNft) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgMintNft) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *MsgMintNft) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *MsgMintNft) GetNftUri() string { - if m != nil { - return m.NftUri - } - return "" -} - -func (m *MsgMintNft) GetNftUriHash() string { - if m != nil { - return m.NftUriHash - } - return "" -} - -type MsgMintNftResponse struct { -} - -func (m *MsgMintNftResponse) Reset() { *m = MsgMintNftResponse{} } -func (m *MsgMintNftResponse) String() string { return proto.CompactTextString(m) } -func (*MsgMintNftResponse) ProtoMessage() {} -func (*MsgMintNftResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{1} -} -func (m *MsgMintNftResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintNftResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintNftResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMintNftResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNftResponse.Merge(m, src) -} -func (m *MsgMintNftResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgMintNftResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNftResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintNftResponse proto.InternalMessageInfo - type MsgListNft struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - ListingType ListingType `protobuf:"varint,3,opt,name=listing_type,json=listingType,proto3,enum=ununifi.nftbackedloan.ListingType" json:"listing_type,omitempty"` - BidToken string `protobuf:"bytes,4,opt,name=bid_token,json=bidToken,proto3" json:"bid_token,omitempty"` - // 1% = 0.01 - MinimumDepositRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=minimum_deposit_rate,json=minimumDepositRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_deposit_rate"` - AutomaticRefinancing bool `protobuf:"varint,6,opt,name=automatic_refinancing,json=automaticRefinancing,proto3" json:"automatic_refinancing,omitempty"` - MinimumBiddingPeriod time.Duration `protobuf:"bytes,7,opt,name=minimum_bidding_period,json=minimumBiddingPeriod,proto3,stdduration" json:"minimum_bidding_period"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + BidDenom string `protobuf:"bytes,3,opt,name=bid_denom,json=bidDenom,proto3" json:"bid_denom,omitempty"` + MinDepositRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=min_deposit_rate,json=minDepositRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_deposit_rate"` + MinBidPeriod time.Duration `protobuf:"bytes,5,opt,name=min_bid_period,json=minBidPeriod,proto3,stdduration" json:"min_bid_period"` } func (m *MsgListNft) Reset() { *m = MsgListNft{} } func (m *MsgListNft) String() string { return proto.CompactTextString(m) } func (*MsgListNft) ProtoMessage() {} func (*MsgListNft) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{2} + return fileDescriptor_c40f8c90d3c7c6ce, []int{0} } func (m *MsgListNft) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,37 +84,23 @@ func (m *MsgListNft) GetSender() string { return "" } -func (m *MsgListNft) GetNftId() NftIdentifier { +func (m *MsgListNft) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} -} - -func (m *MsgListNft) GetListingType() ListingType { - if m != nil { - return m.ListingType - } - return ListingType_DIRECT_ASSET_BORROW + return NftId{} } -func (m *MsgListNft) GetBidToken() string { +func (m *MsgListNft) GetBidDenom() string { if m != nil { - return m.BidToken + return m.BidDenom } return "" } -func (m *MsgListNft) GetAutomaticRefinancing() bool { - if m != nil { - return m.AutomaticRefinancing - } - return false -} - -func (m *MsgListNft) GetMinimumBiddingPeriod() time.Duration { +func (m *MsgListNft) GetMinBidPeriod() time.Duration { if m != nil { - return m.MinimumBiddingPeriod + return m.MinBidPeriod } return 0 } @@ -241,7 +112,7 @@ func (m *MsgListNftResponse) Reset() { *m = MsgListNftResponse{} } func (m *MsgListNftResponse) String() string { return proto.CompactTextString(m) } func (*MsgListNftResponse) ProtoMessage() {} func (*MsgListNftResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{3} + return fileDescriptor_c40f8c90d3c7c6ce, []int{1} } func (m *MsgListNftResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -270,23 +141,23 @@ func (m *MsgListNftResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgListNftResponse proto.InternalMessageInfo -type MsgCancelNftListing struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` +type MsgCancelListing struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` } -func (m *MsgCancelNftListing) Reset() { *m = MsgCancelNftListing{} } -func (m *MsgCancelNftListing) String() string { return proto.CompactTextString(m) } -func (*MsgCancelNftListing) ProtoMessage() {} -func (*MsgCancelNftListing) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{4} +func (m *MsgCancelListing) Reset() { *m = MsgCancelListing{} } +func (m *MsgCancelListing) String() string { return proto.CompactTextString(m) } +func (*MsgCancelListing) ProtoMessage() {} +func (*MsgCancelListing) Descriptor() ([]byte, []int) { + return fileDescriptor_c40f8c90d3c7c6ce, []int{2} } -func (m *MsgCancelNftListing) XXX_Unmarshal(b []byte) error { +func (m *MsgCancelListing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCancelNftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCancelListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCancelNftListing.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCancelListing.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -296,47 +167,47 @@ func (m *MsgCancelNftListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgCancelNftListing) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelNftListing.Merge(m, src) +func (m *MsgCancelListing) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelListing.Merge(m, src) } -func (m *MsgCancelNftListing) XXX_Size() int { +func (m *MsgCancelListing) XXX_Size() int { return m.Size() } -func (m *MsgCancelNftListing) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelNftListing.DiscardUnknown(m) +func (m *MsgCancelListing) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelListing.DiscardUnknown(m) } -var xxx_messageInfo_MsgCancelNftListing proto.InternalMessageInfo +var xxx_messageInfo_MsgCancelListing proto.InternalMessageInfo -func (m *MsgCancelNftListing) GetSender() string { +func (m *MsgCancelListing) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgCancelNftListing) GetNftId() NftIdentifier { +func (m *MsgCancelListing) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } -type MsgCancelNftListingResponse struct { +type MsgCancelListingResponse struct { } -func (m *MsgCancelNftListingResponse) Reset() { *m = MsgCancelNftListingResponse{} } -func (m *MsgCancelNftListingResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCancelNftListingResponse) ProtoMessage() {} -func (*MsgCancelNftListingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{5} +func (m *MsgCancelListingResponse) Reset() { *m = MsgCancelListingResponse{} } +func (m *MsgCancelListingResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelListingResponse) ProtoMessage() {} +func (*MsgCancelListingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c40f8c90d3c7c6ce, []int{3} } -func (m *MsgCancelNftListingResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgCancelListingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCancelNftListingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCancelListingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCancelNftListingResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCancelListingResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -346,33 +217,33 @@ func (m *MsgCancelNftListingResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgCancelNftListingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelNftListingResponse.Merge(m, src) +func (m *MsgCancelListingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelListingResponse.Merge(m, src) } -func (m *MsgCancelNftListingResponse) XXX_Size() int { +func (m *MsgCancelListingResponse) XXX_Size() int { return m.Size() } -func (m *MsgCancelNftListingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelNftListingResponse.DiscardUnknown(m) +func (m *MsgCancelListingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelListingResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgCancelNftListingResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgCancelListingResponse proto.InternalMessageInfo type MsgPlaceBid struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - BidAmount types.Coin `protobuf:"bytes,3,opt,name=bid_amount,json=bidAmount,proto3" json:"bid_amount"` - BiddingPeriod time.Time `protobuf:"bytes,4,opt,name=bidding_period,json=biddingPeriod,proto3,stdtime" json:"bidding_period"` - DepositLendingRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=deposit_lending_rate,json=depositLendingRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"deposit_lending_rate"` - AutomaticPayment bool `protobuf:"varint,6,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` - DepositAmount types.Coin `protobuf:"bytes,7,opt,name=deposit_amount,json=depositAmount,proto3" json:"deposit_amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + Price types.Coin `protobuf:"bytes,3,opt,name=price,proto3" json:"price"` + Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` + InterestRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=interest_rate,json=interestRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_rate"` + AutomaticPayment bool `protobuf:"varint,6,opt,name=automatic_payment,json=automaticPayment,proto3" json:"automatic_payment,omitempty"` + Deposit types.Coin `protobuf:"bytes,7,opt,name=deposit,proto3" json:"deposit"` } func (m *MsgPlaceBid) Reset() { *m = MsgPlaceBid{} } func (m *MsgPlaceBid) String() string { return proto.CompactTextString(m) } func (*MsgPlaceBid) ProtoMessage() {} func (*MsgPlaceBid) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{6} + return fileDescriptor_c40f8c90d3c7c6ce, []int{4} } func (m *MsgPlaceBid) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -408,23 +279,23 @@ func (m *MsgPlaceBid) GetSender() string { return "" } -func (m *MsgPlaceBid) GetNftId() NftIdentifier { +func (m *MsgPlaceBid) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } -func (m *MsgPlaceBid) GetBidAmount() types.Coin { +func (m *MsgPlaceBid) GetPrice() types.Coin { if m != nil { - return m.BidAmount + return m.Price } return types.Coin{} } -func (m *MsgPlaceBid) GetBiddingPeriod() time.Time { +func (m *MsgPlaceBid) GetExpiry() time.Time { if m != nil { - return m.BiddingPeriod + return m.Expiry } return time.Time{} } @@ -436,9 +307,9 @@ func (m *MsgPlaceBid) GetAutomaticPayment() bool { return false } -func (m *MsgPlaceBid) GetDepositAmount() types.Coin { +func (m *MsgPlaceBid) GetDeposit() types.Coin { if m != nil { - return m.DepositAmount + return m.Deposit } return types.Coin{} } @@ -450,7 +321,7 @@ func (m *MsgPlaceBidResponse) Reset() { *m = MsgPlaceBidResponse{} } func (m *MsgPlaceBidResponse) String() string { return proto.CompactTextString(m) } func (*MsgPlaceBidResponse) ProtoMessage() {} func (*MsgPlaceBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{7} + return fileDescriptor_c40f8c90d3c7c6ce, []int{5} } func (m *MsgPlaceBidResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,15 +351,15 @@ func (m *MsgPlaceBidResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgPlaceBidResponse proto.InternalMessageInfo type MsgCancelBid struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` } func (m *MsgCancelBid) Reset() { *m = MsgCancelBid{} } func (m *MsgCancelBid) String() string { return proto.CompactTextString(m) } func (*MsgCancelBid) ProtoMessage() {} func (*MsgCancelBid) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{8} + return fileDescriptor_c40f8c90d3c7c6ce, []int{6} } func (m *MsgCancelBid) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -524,11 +395,11 @@ func (m *MsgCancelBid) GetSender() string { return "" } -func (m *MsgCancelBid) GetNftId() NftIdentifier { +func (m *MsgCancelBid) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } type MsgCancelBidResponse struct { @@ -538,7 +409,7 @@ func (m *MsgCancelBidResponse) Reset() { *m = MsgCancelBidResponse{} } func (m *MsgCancelBidResponse) String() string { return proto.CompactTextString(m) } func (*MsgCancelBidResponse) ProtoMessage() {} func (*MsgCancelBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{9} + return fileDescriptor_c40f8c90d3c7c6ce, []int{7} } func (m *MsgCancelBidResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -568,15 +439,15 @@ func (m *MsgCancelBidResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCancelBidResponse proto.InternalMessageInfo type MsgEndNftListing struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` } func (m *MsgEndNftListing) Reset() { *m = MsgEndNftListing{} } func (m *MsgEndNftListing) String() string { return proto.CompactTextString(m) } func (*MsgEndNftListing) ProtoMessage() {} func (*MsgEndNftListing) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{10} + return fileDescriptor_c40f8c90d3c7c6ce, []int{8} } func (m *MsgEndNftListing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -612,11 +483,11 @@ func (m *MsgEndNftListing) GetSender() string { return "" } -func (m *MsgEndNftListing) GetNftId() NftIdentifier { +func (m *MsgEndNftListing) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } type MsgEndNftListingResponse struct { @@ -626,7 +497,7 @@ func (m *MsgEndNftListingResponse) Reset() { *m = MsgEndNftListingRespon func (m *MsgEndNftListingResponse) String() string { return proto.CompactTextString(m) } func (*MsgEndNftListingResponse) ProtoMessage() {} func (*MsgEndNftListingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{11} + return fileDescriptor_c40f8c90d3c7c6ce, []int{9} } func (m *MsgEndNftListingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -656,15 +527,15 @@ func (m *MsgEndNftListingResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgEndNftListingResponse proto.InternalMessageInfo type MsgSellingDecision struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` } func (m *MsgSellingDecision) Reset() { *m = MsgSellingDecision{} } func (m *MsgSellingDecision) String() string { return proto.CompactTextString(m) } func (*MsgSellingDecision) ProtoMessage() {} func (*MsgSellingDecision) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{12} + return fileDescriptor_c40f8c90d3c7c6ce, []int{10} } func (m *MsgSellingDecision) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -700,11 +571,11 @@ func (m *MsgSellingDecision) GetSender() string { return "" } -func (m *MsgSellingDecision) GetNftId() NftIdentifier { +func (m *MsgSellingDecision) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } type MsgSellingDecisionResponse struct { @@ -714,7 +585,7 @@ func (m *MsgSellingDecisionResponse) Reset() { *m = MsgSellingDecisionRe func (m *MsgSellingDecisionResponse) String() string { return proto.CompactTextString(m) } func (*MsgSellingDecisionResponse) ProtoMessage() {} func (*MsgSellingDecisionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{13} + return fileDescriptor_c40f8c90d3c7c6ce, []int{11} } func (m *MsgSellingDecisionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -743,23 +614,23 @@ func (m *MsgSellingDecisionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSellingDecisionResponse proto.InternalMessageInfo -type MsgPayFullBid struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` +type MsgPayRemainder struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` } -func (m *MsgPayFullBid) Reset() { *m = MsgPayFullBid{} } -func (m *MsgPayFullBid) String() string { return proto.CompactTextString(m) } -func (*MsgPayFullBid) ProtoMessage() {} -func (*MsgPayFullBid) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{14} +func (m *MsgPayRemainder) Reset() { *m = MsgPayRemainder{} } +func (m *MsgPayRemainder) String() string { return proto.CompactTextString(m) } +func (*MsgPayRemainder) ProtoMessage() {} +func (*MsgPayRemainder) Descriptor() ([]byte, []int) { + return fileDescriptor_c40f8c90d3c7c6ce, []int{12} } -func (m *MsgPayFullBid) XXX_Unmarshal(b []byte) error { +func (m *MsgPayRemainder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgPayFullBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgPayRemainder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgPayFullBid.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgPayRemainder.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -769,47 +640,85 @@ func (m *MsgPayFullBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *MsgPayFullBid) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPayFullBid.Merge(m, src) +func (m *MsgPayRemainder) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPayRemainder.Merge(m, src) } -func (m *MsgPayFullBid) XXX_Size() int { +func (m *MsgPayRemainder) XXX_Size() int { return m.Size() } -func (m *MsgPayFullBid) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPayFullBid.DiscardUnknown(m) +func (m *MsgPayRemainder) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPayRemainder.DiscardUnknown(m) } -var xxx_messageInfo_MsgPayFullBid proto.InternalMessageInfo +var xxx_messageInfo_MsgPayRemainder proto.InternalMessageInfo -func (m *MsgPayFullBid) GetSender() string { +func (m *MsgPayRemainder) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgPayFullBid) GetNftId() NftIdentifier { +func (m *MsgPayRemainder) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } -type MsgPayFullBidResponse struct { +type MsgPayRemainderResponse struct { } -func (m *MsgPayFullBidResponse) Reset() { *m = MsgPayFullBidResponse{} } -func (m *MsgPayFullBidResponse) String() string { return proto.CompactTextString(m) } -func (*MsgPayFullBidResponse) ProtoMessage() {} -func (*MsgPayFullBidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{15} +func (m *MsgPayRemainderResponse) Reset() { *m = MsgPayRemainderResponse{} } +func (m *MsgPayRemainderResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPayRemainderResponse) ProtoMessage() {} +func (*MsgPayRemainderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c40f8c90d3c7c6ce, []int{13} +} +func (m *MsgPayRemainderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPayRemainderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPayRemainderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgPayRemainderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPayRemainderResponse.Merge(m, src) +} +func (m *MsgPayRemainderResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPayRemainderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPayRemainderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPayRemainderResponse proto.InternalMessageInfo + +type BorrowBid struct { + Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` +} + +func (m *BorrowBid) Reset() { *m = BorrowBid{} } +func (m *BorrowBid) String() string { return proto.CompactTextString(m) } +func (*BorrowBid) ProtoMessage() {} +func (*BorrowBid) Descriptor() ([]byte, []int) { + return fileDescriptor_c40f8c90d3c7c6ce, []int{14} } -func (m *MsgPayFullBidResponse) XXX_Unmarshal(b []byte) error { +func (m *BorrowBid) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgPayFullBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *BorrowBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgPayFullBidResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_BorrowBid.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -819,29 +728,43 @@ func (m *MsgPayFullBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgPayFullBidResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPayFullBidResponse.Merge(m, src) +func (m *BorrowBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_BorrowBid.Merge(m, src) } -func (m *MsgPayFullBidResponse) XXX_Size() int { +func (m *BorrowBid) XXX_Size() int { return m.Size() } -func (m *MsgPayFullBidResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPayFullBidResponse.DiscardUnknown(m) +func (m *BorrowBid) XXX_DiscardUnknown() { + xxx_messageInfo_BorrowBid.DiscardUnknown(m) } -var xxx_messageInfo_MsgPayFullBidResponse proto.InternalMessageInfo +var xxx_messageInfo_BorrowBid proto.InternalMessageInfo + +func (m *BorrowBid) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +func (m *BorrowBid) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} type MsgBorrow struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + BorrowBids []BorrowBid `protobuf:"bytes,3,rep,name=borrow_bids,json=borrowBids,proto3" json:"borrow_bids"` } func (m *MsgBorrow) Reset() { *m = MsgBorrow{} } func (m *MsgBorrow) String() string { return proto.CompactTextString(m) } func (*MsgBorrow) ProtoMessage() {} func (*MsgBorrow) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{16} + return fileDescriptor_c40f8c90d3c7c6ce, []int{15} } func (m *MsgBorrow) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -877,18 +800,18 @@ func (m *MsgBorrow) GetSender() string { return "" } -func (m *MsgBorrow) GetNftId() NftIdentifier { +func (m *MsgBorrow) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } -func (m *MsgBorrow) GetAmount() types.Coin { +func (m *MsgBorrow) GetBorrowBids() []BorrowBid { if m != nil { - return m.Amount + return m.BorrowBids } - return types.Coin{} + return nil } type MsgBorrowResponse struct { @@ -898,7 +821,7 @@ func (m *MsgBorrowResponse) Reset() { *m = MsgBorrowResponse{} } func (m *MsgBorrowResponse) String() string { return proto.CompactTextString(m) } func (*MsgBorrowResponse) ProtoMessage() {} func (*MsgBorrowResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{17} + return fileDescriptor_c40f8c90d3c7c6ce, []int{16} } func (m *MsgBorrowResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -928,16 +851,16 @@ func (m *MsgBorrowResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBorrowResponse proto.InternalMessageInfo type MsgRepay struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - NftId NftIdentifier `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + NftId NftId `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + RepayBids []BorrowBid `protobuf:"bytes,3,rep,name=repay_bids,json=repayBids,proto3" json:"repay_bids"` } func (m *MsgRepay) Reset() { *m = MsgRepay{} } func (m *MsgRepay) String() string { return proto.CompactTextString(m) } func (*MsgRepay) ProtoMessage() {} func (*MsgRepay) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{18} + return fileDescriptor_c40f8c90d3c7c6ce, []int{17} } func (m *MsgRepay) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -973,18 +896,18 @@ func (m *MsgRepay) GetSender() string { return "" } -func (m *MsgRepay) GetNftId() NftIdentifier { +func (m *MsgRepay) GetNftId() NftId { if m != nil { return m.NftId } - return NftIdentifier{} + return NftId{} } -func (m *MsgRepay) GetAmount() types.Coin { +func (m *MsgRepay) GetRepayBids() []BorrowBid { if m != nil { - return m.Amount + return m.RepayBids } - return types.Coin{} + return nil } type MsgRepayResponse struct { @@ -994,7 +917,7 @@ func (m *MsgRepayResponse) Reset() { *m = MsgRepayResponse{} } func (m *MsgRepayResponse) String() string { return proto.CompactTextString(m) } func (*MsgRepayResponse) ProtoMessage() {} func (*MsgRepayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c40f8c90d3c7c6ce, []int{19} + return fileDescriptor_c40f8c90d3c7c6ce, []int{18} } func (m *MsgRepayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1024,12 +947,10 @@ func (m *MsgRepayResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRepayResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgMintNft)(nil), "ununifi.nftbackedloan.MsgMintNft") - proto.RegisterType((*MsgMintNftResponse)(nil), "ununifi.nftbackedloan.MsgMintNftResponse") proto.RegisterType((*MsgListNft)(nil), "ununifi.nftbackedloan.MsgListNft") proto.RegisterType((*MsgListNftResponse)(nil), "ununifi.nftbackedloan.MsgListNftResponse") - proto.RegisterType((*MsgCancelNftListing)(nil), "ununifi.nftbackedloan.MsgCancelNftListing") - proto.RegisterType((*MsgCancelNftListingResponse)(nil), "ununifi.nftbackedloan.MsgCancelNftListingResponse") + proto.RegisterType((*MsgCancelListing)(nil), "ununifi.nftbackedloan.MsgCancelListing") + proto.RegisterType((*MsgCancelListingResponse)(nil), "ununifi.nftbackedloan.MsgCancelListingResponse") proto.RegisterType((*MsgPlaceBid)(nil), "ununifi.nftbackedloan.MsgPlaceBid") proto.RegisterType((*MsgPlaceBidResponse)(nil), "ununifi.nftbackedloan.MsgPlaceBidResponse") proto.RegisterType((*MsgCancelBid)(nil), "ununifi.nftbackedloan.MsgCancelBid") @@ -1038,8 +959,9 @@ func init() { proto.RegisterType((*MsgEndNftListingResponse)(nil), "ununifi.nftbackedloan.MsgEndNftListingResponse") proto.RegisterType((*MsgSellingDecision)(nil), "ununifi.nftbackedloan.MsgSellingDecision") proto.RegisterType((*MsgSellingDecisionResponse)(nil), "ununifi.nftbackedloan.MsgSellingDecisionResponse") - proto.RegisterType((*MsgPayFullBid)(nil), "ununifi.nftbackedloan.MsgPayFullBid") - proto.RegisterType((*MsgPayFullBidResponse)(nil), "ununifi.nftbackedloan.MsgPayFullBidResponse") + proto.RegisterType((*MsgPayRemainder)(nil), "ununifi.nftbackedloan.MsgPayRemainder") + proto.RegisterType((*MsgPayRemainderResponse)(nil), "ununifi.nftbackedloan.MsgPayRemainderResponse") + proto.RegisterType((*BorrowBid)(nil), "ununifi.nftbackedloan.BorrowBid") proto.RegisterType((*MsgBorrow)(nil), "ununifi.nftbackedloan.MsgBorrow") proto.RegisterType((*MsgBorrowResponse)(nil), "ununifi.nftbackedloan.MsgBorrowResponse") proto.RegisterType((*MsgRepay)(nil), "ununifi.nftbackedloan.MsgRepay") @@ -1049,72 +971,65 @@ func init() { func init() { proto.RegisterFile("ununifi/nftbackedloan/tx.proto", fileDescriptor_c40f8c90d3c7c6ce) } var fileDescriptor_c40f8c90d3c7c6ce = []byte{ - // 1035 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0x8e, 0x49, 0x62, 0x3b, 0x27, 0x3f, 0xa4, 0xdb, 0x24, 0x75, 0xb6, 0xe0, 0x04, 0x53, 0xd1, - 0xb4, 0xa5, 0xbb, 0x4a, 0x7a, 0xc1, 0x0d, 0x42, 0xaa, 0x9b, 0x46, 0xad, 0x88, 0xa3, 0x60, 0x12, - 0x21, 0x2a, 0x21, 0x33, 0xde, 0x9d, 0xdd, 0x0c, 0xd9, 0x9d, 0x59, 0xed, 0xcc, 0x42, 0xf3, 0x16, - 0xe5, 0x8e, 0x2b, 0x78, 0x09, 0x1e, 0xa2, 0x12, 0x42, 0xaa, 0xb8, 0x42, 0xbd, 0x28, 0x28, 0x79, - 0x11, 0x34, 0xb3, 0xb3, 0xe3, 0xc4, 0x89, 0x13, 0x23, 0x61, 0xd4, 0xab, 0x64, 0x7c, 0xbe, 0xf3, - 0x9d, 0x6f, 0xcf, 0x77, 0x7c, 0x76, 0x0c, 0xf5, 0x8c, 0x66, 0x94, 0x04, 0xc4, 0xa5, 0x81, 0xe8, - 0x22, 0xef, 0x10, 0xfb, 0x11, 0x43, 0xd4, 0x15, 0xcf, 0x9d, 0x24, 0x65, 0x82, 0x59, 0x8b, 0x3a, - 0xee, 0x9c, 0x89, 0xdb, 0x0b, 0x21, 0x0b, 0x99, 0x42, 0xb8, 0xf2, 0xbf, 0x1c, 0x6c, 0xaf, 0x84, - 0x8c, 0x85, 0x11, 0x76, 0xd5, 0xa9, 0x9b, 0x05, 0xae, 0x20, 0x31, 0xe6, 0x02, 0xc5, 0x89, 0x06, - 0xd4, 0xfb, 0x01, 0x7e, 0x96, 0x22, 0x41, 0x18, 0x2d, 0xe2, 0x1e, 0xe3, 0x31, 0xe3, 0x6e, 0x17, - 0x71, 0xec, 0x7e, 0xbf, 0xde, 0xc5, 0x02, 0xad, 0xbb, 0x1e, 0x23, 0x45, 0xfc, 0xce, 0xc5, 0x6a, - 0xcf, 0x9c, 0x34, 0x74, 0x39, 0xa7, 0xea, 0xe4, 0x22, 0xf3, 0x43, 0x1e, 0x6a, 0xfc, 0x58, 0x02, - 0x68, 0xf1, 0xb0, 0x45, 0xa8, 0xd8, 0x09, 0x84, 0xb5, 0x04, 0x65, 0x8e, 0xa9, 0x8f, 0xd3, 0x5a, - 0x69, 0xb5, 0xb4, 0x36, 0xd5, 0xd6, 0x27, 0x6b, 0x19, 0xaa, 0x5e, 0x84, 0x38, 0xef, 0x10, 0xbf, - 0xf6, 0x8e, 0x8a, 0x54, 0xd4, 0xf9, 0xa9, 0x6f, 0x2d, 0x42, 0x99, 0x06, 0x42, 0x06, 0xc6, 0x55, - 0x60, 0x92, 0x06, 0xe2, 0xa9, 0x6f, 0xdd, 0x80, 0x8a, 0xfc, 0x38, 0x4b, 0x49, 0x6d, 0x22, 0xa7, - 0xa2, 0x81, 0xd8, 0x4f, 0x89, 0xb5, 0x0a, 0x33, 0x3a, 0xd0, 0x39, 0x40, 0xfc, 0xa0, 0x36, 0xa9, - 0xa2, 0x90, 0x47, 0x9f, 0x20, 0x7e, 0xd0, 0x58, 0x00, 0xab, 0x27, 0xa9, 0x8d, 0x79, 0xc2, 0x28, - 0xc7, 0x8d, 0xdf, 0xc6, 0x95, 0xd2, 0x6d, 0xc2, 0x2f, 0x55, 0xfa, 0xd0, 0xc8, 0x91, 0x3a, 0xa7, - 0x37, 0x6e, 0x39, 0x17, 0xba, 0xe6, 0xec, 0x48, 0x95, 0x98, 0x0a, 0x12, 0x10, 0x9c, 0x36, 0x27, - 0x5e, 0xbe, 0x59, 0x19, 0x2b, 0xa4, 0x3f, 0x86, 0x99, 0x88, 0x70, 0x41, 0x68, 0xd8, 0x11, 0x47, - 0x09, 0x56, 0xcf, 0x35, 0xb7, 0xd1, 0x18, 0x40, 0xb4, 0x9d, 0x43, 0xf7, 0x8e, 0x12, 0xdc, 0x9e, - 0x8e, 0x7a, 0x07, 0xeb, 0x26, 0x4c, 0x75, 0x89, 0xdf, 0x11, 0xec, 0x10, 0x53, 0xdd, 0x83, 0x6a, - 0x97, 0xf8, 0x7b, 0xf2, 0x6c, 0x51, 0x58, 0x88, 0x09, 0x25, 0x71, 0x16, 0x77, 0x7c, 0x9c, 0x30, - 0x4e, 0x44, 0x27, 0x45, 0x02, 0xe7, 0xdd, 0x68, 0x7e, 0x2a, 0xe5, 0xbc, 0x7e, 0xb3, 0xf2, 0x51, - 0x48, 0xc4, 0x41, 0xd6, 0x75, 0x3c, 0x16, 0x6b, 0xdb, 0xf4, 0x9f, 0xfb, 0xdc, 0x3f, 0x74, 0xa5, - 0x38, 0xee, 0x6c, 0x62, 0xef, 0x8f, 0x5f, 0xef, 0x83, 0x76, 0x75, 0x13, 0x7b, 0x6d, 0x4b, 0x33, - 0x6f, 0xe6, 0xc4, 0x6d, 0x24, 0xb0, 0xf5, 0x00, 0x16, 0x51, 0x26, 0x58, 0x8c, 0x04, 0xf1, 0x3a, - 0x29, 0x0e, 0x08, 0x45, 0xd4, 0x23, 0x34, 0xac, 0x95, 0x57, 0x4b, 0x6b, 0xd5, 0xf6, 0x82, 0x09, - 0xb6, 0x7b, 0x31, 0xeb, 0x6b, 0x58, 0x2a, 0x44, 0x76, 0x89, 0xef, 0xcb, 0x86, 0x24, 0x38, 0x25, - 0xcc, 0xaf, 0x55, 0x54, 0x6f, 0x97, 0x9d, 0x7c, 0x86, 0x9d, 0x62, 0x86, 0x9d, 0x4d, 0x3d, 0xc3, - 0xcd, 0xaa, 0x7c, 0x82, 0x9f, 0xfe, 0x5a, 0x29, 0xb5, 0x8b, 0xe7, 0x6c, 0xe6, 0x0c, 0xbb, 0x8a, - 0x40, 0x7b, 0xac, 0xcd, 0x34, 0x1e, 0x27, 0x70, 0xbd, 0xc5, 0xc3, 0x47, 0x88, 0x7a, 0x38, 0xda, - 0x09, 0x84, 0x6e, 0xed, 0x08, 0xbd, 0x6e, 0xbc, 0x0f, 0x37, 0x2f, 0xa8, 0x68, 0x04, 0xbd, 0x1e, - 0x87, 0xe9, 0x16, 0x0f, 0x77, 0x23, 0xe4, 0xe1, 0x26, 0xf1, 0x47, 0x39, 0x75, 0x9f, 0x01, 0xc8, - 0x71, 0x41, 0x31, 0xcb, 0xa8, 0x50, 0x33, 0x27, 0x1b, 0xac, 0x6d, 0x95, 0x4b, 0xc0, 0xd1, 0x4b, - 0xc0, 0x79, 0xc4, 0x08, 0xd5, 0xb9, 0x72, 0xc2, 0x1e, 0xaa, 0x0c, 0xeb, 0x73, 0x98, 0xeb, 0x33, - 0x69, 0x42, 0x71, 0xd8, 0xe7, 0x4c, 0xda, 0x2b, 0x36, 0x51, 0xee, 0xd2, 0x0b, 0xe9, 0xd2, 0x6c, - 0xf7, 0xb4, 0x3d, 0x72, 0x3c, 0x8b, 0xb1, 0x8c, 0x30, 0x55, 0xa4, 0xff, 0xdd, 0x78, 0x6a, 0xe6, - 0xed, 0x9c, 0x58, 0x8d, 0xe7, 0x3d, 0xb8, 0xd6, 0x1b, 0xcf, 0x04, 0x1d, 0xc5, 0x98, 0x0a, 0x3d, - 0x9a, 0xf3, 0x26, 0xb0, 0x9b, 0x7f, 0x6e, 0x6d, 0xc1, 0x5c, 0x21, 0x4e, 0x77, 0xab, 0x32, 0x5c, - 0xb7, 0x66, 0x75, 0x5a, 0xde, 0xb1, 0xc6, 0xa2, 0x9a, 0xb6, 0xc2, 0x5b, 0xe3, 0x39, 0x81, 0x19, - 0x33, 0x12, 0xa3, 0xf5, 0xbc, 0xb1, 0x04, 0x0b, 0xa7, 0x4b, 0x19, 0x09, 0x31, 0xcc, 0xb7, 0x78, - 0xf8, 0x98, 0xfa, 0xff, 0xcf, 0x97, 0xc0, 0x86, 0x5a, 0x7f, 0x39, 0x23, 0x85, 0xa9, 0x2f, 0xea, - 0x97, 0x38, 0x8a, 0x08, 0x0d, 0x37, 0xb1, 0x47, 0x38, 0x61, 0x74, 0x94, 0x62, 0xde, 0x03, 0xfb, - 0x7c, 0x41, 0x23, 0xe7, 0x3b, 0x98, 0x95, 0x9e, 0xa1, 0xa3, 0xad, 0x2c, 0x1a, 0xb5, 0x3b, 0x37, - 0x60, 0xf1, 0x4c, 0x2d, 0x23, 0xe2, 0x97, 0x12, 0x4c, 0xb5, 0x78, 0xd8, 0x64, 0x69, 0xca, 0x7e, - 0x18, 0xe5, 0x4e, 0xf8, 0x04, 0xca, 0xff, 0x6e, 0x1f, 0x68, 0x78, 0xe3, 0x3a, 0x5c, 0x33, 0x02, - 0x8d, 0xec, 0x9f, 0x4b, 0x50, 0x6d, 0xf1, 0xb0, 0x8d, 0x13, 0x74, 0xf4, 0x56, 0xaa, 0xb6, 0xd4, - 0xd8, 0x2b, 0x7d, 0x85, 0xe8, 0x8d, 0xdf, 0x2b, 0x30, 0xde, 0xe2, 0xa1, 0xf5, 0x15, 0x54, 0x8a, - 0x4b, 0xca, 0x07, 0x03, 0x24, 0xf5, 0x2e, 0x0d, 0xf6, 0x9d, 0x2b, 0x21, 0x45, 0x01, 0x49, 0x5c, - 0xdc, 0x29, 0x2e, 0x21, 0xd6, 0x90, 0xcb, 0x88, 0xfb, 0x5e, 0x66, 0x56, 0x0a, 0xf3, 0xe7, 0xde, - 0x64, 0x77, 0x07, 0xa7, 0xf7, 0x63, 0xed, 0x8d, 0xe1, 0xb1, 0xa6, 0xe6, 0x33, 0xa8, 0x9a, 0x77, - 0x55, 0x63, 0x70, 0x7e, 0x81, 0xb1, 0xef, 0x5e, 0x8d, 0x31, 0xdc, 0xdf, 0xc0, 0x54, 0x6f, 0x29, - 0x7e, 0x78, 0x95, 0x38, 0xc9, 0x7e, 0x6f, 0x08, 0x90, 0xa1, 0x67, 0xf0, 0x6e, 0xff, 0x96, 0xb9, - 0xa4, 0xd9, 0x7d, 0x50, 0x7b, 0x7d, 0x68, 0xa8, 0x29, 0x48, 0x60, 0xf6, 0xec, 0x86, 0xbd, 0x3d, - 0x98, 0xe3, 0x0c, 0xd0, 0x76, 0x87, 0x04, 0x9a, 0x52, 0xdf, 0x02, 0x9c, 0x5a, 0x59, 0xb7, 0x2e, - 0x69, 0xba, 0x41, 0xd9, 0x1f, 0x0f, 0x83, 0x32, 0x15, 0xf6, 0xa0, 0xac, 0xd7, 0xd1, 0xea, 0xe0, - 0xbc, 0x1c, 0x61, 0xaf, 0x5d, 0x85, 0x30, 0xac, 0x5f, 0xc0, 0x64, 0xbe, 0x2d, 0x56, 0x06, 0xa7, - 0x28, 0x80, 0x7d, 0xfb, 0x0a, 0x40, 0x41, 0xd9, 0x7c, 0xf2, 0xf2, 0xb8, 0x5e, 0x7a, 0x75, 0x5c, - 0x2f, 0xfd, 0x7d, 0x5c, 0x2f, 0xbd, 0x38, 0xa9, 0x8f, 0xbd, 0x3a, 0xa9, 0x8f, 0xfd, 0x79, 0x52, - 0x1f, 0x7b, 0xe6, 0x9c, 0xba, 0x4d, 0xec, 0xd3, 0x7d, 0x4a, 0xb6, 0x88, 0xeb, 0x1d, 0x20, 0x42, - 0xdd, 0xe7, 0xfd, 0xbf, 0xc8, 0xe4, 0xcd, 0xa2, 0x5b, 0x56, 0x17, 0x9a, 0x07, 0xff, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x68, 0x66, 0x96, 0x15, 0xb7, 0x0d, 0x00, 0x00, + // 922 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x8f, 0xdb, 0x44, + 0x14, 0x5e, 0x37, 0x4d, 0x36, 0x79, 0xd9, 0xd2, 0xad, 0xbb, 0x2d, 0x5e, 0x53, 0x25, 0xc1, 0x48, + 0x6d, 0x4a, 0x55, 0x5b, 0x1b, 0x84, 0x50, 0xa5, 0x9e, 0xd2, 0x14, 0xa8, 0x44, 0x56, 0x8b, 0x69, + 0x85, 0x54, 0x81, 0xa2, 0xb1, 0x3d, 0x76, 0x47, 0x8d, 0x67, 0x2c, 0xcf, 0x04, 0x36, 0x7f, 0x80, + 0x73, 0x8f, 0x1c, 0x39, 0x20, 0x71, 0xe4, 0xc2, 0x8f, 0xe8, 0xb1, 0xe2, 0x84, 0x38, 0x14, 0xb4, + 0xfb, 0x47, 0x90, 0xc7, 0x63, 0x6f, 0x92, 0x36, 0x9b, 0x08, 0x35, 0xa7, 0x64, 0xfc, 0xbe, 0xf7, + 0x7d, 0x9f, 0xdf, 0x7b, 0x33, 0x63, 0x68, 0x4d, 0xe8, 0x84, 0x92, 0x90, 0x38, 0x34, 0x14, 0x1e, + 0xf2, 0x9f, 0xe3, 0x60, 0xcc, 0x10, 0x75, 0xc4, 0xb1, 0x9d, 0xa4, 0x4c, 0x30, 0xfd, 0x9a, 0x8a, + 0xdb, 0x73, 0x71, 0x73, 0x2f, 0x62, 0x11, 0x93, 0x08, 0x27, 0xfb, 0x97, 0x83, 0xcd, 0x76, 0xc4, + 0x58, 0x34, 0xc6, 0x8e, 0x5c, 0x79, 0x93, 0xd0, 0x11, 0x24, 0xc6, 0x5c, 0xa0, 0x38, 0x51, 0x80, + 0xd6, 0x22, 0x20, 0x98, 0xa4, 0x48, 0x10, 0x46, 0x8b, 0xb8, 0xcf, 0x78, 0xcc, 0xb8, 0xe3, 0x21, + 0x8e, 0x9d, 0x1f, 0x0e, 0x3c, 0x2c, 0xd0, 0x81, 0xe3, 0x33, 0x52, 0xc4, 0x6f, 0xbf, 0xdd, 0xed, + 0xdc, 0x4a, 0x41, 0xf7, 0x73, 0xaa, 0x51, 0x6e, 0x32, 0x5f, 0xe4, 0x21, 0xeb, 0xf7, 0x0b, 0x00, + 0x43, 0x1e, 0x7d, 0x45, 0xb8, 0x38, 0x0c, 0x85, 0x7e, 0x1d, 0x6a, 0x1c, 0xd3, 0x00, 0xa7, 0x86, + 0xd6, 0xd1, 0xba, 0x0d, 0x57, 0xad, 0xf4, 0x7b, 0x50, 0xa3, 0xa1, 0x18, 0x91, 0xc0, 0xb8, 0xd0, + 0xd1, 0xba, 0xcd, 0xde, 0x0d, 0xfb, 0xad, 0xb5, 0xb0, 0x0f, 0x43, 0xf1, 0x28, 0xe8, 0x5f, 0x7c, + 0xf9, 0xba, 0xbd, 0xe5, 0x56, 0x69, 0xb6, 0xd0, 0x3f, 0x80, 0x86, 0x47, 0x82, 0x51, 0x80, 0x29, + 0x8b, 0x8d, 0x8a, 0x64, 0xad, 0x7b, 0x24, 0x18, 0x64, 0x6b, 0x3d, 0x84, 0xdd, 0x98, 0xd0, 0x51, + 0x80, 0x13, 0xc6, 0x89, 0x18, 0xa5, 0x48, 0x60, 0xe3, 0x62, 0x86, 0xe9, 0xdf, 0xcf, 0x38, 0xfe, + 0x7e, 0xdd, 0xbe, 0x19, 0x11, 0xf1, 0x6c, 0xe2, 0xd9, 0x3e, 0x8b, 0x95, 0x73, 0xf5, 0x73, 0x97, + 0x07, 0xcf, 0x1d, 0x31, 0x4d, 0x30, 0xb7, 0x07, 0xd8, 0xff, 0xf3, 0x8f, 0xbb, 0xa0, 0x5e, 0x6c, + 0x80, 0x7d, 0xf7, 0xbd, 0x98, 0xd0, 0x41, 0x4e, 0xea, 0x22, 0x81, 0xf5, 0x47, 0x90, 0x3d, 0x19, + 0x65, 0x46, 0x12, 0x9c, 0x12, 0x16, 0x18, 0x55, 0xf9, 0x1e, 0xfb, 0x76, 0xde, 0x05, 0xbb, 0xe8, + 0x82, 0x3d, 0x50, 0x5d, 0xe8, 0xd7, 0x33, 0x03, 0x3f, 0xff, 0xd3, 0xd6, 0xdc, 0x9d, 0x98, 0xd0, + 0x3e, 0x09, 0x8e, 0x64, 0xa2, 0xb5, 0x07, 0xfa, 0x59, 0xc1, 0x5c, 0xcc, 0x13, 0x46, 0x39, 0xb6, + 0x30, 0xec, 0x0e, 0x79, 0xf4, 0x00, 0x51, 0x1f, 0x8f, 0xb3, 0x18, 0xa1, 0xd1, 0x06, 0x8a, 0x69, + 0x99, 0x60, 0x2c, 0xca, 0x94, 0x16, 0x7e, 0xa9, 0x40, 0x73, 0xc8, 0xa3, 0xa3, 0x31, 0xf2, 0x71, + 0x9f, 0x04, 0x9b, 0xe8, 0xe5, 0xa7, 0x50, 0x4d, 0x52, 0xe2, 0x63, 0xd9, 0xc7, 0xac, 0x7a, 0xaa, + 0xe4, 0xd9, 0x8c, 0xda, 0x6a, 0x46, 0xed, 0x07, 0x8c, 0xd0, 0x22, 0x4d, 0xa2, 0xf5, 0xfb, 0x50, + 0xc3, 0xc7, 0x09, 0x49, 0xa7, 0xb2, 0xb7, 0xcd, 0x9e, 0xf9, 0x46, 0xd5, 0x1f, 0x17, 0x9b, 0x23, + 0x2f, 0xfb, 0x8b, 0xac, 0xec, 0x2a, 0x47, 0x47, 0x70, 0x89, 0x50, 0x81, 0x53, 0xcc, 0xd5, 0x80, + 0x54, 0xdf, 0xc1, 0x80, 0xec, 0x14, 0x94, 0x72, 0x3c, 0xee, 0xc0, 0x15, 0x34, 0x11, 0x2c, 0x46, + 0x82, 0xf8, 0xa3, 0x04, 0x4d, 0x63, 0x4c, 0x85, 0x51, 0xeb, 0x68, 0xdd, 0xba, 0xbb, 0x5b, 0x06, + 0x8e, 0xf2, 0xe7, 0xfa, 0x3d, 0xd8, 0x56, 0xf3, 0x6a, 0x6c, 0xaf, 0x57, 0x86, 0x02, 0x6f, 0x5d, + 0x83, 0xab, 0x33, 0x1d, 0x2a, 0x3b, 0x87, 0x60, 0xa7, 0xec, 0xea, 0x66, 0x3a, 0x67, 0x5d, 0x87, + 0xbd, 0x59, 0x89, 0x85, 0xb9, 0x7d, 0x48, 0x83, 0xc3, 0x50, 0x6c, 0x7c, 0x6e, 0xe7, 0x64, 0x4a, + 0x0b, 0x91, 0xdc, 0x50, 0xdf, 0xe0, 0xf1, 0x98, 0xd0, 0x68, 0x80, 0x7d, 0xc2, 0x09, 0xa3, 0x9b, + 0x30, 0x71, 0x03, 0xcc, 0x37, 0x85, 0x4a, 0x1b, 0x01, 0x5c, 0xce, 0x7a, 0x83, 0xa6, 0x2e, 0x8e, + 0x11, 0x91, 0x5a, 0x1b, 0xf0, 0xb0, 0x0f, 0xef, 0x2f, 0xa8, 0x94, 0x06, 0xbe, 0x83, 0x46, 0x9f, + 0xa5, 0x29, 0xfb, 0x51, 0x8d, 0x80, 0x47, 0x82, 0x19, 0xe9, 0x7c, 0xa5, 0x7f, 0x06, 0x35, 0x14, + 0xb3, 0x09, 0x15, 0x4a, 0x7a, 0xe5, 0xec, 0x29, 0xb8, 0xf5, 0x9b, 0x06, 0x8d, 0x21, 0x8f, 0x72, + 0x85, 0x4d, 0x9c, 0x0d, 0x5f, 0x40, 0xd3, 0x93, 0xe4, 0xd9, 0x29, 0xcb, 0x8d, 0x4a, 0xa7, 0xd2, + 0x6d, 0xf6, 0x3a, 0x4b, 0xf2, 0xcb, 0x17, 0x55, 0x1c, 0xe0, 0x15, 0x0f, 0xb8, 0x75, 0x15, 0xae, + 0x94, 0x46, 0xcb, 0xe2, 0xfc, 0xaa, 0x41, 0x7d, 0xc8, 0x23, 0x17, 0x27, 0x68, 0xba, 0x09, 0xf7, + 0x0f, 0x01, 0xd2, 0x8c, 0xfb, 0xff, 0x98, 0x6f, 0xc8, 0x4c, 0xe9, 0x5d, 0x97, 0xdb, 0x49, 0xba, + 0x2c, 0xac, 0xf7, 0x7e, 0xaa, 0x41, 0x65, 0xc8, 0x23, 0xfd, 0x5b, 0xd8, 0x2e, 0xae, 0xd9, 0x0f, + 0x97, 0x30, 0x9f, 0x5d, 0x2c, 0xe6, 0xed, 0x95, 0x90, 0x42, 0x40, 0x27, 0x70, 0x69, 0xfe, 0xe2, + 0xb9, 0xb5, 0x3c, 0x77, 0x0e, 0x68, 0x3a, 0x6b, 0x02, 0x4b, 0xa9, 0xa7, 0x50, 0x2f, 0xef, 0x17, + 0x6b, 0x79, 0x72, 0x81, 0x31, 0x3f, 0x5e, 0x8d, 0x29, 0xb9, 0xbf, 0x87, 0xc6, 0xd9, 0x11, 0xf8, + 0xd1, 0x2a, 0x67, 0x19, 0xfb, 0x9d, 0x35, 0x40, 0x25, 0x3d, 0x83, 0xcb, 0x8b, 0x67, 0xcc, 0x39, + 0x35, 0x5e, 0x80, 0x9a, 0x07, 0x6b, 0x43, 0x4b, 0xc1, 0x10, 0x76, 0xe6, 0x4e, 0x93, 0x9b, 0xe7, + 0xd4, 0x62, 0x06, 0x67, 0xda, 0xeb, 0xe1, 0x4a, 0x9d, 0xc7, 0x50, 0x53, 0xbb, 0xba, 0xb3, 0x3c, + 0x33, 0x47, 0x98, 0xdd, 0x55, 0x88, 0x92, 0xf5, 0x6b, 0xa8, 0xe6, 0x9b, 0xad, 0xbd, 0x3c, 0x45, + 0x02, 0xcc, 0x5b, 0x2b, 0x00, 0x05, 0x65, 0xff, 0xcb, 0x97, 0x27, 0x2d, 0xed, 0xd5, 0x49, 0x4b, + 0xfb, 0xf7, 0xa4, 0xa5, 0xbd, 0x38, 0x6d, 0x6d, 0xbd, 0x3a, 0x6d, 0x6d, 0xfd, 0x75, 0xda, 0xda, + 0x7a, 0x6a, 0xcf, 0xdc, 0xe1, 0x4f, 0xe8, 0x13, 0x4a, 0x3e, 0x27, 0x8e, 0xff, 0x0c, 0x11, 0xea, + 0x1c, 0x2f, 0x7e, 0x8c, 0x67, 0xf7, 0xb9, 0x57, 0x93, 0x1f, 0x0e, 0x9f, 0xfc, 0x17, 0x00, 0x00, + 0xff, 0xff, 0x99, 0x64, 0xca, 0x7e, 0xb2, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1129,14 +1044,12 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - MintNft(ctx context.Context, in *MsgMintNft, opts ...grpc.CallOption) (*MsgMintNftResponse, error) ListNft(ctx context.Context, in *MsgListNft, opts ...grpc.CallOption) (*MsgListNftResponse, error) - CancelNftListing(ctx context.Context, in *MsgCancelNftListing, opts ...grpc.CallOption) (*MsgCancelNftListingResponse, error) + CancelListing(ctx context.Context, in *MsgCancelListing, opts ...grpc.CallOption) (*MsgCancelListingResponse, error) PlaceBid(ctx context.Context, in *MsgPlaceBid, opts ...grpc.CallOption) (*MsgPlaceBidResponse, error) CancelBid(ctx context.Context, in *MsgCancelBid, opts ...grpc.CallOption) (*MsgCancelBidResponse, error) SellingDecision(ctx context.Context, in *MsgSellingDecision, opts ...grpc.CallOption) (*MsgSellingDecisionResponse, error) - EndNftListing(ctx context.Context, in *MsgEndNftListing, opts ...grpc.CallOption) (*MsgEndNftListingResponse, error) - PayFullBid(ctx context.Context, in *MsgPayFullBid, opts ...grpc.CallOption) (*MsgPayFullBidResponse, error) + PayRemainder(ctx context.Context, in *MsgPayRemainder, opts ...grpc.CallOption) (*MsgPayRemainderResponse, error) Borrow(ctx context.Context, in *MsgBorrow, opts ...grpc.CallOption) (*MsgBorrowResponse, error) Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOption) (*MsgRepayResponse, error) } @@ -1149,15 +1062,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) MintNft(ctx context.Context, in *MsgMintNft, opts ...grpc.CallOption) (*MsgMintNftResponse, error) { - out := new(MsgMintNftResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/MintNft", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) ListNft(ctx context.Context, in *MsgListNft, opts ...grpc.CallOption) (*MsgListNftResponse, error) { out := new(MsgListNftResponse) err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/ListNft", in, out, opts...) @@ -1167,9 +1071,9 @@ func (c *msgClient) ListNft(ctx context.Context, in *MsgListNft, opts ...grpc.Ca return out, nil } -func (c *msgClient) CancelNftListing(ctx context.Context, in *MsgCancelNftListing, opts ...grpc.CallOption) (*MsgCancelNftListingResponse, error) { - out := new(MsgCancelNftListingResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/CancelNftListing", in, out, opts...) +func (c *msgClient) CancelListing(ctx context.Context, in *MsgCancelListing, opts ...grpc.CallOption) (*MsgCancelListingResponse, error) { + out := new(MsgCancelListingResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/CancelListing", in, out, opts...) if err != nil { return nil, err } @@ -1203,18 +1107,9 @@ func (c *msgClient) SellingDecision(ctx context.Context, in *MsgSellingDecision, return out, nil } -func (c *msgClient) EndNftListing(ctx context.Context, in *MsgEndNftListing, opts ...grpc.CallOption) (*MsgEndNftListingResponse, error) { - out := new(MsgEndNftListingResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/EndNftListing", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) PayFullBid(ctx context.Context, in *MsgPayFullBid, opts ...grpc.CallOption) (*MsgPayFullBidResponse, error) { - out := new(MsgPayFullBidResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/PayFullBid", in, out, opts...) +func (c *msgClient) PayRemainder(ctx context.Context, in *MsgPayRemainder, opts ...grpc.CallOption) (*MsgPayRemainderResponse, error) { + out := new(MsgPayRemainderResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftbackedloan.Msg/PayRemainder", in, out, opts...) if err != nil { return nil, err } @@ -1241,14 +1136,12 @@ func (c *msgClient) Repay(ctx context.Context, in *MsgRepay, opts ...grpc.CallOp // MsgServer is the server API for Msg service. type MsgServer interface { - MintNft(context.Context, *MsgMintNft) (*MsgMintNftResponse, error) ListNft(context.Context, *MsgListNft) (*MsgListNftResponse, error) - CancelNftListing(context.Context, *MsgCancelNftListing) (*MsgCancelNftListingResponse, error) + CancelListing(context.Context, *MsgCancelListing) (*MsgCancelListingResponse, error) PlaceBid(context.Context, *MsgPlaceBid) (*MsgPlaceBidResponse, error) CancelBid(context.Context, *MsgCancelBid) (*MsgCancelBidResponse, error) SellingDecision(context.Context, *MsgSellingDecision) (*MsgSellingDecisionResponse, error) - EndNftListing(context.Context, *MsgEndNftListing) (*MsgEndNftListingResponse, error) - PayFullBid(context.Context, *MsgPayFullBid) (*MsgPayFullBidResponse, error) + PayRemainder(context.Context, *MsgPayRemainder) (*MsgPayRemainderResponse, error) Borrow(context.Context, *MsgBorrow) (*MsgBorrowResponse, error) Repay(context.Context, *MsgRepay) (*MsgRepayResponse, error) } @@ -1257,14 +1150,11 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) MintNft(ctx context.Context, req *MsgMintNft) (*MsgMintNftResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MintNft not implemented") -} func (*UnimplementedMsgServer) ListNft(ctx context.Context, req *MsgListNft) (*MsgListNftResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListNft not implemented") } -func (*UnimplementedMsgServer) CancelNftListing(ctx context.Context, req *MsgCancelNftListing) (*MsgCancelNftListingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelNftListing not implemented") +func (*UnimplementedMsgServer) CancelListing(ctx context.Context, req *MsgCancelListing) (*MsgCancelListingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelListing not implemented") } func (*UnimplementedMsgServer) PlaceBid(ctx context.Context, req *MsgPlaceBid) (*MsgPlaceBidResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PlaceBid not implemented") @@ -1275,11 +1165,8 @@ func (*UnimplementedMsgServer) CancelBid(ctx context.Context, req *MsgCancelBid) func (*UnimplementedMsgServer) SellingDecision(ctx context.Context, req *MsgSellingDecision) (*MsgSellingDecisionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SellingDecision not implemented") } -func (*UnimplementedMsgServer) EndNftListing(ctx context.Context, req *MsgEndNftListing) (*MsgEndNftListingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EndNftListing not implemented") -} -func (*UnimplementedMsgServer) PayFullBid(ctx context.Context, req *MsgPayFullBid) (*MsgPayFullBidResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PayFullBid not implemented") +func (*UnimplementedMsgServer) PayRemainder(ctx context.Context, req *MsgPayRemainder) (*MsgPayRemainderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PayRemainder not implemented") } func (*UnimplementedMsgServer) Borrow(ctx context.Context, req *MsgBorrow) (*MsgBorrowResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Borrow not implemented") @@ -1292,24 +1179,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_MintNft_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgMintNft) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).MintNft(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftbackedloan.Msg/MintNft", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).MintNft(ctx, req.(*MsgMintNft)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_ListNft_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgListNft) if err := dec(in); err != nil { @@ -1328,20 +1197,20 @@ func _Msg_ListNft_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } -func _Msg_CancelNftListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCancelNftListing) +func _Msg_CancelListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelListing) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).CancelNftListing(ctx, in) + return srv.(MsgServer).CancelListing(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftbackedloan.Msg/CancelNftListing", + FullMethod: "/ununifi.nftbackedloan.Msg/CancelListing", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CancelNftListing(ctx, req.(*MsgCancelNftListing)) + return srv.(MsgServer).CancelListing(ctx, req.(*MsgCancelListing)) } return interceptor(ctx, in, info, handler) } @@ -1400,38 +1269,20 @@ func _Msg_SellingDecision_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -func _Msg_EndNftListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgEndNftListing) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).EndNftListing(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftbackedloan.Msg/EndNftListing", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).EndNftListing(ctx, req.(*MsgEndNftListing)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_PayFullBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgPayFullBid) +func _Msg_PayRemainder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPayRemainder) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).PayFullBid(ctx, in) + return srv.(MsgServer).PayRemainder(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftbackedloan.Msg/PayFullBid", + FullMethod: "/ununifi.nftbackedloan.Msg/PayRemainder", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PayFullBid(ctx, req.(*MsgPayFullBid)) + return srv.(MsgServer).PayRemainder(ctx, req.(*MsgPayRemainder)) } return interceptor(ctx, in, info, handler) } @@ -1476,17 +1327,13 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ununifi.nftbackedloan.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "MintNft", - Handler: _Msg_MintNft_Handler, - }, { MethodName: "ListNft", Handler: _Msg_ListNft_Handler, }, { - MethodName: "CancelNftListing", - Handler: _Msg_CancelNftListing_Handler, + MethodName: "CancelListing", + Handler: _Msg_CancelListing_Handler, }, { MethodName: "PlaceBid", @@ -1501,12 +1348,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_SellingDecision_Handler, }, { - MethodName: "EndNftListing", - Handler: _Msg_EndNftListing_Handler, - }, - { - MethodName: "PayFullBid", - Handler: _Msg_PayFullBid_Handler, + MethodName: "PayRemainder", + Handler: _Msg_PayRemainder_Handler, }, { MethodName: "Borrow", @@ -1521,7 +1364,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "ununifi/nftbackedloan/tx.proto", } -func (m *MsgMintNft) Marshal() (dAtA []byte, err error) { +func (m *MsgListNft) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1531,44 +1374,51 @@ func (m *MsgMintNft) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMintNft) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgListNft) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgListNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftUriHash) > 0 { - i -= len(m.NftUriHash) - copy(dAtA[i:], m.NftUriHash) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftUriHash))) - i-- - dAtA[i] = 0x2a + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MinBidPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinBidPeriod):]) + if err1 != nil { + return 0, err1 } - if len(m.NftUri) > 0 { - i -= len(m.NftUri) - copy(dAtA[i:], m.NftUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftUri))) - i-- - dAtA[i] = 0x22 + i -= n1 + i = encodeVarintTx(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a + { + size := m.MinDepositRate.Size() + i -= size + if _, err := m.MinDepositRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x22 + if len(m.BidDenom) > 0 { + i -= len(m.BidDenom) + copy(dAtA[i:], m.BidDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BidDenom))) i-- dAtA[i] = 0x1a } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 + { + size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Sender) > 0 { i -= len(m.Sender) copy(dAtA[i:], m.Sender) @@ -1579,7 +1429,7 @@ func (m *MsgMintNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgMintNftResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgListNftResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1589,12 +1439,12 @@ func (m *MsgMintNftResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMintNftResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgListNftResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgListNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1602,7 +1452,7 @@ func (m *MsgMintNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgListNft) Marshal() (dAtA []byte, err error) { +func (m *MsgCancelListing) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1612,140 +1462,37 @@ func (m *MsgListNft) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgListNft) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCancelListing) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgListNft) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCancelListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MinimumBiddingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinimumBiddingPeriod):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintTx(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x3a - if m.AutomaticRefinancing { - i-- - if m.AutomaticRefinancing { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } { - size := m.MinimumDepositRate.Size() - i -= size - if _, err := m.MinimumDepositRate.MarshalTo(dAtA[i:]); err != nil { + size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - if len(m.BidToken) > 0 { - i -= len(m.BidToken) - copy(dAtA[i:], m.BidToken) - i = encodeVarintTx(dAtA, i, uint64(len(m.BidToken))) + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) i-- - dAtA[i] = 0x22 - } - if m.ListingType != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ListingType)) - i-- - dAtA[i] = 0x18 - } - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgListNftResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgListNftResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgListNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCancelNftListing) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCancelNftListing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCancelNftListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgCancelNftListingResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgCancelListingResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1755,12 +1502,12 @@ func (m *MsgCancelNftListingResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCancelNftListingResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCancelListingResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCancelNftListingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCancelListingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1789,7 +1536,7 @@ func (m *MsgPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.DepositAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1809,16 +1556,16 @@ func (m *MsgPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x30 } { - size := m.DepositLendingRate.Size() + size := m.InterestRate.Size() i -= size - if _, err := m.DepositLendingRate.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.InterestRate.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a - n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.BiddingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BiddingPeriod):]) + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Expiry, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry):]) if err5 != nil { return 0, err5 } @@ -1827,7 +1574,7 @@ func (m *MsgPlaceBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 { - size, err := m.BidAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Price.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2068,7 +1815,7 @@ func (m *MsgSellingDecisionResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *MsgPayFullBid) Marshal() (dAtA []byte, err error) { +func (m *MsgPayRemainder) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2078,12 +1825,12 @@ func (m *MsgPayFullBid) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgPayFullBid) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgPayRemainder) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgPayFullBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgPayRemainder) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2108,7 +1855,7 @@ func (m *MsgPayFullBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgPayFullBidResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgPayRemainderResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2118,12 +1865,12 @@ func (m *MsgPayFullBidResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgPayFullBidResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgPayRemainderResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgPayFullBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgPayRemainderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2131,7 +1878,7 @@ func (m *MsgPayFullBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgBorrow) Marshal() (dAtA []byte, err error) { +func (m *BorrowBid) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2141,12 +1888,12 @@ func (m *MsgBorrow) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgBorrow) MarshalTo(dAtA []byte) (int, error) { +func (m *BorrowBid) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *BorrowBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2160,7 +1907,51 @@ func (m *MsgBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBorrow) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBorrow) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBorrow) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BorrowBids) > 0 { + for iNdEx := len(m.BorrowBids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BorrowBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } { size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2224,16 +2015,20 @@ func (m *MsgRepay) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.RepayBids) > 0 { + for iNdEx := len(m.RepayBids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RepayBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x1a { size, err := m.NftId.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2288,44 +2083,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgMintNft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftUri) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftUriHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMintNftResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgListNft) Size() (n int) { if m == nil { return 0 @@ -2338,19 +2095,13 @@ func (m *MsgListNft) Size() (n int) { } l = m.NftId.Size() n += 1 + l + sovTx(uint64(l)) - if m.ListingType != 0 { - n += 1 + sovTx(uint64(m.ListingType)) - } - l = len(m.BidToken) + l = len(m.BidDenom) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.MinimumDepositRate.Size() + l = m.MinDepositRate.Size() n += 1 + l + sovTx(uint64(l)) - if m.AutomaticRefinancing { - n += 2 - } - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinimumBiddingPeriod) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MinBidPeriod) n += 1 + l + sovTx(uint64(l)) return n } @@ -2364,7 +2115,7 @@ func (m *MsgListNftResponse) Size() (n int) { return n } -func (m *MsgCancelNftListing) Size() (n int) { +func (m *MsgCancelListing) Size() (n int) { if m == nil { return 0 } @@ -2379,7 +2130,7 @@ func (m *MsgCancelNftListing) Size() (n int) { return n } -func (m *MsgCancelNftListingResponse) Size() (n int) { +func (m *MsgCancelListingResponse) Size() (n int) { if m == nil { return 0 } @@ -2400,16 +2151,16 @@ func (m *MsgPlaceBid) Size() (n int) { } l = m.NftId.Size() n += 1 + l + sovTx(uint64(l)) - l = m.BidAmount.Size() + l = m.Price.Size() n += 1 + l + sovTx(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.BiddingPeriod) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry) n += 1 + l + sovTx(uint64(l)) - l = m.DepositLendingRate.Size() + l = m.InterestRate.Size() n += 1 + l + sovTx(uint64(l)) if m.AutomaticPayment { n += 2 } - l = m.DepositAmount.Size() + l = m.Deposit.Size() n += 1 + l + sovTx(uint64(l)) return n } @@ -2495,7 +2246,7 @@ func (m *MsgSellingDecisionResponse) Size() (n int) { return n } -func (m *MsgPayFullBid) Size() (n int) { +func (m *MsgPayRemainder) Size() (n int) { if m == nil { return 0 } @@ -2510,332 +2261,95 @@ func (m *MsgPayFullBid) Size() (n int) { return n } -func (m *MsgPayFullBidResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBorrow) Size() (n int) { +func (m *MsgPayRemainderResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgBorrowResponse) Size() (n int) { +func (m *BorrowBid) Size() (n int) { if m == nil { return 0 - } - var l int - _ = l - return n -} - -func (m *MsgRepay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.NftId.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgRepayResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgMintNft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMintNft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftUriHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftUriHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + } + var l int + _ = l + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBorrow) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.NftId.Size() + n += 1 + l + sovTx(uint64(l)) + if len(m.BorrowBids) > 0 { + for _, e := range m.BorrowBids { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *MsgBorrowResponse) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + return n } -func (m *MsgMintNftResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMintNftResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNftResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + +func (m *MsgRepay) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.NftId.Size() + n += 1 + l + sovTx(uint64(l)) + if len(m.RepayBids) > 0 { + for _, e := range m.RepayBids { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *MsgRepayResponse) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *MsgListNft) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -2932,27 +2446,8 @@ func (m *MsgListNft) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ListingType", wireType) - } - m.ListingType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ListingType |= ListingType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidToken", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BidDenom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2980,11 +2475,11 @@ func (m *MsgListNft) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BidToken = string(dAtA[iNdEx:postIndex]) + m.BidDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumDepositRate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3012,33 +2507,13 @@ func (m *MsgListNft) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MinimumDepositRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MinDepositRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutomaticRefinancing", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AutomaticRefinancing = bool(v != 0) - case 7: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumBiddingPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinBidPeriod", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3065,7 +2540,7 @@ func (m *MsgListNft) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.MinimumBiddingPeriod, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.MinBidPeriod, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3140,7 +2615,7 @@ func (m *MsgListNftResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCancelNftListing) Unmarshal(dAtA []byte) error { +func (m *MsgCancelListing) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3163,10 +2638,10 @@ func (m *MsgCancelNftListing) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCancelNftListing: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelListing: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelNftListing: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelListing: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3255,7 +2730,7 @@ func (m *MsgCancelNftListing) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCancelNftListingResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCancelListingResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3278,10 +2753,10 @@ func (m *MsgCancelNftListingResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCancelNftListingResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCancelListingResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelNftListingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCancelListingResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3401,7 +2876,7 @@ func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3428,13 +2903,13 @@ func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BiddingPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3461,13 +2936,13 @@ func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.BiddingPeriod, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Expiry, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositLendingRate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InterestRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3495,7 +2970,7 @@ func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DepositLendingRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.InterestRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3521,7 +2996,7 @@ func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { m.AutomaticPayment = bool(v != 0) case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3548,7 +3023,7 @@ func (m *MsgPlaceBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DepositAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4118,7 +3593,7 @@ func (m *MsgSellingDecisionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgPayFullBid) Unmarshal(dAtA []byte) error { +func (m *MsgPayRemainder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4141,10 +3616,10 @@ func (m *MsgPayFullBid) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgPayFullBid: wiretype end group for non-group") + return fmt.Errorf("proto: MsgPayRemainder: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPayFullBid: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgPayRemainder: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4233,7 +3708,57 @@ func (m *MsgPayFullBid) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgPayFullBidResponse) Unmarshal(dAtA []byte) error { +func (m *MsgPayRemainderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPayRemainderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPayRemainderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BorrowBid) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4256,12 +3781,77 @@ func (m *MsgPayFullBidResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgPayFullBidResponse: wiretype end group for non-group") + return fmt.Errorf("proto: BorrowBid: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPayFullBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BorrowBid: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4379,7 +3969,7 @@ func (m *MsgBorrow) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BorrowBids", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4406,7 +3996,8 @@ func (m *MsgBorrow) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BorrowBids = append(m.BorrowBids, BorrowBid{}) + if err := m.BorrowBids[len(m.BorrowBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4577,7 +4168,7 @@ func (m *MsgRepay) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RepayBids", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4604,7 +4195,8 @@ func (m *MsgRepay) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RepayBids = append(m.RepayBids, BorrowBid{}) + if err := m.RepayBids[len(m.RepayBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/nftfactory/client/cli/flags.go b/x/nftfactory/client/cli/flags.go index ed6157a42..1a085c4d9 100644 --- a/x/nftfactory/client/cli/flags.go +++ b/x/nftfactory/client/cli/flags.go @@ -5,17 +5,28 @@ import ( ) const ( + FlagName = "name" FlagSymbol = "symbol" FlagDescription = "description" - FlagClassUri = "class-uri" + FlagUri = "uri" + FlagUriHash = "uri-hash" ) var ( FsCreateClass = flag.NewFlagSet("", flag.ContinueOnError) + FsUpdateClass = flag.NewFlagSet("", flag.ContinueOnError) ) func init() { + FsCreateClass.String(FlagName, "", "Class name") FsCreateClass.String(FlagSymbol, "", "Class symbol") FsCreateClass.String(FlagDescription, "", "Description for denom") - FsCreateClass.String(FlagClassUri, "", "Content URI for class") + FsCreateClass.String(FlagUri, "", "Content URI for class") + FsCreateClass.String(FlagUriHash, "", "Hash of content URI for class") + + FsUpdateClass.String(FlagName, "", "Class name") + FsUpdateClass.String(FlagSymbol, "", "Class symbol") + FsUpdateClass.String(FlagDescription, "", "Description for denom") + FsUpdateClass.String(FlagUri, "", "Content URI for class") + FsUpdateClass.String(FlagUriHash, "", "Hash of content URI for class") } diff --git a/x/nftfactory/client/cli/query.go b/x/nftfactory/client/cli/query.go index 0ba484408..31e9af70e 100644 --- a/x/nftfactory/client/cli/query.go +++ b/x/nftfactory/client/cli/query.go @@ -1,8 +1,8 @@ package cli import ( - "context" "fmt" + "strings" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -13,8 +13,8 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - +func GetQueryCmd() *cobra.Command { + // Group tokenfactory queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), @@ -24,139 +24,102 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand( - CmdQueryParams(), - CmdQueryClassAttributes(), - CmdQueryClassIdsByOwner(), - CmdQueryClassIdsByName(), - CmdQueryNFTMinter(), + GetParams(), + GetCmdClassAuthorityMetadata(), + GetCmdDenomsFromCreator(), ) return cmd } -func CmdQueryParams() *cobra.Command { +// GetParams returns the params for the module +func GetParams() *cobra.Command { cmd := &cobra.Command{ - Use: "params", - Short: "shows params", + Use: "params [flags]", + Short: "Get the params for the x/nftfactory module", Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - - res, err := queryClient.Params(context.Background(), params) + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -func CmdQueryClassAttributes() *cobra.Command { - cmd := &cobra.Command{ - Use: "class-attributes [class-id]", - Args: cobra.ExactArgs(1), - Short: "Query the class attributes by class-id", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.ClassAttributes( - context.Background(), - &types.QueryClassAttributesRequest{ClassId: args[0]}, - ) + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) if err != nil { return err } + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) + return cmd } -func CmdQueryClassIdsByOwner() *cobra.Command { +// GetCmdClassAuthorityMetadata returns the authority metadata for a queried denom +func GetCmdClassAuthorityMetadata() *cobra.Command { cmd := &cobra.Command{ - Use: "class-ids-by-owner [owner-address]", + Use: "class-authority-metadata [class-id] [flags]", + Short: "Get the authority metadata for a specific class id", Args: cobra.ExactArgs(1), - Short: "Query classIDs owned by the owner address", RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.ClassIdsByOwner( - context.Background(), - &types.QueryClassIdsByOwnerRequest{Owner: args[0]}, - ) + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} + queryClient := types.NewQueryClient(clientCtx) -func CmdQueryClassIdsByName() *cobra.Command { - cmd := &cobra.Command{ - Use: "class-ids-by-name [class-name]", - Args: cobra.ExactArgs(1), - Short: "Query classIDs which have the class name", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) + denom := strings.Split(args[0], "/") - queryClient := types.NewQueryClient(clientCtx) + if len(denom) != 3 { + return fmt.Errorf("invalid denom format, expected format: factory/[creator]/[subdenom]") + } - res, err := queryClient.ClassIdsByName( - context.Background(), - &types.QueryClassIdsByNameRequest{ClassName: args[0]}, - ) + res, err := queryClient.ClassAuthorityMetadata(cmd.Context(), &types.QueryClassAuthorityMetadataRequest{ + Creator: denom[1], + Subclass: denom[2], + }) if err != nil { return err } + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) + return cmd } -func CmdQueryNFTMinter() *cobra.Command { +// GetCmdDenomsFromCreator a command to get a list of all tokens created by a specific creator address +func GetCmdDenomsFromCreator() *cobra.Command { cmd := &cobra.Command{ - Use: "nft-minter [class-id] [nft-id]", - Args: cobra.ExactArgs(2), - Short: "Query nft minter with class and nft id", + Use: "classes-from-creator [creator address] [flags]", + Short: "Returns a list of all tokens created by a specific creator address", + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.NFTMinter( - context.Background(), - &types.QueryNFTMinterRequest{ - ClassId: args[0], - NftId: args[1], - }, - ) + res, err := queryClient.ClassesFromCreator(cmd.Context(), &types.QueryClassesFromCreatorRequest{ + Creator: args[0], + }) if err != nil { return err } + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) + return cmd } diff --git a/x/nftfactory/client/cli/tx.go b/x/nftfactory/client/cli/tx.go index 554cd077f..365dd7aed 100644 --- a/x/nftfactory/client/cli/tx.go +++ b/x/nftfactory/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "strconv" "strings" "github.com/spf13/cobra" @@ -29,11 +28,10 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( CmdCreateClass(), + CmdUpdateClass(), CmdMintNFT(), CmdBurnNFT(), - CmdSendClassOwnership(), - CmdUpdateTokenSupplyCap(), - CmdUpdateBaseTokenUri(), + CmdChangeAdmin(), ) return cmd @@ -41,15 +39,17 @@ func GetTxCmd() *cobra.Command { func CmdCreateClass() *cobra.Command { cmd := &cobra.Command{ - Use: "create-class [class-name] [base-token-uri]] [token-supply-cap] [minting-permission] --from [sender]", - Args: cobra.ExactArgs(4), + Use: "create-class [subclass] --from [sender]", + Args: cobra.ExactArgs(1), Short: "create class for minting NFTs", Long: strings.TrimSpace(fmt.Sprintf( - "Example:$ %s tx %s create-class "+ + "Example:$ %s tx %s create-class "+ "--from "+ - "--symbol "+ - "--description "+ - "--class-uri "+ + "--name "+ + "--symbol "+ + "--description "+ + "--uri "+ + "--uri-hash "+ "--chain-id= "+ "--fees=", version.AppName, types.ModuleName), ), @@ -59,36 +59,37 @@ func CmdCreateClass() *cobra.Command { return err } - tokenSupplyCap, err := strconv.ParseUint(args[2], 10, 64) + subClass := args[0] + + className, err := cmd.Flags().GetString(FlagName) if err != nil { return err } - mintingPermission, err := strconv.ParseInt(args[3], 10, 32) + classSymbol, err := cmd.Flags().GetString(FlagSymbol) if err != nil { return err } - classSymbol, err := cmd.Flags().GetString(FlagSymbol) + classDescription, err := cmd.Flags().GetString(FlagDescription) if err != nil { return err } - classDescription, err := cmd.Flags().GetString(FlagDescription) + classUri, err := cmd.Flags().GetString(FlagUri) if err != nil { return err } - classUri, err := cmd.Flags().GetString(FlagClassUri) + classUriHash, err := cmd.Flags().GetString(FlagUriHash) if err != nil { return err } msg := types.NewMsgCreateClass( clientCtx.GetFromAddress().String(), - args[0], - args[1], - tokenSupplyCap, - types.MintingPermission(mintingPermission), + subClass, + className, classSymbol, classDescription, classUri, + classUriHash, ) if err := msg.ValidateBasic(); err != nil { return err @@ -102,16 +103,19 @@ func CmdCreateClass() *cobra.Command { return cmd } -func CmdMintNFT() *cobra.Command { +func CmdUpdateClass() *cobra.Command { cmd := &cobra.Command{ - Use: "mint-nft [class-id] [nft-id] [receiver] --from [sender]", - Args: cobra.ExactArgs(3), - Short: "mint NFT under specific class by class-id", + Use: "update-class [class-id] --from [sender]", + Args: cobra.ExactArgs(1), + Short: "update class", Long: strings.TrimSpace(fmt.Sprintf( - "Note: nft-id must start with [a-zA-Z] character."+ - "nft-id will be that nft-uri combined with base token uri of the class-id, like "+ - "$ %s tx %s mint-nft "+ + "Example:$ %s tx %s update-class "+ "--from "+ + "--name "+ + "--symbol "+ + "--description "+ + "--uri "+ + "--uri-hash "+ "--chain-id= "+ "--fees=", version.AppName, types.ModuleName), ), @@ -121,69 +125,61 @@ func CmdMintNFT() *cobra.Command { return err } - sender := clientCtx.GetFromAddress() + classId := args[0] - recipient := args[2] - recipientAddr, err := sdk.AccAddressFromBech32(recipient) + className, err := cmd.Flags().GetString(FlagName) if err != nil { return err } - - msg := types.NewMsgMintNFT( - sender.String(), - args[0], - args[1], - recipientAddr.String(), - ) - - if err := msg.ValidateBasic(); err != nil { + classSymbol, err := cmd.Flags().GetString(FlagSymbol) + if err != nil { return err } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -func CmdBurnNFT() *cobra.Command { - cmd := &cobra.Command{ - Use: "burn-nft [class-id] [nft-id] --from [sender]", - Args: cobra.ExactArgs(2), - Short: "burn specified NFT", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) + classDescription, err := cmd.Flags().GetString(FlagDescription) + if err != nil { + return err + } + classUri, err := cmd.Flags().GetString(FlagUri) + if err != nil { + return err + } + classUriHash, err := cmd.Flags().GetString(FlagUriHash) if err != nil { return err } - sender := clientCtx.GetFromAddress() - - msg := types.NewMsgBurnNFT( - sender.String(), - args[0], - args[1], + msg := types.NewMsgUpdateClass( + clientCtx.GetFromAddress().String(), + classId, + className, + classSymbol, + classDescription, + classUri, + classUriHash, ) - if err := msg.ValidateBasic(); err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } + cmd.Flags().AddFlagSet(FsUpdateClass) flags.AddTxFlagsToCmd(cmd) return cmd } -func CmdSendClassOwnership() *cobra.Command { +func CmdMintNFT() *cobra.Command { cmd := &cobra.Command{ - Use: "send-class [class-id] [recipient] --from [sender]", - Args: cobra.ExactArgs(2), - Short: "send the ownership of class", + Use: "mint-nft [class-id] [token-id] [receiver] --from [sender]", + Args: cobra.ExactArgs(3), + Short: "mint NFT under specific class by class-id", + Long: strings.TrimSpace(fmt.Sprintf( + "$ %s tx %s mint-nft "+ + "--from "+ + "--chain-id= "+ + "--fees=", version.AppName, types.ModuleName), + ), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -191,15 +187,19 @@ func CmdSendClassOwnership() *cobra.Command { } sender := clientCtx.GetFromAddress() - recipient := args[1] + + classId := args[0] + tokenId := args[1] + recipient := args[2] recipientAddr, err := sdk.AccAddressFromBech32(recipient) if err != nil { return err } - msg := types.NewMsgSendClassOwnership( + msg := types.NewMsgMintNFT( sender.String(), - args[0], + classId, + tokenId, recipientAddr.String(), ) @@ -215,11 +215,11 @@ func CmdSendClassOwnership() *cobra.Command { return cmd } -func CmdUpdateTokenSupplyCap() *cobra.Command { +func CmdBurnNFT() *cobra.Command { cmd := &cobra.Command{ - Use: "update-token-supply-cap [class-id] [token-supply-cap] --from [sender]", + Use: "burn-nft [class-id] [token-id] --from [sender]", Args: cobra.ExactArgs(2), - Short: "update the token supply cap of class specified by class id", + Short: "burn specified NFT", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -228,15 +228,13 @@ func CmdUpdateTokenSupplyCap() *cobra.Command { sender := clientCtx.GetFromAddress() - tokenSupplyCap, err := strconv.ParseUint(args[1], 10, 64) - if err != nil { - return err - } + classId := args[0] + tokenId := args[1] - msg := types.NewMsgUpdateTokenSupplyCap( + msg := types.NewMsgBurnNFT( sender.String(), - args[0], - tokenSupplyCap, + classId, + tokenId, ) if err := msg.ValidateBasic(); err != nil { @@ -251,11 +249,11 @@ func CmdUpdateTokenSupplyCap() *cobra.Command { return cmd } -func CmdUpdateBaseTokenUri() *cobra.Command { +func CmdChangeAdmin() *cobra.Command { cmd := &cobra.Command{ - Use: "update-base-token-uri [class-id] [base-token-uri] --from [sender]", + Use: "change-admin [class-id] [new-admin-address] --from [sender]", Args: cobra.ExactArgs(2), - Short: "update the base token uri of class specified by class id and automatically change the belonging nft uris", + Short: "Changes the admin address for a factory-created class. Must have admin authority to do so.", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -263,11 +261,13 @@ func CmdUpdateBaseTokenUri() *cobra.Command { } sender := clientCtx.GetFromAddress() + classId := args[0] + newAdmin := args[1] - msg := types.NewMsgUpdateBaseTokenUri( + msg := types.NewMsgChangeAdmin( sender.String(), - args[0], - args[1], + classId, + newAdmin, ) if err := msg.ValidateBasic(); err != nil { diff --git a/x/nftfactory/genesis.go b/x/nftfactory/genesis.go deleted file mode 100644 index c47e788ac..000000000 --- a/x/nftfactory/genesis.go +++ /dev/null @@ -1,75 +0,0 @@ -package nftmint - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -// InitGenesis initializes the store state from a genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, gs types.GenesisState) { - k.SetParamSet(ctx, gs.Params) - - for _, classAttributes := range gs.ClassAttributesList { - if err := InitClassRelatingData(ctx, k, nftKeeper, classAttributes); err != nil { - panic(err) - } - } -} - -// ExportGenesis export genesis state for nftmarket module -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { - classAttributesList := k.GetClassAttributesList(ctx) - - return types.GenesisState{ - Params: k.GetParamSet(ctx), - ClassAttributesList: classAttributesList, - } -} - -func InitClassRelatingData(ctx sdk.Context, k keeper.Keeper, nftKeeper types.NftKeeper, classAttributes types.ClassAttributes) error { - class, exists := nftKeeper.GetClass(ctx, classAttributes.ClassId) - if !exists { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, classAttributes.ClassId) - } - - params := k.GetParamSet(ctx) - if err := types.ValidateCreateClass( - params, - class.Name, class.Symbol, classAttributes.BaseTokenUri, class.Description, - classAttributes.MintingPermission, - classAttributes.TokenSupplyCap, - ); err != nil { - return err - } - - owner, err := sdk.AccAddressFromBech32(classAttributes.Owner) - if err != nil { - return err - } - - if err := k.SetClassAttributes(ctx, types.NewClassAttributes( - class.Id, - owner, - classAttributes.BaseTokenUri, - classAttributes.MintingPermission, - classAttributes.TokenSupplyCap, - )); err != nil { - return err - } - - owningClassIdList := k.AddClassIDToOwningClassIdList(ctx, owner, class.Id) - if err := k.SetOwningClassIdList(ctx, owningClassIdList); err != nil { - return err - } - - classNameIdList := k.AddClassNameIdList(ctx, class.Name, class.Id) - if err := k.SetClassNameIdList(ctx, classNameIdList); err != nil { - return err - } - - return nil -} diff --git a/x/nftfactory/keeper/admins.go b/x/nftfactory/keeper/admins.go new file mode 100644 index 000000000..a43cfa76f --- /dev/null +++ b/x/nftfactory/keeper/admins.go @@ -0,0 +1,49 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/gogo/protobuf/proto" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +// GetAuthorityMetadata returns the authority metadata for a specific denom +func (k Keeper) GetAuthorityMetadata(ctx sdk.Context, classId string) (types.ClassAuthorityMetadata, error) { + bz := k.GetDenomPrefixStore(ctx, classId).Get([]byte(types.ClassAuthorityMetadataKey)) + + metadata := types.ClassAuthorityMetadata{} + err := proto.Unmarshal(bz, &metadata) + if err != nil { + return types.ClassAuthorityMetadata{}, err + } + return metadata, nil +} + +// setAuthorityMetadata stores authority metadata for a specific denom +func (k Keeper) setAuthorityMetadata(ctx sdk.Context, classId string, metadata types.ClassAuthorityMetadata) error { + err := metadata.Validate() + if err != nil { + return err + } + + store := k.GetDenomPrefixStore(ctx, classId) + + bz, err := proto.Marshal(&metadata) + if err != nil { + return err + } + + store.Set([]byte(types.ClassAuthorityMetadataKey), bz) + return nil +} + +func (k Keeper) setAdmin(ctx sdk.Context, classId, admin string) error { + metadata, err := k.GetAuthorityMetadata(ctx, classId) + if err != nil { + return err + } + + metadata.Admin = admin + + return k.setAuthorityMetadata(ctx, classId, metadata) +} diff --git a/x/nftfactory/keeper/class.go b/x/nftfactory/keeper/class.go deleted file mode 100644 index 603eaff6e..000000000 --- a/x/nftfactory/keeper/class.go +++ /dev/null @@ -1,332 +0,0 @@ -package keeper - -import ( - "crypto/sha256" - "encoding/hex" - "strings" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - PrefixClassId = "ununifi-" - LenHashByteToHex = 32 - 20 -) - -// CreateClass does validate the contents of MsgCreateClass and operate whole flow for CreateClass message -func (k Keeper) CreateClass(ctx sdk.Context, classID string, msg *types.MsgCreateClass) error { - exists := k.nftKeeper.HasClass(ctx, classID) - if exists { - return sdkerrors.Wrap(nfttypes.ErrClassExists, classID) - } - - params := k.GetParamSet(ctx) - err := types.ValidateCreateClass( - params, - msg.Name, msg.Symbol, msg.BaseTokenUri, msg.Description, - msg.MintingPermission, - msg.TokenSupplyCap, - ) - if err != nil { - return err - } - - if err := k.nftKeeper.SaveClass(ctx, types.NewClass(classID, msg.Name, msg.Symbol, msg.Description, msg.ClassUri)); err != nil { - return err - } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - if err = k.SetClassAttributes(ctx, types.NewClassAttributes(classID, sender, msg.BaseTokenUri, msg.MintingPermission, msg.TokenSupplyCap)); err != nil { - return err - } - - owningClassIdList := k.AddClassIDToOwningClassIdList(ctx, sender, classID) - if err = k.SetOwningClassIdList(ctx, owningClassIdList); err != nil { - return err - } - - classNameIdList := k.AddClassNameIdList(ctx, msg.Name, classID) - if err = k.SetClassNameIdList(ctx, classNameIdList); err != nil { - return err - } - - return nil -} - -// Create class id on UnUniFi using addr sequence and addr byte -func CreateClassId(num uint64, addr sdk.Address) string { - sequenceByte := UintToByte(num) - addrByte := addr.Bytes() - idByte := append(addrByte, sequenceByte...) - - idHash := sha256.Sum256(idByte) - idString := hex.EncodeToString(idHash[LenHashByteToHex:]) - classID := PrefixClassId + strings.ToUpper(idString) - - return classID -} - -// SendClassOwnership does validate the contents of MsgSendClassOwnership and operate whole flow for SendClassOwnership message -func (k Keeper) SendClassOwnership(ctx sdk.Context, msg *types.MsgSendClassOwnership) error { - if !k.nftKeeper.HasClass(ctx, msg.ClassId) { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, msg.ClassId) - } - - classAttirbutes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrap(types.ErrClassAttributesNotExists, msg.ClassId) - } - - if msg.Sender != classAttirbutes.Owner { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of the class", msg.Sender) - } - - classAttirbutes.Owner = msg.Recipient - if err := k.SetClassAttributes(ctx, classAttirbutes); err != nil { - return err - } - - return nil -} - -// UpdateTokenSupplyCap does validate the contents of MsgUpdateTokenSupplyCap and operate whole flow for UpdateTokenSupplyCap message -func (k Keeper) UpdateTokenSupplyCap(ctx sdk.Context, msg *types.MsgUpdateTokenSupplyCap) error { - classAttributes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrap(types.ErrClassAttributesNotExists, msg.ClassId) - } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - if err := k.IsUpgradable(ctx, sender, classAttributes); err != nil { - return err - } - - params := k.GetParamSet(ctx) - if err := types.ValidateTokenSupplyCap(params.MaxNFTSupplyCap, msg.TokenSupplyCap); err != nil { - return err - } - currentSupply := k.nftKeeper.GetTotalSupply(ctx, msg.ClassId) - if err := types.ValidateTokenSupply(currentSupply, msg.TokenSupplyCap); err != nil { - return err - } - - classAttributes.TokenSupplyCap = msg.TokenSupplyCap - if err := k.SetClassAttributes(ctx, classAttributes); err != nil { - return err - } - - return nil -} - -// UpdateBaseTokenUri does validate the contents of MsgUpdateBaseTokenUri and operate whole flow for UpdateBaseTokenUri message -func (k Keeper) UpdateBaseTokenUri(ctx sdk.Context, msg *types.MsgUpdateBaseTokenUri) error { - classAttributes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrap(types.ErrClassAttributesNotExists, msg.ClassId) - } - - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - if err := k.IsUpgradable(ctx, sender, classAttributes); err != nil { - return err - } - - params := k.GetParamSet(ctx) - if err := types.ValidateUri(params.MinUriLen, params.MaxUriLen, msg.BaseTokenUri); err != nil { - return err - } - - classAttributes.BaseTokenUri = msg.BaseTokenUri - if err := k.SetClassAttributes(ctx, classAttributes); err != nil { - return err - } - - if err := k.UpdateNFTUri(ctx, classAttributes.ClassId, classAttributes.BaseTokenUri); err != nil { - return err - } - - return nil -} - -// check if update relating messages are permitted -func (k Keeper) IsUpgradable(ctx sdk.Context, sender sdk.AccAddress, classAttributes types.ClassAttributes) error { - if exists := k.nftKeeper.HasClass(ctx, classAttributes.ClassId); !exists { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, classAttributes.ClassId) - } - - if sender.String() != classAttributes.Owner { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of the class", sender.String()) - } - - return nil -} - -func (k Keeper) SetClassAttributes(ctx sdk.Context, classAttributes types.ClassAttributes) error { - bz, err := k.cdc.Marshal(&classAttributes) - if err != nil { - return sdkerrors.Wrap(err, "Marshal nftmint.ClassAttributes failed") - } - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixClassAttributes)) - prefixStore.Set([]byte(classAttributes.ClassId), bz) - return nil -} - -func (k Keeper) SetOwningClassIdList(ctx sdk.Context, owningClassIdList types.OwningClassIdList) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixOwningClassIdList) - - bz, err := k.cdc.Marshal(&owningClassIdList) - if err != nil { - return sdkerrors.Wrap(err, "Marshal nftmint.OwningClassIdList failed") - } - - owner, err := sdk.AccAddressFromBech32(owningClassIdList.Owner) - if err != nil { - return err - } - - owningClassIdListKey := types.OwningClassIdListKey(owner) - prefixStore.Set(owningClassIdListKey, bz) - return nil -} - -func (k Keeper) SetClassNameIdList(ctx sdk.Context, classNameIdList types.ClassNameIdList) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixClassNameIdList) - - bz, err := k.cdc.Marshal(&classNameIdList) - if err != nil { - return sdkerrors.Wrap(err, "Marshal nftmint.ClassNameIdList failed") - } - prefixStore.Set([]byte(classNameIdList.ClassName), bz) - return nil -} - -func (k Keeper) GetClassAttributes(ctx sdk.Context, classID string) (types.ClassAttributes, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixClassAttributes) - - bz := prefixStore.Get([]byte(classID)) - if bz == nil { - return types.ClassAttributes{}, false - } - var classAttributes types.ClassAttributes - k.cdc.MustUnmarshal(bz, &classAttributes) - return classAttributes, true -} - -func (k Keeper) GetOwningClassIdList(ctx sdk.Context, owner sdk.AccAddress) (types.OwningClassIdList, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixOwningClassIdList) - - var owningClassIdList types.OwningClassIdList - bz := prefixStore.Get(owner.Bytes()) - if bz == nil { - return types.OwningClassIdList{}, false - } - k.cdc.MustUnmarshal(bz, &owningClassIdList) - return owningClassIdList, true -} - -func (k Keeper) GetClassNameIdList(ctx sdk.Context, className string) (types.ClassNameIdList, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, types.KeyPrefixClassNameIdList) - - var classNameIdList types.ClassNameIdList - bz := prefixStore.Get([]byte(className)) - if bz == nil { - return types.ClassNameIdList{}, false - } - k.cdc.MustUnmarshal(bz, &classNameIdList) - return classNameIdList, true -} - -func (k Keeper) GetClassAttributesList(ctx sdk.Context) (classAttributesList []types.ClassAttributes) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixClassAttributes) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var classAttributes types.ClassAttributes - k.cdc.MustUnmarshal(iterator.Value(), &classAttributes) - classAttributesList = append(classAttributesList, classAttributes) - } - - return -} - -func (k Keeper) GetOwningClassIdLists(ctx sdk.Context) (owningClassIdLists []*types.OwningClassIdList) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixOwningClassIdList) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var owningClassIdList types.OwningClassIdList - k.cdc.MustUnmarshal(iterator.Value(), &owningClassIdList) - owningClassIdLists = append(owningClassIdLists, &owningClassIdList) - } - - return -} - -func (k Keeper) GetClassNameIdLists(ctx sdk.Context) (classNameIdLists []*types.ClassNameIdList) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyPrefixClassNameIdList) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var classNameIdList types.ClassNameIdList - k.cdc.MustUnmarshal(iterator.Value(), &classNameIdList) - classNameIdLists = append(classNameIdLists, &classNameIdList) - } - - return -} - -func (k Keeper) AddClassIDToOwningClassIdList(ctx sdk.Context, owner sdk.AccAddress, classID string) types.OwningClassIdList { - owningClassIdList, exists := k.GetOwningClassIdList(ctx, owner) - if !exists { - owningClassIdList = types.NewOwningClassIdList(owner) - } - owningClassIdList.ClassId = append(owningClassIdList.ClassId, classID) - return owningClassIdList -} - -func (k Keeper) AddClassNameIdList(ctx sdk.Context, className string, classID string) types.ClassNameIdList { - classNameIdList, exists := k.GetClassNameIdList(ctx, className) - if !exists { - classNameIdList = types.NewClassNameIdList(className) - } - classNameIdList.ClassId = append(classNameIdList.ClassId, classID) - return classNameIdList -} - -func (k Keeper) DeleteClassIDInOwningClassList(ctx sdk.Context, owner sdk.AccAddress, classID string) error { - owningClassIdList, exists := k.GetOwningClassIdList(ctx, owner) - if !exists { - return sdkerrors.Wrap(types.ErrOwningClassIdListNotExists, owner.String()) - } - - index := SliceIndex(owningClassIdList.ClassId, classID) - if index == -1 { - return sdkerrors.Wrap(types.ErrIndexNotFoundInOwningClassIDs, classID) - } - - owningClassIdList.ClassId = RemoveIndex(owningClassIdList.ClassId, index) - return nil -} diff --git a/x/nftfactory/keeper/class_test.go b/x/nftfactory/keeper/class_test.go deleted file mode 100644 index f6143cb1a..000000000 --- a/x/nftfactory/keeper/class_test.go +++ /dev/null @@ -1,515 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - "github.com/stretchr/testify/require" - - ununifitypes "github.com/UnUniFi/chain/deprecated/types" - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - testName = "test" - testBaseTokenUri = "ipfs://testcid-sample/" - testTokenSupplyCap = 10000 - testMintingPermission = 0 - testNftID = "a00" -) - -// test basic functions of nftmint -func (suite *KeeperTestSuite) TestNftMintClassBasics() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - - classId := keeper.CreateClassId(owner_seq, owner) - - // test relating ClassAttributes - classAttributes := types.ClassAttributes{ - ClassId: classId, - } - // check setting ClassAttributes function - err := suite.nftmintKeeper.SetClassAttributes(suite.ctx, classAttributes) - suite.Require().NoError(err) - // check getting ClassAttributes function - gotClassAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classAttributes.ClassId) - suite.Require().True(exists) - suite.Require().Equal(classAttributes, gotClassAttributes) - - // test relating OwningClassIdList - var classIdList []string - classIdList = append(classIdList, classId) - owningClassIdList := types.OwningClassIdList{ - Owner: owner.Bytes(), - ClassId: classIdList, - } - // check setting OwningClassIdList function - err = suite.nftmintKeeper.SetOwningClassIdList(suite.ctx, owningClassIdList) - suite.Require().NoError(err) - // check getting OwningClassIdList function - gotOwningClassIdList, exists := suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, owner) - suite.Require().True(exists) - suite.Require().Equal(owningClassIdList, gotOwningClassIdList) - - // test relating ClassNameIdList - testClassName := "test" - classNameIdList := types.ClassNameIdList{ - ClassName: testClassName, - ClassId: classIdList, - } - // check setting ClassNameIdList function - err = suite.nftmintKeeper.SetClassNameIdList(suite.ctx, classNameIdList) - suite.Require().NoError(err) - // check getting ClassNameIdList function - gotClassNameIdList, exists := suite.nftmintKeeper.GetClassNameIdList(suite.ctx, testClassName) - suite.Require().True(exists) - suite.Require().Equal(classNameIdList, gotClassNameIdList) -} - -// test of the method to create a class.Id -func TestCreateId(t *testing.T) { - var seq uint64 = 0 - addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) - accAddr, _ := sdk.AccAddressFromBech32(addr.String()) - classIdSeq0 := keeper.CreateClassId(seq, accAddr) - err := types.ValidateClassID(classIdSeq0) - require.NoError(t, err) - - // add one to imitate actual account sequence transition of the expected situation - seq += 1 - classIdSeq1 := keeper.CreateClassId(seq, accAddr) - require.NoError(t, err) - require.NotEqual(t, classIdSeq0, classIdSeq1) -} - -// test for the CreateClass relating functions -func (suite *KeeperTestSuite) TestCreateClass() { - sender := suite.addrs[0] - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - err := suite.CreateClass(suite.ctx, classId, sender) - suite.Require().NoError(err) - - // check if Class is set - class, exists := suite.nftKeeper.GetClass(suite.ctx, classId) - suite.Require().True(exists) - expectedClass := nfttypes.Class{ - Id: classId, - Name: testName, - } - suite.Require().Equal(class, expectedClass) - - // check if ClassAttributes is set - classAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().True(exists) - expectedClassAttributes := types.ClassAttributes{ - ClassId: classId, - Owner: sender.Bytes(), - BaseTokenUri: testBaseTokenUri, - MintingPermission: testMintingPermission, - TokenSupplyCap: testTokenSupplyCap, - } - suite.Require().Equal(classAttributes, expectedClassAttributes) - - // check if OwningClassIdList is set - owningClassIdList, exists := suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, sender.Bytes()) - suite.Require().True(exists) - var classIdList []string - classIdList = append(classIdList, classId) - expectedOwningClassIdList := types.OwningClassIdList{ - Owner: sender.Bytes(), - ClassId: classIdList, - } - suite.Require().Equal(owningClassIdList, expectedOwningClassIdList) - - // check if ClassNameIdList is set - classNameIdList, exists := suite.nftmintKeeper.GetClassNameIdList(suite.ctx, testName) - suite.Require().True(exists) - expectedClassNameIdList := types.ClassNameIdList{ - ClassName: testName, - ClassId: classIdList, - } - suite.Require().Equal(classNameIdList, expectedClassNameIdList) - - senderInInvalidCase := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - senderInInvalidCase_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, senderInInvalidCase) - classIdInInvalidCase := keeper.CreateClassId(senderInInvalidCase_seq, senderInInvalidCase) - // in case which contains the invalid name - testMsgCreateClassInvalidName := types.MsgCreateClass{ - Sender: senderInInvalidCase.Bytes(), - Name: "t", // shorter than the minimum length defined on UnUniFi - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: testTokenSupplyCap, - MintingPermission: testMintingPermission, - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidName) - suite.Require().Error(err) - - // check if data objects aren't set - exists = suite.nftKeeper.HasClass(suite.ctx, classIdInInvalidCase) - suite.Require().False(exists) - _, exists = suite.nftmintKeeper.GetClassAttributes(suite.ctx, classIdInInvalidCase) - suite.Require().False(exists) - _, exists = suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, senderInInvalidCase.Bytes()) - suite.Require().False(exists) - _, exists = suite.nftmintKeeper.GetClassNameIdList(suite.ctx, testMsgCreateClassInvalidName.Name) - suite.Require().False(exists) - - // in case which contains the invalid uri - testMsgCreateClassInvalidUri := types.MsgCreateClass{ - Sender: sender.Bytes(), - Name: testName, - BaseTokenUri: "ipfs", // shorter than the minimum length defined on UnUniFi - TokenSupplyCap: testTokenSupplyCap, - MintingPermission: testMintingPermission, - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidUri) - suite.Require().Error(err) - - // in case which contains the invalid token supply cap - testMsgCreateClassInvalidTokenSupplyCap := types.MsgCreateClass{ - Sender: sender.Bytes(), - Name: testName, - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: 10000000, // bigger than the token supply cap - MintingPermission: 0, - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidTokenSupplyCap) - suite.Require().Error(err) - - // in case which contains the invalid minting permission - testMsgCreateClassInvalidMintingPermission := types.MsgCreateClass{ - Sender: sender.Bytes(), - Name: testName, - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: 10000, - MintingPermission: 10, // not allowed minting permission option - } - err = suite.nftmintKeeper.CreateClass(suite.ctx, classIdInInvalidCase, &testMsgCreateClassInvalidMintingPermission) - suite.Require().Error(err) -} - -// test for the SendClassOwnership relating functions -func (suite *KeeperTestSuite) TestSendClassOwnership() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - recipient := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - testMsgSendClassOwnership := types.MsgSendClassOwnership{ - Sender: sender.Bytes(), - ClassId: classId, - Recipient: recipient.Bytes(), - } - err := suite.nftmintKeeper.SendClassOwnership(suite.ctx, &testMsgSendClassOwnership) - suite.Require().NoError(err) - // check if recipient address becomes new owner of class - classAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().True(exists) - expectedOwner := recipient - suite.Require().Equal(expectedOwner, classAttributes.Owner.AccAddress()) - - // invalid sender of MsgSendClassOwnership - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - testMsgSendClassOwnershipInvalidSender := types.MsgSendClassOwnership{ - Sender: invalidSender.Bytes(), // not the owner of class - ClassId: classId, - Recipient: recipient.Bytes(), - } - err = suite.nftmintKeeper.SendClassOwnership(suite.ctx, &testMsgSendClassOwnershipInvalidSender) - suite.Require().Error(err) - - // invalid class id specification - invalidClassId := "nonexistance" - testMsgCreateClassInvalidClassId := types.MsgSendClassOwnership{ - Sender: sender.Bytes(), - ClassId: invalidClassId, // non-existant class - Recipient: recipient.Bytes(), - } - err = suite.nftmintKeeper.SendClassOwnership(suite.ctx, &testMsgCreateClassInvalidClassId) - suite.Require().Error(err) -} - -// test for the UpdateTokenSupplyCap relating functions -func (suite *KeeperTestSuite) TestUpdateTokenSupplyCap() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - var updatingTokenSupplyCap uint64 = 100 - testMsgUpdateTokenSupplyCap := types.MsgUpdateTokenSupplyCap{ - Sender: sender.Bytes(), - ClassId: classId, - TokenSupplyCap: updatingTokenSupplyCap, - } - err := suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCap) - suite.Require().NoError(err) - classAttributes, exists := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().True(exists) - expectedTokenSupplyCap := updatingTokenSupplyCap - suite.Require().Equal(expectedTokenSupplyCap, classAttributes.TokenSupplyCap) - - // invalid sender of MsgUpdateTokenSupplyCap - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - testMsgUpdateTokenSupplyCapInvalidSender := types.MsgUpdateTokenSupplyCap{ - Sender: invalidSender.Bytes(), // not the owner of class - ClassId: classId, - TokenSupplyCap: 100, - } - err = suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCapInvalidSender) - suite.Require().Error(err) - - // invalid token supply cap specification - testMsgUpdateTokenSupplyCapInvalidCap := types.MsgUpdateTokenSupplyCap{ - Sender: sender.Bytes(), - ClassId: classId, - TokenSupplyCap: 1000000, // bigger than the maximum token supply cap on UnUniFi - } - err = suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCapInvalidCap) - suite.Require().Error(err) - - // invalid case which current token supply is bigger than the updating supply cap - _ = suite.nftKeeper.Mint(suite.ctx, nfttypes.NFT{ClassId: classId, Id: "a00"}, sender) - _ = suite.nftKeeper.Mint(suite.ctx, nfttypes.NFT{ClassId: classId, Id: "a01"}, sender) - testMsgUpdateTokenSupplyCapSmaller := types.MsgUpdateTokenSupplyCap{ - Sender: sender.Bytes(), - ClassId: classId, - TokenSupplyCap: 1, // smaller than the current token supply 2 of the specified class - } - err = suite.nftmintKeeper.UpdateTokenSupplyCap(suite.ctx, &testMsgUpdateTokenSupplyCapSmaller) - suite.Require().Error(err) -} - -// test for the UpdateBaseTokenUri relating functions -func (suite *KeeperTestSuite) TestUpdateBaseTokenUri() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNftID, sender) - - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - var baseTokenUriInvalidLonger string - for i := 0; i <= types.DefaultMaxUriLen; i++ { - baseTokenUriInvalidLonger += "a" - } - - tests := []struct { - testCase string - msg types.MsgUpdateBaseTokenUri - validSender bool - validBaseTokenUir bool - }{ - { - testCase: "invalid sender", - msg: types.MsgUpdateBaseTokenUri{ - Sender: invalidSender.Bytes(), // not the owner of class - ClassId: classId, - BaseTokenUri: "ipfs://testcid-sample-latest/", - }, - validSender: false, - validBaseTokenUir: true, - }, - { - testCase: "updating BaseTokenUri is longer than the maximum length on UnUniFi", - msg: types.MsgUpdateBaseTokenUri{ - Sender: sender.Bytes(), - ClassId: classId, - BaseTokenUri: baseTokenUriInvalidLonger, - }, - validSender: true, - validBaseTokenUir: false, - }, - { - testCase: "updating BaseTokenUri is longer than the maximum length on UnUniFi", - msg: types.MsgUpdateBaseTokenUri{ - Sender: sender.Bytes(), - ClassId: classId, - BaseTokenUri: "t", - }, - validSender: true, - validBaseTokenUir: false, - }, - { - testCase: "successful case", - msg: types.MsgUpdateBaseTokenUri{ - Sender: sender.Bytes(), - ClassId: classId, - BaseTokenUri: "ipfs://testcid-sample-latest/", - }, - validSender: true, - validBaseTokenUir: true, - }, - } - - for _, tc := range tests { - err := suite.nftmintKeeper.UpdateBaseTokenUri(suite.ctx, &tc.msg) - - // invalid cases - if !tc.validSender || !tc.validBaseTokenUir { - suite.Require().Error(err) - gotClassAttributes, _ := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().Equal(testBaseTokenUri, gotClassAttributes.BaseTokenUri) - nft, _ := suite.nftKeeper.GetNFT(suite.ctx, classId, testNftID) - expectedNFTUri := testBaseTokenUri + testNFTId - suite.Require().Equal(expectedNFTUri, nft.Uri) - } - - // valid case - if tc.validSender && tc.validBaseTokenUir { - suite.Require().NoError(err) - gotClassAttributes, _ := suite.nftmintKeeper.GetClassAttributes(suite.ctx, classId) - suite.Require().Equal(tc.msg.BaseTokenUri, gotClassAttributes.BaseTokenUri) - nft, _ := suite.nftKeeper.GetNFT(suite.ctx, classId, testNftID) - expectedNFTUri := tc.msg.BaseTokenUri + testNftID - suite.Require().Equal(expectedNFTUri, nft.Uri) - } - } -} - -// execute CreateClass as the common function -func (suite *KeeperTestSuite) CreateClass(ctx sdk.Context, classID string, sender sdk.AccAddress) error { - testMsgCreateClass := types.MsgCreateClass{ - Sender: sender.Bytes(), - Name: testName, - BaseTokenUri: testBaseTokenUri, - TokenSupplyCap: testTokenSupplyCap, - MintingPermission: testMintingPermission, - } - - err := suite.nftmintKeeper.CreateClass(ctx, classID, &testMsgCreateClass) - return err -} - -// test for the GetClassAttributes relating functions -func (suite *KeeperTestSuite) TestGetClassAttributes() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - classId := keeper.CreateClassId(owner_seq, owner) - _ = suite.CreateClass(suite.ctx, classId, owner) - - tests := []struct { - testCase string - classId string - validClass bool - }{ - { - testCase: "invalid class name", - classId: "invalid_class_id", - validClass: false, - }, - { - testCase: "successful case", - classId: classId, - validClass: true, - }, - } - for _, tc := range tests { - res, valid := suite.nftmintKeeper.GetClassAttributes(suite.ctx, tc.classId) - - // invalid cases - if !tc.validClass { - suite.Require().False(valid) - suite.Require().Equal(res.ClassId, "") - } - - // valid case - if tc.validClass { - suite.Require().True(valid) - suite.Require().Equal(res.ClassId, classId) - suite.Require().Equal(res.Owner.AccAddress(), owner) - } - } -} - -// test for the GetOwningClassIdList relating functions -func (suite *KeeperTestSuite) TestGetOwningClassIdList() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - classId := keeper.CreateClassId(owner_seq, owner) - _ = suite.CreateClass(suite.ctx, classId, owner) - - invalidOwner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - tests := []struct { - testCase string - ownerAddress sdk.AccAddress - validOwner bool - }{ - { - testCase: "invalid sender", - ownerAddress: invalidOwner, - validOwner: false, - }, - { - testCase: "successful case", - ownerAddress: owner, - validOwner: true, - }, - } - for _, tc := range tests { - res, valid := suite.nftmintKeeper.GetOwningClassIdList(suite.ctx, tc.ownerAddress) - - // invalid cases - if !tc.validOwner { - suite.Require().False(valid) - suite.Require().Equal(len(res.ClassId), 0) - } - - // valid case - if tc.validOwner { - suite.Require().True(valid) - suite.Require().Equal(res.Owner, ununifitypes.StringAccAddress(tc.ownerAddress)) - suite.Require().Equal(res.ClassId[0], classId) - } - } -} - -// test for the GetClassNameIdList relating functions -func (suite *KeeperTestSuite) TestGetClassNameIdList() { - owner := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - owner_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, owner) - classId := keeper.CreateClassId(owner_seq, owner) - _ = suite.CreateClass(suite.ctx, classId, owner) - - tests := []struct { - testCase string - className string - validClass bool - }{ - { - testCase: "invalid class name", - className: "invalid_class", - validClass: false, - }, - { - testCase: "successful case", - className: testName, - validClass: true, - }, - } - for _, tc := range tests { - res, valid := suite.nftmintKeeper.GetClassNameIdList(suite.ctx, tc.className) - - // invalid cases - if !tc.validClass { - suite.Require().False(valid) - suite.Require().Equal(len(res.ClassId), 0) - } - - // valid case - if tc.validClass { - suite.Require().True(valid) - suite.Require().Equal(res.ClassId[0], classId) - } - } -} diff --git a/x/nftfactory/keeper/createclass.go b/x/nftfactory/keeper/createclass.go new file mode 100644 index 000000000..2c3a78757 --- /dev/null +++ b/x/nftfactory/keeper/createclass.go @@ -0,0 +1,93 @@ +package keeper + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + // sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +// CreateClass creates new class id with `factory/{creatorAddr}/{subclass}` name. +// Charges creatorAddr fee for creation +func (k Keeper) CreateClass(ctx sdk.Context, creatorAddr, subclass string) (newClassId string, err error) { + err = k.chargeFeeForDenomCreation(ctx, creatorAddr) + if err != nil { + return "", errorsmod.Wrapf(types.ErrUnableToCharge, "class fee collection error: %v", err) + } + + classId, err := k.validateCreateDenom(ctx, creatorAddr, subclass) + if err != nil { + return "", errorsmod.Wrapf(types.ErrInvalidClassId, "class id validation error: %v", err) + } + + err = k.createClassAfterValidation(ctx, creatorAddr, classId) + if err != nil { + return "", errorsmod.Wrap(err, "create class after validation error") + } + + return classId, nil +} + +// Runs CreateClass logic after the charge and all denom validation has been handled. +// Made into a second function for genesis initialization. +func (k Keeper) createClassAfterValidation(ctx sdk.Context, creatorAddr, classId string) (err error) { + + authorityMetadata := types.ClassAuthorityMetadata{ + Admin: creatorAddr, + } + err = k.setAuthorityMetadata(ctx, classId, authorityMetadata) + if err != nil { + return errorsmod.Wrapf(types.ErrInvalidAuthorityMetadata, "unable to set authority metadata: %v", err) + } + + k.addDenomFromCreator(ctx, creatorAddr, classId) + return nil +} + +func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subclass string) (newClassId string, err error) { + + denom, err := types.GetClassId(creatorAddr, subclass) + if err != nil { + return "", errorsmod.Wrapf(types.ErrInvalidClassId, "invalid class id: %v", err) + } + + _, found := k.nftKeeper.GetClass(ctx, denom) + if found { + return "", types.ErrClassExists + } + + return denom, nil +} + +func (k Keeper) chargeFeeForDenomCreation(ctx sdk.Context, creatorAddr string) (err error) { + // Send creation fee to community pool + params, err := k.GetParams(ctx) + if err != nil { + return err + } + creationFee := params.ClassCreationFee + accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + if err != nil { + return errorsmod.Wrapf(types.ErrUnableToCharge, "wrong creator address: %v", err) + } + + if len(creationFee) > 0 { + feeCollectorAddr, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) + if err != nil { + return errorsmod.Wrapf(types.ErrUnableToCharge, "wrong fee collector address: %v", err) + } + + err = k.bankKeeper.SendCoins( + ctx, + accAddr, feeCollectorAddr, + creationFee, + ) + + if err != nil { + return errorsmod.Wrap(err, "unable to send coins to fee collector") + } + } + + return nil +} diff --git a/x/nftfactory/keeper/creators.go b/x/nftfactory/keeper/creators.go new file mode 100644 index 000000000..29db98c12 --- /dev/null +++ b/x/nftfactory/keeper/creators.go @@ -0,0 +1,27 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, classId string) { + store := k.GetCreatorPrefixStore(ctx, creator) + store.Set([]byte(classId), []byte(classId)) +} + +func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { + store := k.GetCreatorPrefixStore(ctx, creator) + + iterator := store.Iterator(nil, nil) + defer iterator.Close() + + classIds := []string{} + for ; iterator.Valid(); iterator.Next() { + classIds = append(classIds, string(iterator.Key())) + } + return classIds +} + +func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { + return k.GetCreatorsPrefixStore(ctx).Iterator(nil, nil) +} diff --git a/x/nftfactory/keeper/genesis.go b/x/nftfactory/keeper/genesis.go new file mode 100644 index 000000000..727acfdda --- /dev/null +++ b/x/nftfactory/keeper/genesis.go @@ -0,0 +1,55 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +// InitGenesis initializes the tokenfactory module's state from a provided genesis +// state. +func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + k.SetParams(ctx, &genState.Params) + + for _, genClass := range genState.GetClasses() { + creator, _, err := types.DeconstructClassId(genClass.GetClassId()) + if err != nil { + panic(err) + } + err = k.createClassAfterValidation(ctx, creator, genClass.GetClassId()) + if err != nil { + panic(err) + } + err = k.setAuthorityMetadata(ctx, genClass.GetClassId(), genClass.GetAuthorityMetadata()) + if err != nil { + panic(err) + } + } +} + +// ExportGenesis returns the tokenfactory module's exported genesis. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + genClasses := []types.GenesisClass{} + iterator := k.GetAllDenomsIterator(ctx) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + class := string(iterator.Value()) + + authorityMetadata, err := k.GetAuthorityMetadata(ctx, class) + if err != nil { + panic(err) + } + + genClasses = append(genClasses, types.GenesisClass{ + ClassId: class, + AuthorityMetadata: authorityMetadata, + }) + } + + params, _ := k.GetParams(ctx) + + return &types.GenesisState{ + Classes: genClasses, + Params: *params, + } +} diff --git a/x/nftfactory/keeper/grpc_query.go b/x/nftfactory/keeper/grpc_query.go index 891a00a95..f724bf82e 100644 --- a/x/nftfactory/keeper/grpc_query.go +++ b/x/nftfactory/keeper/grpc_query.go @@ -2,104 +2,40 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "github.com/UnUniFi/chain/x/nftfactory/types" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" ) var _ types.QueryServer = Keeper{} -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryParamsResponse{ - Params: k.GetParamSet(ctx), - }, nil -} - -func (k Keeper) ClassAttributes(c context.Context, req *types.QueryClassAttributesRequest) (*types.QueryClassAttributesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - if err := types.ValidateClassID(req.ClassId); err != nil { +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + params, err := k.GetParams(sdkCtx) + if err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(c) - classAttributes, found := k.GetClassAttributes(ctx, req.ClassId) - if !found { - return nil, sdkerrors.Wrap(nfttypes.ErrClassNotExists, "class which has that class id doesn't exist") - } - return &types.QueryClassAttributesResponse{ - ClassAttributes: &classAttributes, - }, nil + return &types.QueryParamsResponse{Params: *params}, nil } -func (k Keeper) NFTMinter(c context.Context, req *types.QueryNFTMinterRequest) (*types.QueryNFTMinterResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } +func (k Keeper) ClassAuthorityMetadata(ctx context.Context, req *types.QueryClassAuthorityMetadataRequest) (*types.QueryClassAuthorityMetadataResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) - if err := types.ValidateClassID(req.ClassId); err != nil { - return nil, err - } - if err := types.ValidateNFTID(req.NftId); err != nil { - return nil, err - } + class_id := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubclass()) - ctx := sdk.UnwrapSDKContext(c) - nftMinter, exists := k.GetNFTMinter(ctx, req.ClassId, req.NftId) - if !exists { - return nil, sdkerrors.Wrapf(types.ErrNftAttributesNotExists, "NftAttributes with this %s class and %s nft id doesn't exist", req.ClassId, req.NftId) - } - - return &types.QueryNFTMinterResponse{ - Minter: nftMinter.String(), - }, nil -} - -func (k Keeper) ClassIdsByName(c context.Context, req *types.QueryClassIdsByNameRequest) (*types.QueryClassIdsByNameResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - params := k.GetParamSet(ctx) - if err := types.ValidateClassName(params.MinClassNameLen, params.MaxClassNameLen, req.ClassName); err != nil { + authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, class_id) + if err != nil { return nil, err } - classNameIdList, exists := k.GetClassNameIdList(ctx, req.ClassName) - if !exists { - return nil, sdkerrors.Wrap(types.ErrClassNameIdListNotExists, req.ClassName) - } - return &types.QueryClassIdsByNameResponse{ - ClassNameIdList: &classNameIdList, - }, nil + return &types.QueryClassAuthorityMetadataResponse{AuthorityMetadata: authorityMetadata}, nil } -func (k Keeper) ClassIdsByOwner(c context.Context, req *types.QueryClassIdsByOwnerRequest) (*types.QueryClassIdsByOwnerResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid argument") - } - - ctx := sdk.UnwrapSDKContext(c) - owner, err := sdk.AccAddressFromBech32(req.Owner) - if err != nil { - return nil, err - } - owningClassIdList, found := k.GetOwningClassIdList(ctx, owner) - if !found { - return nil, sdkerrors.Wrap(types.ErrOwningClassIdListNotExists, "owner doesn't have any class") - } - - return &types.QueryClassIdsByOwnerResponse{ - OwningClassIdList: &owningClassIdList, - }, nil +func (k Keeper) ClassesFromCreator(ctx context.Context, req *types.QueryClassesFromCreatorRequest) (*types.QueryClassesFromCreatorResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + classes := k.getDenomsFromCreator(sdkCtx, req.GetCreator()) + return &types.QueryClassesFromCreatorResponse{Classes: classes}, nil } diff --git a/x/nftfactory/keeper/grpc_query_test.go b/x/nftfactory/keeper/grpc_query_test.go deleted file mode 100644 index 117f11f5c..000000000 --- a/x/nftfactory/keeper/grpc_query_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package keeper_test - -import ( - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -func (suite *KeeperTestSuite) TestQueryClassAttributes() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - req := types.QueryClassAttributesRequest{ - ClassId: classId, - } - res, err := suite.nftmintKeeper.ClassAttributes(suite.ctx, &req) - suite.Require().NoError(err) - suite.Require().Equal(classId, res.ClassAttributes.ClassId) - suite.Require().Equal(testBaseTokenUri, res.ClassAttributes.BaseTokenUri) - - invalidReq := types.QueryClassAttributesRequest{ - ClassId: "invalidClassId", - } - _, err = suite.nftmintKeeper.ClassAttributes(suite.ctx, &invalidReq) - suite.Require().Error(err) -} - -func (suite *KeeperTestSuite) TestQueryNftMinter() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - req := types.QueryNFTMinterRequest{ - ClassId: classId, - NftId: testNFTId, - } - res, err := suite.nftmintKeeper.NFTMinter(suite.ctx, &req) - suite.Require().NoError(err) - suite.Require().Equal(sender.String(), res.Minter) -} - -func (suite *KeeperTestSuite) TestQueryClassIdsByOwner() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - req := types.QueryClassIdsByOwnerRequest{ - Owner: sender.String(), - } - res, err := suite.nftmintKeeper.ClassIdsByOwner(suite.ctx, &req) - suite.Require().NoError(err) - var classIds []string - classIds = append(classIds, classId) - expectedRes := types.OwningClassIdList{ - Owner: sender.Bytes(), - ClassId: classIds[:], - } - suite.Require().Equal(&expectedRes, res.OwningClassIdList) -} - -func (suite *KeeperTestSuite) TestQueryIdsByName() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - req := types.QueryClassIdsByNameRequest{ - ClassName: testName, - } - res, err := suite.nftmintKeeper.ClassIdsByName(suite.ctx, &req) - suite.Require().NoError(err) - var classIds []string - classIds = append(classIds, classId) - expectedRes := types.ClassNameIdList{ - ClassName: testName, - ClassId: classIds, - } - suite.Require().Equal(&expectedRes, res.ClassNameIdList) -} diff --git a/x/nftfactory/keeper/keeper.go b/x/nftfactory/keeper/keeper.go index efeb1d012..46dad5b81 100644 --- a/x/nftfactory/keeper/keeper.go +++ b/x/nftfactory/keeper/keeper.go @@ -6,6 +6,7 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -19,26 +20,48 @@ type Keeper struct { memKey storetypes.StoreKey paramSpace paramstypes.Subspace accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper nftKeeper types.NftKeeper + authority string } -func NewKeeper(cdc codec.Codec, storeKey, memKey storetypes.StoreKey, - paramSpace paramstypes.Subspace, accountKeeper types.AccountKeeper, - nftKeeper types.NftKeeper) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } +func NewKeeper(cdc codec.Codec, storeKey, + memKey storetypes.StoreKey, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + nftKeeper types.NftKeeper, + authority string, +) Keeper { return Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - paramSpace: paramSpace, accountKeeper: accountKeeper, + bankKeeper: bankKeeper, nftKeeper: nftKeeper, + authority: authority, } } func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetDenomPrefixStore returns the substore for a specific denom +func (k Keeper) GetDenomPrefixStore(ctx sdk.Context, denom string) sdk.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetDenomPrefixStore(denom)) +} + +// GetCreatorPrefixStore returns the substore for a specific creator address +func (k Keeper) GetCreatorPrefixStore(ctx sdk.Context, creator string) sdk.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetCreatorPrefix(creator)) +} + +// GetCreatorsPrefixStore returns the substore that contains a list of creators +func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) sdk.KVStore { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetCreatorsPrefix()) +} diff --git a/x/nftfactory/keeper/keeper_test.go b/x/nftfactory/keeper/keeper_test.go index b698323a8..bd4264a03 100644 --- a/x/nftfactory/keeper/keeper_test.go +++ b/x/nftfactory/keeper/keeper_test.go @@ -5,137 +5,54 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + + nftkeeper "github.com/UnUniFi/chain/x/nft/keeper" + "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" - sdktestutil "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/x/nft" - "github.com/cosmos/cosmos-sdk/x/nft/module" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - - // nfttestutil "github.com/cosmos/cosmos-sdk/x/nft/testutil" - "github.com/UnUniFi/chain/x/nftfactory/types/testutil" + "github.com/cosmos/cosmos-sdk/baseapp" simapp "github.com/UnUniFi/chain/app" + "github.com/UnUniFi/chain/x/nftfactory/types" ) type KeeperTestSuite struct { suite.Suite - ctx sdk.Context - addrs []sdk.AccAddress - // queryClient nft.QueryClient - // nftKeeper nftkeeper.Keeper - nftKeeper *testutil.MockNftKeeper - nftmintKeeper keeper.Keeper - // accountKeeper *nfttestutil.MockAccountKeeper - accountKeeper *testutil.MockAccountKeeper - - encCfg moduletestutil.TestEncodingConfig + ctx sdk.Context + app *simapp.App + addrs []sdk.AccAddress + queryClient nft.QueryClient + keeper keeper.Keeper + nftKeeper nftkeeper.Keeper + accountKeeper authkeeper.AccountKeeper } -func (s *KeeperTestSuite) SetupTest() { - // s.addrs = simtestutil.CreateIncrementalAccounts(3) - // s.encCfg = moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}) - - // key := sdk.NewKVStoreKey(nft.StoreKey) - // testCtx := sdktestutil.DefaultContextWithDB(s.T(), key, sdk.NewTransientStoreKey("transient_test")) - // ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) - - // // gomock initializations - // ctrl := gomock.NewController(s.T()) - // accountKeeper := testutil.NewMockAccountKeeper(ctrl) - // bankKeeper := testutil.NewMockBankKeeper(ctrl) - // xbankKeeper := testutil.NewMockNftKeeper(ctrl) - // accountKeeper.EXPECT().GetModuleAddress("nft").Return(s.addrs[0]).AnyTimes() - - // nftKeeper := nftkeeper.NewKeeper(key, s.encCfg.Codec, accountKeeper, bankKeeper) - // queryHelper := baseapp.NewQueryServerTestHelper(ctx, s.encCfg.InterfaceRegistry) - // nft.RegisterQueryServer(queryHelper, nftKeeper) - - // storeKey := sdk.NewKVStoreKey(types.StoreKey) - // memKey := sdk.NewKVStoreKey(types.MemStoreKey) - // app := simapp.Setup(s.T(), ([]wasm.Option{})...) - // // encodingConfig := appparams.MakeEncodingConfig() - // // appCodec := s.encCfg.Marshaler - // nftmintKeeper := keeper.NewKeeper( - // s.encCfg.Codec, - // storeKey, - // memKey, - // app.GetSubspace(types.ModuleName), - // accountKeeper, - // nftKeeper, - // ) - - // s.nftKeeper = nftKeeper - // s.nftmintKeeper = nftmintKeeper - // s.queryClient = nft.NewQueryClient(queryHelper) - // s.ctx = ctx - - s.addrs = simtestutil.CreateIncrementalAccounts(3) - s.encCfg = moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}) - - key := sdk.NewKVStoreKey(nft.StoreKey) - testCtx := sdktestutil.DefaultContextWithDB(s.T(), key, sdk.NewTransientStoreKey("transient_test")) - ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) - - // gomock initializations - ctrl := gomock.NewController(s.T()) - defer ctrl.Finish() - accountKeeper := testutil.NewMockAccountKeeper(ctrl) - nftKeeper := testutil.NewMockNftKeeper(ctrl) - // uint64c := make(chan uint64) - // errorc := make(chan error) - // fmt.Println("s.addrs[0]") - // fmt.Println(s.addrs[0]) - // accountKeeper.EXPECT().GetSequence(gomock.Any(), uint(1)).Return(uint64(1), nil).AnyTimes() - - // loop addrs length - numIncrements := 5 - // for i := 0; i < len(s.addrs); i++ { - // for j := 0; j <= numIncrements; j++ { - // // mockCounter.EXPECT().Increment().Return(i) - // // accountKeeper.EXPECT().GetSequence(ctx, s.addrs[0]).Return(uint64(1), nil).AnyTimes() - // accountKeeper.EXPECT().GetSequence(ctx, s.addrs[i]).Return(uint64(j), nil) - // } - // } - for j := 0; j <= numIncrements; j++ { - accountKeeper.EXPECT().GetSequence(ctx, s.addrs[0]).Return(uint64(j), nil).Times(j).AnyTimes() - } - - // accountKeeper.EXPECT().GetSequence(ctx, s.addrs[0]).Return(uint64(1), nil).AnyTimes() - // accountKeeper.EXPECT().GetSequence(ctx,s.addrs[0]).Return(s.addrs[0]).AnyTimes() - - // nftKeeper := nftkeeper.NewKeeper(key, s.encCfg.Codec, accountKeeper, bankKeeper) - // queryHelper := baseapp.NewQueryServerTestHelper(ctx, s.encCfg.InterfaceRegistry) - // nft.RegisterQueryServer(queryHelper, nftKeeper) - - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memKey := sdk.NewKVStoreKey(types.MemStoreKey) - app := simapp.Setup(s.T(), ([]wasm.Option{})...) - // encodingConfig := appparams.MakeEncodingConfig() - // appCodec := s.encCfg.Marshaler - nftmintKeeper := keeper.NewKeeper( - s.encCfg.Codec, - storeKey, - memKey, - app.GetSubspace(types.ModuleName), - accountKeeper, - nftKeeper, - ) - - s.nftKeeper = nftKeeper - s.nftmintKeeper = nftmintKeeper - s.accountKeeper = accountKeeper - // s.queryClient = nft.NewQueryClient(queryHelper) - s.ctx = ctx +func (suite *KeeperTestSuite) SetupTest() { + isCheckTx := false + + app := simapp.Setup(suite.T(), ([]wasm.Option{})...) + + suite.ctx = app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) + suite.app = app + suite.addrs = simapp.AddTestAddrsIncremental(app, suite.ctx, 3, sdk.NewInt(30000000)) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry()) + nft.RegisterQueryServer(queryHelper, app.UnUniFiNFTKeeper) + suite.queryClient = nft.NewQueryClient(queryHelper) + + suite.keeper = app.NftfactoryKeeper + suite.nftKeeper = app.UnUniFiNFTKeeper + suite.accountKeeper = app.AccountKeeper + params := types.DefaultParams() + params.FeeCollectorAddress = suite.addrs[0].String() + app.NftfactoryKeeper.SetParams(suite.ctx, ¶ms) } func TestKeeperSuite(t *testing.T) { diff --git a/x/nftfactory/keeper/msg_server.go b/x/nftfactory/keeper/msg_server.go index d12eae472..06ee792bb 100644 --- a/x/nftfactory/keeper/msg_server.go +++ b/x/nftfactory/keeper/msg_server.go @@ -2,11 +2,13 @@ package keeper import ( "context" - "strconv" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/UnUniFi/chain/x/nftfactory/types" + + "github.com/cosmos/cosmos-sdk/x/nft" ) type msgServer struct { @@ -24,105 +26,162 @@ var _ types.MsgServer = msgServer{} func (k msgServer) CreateClass(c context.Context, msg *types.MsgCreateClass) (*types.MsgCreateClassResponse, error) { ctx := sdk.UnwrapSDKContext(c) - sender, err := sdk.AccAddressFromBech32(msg.Sender) + classId, err := k.keeper.CreateClass(ctx, msg.Sender, msg.Subclass) if err != nil { return nil, err } - seq, err := k.keeper.accountKeeper.GetSequence(ctx, sender) - if err != nil { - return nil, err + class := nft.Class{ + Id: classId, + Name: msg.Name, + Symbol: msg.Symbol, + Description: msg.Description, + Uri: msg.Uri, + UriHash: msg.UriHash, } - - classID := CreateClassId(seq, sender) - err = k.keeper.CreateClass(ctx, classID, msg) + err = k.keeper.nftKeeper.SaveClass(ctx, class) if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventCreateClass{ - Owner: msg.Sender, - ClassId: classID, - BaseTokenUri: msg.BaseTokenUri, - TokenSupplyCap: strconv.FormatUint(msg.TokenSupplyCap, 10), - MintingPermission: msg.MintingPermission, + _ = ctx.EventManager().EmitTypedEvent(&types.EventCreateClass{ + Sender: msg.Sender, + ClassId: classId, }) return &types.MsgCreateClassResponse{}, nil } -func (k msgServer) SendClassOwnership(c context.Context, msg *types.MsgSendClassOwnership) (*types.MsgSendClassOwnershipResponse, error) { +func (k msgServer) UpdateClass(c context.Context, msg *types.MsgUpdateClass) (*types.MsgUpdateClassResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.SendClassOwnership(ctx, msg); err != nil { + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventSendClassOwnership{ - Sender: msg.Sender, - ClassId: msg.ClassId, - Receiver: msg.Recipient, + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = k.keeper.nftKeeper.UpdateClass(ctx, nft.Class{ + Id: msg.ClassId, + Name: msg.Name, + Symbol: msg.Symbol, + Description: msg.Description, + Uri: msg.Uri, + UriHash: msg.UriHash, + }) + if err != nil { + return nil, err + } + + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateClass{ + Sender: msg.Sender, + ClassId: msg.ClassId, }) - return &types.MsgSendClassOwnershipResponse{}, nil + + return &types.MsgUpdateClassResponse{}, nil } -func (k msgServer) UpdateBaseTokenUri(c context.Context, msg *types.MsgUpdateBaseTokenUri) (*types.MsgUpdateBaseTokenUriResponse, error) { +func (k msgServer) MintNFT(c context.Context, msg *types.MsgMintNFT) (*types.MsgMintNFTResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.UpdateBaseTokenUri(ctx, msg); err != nil { + _, classExists := k.keeper.nftKeeper.GetClass(ctx, msg.ClassId) + if !classExists { + return nil, types.ErrClassDoesNotExist.Wrapf("class id: %s", msg.ClassId) + } + + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { + return nil, err + } + + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = k.keeper.mintTo(ctx, nft.NFT{ + ClassId: msg.ClassId, + Id: msg.TokenId, + Uri: msg.Uri, + UriHash: msg.UriHash, + }, msg.Sender) + + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventUpdateBaseTokenUri{ - Owner: msg.Sender, - ClassId: msg.ClassId, - BaseTokenUri: msg.BaseTokenUri, + _ = ctx.EventManager().EmitTypedEvent(&types.EventMintNFT{ + Sender: msg.Sender, + ClassId: msg.ClassId, + TokenId: msg.TokenId, + Recipient: msg.Recipient, }) - return &types.MsgUpdateBaseTokenUriResponse{}, nil + return &types.MsgMintNFTResponse{}, nil } -func (k msgServer) UpdateTokenSupplyCap(c context.Context, msg *types.MsgUpdateTokenSupplyCap) (*types.MsgUpdateTokenSupplyCapResponse, error) { +func (k msgServer) BurnNFT(c context.Context, msg *types.MsgBurnNFT) (*types.MsgBurnNFTResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.UpdateTokenSupplyCap(ctx, msg); err != nil { + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { + return nil, err + } + + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = k.keeper.burnFrom(ctx, msg.ClassId, msg.TokenId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventUpdateTokenSupplyCap{ - Owner: msg.Sender, - ClassId: msg.ClassId, - TokenSupplyCap: strconv.FormatUint(msg.TokenSupplyCap, 10), + _ = ctx.EventManager().EmitTypedEvent(&types.EventBurnNFT{ + Sender: msg.Sender, + ClassId: msg.ClassId, + TokenId: msg.TokenId, }) - return &types.MsgUpdateTokenSupplyCapResponse{}, nil + return &types.MsgBurnNFTResponse{}, nil } -func (k msgServer) MintNFT(c context.Context, msg *types.MsgMintNFT) (*types.MsgMintNFTResponse, error) { +func (k msgServer) ChangeAdmin(c context.Context, msg *types.MsgChangeAdmin) (*types.MsgChangeAdminResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.MintNFT(ctx, msg); err != nil { + authorityMetadata, err := k.keeper.GetAuthorityMetadata(ctx, msg.ClassId) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventMintNFT{ - ClassId: msg.ClassId, - NftId: msg.NftId, - Owner: msg.Recipient, - Minter: msg.Sender, + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = k.keeper.setAdmin(ctx, msg.ClassId, msg.NewAdmin) + if err != nil { + return nil, err + } + + _ = ctx.EventManager().EmitTypedEvent(&types.EventChangeAdmin{ + Admin: msg.Sender, + ClassId: msg.ClassId, + NewAdmin: msg.NewAdmin, }) - return &types.MsgMintNFTResponse{}, nil + return &types.MsgChangeAdminResponse{}, nil } -func (k msgServer) BurnNFT(c context.Context, msg *types.MsgBurnNFT) (*types.MsgBurnNFTResponse, error) { +func (k msgServer) UpdateParams(c context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) - if err := k.keeper.BurnNFT(ctx, msg); err != nil { + if msg.Sender != k.keeper.authority { + return nil, sdkerrors.ErrUnauthorized + } + + err := k.keeper.SetParams(ctx, &msg.Params) + if err != nil { return nil, err } - ctx.EventManager().EmitTypedEvent(&types.EventBurnNFT{ - Burner: msg.Sender, - ClassId: msg.ClassId, - NftId: msg.NftId, - }) - return &types.MsgBurnNFTResponse{}, nil + return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/nftfactory/keeper/nft.go b/x/nftfactory/keeper/nft.go deleted file mode 100644 index 3ef3ebfbf..000000000 --- a/x/nftfactory/keeper/nft.go +++ /dev/null @@ -1,125 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -// MintNFT does validate the contents of MsgMintNFT and operate whole flow for MintNFT message -func (k Keeper) MintNFT(ctx sdk.Context, msg *types.MsgMintNFT) error { - if !k.nftKeeper.HasClass(ctx, msg.ClassId) { - return sdkerrors.Wrap(nfttypes.ErrClassExists, msg.ClassId) - } - - classAttributes, exists := k.GetClassAttributes(ctx, msg.ClassId) - if !exists { - return sdkerrors.Wrapf(types.ErrClassAttributesNotExists, "class attributes with class id %s doesn't exist", msg.ClassId) - } - - nftUri := classAttributes.BaseTokenUri + msg.NftId - params := k.GetParamSet(ctx) - currentTokenSupply := k.nftKeeper.GetTotalSupply(ctx, msg.ClassId) - - owner, err := sdk.AccAddressFromBech32(classAttributes.Owner) - if err != nil { - return err - } - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return err - } - - err = types.ValidateMintNFT( - params, - classAttributes.MintingPermission, - owner, sender, - nftUri, msg.NftId, - currentTokenSupply, classAttributes.TokenSupplyCap, - ) - if err != nil { - return err - } - - recipient, err := sdk.AccAddressFromBech32(msg.Recipient) - if err != nil { - return err - } - - if err := k.nftKeeper.Mint(ctx, types.NewNFT(msg.ClassId, msg.NftId, nftUri), recipient); err != nil { - return err - } - - if err := k.SetNFTMinter(ctx, msg.ClassId, msg.NftId, sender); err != nil { - return err - } - - return nil -} - -// BurnNFT does validate the contents of MsgBurnNFT and operate whole flow for BurnNFT message -func (k Keeper) BurnNFT(ctx sdk.Context, msg *types.MsgBurnNFT) error { - if !k.nftKeeper.HasClass(ctx, msg.ClassId) { - return sdkerrors.Wrap(nfttypes.ErrClassNotExists, msg.ClassId) - } - - if !k.nftKeeper.HasNFT(ctx, msg.ClassId, msg.NftId) { - return sdkerrors.Wrap(nfttypes.ErrNFTNotExists, msg.NftId) - } - - owner := k.nftKeeper.GetOwner(ctx, msg.ClassId, msg.NftId) - if owner.String() != msg.Sender { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not the owner of nft %s", msg.Sender, msg.NftId) - } - - if err := k.nftKeeper.Burn(ctx, msg.ClassId, msg.NftId); err != nil { - return err - } - return nil -} - -// UpdateNFTUri is called in UpdateBaseTokenUri message to apply the changed BaseTokenUri to each NFT.Uri -func (k Keeper) UpdateNFTUri(ctx sdk.Context, classID, baseTokenUri string) error { - nfts := k.nftKeeper.GetNFTsOfClass(ctx, classID) - if len(nfts) == 0 { - return nil - } - - params := k.GetParamSet(ctx) - for _, nft := range nfts { - nftUriLatest := baseTokenUri + nft.Id - nft.Uri = nftUriLatest - if err := types.ValidateUri(params.MinUriLen, params.MaxUriLen, nftUriLatest); err != nil { - return err - } - if err := k.nftKeeper.Update(ctx, nft); err != nil { - return err - } - } - - return nil -} - -func (k Keeper) SetNFTMinter(ctx sdk.Context, classID, nftID string, minter sdk.AccAddress) error { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixNFTMinter)) - - prefixStore.Set(types.NFTMinterKey(classID, nftID), minter.Bytes()) - return nil -} - -func (k Keeper) GetNFTMinter(ctx sdk.Context, classID, nftID string) (sdk.AccAddress, bool) { - store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(types.KeyPrefixNFTMinter)) - - bz := prefixStore.Get(types.NFTMinterKey(classID, nftID)) - if bz == nil { - return nil, false - } - - minter := sdk.AccAddress(bz) - return minter, true -} diff --git a/x/nftfactory/keeper/nft_test.go b/x/nftfactory/keeper/nft_test.go deleted file mode 100644 index a9f2d1ee4..000000000 --- a/x/nftfactory/keeper/nft_test.go +++ /dev/null @@ -1,193 +0,0 @@ -package keeper_test - -import ( - "fmt" - - "github.com/cometbft/cometbft/crypto/ed25519" - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/UnUniFi/chain/x/nftfactory/keeper" - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - testNFTId = "a00" -) - -// test for the MintNFT relating functions -func (suite *KeeperTestSuite) TestMintNFT() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.CreateClass(suite.ctx, classId, sender) - - recipient := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - - testMsgMintNFT := types.MsgMintNFT{ - Sender: sender.Bytes(), - ClassId: classId, - NftId: testNFTId, - Recipient: recipient.Bytes(), - } - err := suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFT) - suite.Require().NoError(err) - // check owner - owner := suite.nftKeeper.GetOwner(suite.ctx, classId, testNFTId) - expectedOwner := recipient - suite.Require().Equal(expectedOwner, owner) - // check minter - minter, exists := suite.nftmintKeeper.GetNFTMinter(suite.ctx, classId, testNFTId) - suite.Require().True(exists) - expectedMinter := sender - suite.Require().Equal(expectedMinter, minter) - - // invalid nft id case to give invalid nft uri length on UnUniFi - invalidNFTIdUri := "test" - for i := 0; i < types.DefaultMaxUriLen; i++ { - invalidNFTIdUri += "a" - } - testMsgMintNFTInvalidNftIdUri := types.MsgMintNFT{ - Sender: sender.Bytes(), - ClassId: classId, - NftId: invalidNFTIdUri, - Recipient: recipient.Bytes(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTInvalidNftIdUri) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, invalidNFTIdUri) - suite.Require().False(exists) - - // invalid nft id by sdk's x/nft validation in case for not being called through message - invalidNFTId := "a" // shorter than the defined minimum length by sdk's x/nft module - testMsgMintNFTInvalidNftId := types.MsgMintNFT{ - Sender: sender.Bytes(), - ClassId: classId, - NftId: invalidNFTId, - Recipient: recipient.Bytes(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTInvalidNftId) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, invalidNFTId) - suite.Require().False(exists) - - // invalid case by the minting permission limitation - // estimate MintingPermission = 0 (OnlyOwner) - notOwnerOfClass := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - testNFTId2 := testNFTId + "2" - testMsgMintNFTInvalidMinter := types.MsgMintNFT{ - Sender: notOwnerOfClass.Bytes(), - ClassId: classId, - NftId: testNFTId2, - Recipient: recipient.Bytes(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTInvalidMinter) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId2) - suite.Require().False(exists) - - // invalid case which is over the defined token supply cap - classId = "test" - testMsgCreateClass := types.MsgCreateClass{ - Sender: sender.Bytes(), - Name: "test", - BaseTokenUri: "ipfs://testuri/", - TokenSupplyCap: 1, - MintingPermission: 0, - } - _ = suite.nftmintKeeper.CreateClass(suite.ctx, classId, &testMsgCreateClass) - _ = suite.nftKeeper.Mint(suite.ctx, nfttypes.NFT{ClassId: classId, Id: testNFTId}, sender) - testMsgMintNFTOverCap := types.MsgMintNFT{ - Sender: sender.Bytes(), - ClassId: classId, - NftId: testNFTId2, - Recipient: sender.Bytes(), - } - err = suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFTOverCap) - suite.Require().Error(err) - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId2) - suite.Require().False(exists) -} - -// tests for the BurnNFT relating functions -func (suite *KeeperTestSuite) TestBurnNFT() { - sender := suite.addrs[0] - fmt.Println("sender") - fmt.Println(sender) - sender_ := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - fmt.Println("sender_") - fmt.Println(sender_) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - // sender_seq, _ := suite.app.AccountKeeper.GetSequence(suite.ctx, sender) - - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - testMsgBurnNFT := types.MsgBurnNFT{ - Sender: sender.Bytes(), - ClassId: classId, - NftId: testNFTId, - } - err := suite.nftmintKeeper.BurnNFT(suite.ctx, &testMsgBurnNFT) - suite.Require().NoError(err) - // check if burned successfully - exists := suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId) - suite.Require().False(exists) - - // invalid case which sender is not the owner of the nft - invalidSender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - testMsgBurnNFTInvalidSender := types.MsgBurnNFT{ - Sender: invalidSender.Bytes(), - ClassId: classId, - NftId: testNFTId, - } - err = suite.nftmintKeeper.BurnNFT(suite.ctx, &testMsgBurnNFTInvalidSender) - suite.Require().Error(err) - // check if not burned as intended - exists = suite.nftKeeper.HasNFT(suite.ctx, classId, testNFTId) - suite.Require().True(exists) -} - -// tests for UpdateNFTUri function -func (suite *KeeperTestSuite) TestUpdateNFTUri() { - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes()) - sender_seq, _ := suite.accountKeeper.GetSequence(suite.ctx, sender) - - classId := keeper.CreateClassId(sender_seq, sender) - _ = suite.MintNFT(suite.ctx, classId, testNFTId, sender) - - updatingBaseTokenUri := "ipfs://test-latest/" - err := suite.nftmintKeeper.UpdateNFTUri(suite.ctx, classId, updatingBaseTokenUri) - suite.Require().NoError(err) - nft, _ := suite.nftKeeper.GetNFT(suite.ctx, classId, testNFTId) - expectedNFTUri := updatingBaseTokenUri + testNFTId - suite.Require().Equal(expectedNFTUri, nft.Uri) - - // invalid BaseTokenUri length defined on UnUniFi - invalidBaseTokenUri := "invalid" - for i := 0; i < types.DefaultMaxUriLen; i++ { - invalidBaseTokenUri += "a" - } - err = suite.nftmintKeeper.UpdateNFTUri(suite.ctx, classId, invalidBaseTokenUri) - suite.Require().Error(err) - // check if nft uri doesn't change after updating - nft, _ = suite.nftKeeper.GetNFT(suite.ctx, classId, testNFTId) - expectedNFTUri = updatingBaseTokenUri + testNFTId - suite.Require().Equal(expectedNFTUri, nft.Uri) -} - -// mint nft method for keeper test -func (suite *KeeperTestSuite) MintNFT(ctx sdk.Context, classID, nftID string, sender sdk.AccAddress) error { - _ = suite.CreateClass(suite.ctx, classID, sender) - - testMsgMintNFT := types.MsgMintNFT{ - Sender: sender.Bytes(), - ClassId: classID, - NftId: nftID, - Recipient: sender.Bytes(), - } - err := suite.nftmintKeeper.MintNFT(suite.ctx, &testMsgMintNFT) - return err -} diff --git a/x/nftfactory/keeper/nftactions.go b/x/nftfactory/keeper/nftactions.go new file mode 100644 index 000000000..47dd0c817 --- /dev/null +++ b/x/nftfactory/keeper/nftactions.go @@ -0,0 +1,44 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/cosmos-sdk/x/nft" + + "github.com/UnUniFi/chain/x/nftfactory/types" +) + +func (k Keeper) mintTo(ctx sdk.Context, token nft.NFT, mintTo string) error { + // verify that denom is an x/nftfactory denom + _, _, err := types.DeconstructClassId(token.ClassId) + if err != nil { + return err + } + + addr, err := sdk.AccAddressFromBech32(mintTo) + if err != nil { + return err + } + + err = k.nftKeeper.Mint(ctx, token, addr) + if err != nil { + return err + } + + return nil +} + +func (k Keeper) burnFrom(ctx sdk.Context, classId string, tokenId string) error { + // verify that denom is an x/nftfactory denom + _, _, err := types.DeconstructClassId(classId) + if err != nil { + return err + } + + err = k.nftKeeper.Burn(ctx, classId, tokenId) + if err != nil { + return err + } + + return nil +} diff --git a/x/nftfactory/keeper/params.go b/x/nftfactory/keeper/params.go index 262044c33..384751019 100644 --- a/x/nftfactory/keeper/params.go +++ b/x/nftfactory/keeper/params.go @@ -2,18 +2,36 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/UnUniFi/chain/x/nftfactory/types" ) -// GetParamSet returns token params from the global param store -func (k Keeper) GetParamSet(ctx sdk.Context) types.Params { - var p types.Params - k.paramSpace.GetParamSet(ctx, &p) - return p +func (k Keeper) GetParams(ctx sdk.Context) (*types.Params, error) { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(types.KeyParams) + if bz == nil { + return nil, sdkerrors.ErrNotFound.Wrap("x/nftfactory module params") + } + + var params types.Params + if err := k.cdc.Unmarshal(bz, ¶ms); err != nil { + return nil, types.ErrParsingParams.Wrap(err.Error()) + } + + return ¶ms, nil } -// SetParamSet sets token params to the global param store -func (k Keeper) SetParamSet(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { + store := ctx.KVStore(k.storeKey) + + bz, err := k.cdc.Marshal(params) + if err != nil { + return types.ErrParsingParams.Wrap(err.Error()) + } + + store.Set(types.KeyParams, bz) + + return nil } diff --git a/x/nftfactory/keeper/test/01_create_update_class.sh b/x/nftfactory/keeper/test/01_create_update_class.sh new file mode 100644 index 000000000..d895c5061 --- /dev/null +++ b/x/nftfactory/keeper/test/01_create_update_class.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w + +echo "------------create class id------------" +ununifid tx nftfactory create-class test \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_id=$(ununifid q nftfactory classes-from-creator $user1_address -o json | jq .classes[0] | tr -d '"') +expected_class_id=factory/$user1_address/test + +echo "------------check class id------------" +if [ "$expected_class_id" = "$class_id" ]; then + echo "pass: class_id is correct: $class_id" +else + echo "error: class_id is incorrect:" + echo "expected: $expected_class_id actual: $class_id" +fi + +echo "------------update class------------" +ununifid tx nftfactory update-class $class_id \ +--name "updated" --symbol "OK" --description "after class changed" --uri "change url" --uri-hash "changed" \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_name=$(ununifid q nft class $class_id -o json | jq .class.name | tr -d '"') +expected_class_name=updated + +echo "------------check class name------------" +if [ "$expected_class_name" = "$class_name" ]; then + echo "pass: class_name is correct: $class_name" +else + echo "error: class_name is incorrect:" + echo "expected: $expected_class_name actual: $class_name" +fi diff --git a/x/nftfactory/keeper/test/02_create_delete-nft.sh b/x/nftfactory/keeper/test/02_create_delete-nft.sh new file mode 100644 index 000000000..2dd98962a --- /dev/null +++ b/x/nftfactory/keeper/test/02_create_delete-nft.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w + +echo "------------create class------------" +ununifid tx nftfactory create-class test \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_id=$(ununifid q nftfactory classes-from-creator $user1_address -o json | jq .classes[0] | tr -d '"') + +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft $class_id test01 $user1_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +owner=$(ununifid q nft owner $class_id test01 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "$user1_address" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: $user1_address actual: $owner" +fi + +echo "------------not owner cannot burn nft------------" +ununifid tx nftfactory burn-nft $class_id test01 \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep +owner=$(ununifid q nft owner $class_id test01 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "$user1_address" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: $user1_address actual: $owner" +fi + + +echo "------------burn nft------------" +ununifid tx nftfactory burn-nft $class_id test01 \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +owner=$(ununifid q nft owner $class_id test01 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: "" actual: $owner" +fi diff --git a/x/nftfactory/keeper/test/03_change_admin.sh b/x/nftfactory/keeper/test/03_change_admin.sh new file mode 100644 index 000000000..606ddf734 --- /dev/null +++ b/x/nftfactory/keeper/test/03_change_admin.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# block speed +sleep=5 + +user1_address=ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w +user2_address=ununifi1v0h8j7x7kfys29kj4uwdudcc9y0nx6twwxahla + +echo "------------create class------------" +ununifid tx nftfactory create-class test \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +class_id=$(ununifid q nftfactory classes-from-creator $user1_address -o json | jq .classes[0] | tr -d '"') + +echo "------------change admin------------" +ununifid tx nftfactory change-admin $class_id $user2_address \ +--from user1 --keyring-backend test --chain-id test --yes + +sleep $sleep + +admin=$(ununifid q nftfactory class-authority-metadata $class_id -o json | jq .authority_metadata.Admin | tr -d '"') + +echo "------------check admin------------" +if [ "$user2_address" = "$admin" ]; then + echo "pass: admin is correct: $admin" +else + echo "error: admin is incorrect:" + echo "expected: $user2_address actual: $admin" +fi + +echo "------------mint nft------------" +ununifid tx nftfactory mint-nft $class_id test02 $user2_address \ +--from user2 --keyring-backend test --chain-id test --yes + +sleep $sleep + +owner=$(ununifid q nft owner $class_id test02 -o json | jq .owner | tr -d '"') + +echo "------------check owner------------" +if [ "$user2_address" = "$owner" ]; then + echo "pass: owner is correct: $owner" +else + echo "error: owner is incorrect:" + echo "expected: $user2_address actual: $owner" +fi diff --git a/x/nftfactory/keeper/utils.go b/x/nftfactory/keeper/utils.go deleted file mode 100644 index 650c4994a..000000000 --- a/x/nftfactory/keeper/utils.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper - -import ( - "encoding/binary" -) - -// use with error handler -func SliceIndex(s []string, element string) int { - for i := 0; i < len(s); i++ { - if element == s[i] { - return i - } - } - return -1 -} - -func RemoveIndex(s []string, index int) []string { - return (append(s[:index], s[index+1:]...)) -} - -func UintToByte(u uint64) []byte { - b := make([]byte, 8) - binary.LittleEndian.PutUint64(b, u) - return b -} diff --git a/x/nftfactory/module.go b/x/nftfactory/module.go index 65bc2d881..c89ade74e 100644 --- a/x/nftfactory/module.go +++ b/x/nftfactory/module.go @@ -1,4 +1,4 @@ -package nftmint +package nftfactory import ( "context" @@ -89,7 +89,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { // GetQueryCmd returns the capability module's root query command. func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + return cli.GetQueryCmd() } // ---------------------------------------------------------------------------- @@ -137,15 +137,15 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - InitGenesis(ctx, am.keeper, am.nftKeeper, genState) + am.keeper.InitGenesis(ctx, genState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(&genState) + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) } // ConsensusVersion implements AppModule/ConsensusVersion. diff --git a/x/nftfactory/spec/02_state.md b/x/nftfactory/spec/02_state.md index 16cc1d5af..951ed2cb4 100644 --- a/x/nftfactory/spec/02_state.md +++ b/x/nftfactory/spec/02_state.md @@ -1,65 +1,24 @@ # State -## Class and its Relating Attributes - -### ClassAttributes - -We use `ClassAttributes` data object to represent the information which sdk's x/nft module's `Class` doesn't have like owner of the `Class`. -We require to choose the parameter values when to send `MsgCreateClass` message. To change the parameters in `ClassAttributes` can be made by sending messages to achieve it like `MsgUpdateBaseTokenUri`. -The close explanation of each parameter lies in 01_concept page. - - ```protobuf -message ClassAttributes { - string class_id = 1; - string owner = 2; - string base_token_uri = 3; - MintingPermission minting_permission = 4; - uint64 token_supply_cap = 5; -} +message ClassAuthorityMetadata { + option (gogoproto.equal) = true; -enum MintingPermission { - OnlyOwner = 0; - Anyone = 1; - WhiteList = 2; + // Can be empty for no admin, or a valid address + string Admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; } ``` -### OwningClassIdList - -OwningClassIdList data is to record the class ids which are owned by specific address. -This is specifically used to query `QueryClassIdsByOwner`. - ```protobuf -message OwningClassIdList { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", +message Params { + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + repeated cosmos.base.v1beta1.Coin class_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", (gogoproto.nullable) = false ]; - repeated string class_id = 2; -} -``` - -### ClassNameIdList -ClassNameIdList data is to record the class ids which has specific name. -This is specifically used to query `QueryClassIdsByName`. - -```protobuf -message ClassNameIdList { - string class_name = 1; - repeated string class_id = 2; + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 2; } ``` - -- ClassAttributes with prefix "0x01": `format(class_id) -> ClassAttributes` -- OwningClassIdList with prefix "0x03": `format(owner) -> OwningClassIdList` -- ClassNameIdList with prefix "0x04": `format(name) -> ClassNameIdList` - -## NFT and its Relating Attributes - -There aren't types defined in proto for the relating to nft data. -But, in UnUniFi, the minter of each NFT is recorded. - -- Minter with prefix "0x02": `format(class_id + nft_id) -> AccAddress.Byte()` diff --git a/x/nftfactory/spec/03_msgs_and_queries.md b/x/nftfactory/spec/03_msgs_and_queries.md index 562bf82c0..1df9aa388 100644 --- a/x/nftfactory/spec/03_msgs_and_queries.md +++ b/x/nftfactory/spec/03_msgs_and_queries.md @@ -2,94 +2,19 @@ ## Messages -The `nftmint` module provides below messages. +The `nftfactory` module provides below messages. ### CreateClass -CreateClass message is used to create `Class` for minting NFTs using cosmos sdk's x/nft module functions. -In cosmos sdk, the `Class` object is to the contract in EVM. So to mint NFT requires corresponding the `Class`. - -Additionaly on UnUniFi, we create `ClassAttributes` data with some parameters. -The `MintingPermission` defines who can mint NFTs under this `Class`. The current providing options are `OnlyOwner` (0) and `Anyone` (1). -If the `Class` have `OnlyOwner` permission, the NFTs can be minted by literaly only owner of the `Class`. -If the `Class` have `Anyone` permission, the NFTs can be minted by anyone. - -The `Symbol`, `Description` and `ClassUri` are the flag options which can be set blank. - ```protobuf message MsgCreateClass { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string name = 2; - string base_token_uri = 3; - uint64 token_supply_cap = 4; - MintingPermission minting_permission = 5; - string symbol = 7; - string description = 8; - string class_uri = 9; -} - -enum MintingPermission { - OnlyOwner = 0; - Anyone = 1; -} -``` - -### SendClass - -The SendClass message is used to change the owner of the `Class` on UnUniFi. -Technically speaking, this message, if accepted, changes the parameter value of the `ClassAttributes.Owner` to the recipient. - -```protobuf -message MsgSendClass { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - string recipient = 3 [ - (gogoproto.moretags) = "yaml:\"recipient\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; -} -``` - -### UpdateBaseTokenUri - -The UpdateBaseTokenUri message is used to change the `BaseTokenUri` of the `Class` by defining `Class.Id`. -When this message is sended successfully, the all belonging NFT's `NFT.Uri` are changed according to the updating `BaseTokenUri`. - -```protobuf -message MsgUpdateBaseTokenUri { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - string base_token_uri = 3; -} -``` - -### UpdateTokenSupplyCap - -The UpdateTokenSupplyCap message is used to change the `TokenSupplyCap` of the `Class` by defining `Class.Id`. -This message fails if the tokens supply under the `Class` is over the updating `TokenSupplyCap`. - -```protobuf -message MsgUpdateTokenSupplyCap { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - uint64 token_supply_cap = 3; + string sender = 1; + string subclass = 2; + string name = 3; + string symbol = 4; + string description = 5; + string uri = 6; + string uri_hash = 7; } ``` @@ -100,18 +25,12 @@ The specifing `NFT.Id` becomes a part of the `NFT.Uri`. ```protobuf message MsgMintNFT { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string class_id = 2; - string nft_id = 3; - string recipient = 4 [ - (gogoproto.moretags) = "yaml:\"recipient\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; + string sender = 1; + string class_id = 2; + string token_id = 3; + string uri = 4; + string uri_hash = 5; + string recipient = 6; } ``` @@ -122,96 +41,8 @@ Only the owner of the `NFT` can send this message. ```protobuf message MsgBurnNFT { - string sender = 1 [ - (gogoproto.moretags) = "yaml:\"sender\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; + string sender = 1; string class_id = 2; - string nft_id = 3; -} -``` - -## Queries - -The `nftmint` module supports below queries. - -### ClassAttributes - -The ClassAttributes query is used to get `ClassAttributes` data specified by `Class.Id`. -The `ClassAttributes` data structure is as below. - -```protobuf -message QueryClassAttributesRequest { - string class_id = 1; -} -message QueryClassAttributesResponse { - ClassAttributes class_attributes = 1; -} - -message ClassAttributes { - string class_id = 1; - string owner = 2 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - string base_token_uri = 3; - MintingPermission minting_permission = 4; - uint64 token_supply_cap = 5; -} -``` - -### NFTMinter - -The NFTMinter query is used to get the minter of the `NFT` specified by `Class.Id` and `NFT.Id`. - -```protobuf -message QueryNFTMinterRequest { - string class_id = 1; - string nft_id = 2; -} -message QueryNFTMinterResponse { - string minter = 1; -} -``` - -### ClassIdsByName - -The ClassIdsByName query is used to get the `ClassNameIdList` data specified by `Class.Name`. - -```protobuf -message QueryClassIdsByNameRequest { - string class_name = 1; -} -message QueryClassIdsByNameResponse { - ClassNameIdList class_name_id_list = 1; -} - -message ClassNameIdList { - string class_name = 1; - repeated string class_id = 2; -} -``` - -### ClassIdsByOwner - -The ClassIdsByOwner query is used to get the `OwningClassIdList` data specified by the owner address. - -```protobuf -message QueryClassIdsByOwnerRequest { - string owner = 1; -} -message QueryClassIdsByOwnerResponse { - OwningClassIdList owning_class_id_list = 1; -} - -message OwningClassIdList { - string owner = 1 [ - (gogoproto.moretags) = "yaml:\"owner\"", - (gogoproto.customtype) = "github.com/UnUniFi/chain/types.StringAccAddress", - (gogoproto.nullable) = false - ]; - repeated string class_id = 2; + string token_id = 3; } ``` diff --git a/x/nftfactory/spec/04_events.md b/x/nftfactory/spec/04_events.md index 6c0ce6fc1..ce2eab679 100644 --- a/x/nftfactory/spec/04_events.md +++ b/x/nftfactory/spec/04_events.md @@ -2,65 +2,32 @@ The `nftmint` module emits the following events. -## EventMsgCreateClass +## EventCreateClass ```protobuf message EventCreateClass { string owner = 1; string class_id = 2; - string base_token_uri = 3; - string token_supply_cap = 4; - MintingPermission minting_permission = 5; } ``` -## EventMsgSendClass - -```protobuf -message EventSendClass { - string sender = 1; - string receiver = 2; - string class_id = 3; -} -``` - -## EventMsgUpdateBaseTokenUri - -```protobuf -message EventUpdateBaseTokenUri { - string owner = 1; - string class_id = 2; - string base_token_uri = 3; -} -``` - -## EventMsgUpdateTokenSupplyCap - -```protobuf -message EventUpdateTokenSupplyCap { - string owner = 1; - string class_id = 2; - string token_supply_cap = 3; -} -``` - -## EventMsgMintNFT +## EventMintNFT ```protobuf message EventMintNFT { - string class_id = 1; - string nft_id = 2; - string owner = 3; - string minter = 4; + string sender = 1; + string class_id = 2; + string token_id = 3; + string recipient = 4; } ``` -## EventMsgBurnNFT +## EventBurnNFT ```protobuf message EventBurnNFT { - string burner = 1; + string sender = 1; string class_id = 2; - string nft_id = 3; + string token_id = 3; } ``` diff --git a/x/nftfactory/spec/05_params.md b/x/nftfactory/spec/05_params.md index c0330e25f..03c595a3b 100644 --- a/x/nftfactory/spec/05_params.md +++ b/x/nftfactory/spec/05_params.md @@ -2,34 +2,16 @@ `Params` describes global parameters that are maintained by governance. -| Key | Type | -| ----------------------| -------------| -| MaxNFTSupplyCap | uint64 | -| MinClassNameLen | uint64 | -| MaxClassNameLen | uint64 | -| MinUriLen | uint64 | -| MaxUriLen | uint64 | -| MaxSymbolLen | uint64 | -| MaxDescriptionLen | uint64 | +```protobuf +message Params { + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + repeated cosmos.base.v1beta1.Coin class_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", + (gogoproto.nullable) = false + ]; -1. **MaxTokenSupply** - The max token supply is the cap of the number of each `Class`'s `NFT`. -1. **MinClassNameLen** - The min class name length is the min string length that `Class.Name` can be put. -1. **MaxClassNameLen** - The max class name length is the max string length that `Class.Name` can be put. -1. **MinUriLen** - The min uri length is the min string length that uris on UnUniFi can be put. -1. **MaxUriLen** - The max uri length is the max string length that uris on UnUniFi can be put. -1. **MaxSymbolLen** - The max symbol length is the max string length that `Class.Symbol` can be put. -1. **MaxDescriptionLen** - The max description length is the max string length that `Class.Description` can be put. - -### Default values - -```json -{ - "MaxTokenSupplyLimit": 100000, - "MinClassNameLen": 3, - "MaxClassNameLen": 128, - "MinUriLen": 8, - "MaxUriLen": 512, - "MaxSymbolLen": 16, - "MaxDescriptionLen": 1024 + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 2; } ``` diff --git a/x/nftfactory/spec/README.md b/x/nftfactory/spec/README.md index c3924f357..cd49eac0c 100644 --- a/x/nftfactory/spec/README.md +++ b/x/nftfactory/spec/README.md @@ -1,14 +1,13 @@ -# NFT Mint +# NFT Factory ## Abstract -The `nftmint` module provides the feature to mint NFTs on UnUniFi. -Users can mint collective NFTs by sending specific messages. +The `nftfactory` module provides the feature to create NFTs. ## Contents -[Concepts](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/01_concepts.md) -[State](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/02_state.md) -[Messages and Query](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/03_msgs_and_queries.md) +[Concepts](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/01_concepts.md) +[State](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/02_state.md) +[Messages and Query](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/03_msgs_and_queries.md) [Events](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/04_events.md) [Params](https://github.com/UnUniFi/chain/blob/design/spec/x/nftmint/spec/05_params.md) diff --git a/x/nftfactory/types/class.go b/x/nftfactory/types/class.go deleted file mode 100644 index dd2860a5e..000000000 --- a/x/nftfactory/types/class.go +++ /dev/null @@ -1,42 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" -) - -func NewClass(classID, name, symbol, description, classUri string) nfttypes.Class { - return nfttypes.Class{ - Id: classID, - Name: name, - Symbol: symbol, - Description: description, - Uri: classUri, - } -} - -func NewClassAttributes( - classID string, - owner sdk.AccAddress, - baseTokenUri string, - mintingpermission MintingPermission, - tokenSupplyCap uint64, -) ClassAttributes { - return ClassAttributes{ - ClassId: classID, - Owner: owner.String(), - BaseTokenUri: baseTokenUri, - MintingPermission: mintingpermission, - TokenSupplyCap: tokenSupplyCap, - } -} - -func NewOwningClassIdList(owner sdk.AccAddress) OwningClassIdList { - var classIDList []string - return OwningClassIdList{Owner: owner.String(), ClassId: classIDList} -} - -func NewClassNameIdList(className string) ClassNameIdList { - var classIDList []string - return ClassNameIdList{ClassName: className, ClassId: classIDList} -} diff --git a/x/nftfactory/types/class_id.go b/x/nftfactory/types/class_id.go new file mode 100644 index 000000000..e3a7bb289 --- /dev/null +++ b/x/nftfactory/types/class_id.go @@ -0,0 +1,65 @@ +package types + +import ( + "strings" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + ModuleDenomPrefix = "factory" + MaxSubdenomLength = 512 + MaxHrpLength = 16 + // MaxCreatorLength = 59 + MaxHrpLength + MaxCreatorLength = 59 + MaxHrpLength +) + +// GetClassId constructs a denom string for tokens created by tokenfactory +// based on an input creator address and a subdenom +// The denom constructed is factory/{creator}/{subdenom} +func GetClassId(creator, subclass string) (string, error) { + if len(subclass) > MaxSubdenomLength { + return "", ErrSubclassTooLong + } + if len(subclass) > MaxCreatorLength { + return "", ErrCreatorTooLong + } + if strings.Contains(creator, "/") { + return "", ErrInvalidCreator + } + denom := strings.Join([]string{ModuleDenomPrefix, creator, subclass}, "/") + return denom, sdk.ValidateDenom(denom) +} + +// DeconstructClassId takes a token denom string and verifies that it is a valid +// denom of the tokenfactory module, and is of the form `factory/{creator}/{subdenom}` +// If valid, it returns the creator address and subdenom +func DeconstructClassId(classId string) (creator, subclass string, err error) { + err = sdk.ValidateDenom(classId) + if err != nil { + return "", "", err + } + + strParts := strings.Split(classId, "/") + if len(strParts) < 3 { + return "", "", errorsmod.Wrapf(ErrInvalidClassId, "not enough parts of class id %s", classId) + } + + if strParts[0] != ModuleDenomPrefix { + return "", "", errorsmod.Wrapf(ErrInvalidClassId, "class id prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) + } + + creator = strParts[1] + _, err = sdk.AccAddressFromBech32(creator) + if err != nil { + return "", "", errorsmod.Wrapf(ErrInvalidClassId, "Invalid creator address (%s)", err) + } + + // Handle the case where a denom has a slash in its subdenom. For example, + // when we did the split, we'd turn factory/accaddr/atomderivative/sikka into ["factory", "accaddr", "atomderivative", "sikka"] + // So we have to join [2:] with a "/" as the delimiter to get back the correct subdenom which should be "atomderivative/sikka" + subclass = strings.Join(strParts[2:], "/") + + return creator, subclass, nil +} diff --git a/x/nftfactory/types/codec.go b/x/nftfactory/types/codec.go index 103891af7..6ff421232 100644 --- a/x/nftfactory/types/codec.go +++ b/x/nftfactory/types/codec.go @@ -13,11 +13,11 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateClass{}, + &MsgUpdateClass{}, &MsgMintNFT{}, - &MsgSendClassOwnership{}, - &MsgUpdateBaseTokenUri{}, - &MsgUpdateTokenSupplyCap{}, &MsgBurnNFT{}, + &MsgChangeAdmin{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/nftfactory/types/errors.go b/x/nftfactory/types/errors.go index b79b838f9..2cfdabdb2 100644 --- a/x/nftfactory/types/errors.go +++ b/x/nftfactory/types/errors.go @@ -1,22 +1,24 @@ package types +// DONTCOVER + import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + fmt "fmt" + + errorsmod "cosmossdk.io/errors" ) +// x/tokenfactory module sentinel errors var ( - ErrClassIdInvalidLength = sdkerrors.Register(ModuleName, 1, "class id length is invalid") - ErrClassAttributesNotExists = sdkerrors.Register(ModuleName, 2, "class attributes does not exist") - ErrOwningClassIdListNotExists = sdkerrors.Register(ModuleName, 3, "owning class list does not exist") - ErrIndexNotFoundInOwningClassIDs = sdkerrors.Register(ModuleName, 4, "class id is not found in list") - ErrInvalidMintingPermission = sdkerrors.Register(ModuleName, 5, "invalid minting permission for the class") - ErrClassNameIdListNotExists = sdkerrors.Register(ModuleName, 6, "class name id list with this class name does not exists") - ErrClassNameInvalidLength = sdkerrors.Register(ModuleName, 7, "invalid class name length on UnUniFi") - ErrUriInvalidLength = sdkerrors.Register(ModuleName, 8, "invalid uri length on UnUniFi") - ErrInvalidTokenSupplyCap = sdkerrors.Register(ModuleName, 9, "invalid token supply cap on UnUniFi") - ErrClassSymbolInvalidLength = sdkerrors.Register(ModuleName, 10, "invalid class symbol length on UnUniFi") - ErrClassDescriptionInvalidLength = sdkerrors.Register(ModuleName, 11, "invalid class description length on UnUniFi") - ErrTokenSupplyBelow = sdkerrors.Register(ModuleName, 12, "updating token supply cap number is over the number of the current supplied token") - ErrNftAttributesNotExists = sdkerrors.Register(ModuleName, 13, "nft attributes does not exist") - ErrTokenSupplyCapOver = sdkerrors.Register(ModuleName, 14, "current token supply is reached the number of the defined token supply cap") + ErrParsingParams = errorsmod.Register(ModuleName, 1, "failed to marshal or unmarshal module params") + ErrClassExists = errorsmod.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") + ErrUnauthorized = errorsmod.Register(ModuleName, 3, "unauthorized account") + ErrInvalidClassId = errorsmod.Register(ModuleName, 4, "invalid class id") + ErrInvalidCreator = errorsmod.Register(ModuleName, 5, "invalid creator") + ErrInvalidAuthorityMetadata = errorsmod.Register(ModuleName, 6, "invalid authority metadata") + ErrInvalidGenesis = errorsmod.Register(ModuleName, 7, "invalid genesis") + ErrSubclassTooLong = errorsmod.Register(ModuleName, 8, fmt.Sprintf("subclass too long, max length is %d bytes", MaxSubdenomLength)) + ErrCreatorTooLong = errorsmod.Register(ModuleName, 9, fmt.Sprintf("creator too long, max length is %d bytes", MaxCreatorLength)) + ErrClassDoesNotExist = errorsmod.Register(ModuleName, 10, "class does not exist") + ErrUnableToCharge = errorsmod.Register(ModuleName, 11, "unable to charge for denom creation") ) diff --git a/x/nftfactory/types/event.pb.go b/x/nftfactory/types/event.pb.go index 95dd35ff0..13474472e 100644 --- a/x/nftfactory/types/event.pb.go +++ b/x/nftfactory/types/event.pb.go @@ -24,11 +24,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type EventCreateClass struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` - TokenSupplyCap string `protobuf:"bytes,4,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` - MintingPermission MintingPermission `protobuf:"varint,5,opt,name=minting_permission,json=mintingPermission,proto3,enum=ununifi.nftfactory.MintingPermission" json:"minting_permission,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } func (m *EventCreateClass) Reset() { *m = EventCreateClass{} } @@ -64,9 +61,9 @@ func (m *EventCreateClass) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateClass proto.InternalMessageInfo -func (m *EventCreateClass) GetOwner() string { +func (m *EventCreateClass) GetSender() string { if m != nil { - return m.Owner + return m.Sender } return "" } @@ -78,45 +75,23 @@ func (m *EventCreateClass) GetClassId() string { return "" } -func (m *EventCreateClass) GetBaseTokenUri() string { - if m != nil { - return m.BaseTokenUri - } - return "" -} - -func (m *EventCreateClass) GetTokenSupplyCap() string { - if m != nil { - return m.TokenSupplyCap - } - return "" -} - -func (m *EventCreateClass) GetMintingPermission() MintingPermission { - if m != nil { - return m.MintingPermission - } - return MintingPermission_OnlyOwner -} - -type EventSendClassOwnership struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` - ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` +type EventUpdateClass struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } -func (m *EventSendClassOwnership) Reset() { *m = EventSendClassOwnership{} } -func (m *EventSendClassOwnership) String() string { return proto.CompactTextString(m) } -func (*EventSendClassOwnership) ProtoMessage() {} -func (*EventSendClassOwnership) Descriptor() ([]byte, []int) { +func (m *EventUpdateClass) Reset() { *m = EventUpdateClass{} } +func (m *EventUpdateClass) String() string { return proto.CompactTextString(m) } +func (*EventUpdateClass) ProtoMessage() {} +func (*EventUpdateClass) Descriptor() ([]byte, []int) { return fileDescriptor_8d5133c6cc79979f, []int{1} } -func (m *EventSendClassOwnership) XXX_Unmarshal(b []byte) error { +func (m *EventUpdateClass) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventUpdateClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventSendClassOwnership.Marshal(b, m, deterministic) + return xxx_messageInfo_EventUpdateClass.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -126,57 +101,51 @@ func (m *EventSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *EventSendClassOwnership) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventSendClassOwnership.Merge(m, src) +func (m *EventUpdateClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateClass.Merge(m, src) } -func (m *EventSendClassOwnership) XXX_Size() int { +func (m *EventUpdateClass) XXX_Size() int { return m.Size() } -func (m *EventSendClassOwnership) XXX_DiscardUnknown() { - xxx_messageInfo_EventSendClassOwnership.DiscardUnknown(m) +func (m *EventUpdateClass) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateClass.DiscardUnknown(m) } -var xxx_messageInfo_EventSendClassOwnership proto.InternalMessageInfo +var xxx_messageInfo_EventUpdateClass proto.InternalMessageInfo -func (m *EventSendClassOwnership) GetSender() string { +func (m *EventUpdateClass) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *EventSendClassOwnership) GetReceiver() string { - if m != nil { - return m.Receiver - } - return "" -} - -func (m *EventSendClassOwnership) GetClassId() string { +func (m *EventUpdateClass) GetClassId() string { if m != nil { return m.ClassId } return "" } -type EventUpdateBaseTokenUri struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` +type EventMintNFT struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` + Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` } -func (m *EventUpdateBaseTokenUri) Reset() { *m = EventUpdateBaseTokenUri{} } -func (m *EventUpdateBaseTokenUri) String() string { return proto.CompactTextString(m) } -func (*EventUpdateBaseTokenUri) ProtoMessage() {} -func (*EventUpdateBaseTokenUri) Descriptor() ([]byte, []int) { +func (m *EventMintNFT) Reset() { *m = EventMintNFT{} } +func (m *EventMintNFT) String() string { return proto.CompactTextString(m) } +func (*EventMintNFT) ProtoMessage() {} +func (*EventMintNFT) Descriptor() ([]byte, []int) { return fileDescriptor_8d5133c6cc79979f, []int{2} } -func (m *EventUpdateBaseTokenUri) XXX_Unmarshal(b []byte) error { +func (m *EventMintNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventUpdateBaseTokenUri.Marshal(b, m, deterministic) + return xxx_messageInfo_EventMintNFT.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -186,118 +155,64 @@ func (m *EventUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *EventUpdateBaseTokenUri) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventUpdateBaseTokenUri.Merge(m, src) +func (m *EventMintNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventMintNFT.Merge(m, src) } -func (m *EventUpdateBaseTokenUri) XXX_Size() int { +func (m *EventMintNFT) XXX_Size() int { return m.Size() } -func (m *EventUpdateBaseTokenUri) XXX_DiscardUnknown() { - xxx_messageInfo_EventUpdateBaseTokenUri.DiscardUnknown(m) +func (m *EventMintNFT) XXX_DiscardUnknown() { + xxx_messageInfo_EventMintNFT.DiscardUnknown(m) } -var xxx_messageInfo_EventUpdateBaseTokenUri proto.InternalMessageInfo +var xxx_messageInfo_EventMintNFT proto.InternalMessageInfo -func (m *EventUpdateBaseTokenUri) GetOwner() string { +func (m *EventMintNFT) GetSender() string { if m != nil { - return m.Owner + return m.Sender } return "" } -func (m *EventUpdateBaseTokenUri) GetClassId() string { +func (m *EventMintNFT) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *EventUpdateBaseTokenUri) GetBaseTokenUri() string { - if m != nil { - return m.BaseTokenUri - } - return "" -} - -type EventUpdateTokenSupplyCap struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - TokenSupplyCap string `protobuf:"bytes,3,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` -} - -func (m *EventUpdateTokenSupplyCap) Reset() { *m = EventUpdateTokenSupplyCap{} } -func (m *EventUpdateTokenSupplyCap) String() string { return proto.CompactTextString(m) } -func (*EventUpdateTokenSupplyCap) ProtoMessage() {} -func (*EventUpdateTokenSupplyCap) Descriptor() ([]byte, []int) { - return fileDescriptor_8d5133c6cc79979f, []int{3} -} -func (m *EventUpdateTokenSupplyCap) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventUpdateTokenSupplyCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventUpdateTokenSupplyCap.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventUpdateTokenSupplyCap) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventUpdateTokenSupplyCap.Merge(m, src) -} -func (m *EventUpdateTokenSupplyCap) XXX_Size() int { - return m.Size() -} -func (m *EventUpdateTokenSupplyCap) XXX_DiscardUnknown() { - xxx_messageInfo_EventUpdateTokenSupplyCap.DiscardUnknown(m) -} - -var xxx_messageInfo_EventUpdateTokenSupplyCap proto.InternalMessageInfo - -func (m *EventUpdateTokenSupplyCap) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *EventUpdateTokenSupplyCap) GetClassId() string { +func (m *EventMintNFT) GetTokenId() string { if m != nil { - return m.ClassId + return m.TokenId } return "" } -func (m *EventUpdateTokenSupplyCap) GetTokenSupplyCap() string { +func (m *EventMintNFT) GetRecipient() string { if m != nil { - return m.TokenSupplyCap + return m.Recipient } return "" } -type EventMintNFT struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` - Minter string `protobuf:"bytes,4,opt,name=minter,proto3" json:"minter,omitempty"` +type EventBurnNFT struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` } -func (m *EventMintNFT) Reset() { *m = EventMintNFT{} } -func (m *EventMintNFT) String() string { return proto.CompactTextString(m) } -func (*EventMintNFT) ProtoMessage() {} -func (*EventMintNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_8d5133c6cc79979f, []int{4} +func (m *EventBurnNFT) Reset() { *m = EventBurnNFT{} } +func (m *EventBurnNFT) String() string { return proto.CompactTextString(m) } +func (*EventBurnNFT) ProtoMessage() {} +func (*EventBurnNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_8d5133c6cc79979f, []int{3} } -func (m *EventMintNFT) XXX_Unmarshal(b []byte) error { +func (m *EventBurnNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventMintNFT.Marshal(b, m, deterministic) + return xxx_messageInfo_EventBurnNFT.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -307,64 +222,57 @@ func (m *EventMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *EventMintNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventMintNFT.Merge(m, src) +func (m *EventBurnNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBurnNFT.Merge(m, src) } -func (m *EventMintNFT) XXX_Size() int { +func (m *EventBurnNFT) XXX_Size() int { return m.Size() } -func (m *EventMintNFT) XXX_DiscardUnknown() { - xxx_messageInfo_EventMintNFT.DiscardUnknown(m) +func (m *EventBurnNFT) XXX_DiscardUnknown() { + xxx_messageInfo_EventBurnNFT.DiscardUnknown(m) } -var xxx_messageInfo_EventMintNFT proto.InternalMessageInfo - -func (m *EventMintNFT) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} +var xxx_messageInfo_EventBurnNFT proto.InternalMessageInfo -func (m *EventMintNFT) GetNftId() string { +func (m *EventBurnNFT) GetSender() string { if m != nil { - return m.NftId + return m.Sender } return "" } -func (m *EventMintNFT) GetOwner() string { +func (m *EventBurnNFT) GetClassId() string { if m != nil { - return m.Owner + return m.ClassId } return "" } -func (m *EventMintNFT) GetMinter() string { +func (m *EventBurnNFT) GetTokenId() string { if m != nil { - return m.Minter + return m.TokenId } return "" } -type EventBurnNFT struct { - Burner string `protobuf:"bytes,1,opt,name=burner,proto3" json:"burner,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +type EventChangeAdmin struct { + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` + ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NewAdmin string `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty"` } -func (m *EventBurnNFT) Reset() { *m = EventBurnNFT{} } -func (m *EventBurnNFT) String() string { return proto.CompactTextString(m) } -func (*EventBurnNFT) ProtoMessage() {} -func (*EventBurnNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_8d5133c6cc79979f, []int{5} +func (m *EventChangeAdmin) Reset() { *m = EventChangeAdmin{} } +func (m *EventChangeAdmin) String() string { return proto.CompactTextString(m) } +func (*EventChangeAdmin) ProtoMessage() {} +func (*EventChangeAdmin) Descriptor() ([]byte, []int) { + return fileDescriptor_8d5133c6cc79979f, []int{4} } -func (m *EventBurnNFT) XXX_Unmarshal(b []byte) error { +func (m *EventChangeAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventBurnNFT.Marshal(b, m, deterministic) + return xxx_messageInfo_EventChangeAdmin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -374,81 +282,71 @@ func (m *EventBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *EventBurnNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventBurnNFT.Merge(m, src) +func (m *EventChangeAdmin) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventChangeAdmin.Merge(m, src) } -func (m *EventBurnNFT) XXX_Size() int { +func (m *EventChangeAdmin) XXX_Size() int { return m.Size() } -func (m *EventBurnNFT) XXX_DiscardUnknown() { - xxx_messageInfo_EventBurnNFT.DiscardUnknown(m) +func (m *EventChangeAdmin) XXX_DiscardUnknown() { + xxx_messageInfo_EventChangeAdmin.DiscardUnknown(m) } -var xxx_messageInfo_EventBurnNFT proto.InternalMessageInfo +var xxx_messageInfo_EventChangeAdmin proto.InternalMessageInfo -func (m *EventBurnNFT) GetBurner() string { +func (m *EventChangeAdmin) GetAdmin() string { if m != nil { - return m.Burner + return m.Admin } return "" } -func (m *EventBurnNFT) GetClassId() string { +func (m *EventChangeAdmin) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *EventBurnNFT) GetNftId() string { +func (m *EventChangeAdmin) GetNewAdmin() string { if m != nil { - return m.NftId + return m.NewAdmin } return "" } func init() { proto.RegisterType((*EventCreateClass)(nil), "ununifi.nftfactory.EventCreateClass") - proto.RegisterType((*EventSendClassOwnership)(nil), "ununifi.nftfactory.EventSendClassOwnership") - proto.RegisterType((*EventUpdateBaseTokenUri)(nil), "ununifi.nftfactory.EventUpdateBaseTokenUri") - proto.RegisterType((*EventUpdateTokenSupplyCap)(nil), "ununifi.nftfactory.EventUpdateTokenSupplyCap") + proto.RegisterType((*EventUpdateClass)(nil), "ununifi.nftfactory.EventUpdateClass") proto.RegisterType((*EventMintNFT)(nil), "ununifi.nftfactory.EventMintNFT") proto.RegisterType((*EventBurnNFT)(nil), "ununifi.nftfactory.EventBurnNFT") + proto.RegisterType((*EventChangeAdmin)(nil), "ununifi.nftfactory.EventChangeAdmin") } func init() { proto.RegisterFile("ununifi/nftfactory/event.proto", fileDescriptor_8d5133c6cc79979f) } var fileDescriptor_8d5133c6cc79979f = []byte{ - // 456 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x5d, 0x8b, 0xd3, 0x40, - 0x14, 0x6d, 0x8c, 0x8d, 0xeb, 0xb0, 0x94, 0x75, 0x58, 0x6b, 0xb6, 0x0f, 0x61, 0x89, 0x0a, 0x05, - 0x21, 0x01, 0xfd, 0x07, 0x2d, 0xbb, 0xb0, 0x0f, 0x7e, 0xb0, 0xdb, 0x82, 0xf8, 0x12, 0xd2, 0x64, - 0xd2, 0x0e, 0x6e, 0xee, 0x0c, 0x33, 0x93, 0x6a, 0xff, 0x85, 0x3f, 0xcb, 0xc7, 0x7d, 0xf4, 0x51, - 0xda, 0x27, 0xff, 0x85, 0xcc, 0x64, 0x68, 0x12, 0x2d, 0x82, 0x0f, 0xfb, 0x96, 0x73, 0xef, 0xe1, - 0x9e, 0x7b, 0xce, 0xcd, 0xa0, 0xa0, 0x82, 0x0a, 0x68, 0x41, 0x63, 0x28, 0x54, 0x91, 0x66, 0x8a, - 0x89, 0x4d, 0x4c, 0xd6, 0x04, 0x54, 0xc4, 0x05, 0x53, 0x0c, 0x63, 0xdb, 0x8f, 0x9a, 0xfe, 0xe8, - 0x74, 0xc9, 0x96, 0xcc, 0xb4, 0x63, 0xfd, 0x55, 0x33, 0x47, 0xcf, 0x0f, 0x4c, 0x6a, 0x3e, 0x6b, - 0x52, 0xf8, 0xcb, 0x41, 0x27, 0x17, 0x7a, 0xfc, 0x54, 0x90, 0x54, 0x91, 0xe9, 0x6d, 0x2a, 0x25, - 0x3e, 0x45, 0x7d, 0xf6, 0x05, 0x88, 0xf0, 0x9d, 0x73, 0x67, 0xfc, 0xf8, 0xba, 0x06, 0xf8, 0x0c, - 0x1d, 0x65, 0xba, 0x9d, 0xd0, 0xdc, 0x7f, 0x60, 0x1a, 0x8f, 0x0c, 0xbe, 0xca, 0xf1, 0x0b, 0x34, - 0x58, 0xa4, 0x92, 0x24, 0x8a, 0x7d, 0x26, 0x90, 0x54, 0x82, 0xfa, 0xae, 0x21, 0x1c, 0xeb, 0xea, - 0x4c, 0x17, 0xe7, 0x82, 0xe2, 0x31, 0x3a, 0xa9, 0x09, 0xb2, 0xe2, 0xfc, 0x76, 0x93, 0x64, 0x29, - 0xf7, 0x1f, 0x1a, 0xde, 0xc0, 0xd4, 0x6f, 0x4c, 0x79, 0x9a, 0x72, 0x3c, 0x43, 0xb8, 0xa4, 0xa0, - 0x28, 0x2c, 0x13, 0x4e, 0x44, 0x49, 0xa5, 0xa4, 0x0c, 0xfc, 0xfe, 0xb9, 0x33, 0x1e, 0xbc, 0x7e, - 0x19, 0xfd, 0x9d, 0x40, 0xf4, 0xb6, 0x66, 0x7f, 0xd8, 0x93, 0xaf, 0x9f, 0x94, 0x7f, 0x96, 0xc2, - 0x15, 0x7a, 0x66, 0xac, 0xde, 0x10, 0xc8, 0x8d, 0xd1, 0xf7, 0xda, 0x97, 0x5c, 0x51, 0x8e, 0x87, - 0xc8, 0x93, 0x04, 0xf2, 0xbd, 0x65, 0x8b, 0xf0, 0x08, 0x1d, 0x09, 0x92, 0x11, 0xba, 0x26, 0xc2, - 0x7a, 0xde, 0xe3, 0x4e, 0x1e, 0x6e, 0x27, 0x8f, 0x90, 0x5b, 0xa5, 0x39, 0xcf, 0x53, 0x45, 0x26, - 0xed, 0x10, 0xee, 0x27, 0xdb, 0x70, 0x8d, 0xce, 0x5a, 0x8a, 0xb3, 0x6e, 0x9c, 0xff, 0xad, 0x79, - 0xe8, 0x52, 0xee, 0xa1, 0x4b, 0x85, 0x80, 0x8e, 0x8d, 0xae, 0x3e, 0xc0, 0xbb, 0xcb, 0x59, 0x67, - 0xa8, 0xd3, 0x1d, 0xfa, 0x14, 0x79, 0x50, 0xa8, 0x46, 0xad, 0x0f, 0x85, 0xba, 0xca, 0x9b, 0xe5, - 0xdc, 0xf6, 0x72, 0x43, 0xe4, 0xe9, 0x03, 0x12, 0x61, 0xff, 0x10, 0x8b, 0xc2, 0x8f, 0x56, 0x6f, - 0x52, 0x09, 0xd0, 0x7a, 0x43, 0xe4, 0x2d, 0x2a, 0xd1, 0x78, 0xb3, 0xe8, 0x5f, 0xe6, 0x9a, 0x3d, - 0xdc, 0xd6, 0x1e, 0x93, 0x8b, 0xef, 0xdb, 0xc0, 0xb9, 0xdb, 0x06, 0xce, 0xcf, 0x6d, 0xe0, 0x7c, - 0xdb, 0x05, 0xbd, 0xbb, 0x5d, 0xd0, 0xfb, 0xb1, 0x0b, 0x7a, 0x9f, 0x5e, 0x2d, 0xa9, 0x5a, 0x55, - 0x8b, 0x28, 0x63, 0x65, 0x3c, 0x87, 0x39, 0xd0, 0x4b, 0x1a, 0x67, 0xab, 0x94, 0x42, 0xfc, 0xb5, - 0xfd, 0xb6, 0xd4, 0x86, 0x13, 0xb9, 0xf0, 0xcc, 0xbb, 0x7a, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0xbc, 0xbf, 0x5d, 0xef, 0xc8, 0x03, 0x00, 0x00, + // 318 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x4b, 0x02, 0x41, + 0x14, 0xc7, 0xdd, 0x2c, 0xd3, 0xa1, 0x43, 0x2c, 0x12, 0x66, 0x31, 0x84, 0x5d, 0x82, 0xc0, 0x39, + 0xf4, 0x09, 0x52, 0x14, 0x3c, 0xd4, 0x21, 0xf2, 0x12, 0x81, 0x8d, 0x3b, 0xcf, 0x75, 0x28, 0xdf, + 0x2c, 0xb3, 0xb3, 0x99, 0x7d, 0x8a, 0x3e, 0x56, 0x47, 0x8f, 0x1d, 0x43, 0xbf, 0x48, 0xcc, 0xcc, + 0x96, 0x09, 0x9d, 0xaa, 0xdb, 0xfb, 0xef, 0xef, 0xed, 0xef, 0x0f, 0xc3, 0x23, 0x34, 0xc3, 0x0c, + 0xe5, 0x48, 0x32, 0x1c, 0x99, 0x11, 0x8f, 0x8c, 0xd2, 0x33, 0x06, 0x8f, 0x80, 0xa6, 0x99, 0x68, + 0x65, 0x54, 0x18, 0xe6, 0xbc, 0xb9, 0xe2, 0xf5, 0x6a, 0xac, 0x62, 0xe5, 0x30, 0xb3, 0x93, 0xdf, + 0xac, 0x1f, 0xff, 0x60, 0x5a, 0x8d, 0x7e, 0xa9, 0xd1, 0x21, 0xbb, 0x1d, 0x6b, 0x6f, 0x6b, 0xe0, + 0x06, 0xda, 0x0f, 0x3c, 0x4d, 0xc3, 0x3d, 0x52, 0x4a, 0x01, 0x05, 0xe8, 0x5a, 0x70, 0x14, 0x9c, + 0x54, 0xae, 0xf2, 0x14, 0xee, 0x93, 0x72, 0x64, 0x17, 0x06, 0x52, 0xd4, 0x36, 0x1c, 0xd9, 0x76, + 0xb9, 0x27, 0xbe, 0x34, 0xfd, 0x44, 0xfc, 0x45, 0xf3, 0x4c, 0x76, 0x9c, 0xe6, 0x42, 0xa2, 0xb9, + 0xec, 0x5e, 0xff, 0x42, 0x61, 0x91, 0x51, 0xf7, 0x80, 0x16, 0x15, 0x3d, 0x72, 0xb9, 0x27, 0xc2, + 0x43, 0x52, 0xd1, 0x10, 0xc9, 0x44, 0x02, 0x9a, 0xda, 0xa6, 0x63, 0xab, 0x0f, 0x8d, 0xdb, 0xbc, + 0xbb, 0x95, 0x69, 0xfc, 0xf7, 0xee, 0xc6, 0xdd, 0xe7, 0x3b, 0x8f, 0x39, 0xc6, 0x70, 0x2e, 0x26, + 0x12, 0xc3, 0x2a, 0xd9, 0xe2, 0x76, 0xc8, 0x0b, 0x7c, 0x58, 0xf3, 0x17, 0xd7, 0xfd, 0x07, 0xa4, + 0x82, 0x30, 0x1d, 0xf8, 0x9f, 0x7c, 0x77, 0x19, 0x61, 0xea, 0x6c, 0xad, 0xce, 0xeb, 0x82, 0x06, + 0xf3, 0x05, 0x0d, 0xde, 0x17, 0x34, 0x78, 0x59, 0xd2, 0xc2, 0x7c, 0x49, 0x0b, 0x6f, 0x4b, 0x5a, + 0xb8, 0x39, 0x8d, 0xa5, 0x19, 0x67, 0xc3, 0x66, 0xa4, 0x26, 0xac, 0x8f, 0x7d, 0x94, 0x5d, 0xc9, + 0xa2, 0x31, 0x97, 0xc8, 0x9e, 0xbe, 0xdf, 0x86, 0x99, 0x25, 0x90, 0x0e, 0x4b, 0xee, 0x2e, 0xce, + 0x3e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x20, 0xfc, 0x30, 0x5c, 0x88, 0x02, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { @@ -471,25 +369,6 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MintingPermission != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.MintingPermission)) - i-- - dAtA[i] = 0x28 - } - if len(m.TokenSupplyCap) > 0 { - i -= len(m.TokenSupplyCap) - copy(dAtA[i:], m.TokenSupplyCap) - i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenSupplyCap))) - i-- - dAtA[i] = 0x22 - } - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintEvent(dAtA, i, uint64(len(m.BaseTokenUri))) - i-- - dAtA[i] = 0x1a - } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) @@ -497,17 +376,17 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *EventSendClassOwnership) Marshal() (dAtA []byte, err error) { +func (m *EventUpdateClass) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -517,12 +396,12 @@ func (m *EventSendClassOwnership) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventSendClassOwnership) MarshalTo(dAtA []byte) (int, error) { +func (m *EventUpdateClass) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventUpdateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -532,13 +411,6 @@ func (m *EventSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.ClassId) i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x1a - } - if len(m.Receiver) > 0 { - i -= len(m.Receiver) - copy(dAtA[i:], m.Receiver) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) - i-- dAtA[i] = 0x12 } if len(m.Sender) > 0 { @@ -551,7 +423,7 @@ func (m *EventSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *EventUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { +func (m *EventMintNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -561,20 +433,27 @@ func (m *EventUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventUpdateBaseTokenUri) MarshalTo(dAtA []byte) (int, error) { +func (m *EventMintNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintEvent(dAtA, i, uint64(len(m.BaseTokenUri))) + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x22 + } + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -585,17 +464,17 @@ func (m *EventUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *EventUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { +func (m *EventBurnNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -605,20 +484,20 @@ func (m *EventUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventUpdateTokenSupplyCap) MarshalTo(dAtA []byte) (int, error) { +func (m *EventBurnNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.TokenSupplyCap) > 0 { - i -= len(m.TokenSupplyCap) - copy(dAtA[i:], m.TokenSupplyCap) - i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenSupplyCap))) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -629,17 +508,17 @@ func (m *EventUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, erro i-- dAtA[i] = 0x12 } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *EventMintNFT) Marshal() (dAtA []byte, err error) { +func (m *EventChangeAdmin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -649,85 +528,34 @@ func (m *EventMintNFT) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventMintNFT) MarshalTo(dAtA []byte) (int, error) { +func (m *EventChangeAdmin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventChangeAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Minter) > 0 { - i -= len(m.Minter) - copy(dAtA[i:], m.Minter) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Minter))) - i-- - dAtA[i] = 0x22 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventBurnNFT) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventBurnNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NftId))) - i-- dAtA[i] = 0x1a } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ClassId))) + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintEvent(dAtA, i, uint64(len(m.NewAdmin))) i-- dAtA[i] = 0x12 } - if len(m.Burner) > 0 { - i -= len(m.Burner) - copy(dAtA[i:], m.Burner) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Burner))) + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Admin))) i-- dAtA[i] = 0xa } @@ -737,355 +565,122 @@ func (m *EventBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { offset -= sovEvent(v) base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *EventCreateClass) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.BaseTokenUri) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.TokenSupplyCap) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - if m.MintingPermission != 0 { - n += 1 + sovEvent(uint64(m.MintingPermission)) - } - return n -} - -func (m *EventSendClassOwnership) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Receiver) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventUpdateBaseTokenUri) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.BaseTokenUri) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventUpdateTokenSupplyCap) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.TokenSupplyCap) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventMintNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.Minter) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func (m *EventBurnNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Burner) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - -func sovEvent(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEvent(x uint64) (n int) { - return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *EventCreateClass) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventCreateClass: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventCreateClass: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokenSupplyCap = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MintingPermission", wireType) - } - m.MintingPermission = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MintingPermission |= MintingPermission(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventCreateClass) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *EventUpdateClass) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventMintNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventBurnNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventChangeAdmin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.NewAdmin) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } -func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventCreateClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1108,10 +703,10 @@ func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventSendClassOwnership: wiretype end group for non-group") + return fmt.Errorf("proto: EventCreateClass: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventSendClassOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventCreateClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1147,38 +742,6 @@ func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Receiver = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1231,7 +794,7 @@ func (m *EventSendClassOwnership) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { +func (m *EventUpdateClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1254,15 +817,15 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventUpdateBaseTokenUri: wiretype end group for non-group") + return fmt.Errorf("proto: EventUpdateClass: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventUpdateBaseTokenUri: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventUpdateClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1290,7 +853,7 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1324,38 +887,6 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -1377,7 +908,7 @@ func (m *EventUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { +func (m *EventMintNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1400,15 +931,15 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventUpdateTokenSupplyCap: wiretype end group for non-group") + return fmt.Errorf("proto: EventMintNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventUpdateTokenSupplyCap: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1436,7 +967,7 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1472,7 +1003,39 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1500,7 +1063,7 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TokenSupplyCap = string(dAtA[iNdEx:postIndex]) + m.Recipient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1523,7 +1086,7 @@ func (m *EventUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventMintNFT) Unmarshal(dAtA []byte) error { +func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1546,15 +1109,15 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventMintNFT: wiretype end group for non-group") + return fmt.Errorf("proto: EventBurnNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1582,11 +1145,11 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1614,43 +1177,11 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1678,7 +1209,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Minter = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1701,7 +1232,7 @@ func (m *EventMintNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { +func (m *EventChangeAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1724,15 +1255,15 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventBurnNFT: wiretype end group for non-group") + return fmt.Errorf("proto: EventChangeAdmin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Burner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1760,11 +1291,11 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Burner = string(dAtA[iNdEx:postIndex]) + m.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1792,11 +1323,11 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1824,7 +1355,7 @@ func (m *EventBurnNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NftId = string(dAtA[iNdEx:postIndex]) + m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/nftfactory/types/expected_keepers.go b/x/nftfactory/types/expected_keepers.go index 036d8c233..31afe96c7 100644 --- a/x/nftfactory/types/expected_keepers.go +++ b/x/nftfactory/types/expected_keepers.go @@ -9,8 +9,24 @@ type AccountKeeper interface { GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint64, error) } +type BankKeeper interface { + // View + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx sdk.Context, denom string) sdk.Coin + + // Send + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} + type NftKeeper interface { SaveClass(ctx sdk.Context, class nfttypes.Class) error + UpdateClass(ctx sdk.Context, class nfttypes.Class) error Mint(ctx sdk.Context, token nfttypes.NFT, receiver sdk.AccAddress) error Burn(ctx sdk.Context, classID string, nftID string) error diff --git a/x/nftfactory/types/genesis.go b/x/nftfactory/types/genesis.go index 42e6e17a9..3931a94d5 100644 --- a/x/nftfactory/types/genesis.go +++ b/x/nftfactory/types/genesis.go @@ -1,49 +1,46 @@ package types import ( - "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { - params := DefaultParams() return &GenesisState{ - Params: params, + Params: DefaultParams(), + Classes: []GenesisClass{}, } } +// Validate performs basic genesis state validation returning an error upon any +// failure. func (gs GenesisState) Validate() error { - if err := gs.Params.Validate(); err != nil { + err := gs.Params.Validate() + if err != nil { return err } - for _, classAttributes := range gs.ClassAttributesList { - if err := ValidateClassAttributes(classAttributes, gs.Params); err != nil { - return err - } - } + seenDenoms := map[string]bool{} - return nil -} - -func NewGenesisState(params Params) *GenesisState { - return &GenesisState{ - Params: params, - } -} - -func DefaultGenesisState() *GenesisState { - return NewGenesisState(DefaultParams()) -} + for _, class := range gs.GetClasses() { + if seenDenoms[class.GetClassId()] { + return sdkerrors.Wrapf(ErrInvalidGenesis, "duplicate class id: %s", class.GetClassId()) + } + seenDenoms[class.GetClassId()] = true -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { - var genesisState GenesisState + _, _, err := DeconstructClassId(class.GetClassId()) + if err != nil { + return err + } - if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + if class.AuthorityMetadata.Admin != "" { + _, err = sdk.AccAddressFromBech32(class.AuthorityMetadata.Admin) + if err != nil { + return sdkerrors.Wrapf(ErrInvalidAuthorityMetadata, "Invalid admin address (%s)", err) + } + } } - return &genesisState + return nil } diff --git a/x/nftfactory/types/genesis.pb.go b/x/nftfactory/types/genesis.pb.go index cb382d8cb..9fb8f16d6 100644 --- a/x/nftfactory/types/genesis.pb.go +++ b/x/nftfactory/types/genesis.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the nftfactory module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` - ClassAttributesList []ClassAttributes `protobuf:"bytes,2,rep,name=class_attributes_list,json=classAttributesList,proto3" json:"class_attributes_list" yaml:"class_attributes_list"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` + Classes []GenesisClass `protobuf:"bytes,2,rep,name=classes,proto3" json:"classes" yaml:"class_ownerships"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,41 +69,126 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetClassAttributesList() []ClassAttributes { +func (m *GenesisState) GetClasses() []GenesisClass { if m != nil { - return m.ClassAttributesList + return m.Classes } return nil } +type GenesisClass struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` + AuthorityMetadata ClassAuthorityMetadata `protobuf:"bytes,2,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` +} + +func (m *GenesisClass) Reset() { *m = GenesisClass{} } +func (m *GenesisClass) String() string { return proto.CompactTextString(m) } +func (*GenesisClass) ProtoMessage() {} +func (*GenesisClass) Descriptor() ([]byte, []int) { + return fileDescriptor_d707804010bac885, []int{1} +} +func (m *GenesisClass) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisClass.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisClass.Merge(m, src) +} +func (m *GenesisClass) XXX_Size() int { + return m.Size() +} +func (m *GenesisClass) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisClass.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisClass proto.InternalMessageInfo + +func (m *GenesisClass) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *GenesisClass) GetAuthorityMetadata() ClassAuthorityMetadata { + if m != nil { + return m.AuthorityMetadata + } + return ClassAuthorityMetadata{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "ununifi.nftfactory.GenesisState") + proto.RegisterType((*GenesisClass)(nil), "ununifi.nftfactory.GenesisClass") } func init() { proto.RegisterFile("ununifi/nftfactory/genesis.proto", fileDescriptor_d707804010bac885) } var fileDescriptor_d707804010bac885 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto + // 358 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xcd, 0x2b, 0xcd, 0xcb, 0x4c, 0xcb, 0xd4, 0xcf, 0x4b, 0x2b, 0x49, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xaa, 0xd0, 0x43, 0xa8, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, 0x58, 0x10, 0x95, - 0x52, 0xca, 0x58, 0xcc, 0x42, 0x30, 0x21, 0x8a, 0x94, 0x6e, 0x30, 0x72, 0xf1, 0xb8, 0x43, 0x2c, + 0x52, 0xca, 0x58, 0xcc, 0x42, 0x30, 0x21, 0x8a, 0x94, 0xb6, 0x31, 0x72, 0xf1, 0xb8, 0x43, 0x2c, 0x08, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0xf2, 0xe4, 0x62, 0x2b, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd2, 0xc3, 0xb4, 0x50, 0x2f, 0x00, 0xac, 0xc2, 0x49, 0xf4, 0xc4, 0x3d, 0x79, 0x86, 0x4f, 0xf7, 0xe4, 0x79, 0x2b, 0x13, 0x73, 0x73, 0xac, 0x94, 0x20, - 0xfa, 0x94, 0x82, 0xa0, 0x06, 0x08, 0xd5, 0x72, 0x89, 0x26, 0xe7, 0x24, 0x16, 0x17, 0xc7, 0x27, - 0x96, 0x94, 0x14, 0x65, 0x26, 0x95, 0x96, 0xa4, 0x16, 0xc7, 0xe7, 0x64, 0x16, 0x97, 0x48, 0x30, - 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x29, 0x63, 0x33, 0xd9, 0x19, 0xa4, 0xc1, 0x11, 0xae, 0xde, 0x49, - 0x05, 0x6a, 0x85, 0x0c, 0xc4, 0x0a, 0xac, 0xe6, 0x29, 0x05, 0x09, 0x27, 0xa3, 0x6a, 0xf3, 0xc9, - 0x2c, 0x2e, 0x71, 0x72, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, - 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xed, - 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xd0, 0xbc, 0xd0, 0xbc, 0x4c, - 0xb7, 0x4c, 0xfd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0xfd, 0x0a, 0xe4, 0xc0, 0x2a, 0xa9, 0x2c, 0x48, - 0x2d, 0x4e, 0x62, 0x03, 0x07, 0x94, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x5e, 0x79, 0x36, - 0x9b, 0x01, 0x00, 0x00, + 0xfa, 0x94, 0x82, 0xa0, 0x06, 0x08, 0x45, 0x73, 0xb1, 0x27, 0xe7, 0x24, 0x16, 0x17, 0xa7, 0x16, + 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x29, 0x60, 0x33, 0x0b, 0x6a, 0xbb, 0x33, 0x48, 0xa5, + 0x93, 0x3c, 0xd4, 0x44, 0x71, 0x88, 0x89, 0x60, 0xed, 0xf1, 0xf9, 0xe5, 0x79, 0xa9, 0x45, 0xc5, + 0x19, 0x99, 0x05, 0xc5, 0x4a, 0x41, 0x30, 0x13, 0x95, 0x0e, 0x21, 0x1c, 0x0e, 0xd6, 0x2a, 0xa4, + 0xc7, 0xc5, 0x01, 0x51, 0x9e, 0x99, 0x02, 0x76, 0x3a, 0xa7, 0x93, 0xf0, 0xa7, 0x7b, 0xf2, 0xfc, + 0xc8, 0x06, 0x65, 0xa6, 0xc0, 0x0c, 0xf0, 0x4c, 0x11, 0xaa, 0xe1, 0x12, 0x4a, 0x2c, 0x2d, 0xc9, + 0xc8, 0x2f, 0xca, 0x2c, 0xa9, 0x8c, 0xcf, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0x94, 0x60, + 0x02, 0x7b, 0x5a, 0x0b, 0x9b, 0x43, 0xc1, 0xd6, 0x38, 0xc2, 0xb4, 0xf8, 0x42, 0x75, 0x38, 0x29, + 0x42, 0x9d, 0x2c, 0x09, 0xb1, 0x09, 0xd3, 0x4c, 0xa5, 0x20, 0xc1, 0x44, 0x74, 0x5d, 0x56, 0x2c, + 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0xb9, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, + 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, + 0x94, 0x76, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x68, 0x5e, 0x68, + 0x5e, 0xa6, 0x5b, 0xa6, 0x7e, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x7e, 0x05, 0x72, 0x7c, 0x96, 0x54, + 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xe3, 0xd2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x40, + 0xc5, 0x8b, 0x3e, 0x02, 0x00, 0x00, } +func (this *GenesisClass) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GenesisClass) + if !ok { + that2, ok := that.(GenesisClass) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClassId != that1.ClassId { + return false + } + if !this.AuthorityMetadata.Equal(&that1.AuthorityMetadata) { + return false + } + return true +} func (m *GenesisState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -124,10 +209,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ClassAttributesList) > 0 { - for iNdEx := len(m.ClassAttributesList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Classes) > 0 { + for iNdEx := len(m.Classes) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ClassAttributesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Classes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -151,6 +236,46 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GenesisClass) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisClass) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.AuthorityMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -170,8 +295,8 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.ClassAttributesList) > 0 { - for _, e := range m.ClassAttributesList { + if len(m.Classes) > 0 { + for _, e := range m.Classes { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -179,6 +304,21 @@ func (m *GenesisState) Size() (n int) { return n } +func (m *GenesisClass) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = m.AuthorityMetadata.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -249,7 +389,123 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassAttributesList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Classes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Classes = append(m.Classes, GenesisClass{}) + if err := m.Classes[len(m.Classes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GenesisClass) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisClass: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisClass: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -276,8 +532,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassAttributesList = append(m.ClassAttributesList, ClassAttributes{}) - if err := m.ClassAttributesList[len(m.ClassAttributesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/nftfactory/types/keys.go b/x/nftfactory/types/keys.go index 9c45f784f..7170055c5 100644 --- a/x/nftfactory/types/keys.go +++ b/x/nftfactory/types/keys.go @@ -1,18 +1,15 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "strings" ) const ( // ModuleName defines the module name ModuleName = "nftfactory" - // ChainName defines the chain name to put StoreKey for avoiding the KVStore collision to sdk's nft module KVStore key - ChainName = "ununifi" - // StoreKey defines the primary module store key - StoreKey = ChainName + ModuleName + StoreKey = "_" + ModuleName // RouterKey is the message route for nftfactory RouterKey = ModuleName @@ -24,26 +21,32 @@ const ( MemStoreKey = "mem_nftfactory" ) -var ( - // KeyPrefixClassAttributes defines prefix key for ClassAttributes - KeyPrefixClassAttributes = []byte{0x01} - - // KeyPrefixNFTAttributes defines prefix key for NFTAttributes - KeyPrefixNFTMinter = []byte{0x02} +// KeySeparator is used to combine parts of the keys in the store +const KeySeparator = "/" - // KeyPrefixOwningClassList defines prefix key for OwningClassList - KeyPrefixOwningClassIdList = []byte{0x03} +var ( + // Module parameters + KeyParams = []byte{0x00} - // KeyPrefixClassNameIdList defines prefix key for ClassNameIdList - KeyPrefixClassNameIdList = []byte{0x04} + ClassAuthorityMetadataKey = "authoritymetadata" + ClassIdsPrefixKey = "class_ids" + CreatorPrefixKey = "creator" + AdminPrefixKey = "admin" ) -func NFTMinterKey(classID, nftID string) []byte { - nftIdentifier := classID + nftID - return []byte(nftIdentifier) +// GetDenomPrefixStore returns the store prefix where all the data associated with a specific denom +// is stored +func GetDenomPrefixStore(classId string) []byte { + return []byte(strings.Join([]string{ClassIdsPrefixKey, classId, ""}, KeySeparator)) +} + +// GetCreatorsPrefix returns the store prefix where the list of the denoms created by a specific +// creator are stored +func GetCreatorPrefix(creator string) []byte { + return []byte(strings.Join([]string{CreatorPrefixKey, creator, ""}, KeySeparator)) } -func OwningClassIdListKey(owner sdk.AccAddress) []byte { - ownerAddr, _ := sdk.AccAddressFromBech32(owner.String()) - return ownerAddr.Bytes() +// GetCreatorsPrefix returns the store prefix where a list of all creator addresses are stored +func GetCreatorsPrefix() []byte { + return []byte(strings.Join([]string{CreatorPrefixKey, ""}, KeySeparator)) } diff --git a/x/nftfactory/types/metadata.go b/x/nftfactory/types/metadata.go new file mode 100644 index 000000000..c8d96fcdb --- /dev/null +++ b/x/nftfactory/types/metadata.go @@ -0,0 +1,15 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (metadata ClassAuthorityMetadata) Validate() error { + if metadata.Admin != "" { + _, err := sdk.AccAddressFromBech32(metadata.Admin) + if err != nil { + return err + } + } + return nil +} diff --git a/x/nftfactory/types/msgs.go b/x/nftfactory/types/msgs.go index e4fb3c502..4bef432a5 100644 --- a/x/nftfactory/types/msgs.go +++ b/x/nftfactory/types/msgs.go @@ -6,48 +6,34 @@ import ( nfttypes "github.com/cosmos/cosmos-sdk/x/nft" ) -// nftmint message types -const ( - TypeMsgCreateClass = "create-class" - TypeMsgMintNFT = "mint-nft" - TypeMsgSendClassOwnership = "send-class" - TypeMsgUpdateBaseTokenUri = "update-base-token-uri" - TypeMsgUpdateTokenSupplyCap = "update-token-supply-cap" - TypeMsgBurnNFT = "burn-nft" -) - var ( _ sdk.Msg = &MsgCreateClass{} + _ sdk.Msg = &MsgUpdateClass{} _ sdk.Msg = &MsgMintNFT{} - _ sdk.Msg = &MsgSendClassOwnership{} - _ sdk.Msg = &MsgUpdateBaseTokenUri{} - _ sdk.Msg = &MsgUpdateTokenSupplyCap{} _ sdk.Msg = &MsgBurnNFT{} + _ sdk.Msg = &MsgChangeAdmin{} ) func NewMsgCreateClass( sender string, - name, baseTokenUri string, - tokenSupplyCap uint64, - mintingPermission MintingPermission, - symbol, description, classUri string, + subclass string, + name string, + symbol string, + description string, + uri string, + uriHash string, ) *MsgCreateClass { return &MsgCreateClass{ - Sender: sender, - Name: name, - BaseTokenUri: baseTokenUri, - TokenSupplyCap: tokenSupplyCap, - MintingPermission: mintingPermission, - Symbol: symbol, - Description: description, - ClassUri: classUri, + Sender: sender, + Subclass: subclass, + Name: name, + Symbol: symbol, + Description: description, + Uri: uri, + UriHash: uriHash, } } -func (msg MsgCreateClass) Route() string { return RouterKey } - -func (msg MsgCreateClass) Type() string { return TypeMsgCreateClass } - func (msg MsgCreateClass) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -57,77 +43,61 @@ func (msg MsgCreateClass) ValidateBasic() error { return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgCreateClass) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. func (msg MsgCreateClass) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgMintNFT( +func NewMsgUpdateClass( sender string, - classID, nftID string, - recipient string, -) *MsgMintNFT { - return &MsgMintNFT{ - Sender: sender, - ClassId: classID, - NftId: nftID, - Recipient: recipient, - } -} - -func (msg MsgMintNFT) Route() string { return RouterKey } - -func (msg MsgMintNFT) Type() string { return TypeMsgMintNFT } - -func (msg MsgMintNFT) ValidateBasic() error { + classId string, + name string, + symbol string, + description string, + uri string, + uriHash string, +) *MsgUpdateClass { + return &MsgUpdateClass{ + Sender: sender, + ClassId: classId, + Name: name, + Symbol: symbol, + Description: description, + Uri: uri, + UriHash: uriHash, + } +} + +func (msg MsgUpdateClass) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") } - if err := ValidateClassID(msg.ClassId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) - } - - if err := ValidateNFTID(msg.NftId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) - } - return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgMintNFT) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. -func (msg MsgMintNFT) GetSigners() []sdk.AccAddress { +func (msg MsgUpdateClass) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgSendClassOwnership(sender string, classID string, recipient string) *MsgSendClassOwnership { - return &MsgSendClassOwnership{ +func NewMsgMintNFT( + sender string, + classID, tokenID string, + recipient string, +) *MsgMintNFT { + return &MsgMintNFT{ Sender: sender, ClassId: classID, + TokenId: tokenID, Recipient: recipient, } } -func (msg MsgSendClassOwnership) Route() string { return RouterKey } - -func (msg MsgSendClassOwnership) Type() string { return TypeMsgSendClassOwnership } - -func (msg MsgSendClassOwnership) ValidateBasic() error { +func (msg MsgMintNFT) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") @@ -137,34 +107,31 @@ func (msg MsgSendClassOwnership) ValidateBasic() error { return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) } - return nil -} + if err := ValidateNFTID(msg.TokenId); err != nil { + return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.TokenId) + } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgSendClassOwnership) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) + return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgSendClassOwnership) GetSigners() []sdk.AccAddress { +func (msg MsgMintNFT) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgUpdateBaseTokenUri(sender string, classID, baseTokenUri string) *MsgUpdateBaseTokenUri { - return &MsgUpdateBaseTokenUri{ - Sender: sender, - ClassId: classID, - BaseTokenUri: baseTokenUri, +func NewMsgBurnNFT( + burner string, + classId, tokenId string, +) *MsgBurnNFT { + return &MsgBurnNFT{ + Sender: burner, + ClassId: classId, + TokenId: tokenId, } } -func (msg MsgUpdateBaseTokenUri) Route() string { return RouterKey } - -func (msg MsgUpdateBaseTokenUri) Type() string { return TypeMsgUpdateBaseTokenUri } - -func (msg MsgUpdateBaseTokenUri) ValidateBasic() error { +func (msg MsgBurnNFT) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") @@ -173,98 +140,64 @@ func (msg MsgUpdateBaseTokenUri) ValidateBasic() error { if err := ValidateClassID(msg.ClassId); err != nil { return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) } - return nil -} -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgUpdateBaseTokenUri) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) + if err := ValidateNFTID(msg.TokenId); err != nil { + return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.TokenId) + } + + return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgUpdateBaseTokenUri) GetSigners() []sdk.AccAddress { +func (msg MsgBurnNFT) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgUpdateTokenSupplyCap(sender string, classID string, tokenSupplyCap uint64) *MsgUpdateTokenSupplyCap { - return &MsgUpdateTokenSupplyCap{ - Sender: sender, - ClassId: classID, - TokenSupplyCap: tokenSupplyCap, +func NewMsgChangeAdmin( + sender string, + classId string, + newAdmin string, +) *MsgChangeAdmin { + return &MsgChangeAdmin{ + Sender: sender, + ClassId: classId, + NewAdmin: newAdmin, } } -func (msg MsgUpdateTokenSupplyCap) Route() string { return RouterKey } - -func (msg MsgUpdateTokenSupplyCap) Type() string { return TypeMsgUpdateTokenSupplyCap } - -func (msg MsgUpdateTokenSupplyCap) ValidateBasic() error { +func (msg MsgChangeAdmin) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") } - if err := ValidateClassID(msg.ClassId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) - } - return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgUpdateTokenSupplyCap) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the addresses of signers that must sign. -func (msg MsgUpdateTokenSupplyCap) GetSigners() []sdk.AccAddress { +func (msg MsgChangeAdmin) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } -func NewMsgBurnNFT( - burner string, - classID, nftID string, -) *MsgBurnNFT { - return &MsgBurnNFT{ - Sender: burner, - ClassId: classID, - NftId: nftID, - } -} - -func (msg MsgBurnNFT) Route() string { return RouterKey } +// ensure Msg interface compliance at compile time +var _ sdk.Msg = &MsgUpdateParams{} -func (msg MsgBurnNFT) Type() string { return TypeMsgBurnNFT } - -func (msg MsgBurnNFT) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address is not valid") +func NewMsgUpdateParams(sender string, params Params) MsgUpdateParams { + return MsgUpdateParams{ + Sender: sender, + Params: params, } - - if err := ValidateClassID(msg.ClassId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyClassID, "Invalid class id (%s)", msg.ClassId) - } - - if err := ValidateNFTID(msg.NftId); err != nil { - return sdkerrors.Wrapf(nfttypes.ErrEmptyNFTID, "Invalid nft id (%s)", msg.NftId) - } - - return nil } -// GetSignBytes gets the canonical byte representation of the Msg. -func (msg MsgBurnNFT) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) +// ValidateBasic does a simple validation check that doesn't require access to state. +func (msg MsgUpdateParams) ValidateBasic() error { + return nil } // GetSigners returns the addresses of signers that must sign. -func (msg MsgBurnNFT) GetSigners() []sdk.AccAddress { +func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} } diff --git a/x/nftfactory/types/nftfactory.pb.go b/x/nftfactory/types/nftfactory.pb.go index 98389cd61..df0d865d4 100644 --- a/x/nftfactory/types/nftfactory.pb.go +++ b/x/nftfactory/types/nftfactory.pb.go @@ -5,9 +5,10 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -24,176 +25,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MintingPermission int32 - -const ( - MintingPermission_OnlyOwner MintingPermission = 0 - MintingPermission_Anyone MintingPermission = 1 -) - -var MintingPermission_name = map[int32]string{ - 0: "OnlyOwner", - 1: "Anyone", -} - -var MintingPermission_value = map[string]int32{ - "OnlyOwner": 0, - "Anyone": 1, -} - -func (x MintingPermission) String() string { - return proto.EnumName(MintingPermission_name, int32(x)) -} - -func (MintingPermission) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{0} -} - -type ClassAttributes struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` - MintingPermission MintingPermission `protobuf:"varint,4,opt,name=minting_permission,json=mintingPermission,proto3,enum=ununifi.nftfactory.MintingPermission" json:"minting_permission,omitempty"` - TokenSupplyCap uint64 `protobuf:"varint,5,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` +// ClassAuthorityMetadata specifies metadata for addresses that have specific +// capabilities over a nft factory class. Right now there is only one Admin +// permission, but is planned to be extended to the future. +type ClassAuthorityMetadata struct { + // Can be empty for no admin, or a valid address + Admin string `protobuf:"bytes,1,opt,name=Admin,proto3" json:"Admin,omitempty" yaml:"admin"` } -func (m *ClassAttributes) Reset() { *m = ClassAttributes{} } -func (m *ClassAttributes) String() string { return proto.CompactTextString(m) } -func (*ClassAttributes) ProtoMessage() {} -func (*ClassAttributes) Descriptor() ([]byte, []int) { +func (m *ClassAuthorityMetadata) Reset() { *m = ClassAuthorityMetadata{} } +func (m *ClassAuthorityMetadata) String() string { return proto.CompactTextString(m) } +func (*ClassAuthorityMetadata) ProtoMessage() {} +func (*ClassAuthorityMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_19bd2cd86ea9a985, []int{0} } -func (m *ClassAttributes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClassAttributes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClassAttributes.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ClassAttributes) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClassAttributes.Merge(m, src) -} -func (m *ClassAttributes) XXX_Size() int { - return m.Size() -} -func (m *ClassAttributes) XXX_DiscardUnknown() { - xxx_messageInfo_ClassAttributes.DiscardUnknown(m) -} - -var xxx_messageInfo_ClassAttributes proto.InternalMessageInfo - -func (m *ClassAttributes) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *ClassAttributes) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *ClassAttributes) GetBaseTokenUri() string { - if m != nil { - return m.BaseTokenUri - } - return "" -} - -func (m *ClassAttributes) GetMintingPermission() MintingPermission { - if m != nil { - return m.MintingPermission - } - return MintingPermission_OnlyOwner -} - -func (m *ClassAttributes) GetTokenSupplyCap() uint64 { - if m != nil { - return m.TokenSupplyCap - } - return 0 -} - -type OwningClassIdList struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ClassId []string `protobuf:"bytes,2,rep,name=class_id,json=classId,proto3" json:"class_id,omitempty"` -} - -func (m *OwningClassIdList) Reset() { *m = OwningClassIdList{} } -func (m *OwningClassIdList) String() string { return proto.CompactTextString(m) } -func (*OwningClassIdList) ProtoMessage() {} -func (*OwningClassIdList) Descriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{1} -} -func (m *OwningClassIdList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OwningClassIdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OwningClassIdList.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *OwningClassIdList) XXX_Merge(src proto.Message) { - xxx_messageInfo_OwningClassIdList.Merge(m, src) -} -func (m *OwningClassIdList) XXX_Size() int { - return m.Size() -} -func (m *OwningClassIdList) XXX_DiscardUnknown() { - xxx_messageInfo_OwningClassIdList.DiscardUnknown(m) -} - -var xxx_messageInfo_OwningClassIdList proto.InternalMessageInfo - -func (m *OwningClassIdList) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *OwningClassIdList) GetClassId() []string { - if m != nil { - return m.ClassId - } - return nil -} - -type ClassNameIdList struct { - ClassName string `protobuf:"bytes,1,opt,name=class_name,json=className,proto3" json:"class_name,omitempty"` - ClassId []string `protobuf:"bytes,2,rep,name=class_id,json=classId,proto3" json:"class_id,omitempty"` -} - -func (m *ClassNameIdList) Reset() { *m = ClassNameIdList{} } -func (m *ClassNameIdList) String() string { return proto.CompactTextString(m) } -func (*ClassNameIdList) ProtoMessage() {} -func (*ClassNameIdList) Descriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{2} -} -func (m *ClassNameIdList) XXX_Unmarshal(b []byte) error { +func (m *ClassAuthorityMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ClassNameIdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ClassAuthorityMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ClassNameIdList.Marshal(b, m, deterministic) + return xxx_messageInfo_ClassAuthorityMetadata.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -203,47 +54,37 @@ func (m *ClassNameIdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *ClassNameIdList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClassNameIdList.Merge(m, src) +func (m *ClassAuthorityMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClassAuthorityMetadata.Merge(m, src) } -func (m *ClassNameIdList) XXX_Size() int { +func (m *ClassAuthorityMetadata) XXX_Size() int { return m.Size() } -func (m *ClassNameIdList) XXX_DiscardUnknown() { - xxx_messageInfo_ClassNameIdList.DiscardUnknown(m) +func (m *ClassAuthorityMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_ClassAuthorityMetadata.DiscardUnknown(m) } -var xxx_messageInfo_ClassNameIdList proto.InternalMessageInfo +var xxx_messageInfo_ClassAuthorityMetadata proto.InternalMessageInfo -func (m *ClassNameIdList) GetClassName() string { +func (m *ClassAuthorityMetadata) GetAdmin() string { if m != nil { - return m.ClassName + return m.Admin } return "" } -func (m *ClassNameIdList) GetClassId() []string { - if m != nil { - return m.ClassId - } - return nil -} - type Params struct { - MaxNFTSupplyCap uint64 `protobuf:"varint,1,opt,name=MaxNFTSupplyCap,proto3" json:"MaxNFTSupplyCap,omitempty"` - MinClassNameLen uint64 `protobuf:"varint,2,opt,name=MinClassNameLen,proto3" json:"MinClassNameLen,omitempty"` - MaxClassNameLen uint64 `protobuf:"varint,3,opt,name=MaxClassNameLen,proto3" json:"MaxClassNameLen,omitempty"` - MinUriLen uint64 `protobuf:"varint,4,opt,name=MinUriLen,proto3" json:"MinUriLen,omitempty"` - MaxUriLen uint64 `protobuf:"varint,5,opt,name=MaxUriLen,proto3" json:"MaxUriLen,omitempty"` - MaxSymbolLen uint64 `protobuf:"varint,6,opt,name=MaxSymbolLen,proto3" json:"MaxSymbolLen,omitempty"` - MaxDescriptionLen uint64 `protobuf:"varint,7,opt,name=MaxDescriptionLen,proto3" json:"MaxDescriptionLen,omitempty"` + // ClassCreationFee is the fee required to create a new denom using the nftfactory module + ClassCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=class_creation_fee,json=classCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"class_creation_fee" yaml:"denom_creation_fee"` + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + FeeCollectorAddress string `protobuf:"bytes,2,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_19bd2cd86ea9a985, []int{3} + return fileDescriptor_19bd2cd86ea9a985, []int{1} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -272,60 +113,22 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetMaxNFTSupplyCap() uint64 { - if m != nil { - return m.MaxNFTSupplyCap - } - return 0 -} - -func (m *Params) GetMinClassNameLen() uint64 { - if m != nil { - return m.MinClassNameLen - } - return 0 -} - -func (m *Params) GetMaxClassNameLen() uint64 { - if m != nil { - return m.MaxClassNameLen - } - return 0 -} - -func (m *Params) GetMinUriLen() uint64 { - if m != nil { - return m.MinUriLen - } - return 0 -} - -func (m *Params) GetMaxUriLen() uint64 { - if m != nil { - return m.MaxUriLen - } - return 0 -} - -func (m *Params) GetMaxSymbolLen() uint64 { +func (m *Params) GetClassCreationFee() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { - return m.MaxSymbolLen + return m.ClassCreationFee } - return 0 + return nil } -func (m *Params) GetMaxDescriptionLen() uint64 { +func (m *Params) GetFeeCollectorAddress() string { if m != nil { - return m.MaxDescriptionLen + return m.FeeCollectorAddress } - return 0 + return "" } func init() { - proto.RegisterEnum("ununifi.nftfactory.MintingPermission", MintingPermission_name, MintingPermission_value) - proto.RegisterType((*ClassAttributes)(nil), "ununifi.nftfactory.ClassAttributes") - proto.RegisterType((*OwningClassIdList)(nil), "ununifi.nftfactory.OwningClassIdList") - proto.RegisterType((*ClassNameIdList)(nil), "ununifi.nftfactory.ClassNameIdList") + proto.RegisterType((*ClassAuthorityMetadata)(nil), "ununifi.nftfactory.ClassAuthorityMetadata") proto.RegisterType((*Params)(nil), "ununifi.nftfactory.Params") } @@ -334,135 +137,57 @@ func init() { } var fileDescriptor_19bd2cd86ea9a985 = []byte{ - // 504 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0x87, 0xe3, 0xfc, 0x2b, 0x59, 0x95, 0x34, 0x59, 0xf5, 0x10, 0x2a, 0x30, 0x51, 0x00, 0x29, - 0x02, 0x64, 0x4b, 0xf0, 0x04, 0x25, 0xa5, 0x12, 0xa2, 0x69, 0xaa, 0x34, 0xb9, 0x70, 0x89, 0xd6, - 0xee, 0xc6, 0x1d, 0x11, 0xcf, 0x5a, 0xde, 0xb5, 0x1a, 0xbf, 0x05, 0x07, 0x1e, 0x8a, 0x63, 0x8f, - 0x1c, 0x51, 0x72, 0xe1, 0x31, 0xd0, 0xae, 0xdd, 0xc4, 0x69, 0x24, 0x6e, 0xde, 0xef, 0xf7, 0x69, - 0xbc, 0x33, 0xa3, 0x25, 0xaf, 0x12, 0x4c, 0x10, 0xe6, 0xe0, 0xe2, 0x5c, 0xcd, 0x99, 0xaf, 0x44, - 0x9c, 0x16, 0x3e, 0x9d, 0x28, 0x16, 0x4a, 0x50, 0x9a, 0x4b, 0xce, 0x36, 0x39, 0x39, 0x0e, 0x44, - 0x20, 0x4c, 0xec, 0xea, 0xaf, 0xcc, 0x3c, 0x79, 0x19, 0x08, 0x11, 0x2c, 0xb8, 0x6b, 0x4e, 0x5e, - 0x32, 0x77, 0x15, 0x84, 0x5c, 0x2a, 0x16, 0x46, 0x99, 0xd0, 0xfb, 0x6b, 0x91, 0xa3, 0xc1, 0x82, - 0x49, 0x79, 0xaa, 0x54, 0x0c, 0x5e, 0xa2, 0xb8, 0xa4, 0xcf, 0xc8, 0x13, 0x5f, 0xa3, 0x19, 0xdc, - 0x74, 0xac, 0xae, 0xd5, 0x6f, 0x8c, 0x0f, 0xcc, 0xf9, 0xcb, 0x0d, 0x3d, 0x26, 0x35, 0x71, 0x87, - 0x3c, 0xee, 0x94, 0x0d, 0xcf, 0x0e, 0xf4, 0x35, 0x69, 0x7a, 0x4c, 0xf2, 0x99, 0x12, 0xdf, 0x39, - 0xce, 0x92, 0x18, 0x3a, 0x15, 0x13, 0x1f, 0x6a, 0x3a, 0xd1, 0x70, 0x1a, 0x03, 0x9d, 0x10, 0x1a, - 0x02, 0x2a, 0xc0, 0x60, 0x16, 0xf1, 0x38, 0x04, 0x29, 0x41, 0x60, 0xa7, 0xda, 0xb5, 0xfa, 0xcd, - 0x0f, 0x6f, 0x9c, 0xfd, 0x96, 0x9c, 0x61, 0x66, 0x5f, 0x6d, 0xe4, 0x71, 0x3b, 0x7c, 0x8c, 0x68, - 0x9f, 0xb4, 0xb2, 0xdf, 0xca, 0x24, 0x8a, 0x16, 0xe9, 0xcc, 0x67, 0x51, 0xa7, 0xd6, 0xb5, 0xfa, - 0xd5, 0x71, 0xd3, 0xf0, 0x6b, 0x83, 0x07, 0x2c, 0xea, 0x9d, 0x91, 0xf6, 0xe8, 0x0e, 0x01, 0x83, - 0x41, 0xd6, 0xcc, 0x05, 0x48, 0xb5, 0x6d, 0xc8, 0x2a, 0x36, 0x54, 0x9c, 0x40, 0xb9, 0x5b, 0x29, - 0x4c, 0xa0, 0xf7, 0x35, 0x9f, 0xd7, 0x25, 0x0b, 0x79, 0x5e, 0xe3, 0x05, 0x21, 0x99, 0x8d, 0x2c, - 0xe4, 0x79, 0xa1, 0x86, 0xff, 0x20, 0xfd, 0xaf, 0xd8, 0xcf, 0x32, 0xa9, 0x5f, 0xb1, 0x98, 0x85, - 0x92, 0xf6, 0xc9, 0xd1, 0x90, 0x2d, 0x2f, 0xcf, 0x27, 0x9b, 0x0b, 0x9b, 0x4a, 0xd5, 0xf1, 0x63, - 0x6c, 0x4c, 0xc0, 0xcd, 0x25, 0x2e, 0x38, 0x9a, 0x6d, 0x68, 0x73, 0x17, 0xe7, 0x35, 0x77, 0xcc, - 0xca, 0xa6, 0xe6, 0x8e, 0xf9, 0x9c, 0x34, 0x86, 0xa0, 0xb7, 0xa4, 0x9d, 0xaa, 0x71, 0xb6, 0xc0, - 0xa4, 0x6c, 0x99, 0xa7, 0xb5, 0x3c, 0x7d, 0x00, 0xb4, 0x47, 0x0e, 0x87, 0x6c, 0x79, 0x9d, 0x86, - 0x9e, 0x58, 0x68, 0xa1, 0x6e, 0x84, 0x1d, 0x46, 0xdf, 0x93, 0xf6, 0x90, 0x2d, 0xcf, 0xb8, 0xf4, - 0x63, 0x88, 0x14, 0x08, 0xd4, 0xe2, 0x81, 0x11, 0xf7, 0x83, 0xb7, 0x0e, 0x69, 0xef, 0xed, 0x9e, - 0x3e, 0x25, 0x8d, 0x11, 0x2e, 0xd2, 0x91, 0x5e, 0x50, 0xab, 0x44, 0x09, 0xa9, 0x9f, 0x62, 0x2a, - 0x90, 0xb7, 0xac, 0x4f, 0x9f, 0x7f, 0xad, 0x6c, 0xeb, 0x7e, 0x65, 0x5b, 0x7f, 0x56, 0xb6, 0xf5, - 0x63, 0x6d, 0x97, 0xee, 0xd7, 0x76, 0xe9, 0xf7, 0xda, 0x2e, 0x7d, 0x7b, 0x17, 0x80, 0xba, 0x4d, - 0x3c, 0xc7, 0x17, 0xa1, 0x3b, 0xc5, 0x29, 0xc2, 0x39, 0xb8, 0xfe, 0x2d, 0x03, 0x74, 0x97, 0xc5, - 0x17, 0xa6, 0xd2, 0x88, 0x4b, 0xaf, 0x6e, 0x9e, 0xc4, 0xc7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x60, 0x5f, 0x00, 0x47, 0x84, 0x03, 0x00, 0x00, -} - -func (m *ClassAttributes) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClassAttributes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClassAttributes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TokenSupplyCap != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.TokenSupplyCap)) - i-- - dAtA[i] = 0x28 - } - if m.MintingPermission != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MintingPermission)) - i-- - dAtA[i] = 0x20 - } - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.BaseTokenUri))) - i-- - dAtA[i] = 0x1a - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *OwningClassIdList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OwningClassIdList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OwningClassIdList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassId) > 0 { - for iNdEx := len(m.ClassId) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClassId[iNdEx]) - copy(dAtA[i:], m.ClassId[iNdEx]) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassId[iNdEx]))) - i-- - dAtA[i] = 0x12 + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xbb, 0x6a, 0xf3, 0x30, + 0x14, 0xc7, 0xad, 0xef, 0x12, 0xf8, 0xfc, 0x75, 0x08, 0xee, 0x85, 0x24, 0x83, 0x1d, 0x5c, 0x28, + 0x81, 0x52, 0x8b, 0xa4, 0x5b, 0xb6, 0xc4, 0x34, 0x5b, 0xa0, 0x04, 0xb2, 0x74, 0x31, 0xb2, 0x7c, + 0x9c, 0x88, 0xda, 0x52, 0xb0, 0xe4, 0x52, 0xbf, 0x45, 0xa7, 0xce, 0x9d, 0xfb, 0x24, 0x19, 0xb3, + 0x14, 0x3a, 0xa5, 0x25, 0x59, 0x3a, 0xe7, 0x09, 0x8a, 0x2f, 0xa5, 0xe9, 0xe4, 0x83, 0x7f, 0x47, + 0x7f, 0xfd, 0xce, 0x91, 0x7e, 0x9a, 0xf2, 0x94, 0xb3, 0x90, 0x61, 0x1e, 0xaa, 0x90, 0x50, 0x25, + 0x92, 0x6c, 0xaf, 0x74, 0x16, 0x89, 0x50, 0xc2, 0x30, 0xaa, 0x26, 0xe7, 0x9b, 0xb4, 0x8e, 0x66, + 0x62, 0x26, 0x0a, 0x8c, 0xf3, 0xaa, 0xec, 0x6c, 0x99, 0x54, 0xc8, 0x58, 0x48, 0xec, 0x13, 0x09, + 0xf8, 0xae, 0xeb, 0x83, 0x22, 0x5d, 0x4c, 0x05, 0xe3, 0x25, 0xb7, 0x47, 0xfa, 0x89, 0x1b, 0x11, + 0x29, 0x07, 0xa9, 0x9a, 0x8b, 0x84, 0xa9, 0x6c, 0x0c, 0x8a, 0x04, 0x44, 0x11, 0xe3, 0x4c, 0xff, + 0x3b, 0x08, 0x62, 0xc6, 0x1b, 0xa8, 0x8d, 0x3a, 0xff, 0x86, 0xf5, 0xdd, 0xda, 0x3a, 0xc8, 0x48, + 0x1c, 0xf5, 0x6d, 0x92, 0xff, 0xb6, 0x27, 0x25, 0xee, 0xff, 0xf9, 0x78, 0xb2, 0x90, 0xfd, 0x82, + 0xf4, 0xda, 0x35, 0x49, 0x48, 0x2c, 0x8d, 0x47, 0xa4, 0x1b, 0x34, 0xcf, 0xf4, 0x68, 0x02, 0x44, + 0x31, 0xc1, 0xbd, 0x10, 0xa0, 0x81, 0xda, 0xbf, 0x3b, 0xff, 0x7b, 0x4d, 0xa7, 0x14, 0x72, 0x72, + 0x21, 0xa7, 0x12, 0x72, 0x5c, 0xc1, 0xf8, 0x70, 0xbc, 0x5c, 0x5b, 0xda, 0x6e, 0x6d, 0x35, 0xcb, + 0x5b, 0x02, 0xe0, 0x22, 0xfe, 0x11, 0x61, 0x3f, 0xbf, 0x59, 0x9d, 0x19, 0x53, 0xf3, 0xd4, 0x77, + 0xa8, 0x88, 0x71, 0x35, 0x5a, 0xf9, 0xb9, 0x90, 0xc1, 0x2d, 0x56, 0xd9, 0x02, 0x64, 0x91, 0x26, + 0x27, 0xf5, 0xc2, 0xc1, 0xad, 0xce, 0x8f, 0x00, 0x8c, 0x9e, 0x7e, 0x1c, 0x02, 0x78, 0x54, 0x44, + 0x11, 0xe4, 0x3b, 0xf3, 0x48, 0x10, 0x24, 0x20, 0x65, 0xe3, 0x57, 0x3e, 0xe1, 0xe4, 0x30, 0x04, + 0x70, 0xbf, 0xd8, 0xa0, 0x44, 0xc3, 0xab, 0xe5, 0xc6, 0x44, 0xab, 0x8d, 0x89, 0xde, 0x37, 0x26, + 0x7a, 0xd8, 0x9a, 0xda, 0x6a, 0x6b, 0x6a, 0xaf, 0x5b, 0x53, 0xbb, 0x39, 0xdf, 0x33, 0x99, 0xf2, + 0x29, 0x67, 0x23, 0x86, 0xe9, 0x9c, 0x30, 0x8e, 0xef, 0xf7, 0xdf, 0xae, 0x50, 0xf2, 0x6b, 0xc5, + 0xb6, 0x2f, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x03, 0x84, 0xc4, 0x47, 0xde, 0x01, 0x00, 0x00, +} + +func (this *ClassAuthorityMetadata) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ClassAuthorityMetadata) + if !ok { + that2, ok := that.(ClassAuthorityMetadata) + if ok { + that1 = &that2 + } else { + return false } } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return len(dAtA) - i, nil + if this.Admin != that1.Admin { + return false + } + return true } - -func (m *ClassNameIdList) Marshal() (dAtA []byte, err error) { +func (m *ClassAuthorityMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -472,29 +197,20 @@ func (m *ClassNameIdList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ClassNameIdList) MarshalTo(dAtA []byte) (int, error) { +func (m *ClassAuthorityMetadata) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ClassNameIdList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ClassAuthorityMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ClassId) > 0 { - for iNdEx := len(m.ClassId) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ClassId[iNdEx]) - copy(dAtA[i:], m.ClassId[iNdEx]) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassId[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.ClassName) > 0 { - i -= len(m.ClassName) - copy(dAtA[i:], m.ClassName) - i = encodeVarintNftfactory(dAtA, i, uint64(len(m.ClassName))) + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintNftfactory(dAtA, i, uint64(len(m.Admin))) i-- dAtA[i] = 0xa } @@ -521,40 +237,26 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MaxDescriptionLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxDescriptionLen)) + if len(m.FeeCollectorAddress) > 0 { + i -= len(m.FeeCollectorAddress) + copy(dAtA[i:], m.FeeCollectorAddress) + i = encodeVarintNftfactory(dAtA, i, uint64(len(m.FeeCollectorAddress))) i-- - dAtA[i] = 0x38 - } - if m.MaxSymbolLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxSymbolLen)) - i-- - dAtA[i] = 0x30 - } - if m.MaxUriLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxUriLen)) - i-- - dAtA[i] = 0x28 - } - if m.MinUriLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MinUriLen)) - i-- - dAtA[i] = 0x20 - } - if m.MaxClassNameLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxClassNameLen)) - i-- - dAtA[i] = 0x18 - } - if m.MinClassNameLen != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MinClassNameLen)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if m.MaxNFTSupplyCap != 0 { - i = encodeVarintNftfactory(dAtA, i, uint64(m.MaxNFTSupplyCap)) - i-- - dAtA[i] = 0x8 + if len(m.ClassCreationFee) > 0 { + for iNdEx := len(m.ClassCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ClassCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNftfactory(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -570,98 +272,35 @@ func encodeVarintNftfactory(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *ClassAttributes) Size() (n int) { +func (m *ClassAuthorityMetadata) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ClassId) + l = len(m.Admin) if l > 0 { n += 1 + l + sovNftfactory(uint64(l)) } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftfactory(uint64(l)) - } - l = len(m.BaseTokenUri) - if l > 0 { - n += 1 + l + sovNftfactory(uint64(l)) - } - if m.MintingPermission != 0 { - n += 1 + sovNftfactory(uint64(m.MintingPermission)) - } - if m.TokenSupplyCap != 0 { - n += 1 + sovNftfactory(uint64(m.TokenSupplyCap)) - } return n } -func (m *OwningClassIdList) Size() (n int) { +func (m *Params) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNftfactory(uint64(l)) - } - if len(m.ClassId) > 0 { - for _, s := range m.ClassId { - l = len(s) + if len(m.ClassCreationFee) > 0 { + for _, e := range m.ClassCreationFee { + l = e.Size() n += 1 + l + sovNftfactory(uint64(l)) } } - return n -} - -func (m *ClassNameIdList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassName) + l = len(m.FeeCollectorAddress) if l > 0 { n += 1 + l + sovNftfactory(uint64(l)) } - if len(m.ClassId) > 0 { - for _, s := range m.ClassId { - l = len(s) - n += 1 + l + sovNftfactory(uint64(l)) - } - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaxNFTSupplyCap != 0 { - n += 1 + sovNftfactory(uint64(m.MaxNFTSupplyCap)) - } - if m.MinClassNameLen != 0 { - n += 1 + sovNftfactory(uint64(m.MinClassNameLen)) - } - if m.MaxClassNameLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxClassNameLen)) - } - if m.MinUriLen != 0 { - n += 1 + sovNftfactory(uint64(m.MinUriLen)) - } - if m.MaxUriLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxUriLen)) - } - if m.MaxSymbolLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxSymbolLen)) - } - if m.MaxDescriptionLen != 0 { - n += 1 + sovNftfactory(uint64(m.MaxDescriptionLen)) - } return n } @@ -671,7 +310,7 @@ func sovNftfactory(x uint64) (n int) { func sozNftfactory(x uint64) (n int) { return sovNftfactory(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *ClassAttributes) Unmarshal(dAtA []byte) error { +func (m *ClassAuthorityMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -694,15 +333,15 @@ func (m *ClassAttributes) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ClassAttributes: wiretype end group for non-group") + return fmt.Errorf("proto: ClassAuthorityMetadata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ClassAttributes: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClassAuthorityMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -730,117 +369,15 @@ func (m *ClassAttributes) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipNftfactory(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MintingPermission", wireType) - } - m.MintingPermission = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MintingPermission |= MintingPermission(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) - } - m.TokenSupplyCap = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TokenSupplyCap |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNftfactory(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthNftfactory } if (iNdEx + skippy) > l { @@ -855,7 +392,7 @@ func (m *ClassAttributes) Unmarshal(dAtA []byte) error { } return nil } -func (m *OwningClassIdList) Unmarshal(dAtA []byte) error { +func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -878,49 +415,17 @@ func (m *OwningClassIdList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OwningClassIdList: wiretype end group for non-group") + return fmt.Errorf("proto: Params: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OwningClassIdList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClassCreationFee", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNftfactory @@ -930,109 +435,29 @@ func (m *OwningClassIdList) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNftfactory } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNftfactory } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = append(m.ClassId, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNftfactory(dAtA[iNdEx:]) - if err != nil { + m.ClassCreationFee = append(m.ClassCreationFee, types.Coin{}) + if err := m.ClassCreationFee[len(m.ClassCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftfactory - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClassNameIdList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClassNameIdList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClassNameIdList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNftfactory - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNftfactory - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1060,7 +485,7 @@ func (m *ClassNameIdList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = append(m.ClassId, string(dAtA[iNdEx:postIndex])) + m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1083,189 +508,6 @@ func (m *ClassNameIdList) Unmarshal(dAtA []byte) error { } return nil } -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxNFTSupplyCap", wireType) - } - m.MaxNFTSupplyCap = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxNFTSupplyCap |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinClassNameLen", wireType) - } - m.MinClassNameLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinClassNameLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxClassNameLen", wireType) - } - m.MaxClassNameLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxClassNameLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinUriLen", wireType) - } - m.MinUriLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinUriLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxUriLen", wireType) - } - m.MaxUriLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxUriLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSymbolLen", wireType) - } - m.MaxSymbolLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxSymbolLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxDescriptionLen", wireType) - } - m.MaxDescriptionLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNftfactory - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxDescriptionLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNftfactory(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNftfactory - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipNftfactory(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/nftfactory/types/params.go b/x/nftfactory/types/params.go index a8c4f07df..55b26d206 100644 --- a/x/nftfactory/types/params.go +++ b/x/nftfactory/types/params.go @@ -3,171 +3,66 @@ package types import ( fmt "fmt" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( - DefaultMaxNFTSupplyCap = 100000 - DefaultMinClassNameLen = 3 - DefaultMaxClassNameLen = 128 - DefaultMinUriLen = 8 - DefaultMaxUriLen = 512 - DefaultMaxSymbolLen = 16 - DefaultMaxDescriptionLen = 1024 + DefaultFeeDenom = "uguu" + DefaultFeeAmount int64 = 1_000_000 + DefaultFeeCollectorAddress = "" ) -// NewParams returns a new params object -func NewParams( - maxNFTMintSupplyCap, - minClassNameLen, maxClassNameLen, - minUriLen, maxUriLen, - maxSymbolLen, - maxDescriptionLen uint64, -) Params { +func NewParams(denomCreationFee sdk.Coins, feeCollectorAddress string) Params { return Params{ - MaxNFTSupplyCap: maxNFTMintSupplyCap, - MinClassNameLen: minClassNameLen, - MaxClassNameLen: maxClassNameLen, - MinUriLen: minUriLen, - MaxUriLen: maxClassNameLen, - MaxSymbolLen: maxSymbolLen, - MaxDescriptionLen: maxDescriptionLen, + ClassCreationFee: denomCreationFee, + FeeCollectorAddress: feeCollectorAddress, } } -// DefaultParams returns default params for nftmint module +// default tokenfactory module parameters. func DefaultParams() Params { return Params{ - MaxNFTSupplyCap: DefaultMaxNFTSupplyCap, - MinClassNameLen: DefaultMinClassNameLen, - MaxClassNameLen: DefaultMaxClassNameLen, - MinUriLen: DefaultMinUriLen, - MaxUriLen: DefaultMaxUriLen, - MaxSymbolLen: DefaultMaxSymbolLen, - MaxDescriptionLen: DefaultMaxDescriptionLen, + ClassCreationFee: sdk.NewCoins(sdk.NewInt64Coin(DefaultFeeDenom, DefaultFeeAmount)), + FeeCollectorAddress: DefaultFeeCollectorAddress, } } -// ParamKeyTable Key declaration for parameters -func ParamKeyTable() paramstypes.KeyTable { - return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// Parameter keys -var ( - KeyMaxNFTSupplyCap = []byte("MaxNFTSupplyCap") - KeyMinClassNameLen = []byte("MinClassNameLen") - KeyMaxClassNameLen = []byte("MaxClassNameLen") - KeyMinUriLen = []byte("MinUriLen") - KeyMaxUriLen = []byte("MaxUriLen") - KeyMaxSymbolLen = []byte("MaxSymbolLen") - KeyMaxDescriptionLen = []byte("MaxDescriptionLen") -) - -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs -func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { - return paramstypes.ParamSetPairs{ - paramstypes.NewParamSetPair(KeyMaxNFTSupplyCap, &p.MaxNFTSupplyCap, validateMaxNFTSupplyCap), - paramstypes.NewParamSetPair(KeyMinClassNameLen, &p.MinClassNameLen, validateMinClassNameLen), - paramstypes.NewParamSetPair(KeyMaxClassNameLen, &p.MaxClassNameLen, validateMaxClassNameLen), - paramstypes.NewParamSetPair(KeyMinUriLen, &p.MinUriLen, validateMinUriLen), - paramstypes.NewParamSetPair(KeyMaxUriLen, &p.MaxUriLen, validateMaxUriLen), - paramstypes.NewParamSetPair(KeyMaxSymbolLen, &p.MaxSymbolLen, validateMaxSymbolLen), - paramstypes.NewParamSetPair(KeyMaxDescriptionLen, &p.MaxDescriptionLen, validateMaxDescriptionLen), - } -} - -// Validate checks that the parameters have valid values. +// validate params. func (p Params) Validate() error { - if err := validateMaxNFTSupplyCap(p.MaxNFTSupplyCap); err != nil { - return err - } - - if err := validateMinClassNameLen(p.MinClassNameLen); err != nil { - return err - } - - if err := validateMaxClassNameLen(p.MaxClassNameLen); err != nil { - return err - } - - if err := validateMinUriLen(p.MinUriLen); err != nil { - return err - } - - if err := validateMaxUriLen(p.MaxUriLen); err != nil { - return err - } - - if err := validateMaxSymbolLen(p.MaxSymbolLen); err != nil { - return err - } - - if err := validateMaxDescriptionLen(p.MaxDescriptionLen); err != nil { + if err := validateDenomCreationFee(p.ClassCreationFee); err != nil { return err } - return nil + return validateFeeCollectorAddress(p.FeeCollectorAddress) } -func validateMaxNFTSupplyCap(i interface{}) error { - _, ok := i.(uint64) +func validateDenomCreationFee(i interface{}) error { + v, ok := i.(sdk.Coins) if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + return fmt.Errorf("invalid parameter type: %T", i) } - return nil -} - -func validateMinClassNameLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + if err := v.Validate(); err != nil { + return fmt.Errorf("invalid denom creation fee: %+v, %w", i, err) } return nil } -func validateMaxClassNameLen(i interface{}) error { - _, ok := i.(uint64) +func validateFeeCollectorAddress(i interface{}) error { + v, ok := i.(string) if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + return fmt.Errorf("invalid parameter type: %T", i) } - return nil -} - -func validateMinUriLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + // Fee collector address might be explicitly empty in test environments + if len(v) == 0 { + return nil } - return nil -} - -func validateMaxUriLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) - } - - return nil -} - -func validateMaxSymbolLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) - } - - return nil -} - -func validateMaxDescriptionLen(i interface{}) error { - _, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter types: %T", i) + _, err := sdk.AccAddressFromBech32(v) + if err != nil { + return fmt.Errorf("invalid fee collector address: %w", err) } return nil diff --git a/x/nftfactory/types/query.pb.go b/x/nftfactory/types/query.pb.go index 4c2a375e1..39b2b908e 100644 --- a/x/nftfactory/types/query.pb.go +++ b/x/nftfactory/types/query.pb.go @@ -29,6 +29,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest is the request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -65,7 +66,9 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +// QueryParamsResponse is the response type for the Query/Params RPC method. type QueryParamsResponse struct { + // params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -109,22 +112,23 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryClassAttributesRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` +type QueryClassAuthorityMetadataRequest struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` + Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty" yaml:"subclass"` } -func (m *QueryClassAttributesRequest) Reset() { *m = QueryClassAttributesRequest{} } -func (m *QueryClassAttributesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClassAttributesRequest) ProtoMessage() {} -func (*QueryClassAttributesRequest) Descriptor() ([]byte, []int) { +func (m *QueryClassAuthorityMetadataRequest) Reset() { *m = QueryClassAuthorityMetadataRequest{} } +func (m *QueryClassAuthorityMetadataRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassAuthorityMetadataRequest) ProtoMessage() {} +func (*QueryClassAuthorityMetadataRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ce869c90a3ee4b0a, []int{2} } -func (m *QueryClassAttributesRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryClassAuthorityMetadataRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassAttributesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassAuthorityMetadataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassAttributesRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassAuthorityMetadataRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -134,225 +138,48 @@ func (m *QueryClassAttributesRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassAttributesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassAttributesRequest.Merge(m, src) +func (m *QueryClassAuthorityMetadataRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassAuthorityMetadataRequest.Merge(m, src) } -func (m *QueryClassAttributesRequest) XXX_Size() int { +func (m *QueryClassAuthorityMetadataRequest) XXX_Size() int { return m.Size() } -func (m *QueryClassAttributesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassAttributesRequest.DiscardUnknown(m) +func (m *QueryClassAuthorityMetadataRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassAuthorityMetadataRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassAttributesRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryClassAuthorityMetadataRequest proto.InternalMessageInfo -func (m *QueryClassAttributesRequest) GetClassId() string { +func (m *QueryClassAuthorityMetadataRequest) GetCreator() string { if m != nil { - return m.ClassId + return m.Creator } return "" } -type QueryClassAttributesResponse struct { - ClassAttributes *ClassAttributes `protobuf:"bytes,1,opt,name=class_attributes,json=classAttributes,proto3" json:"class_attributes,omitempty"` -} - -func (m *QueryClassAttributesResponse) Reset() { *m = QueryClassAttributesResponse{} } -func (m *QueryClassAttributesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClassAttributesResponse) ProtoMessage() {} -func (*QueryClassAttributesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{3} -} -func (m *QueryClassAttributesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClassAttributesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClassAttributesResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryClassAttributesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassAttributesResponse.Merge(m, src) -} -func (m *QueryClassAttributesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryClassAttributesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassAttributesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClassAttributesResponse proto.InternalMessageInfo - -func (m *QueryClassAttributesResponse) GetClassAttributes() *ClassAttributes { - if m != nil { - return m.ClassAttributes - } - return nil -} - -type QueryNFTMinterRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryNFTMinterRequest) Reset() { *m = QueryNFTMinterRequest{} } -func (m *QueryNFTMinterRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNFTMinterRequest) ProtoMessage() {} -func (*QueryNFTMinterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{4} -} -func (m *QueryNFTMinterRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNFTMinterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNFTMinterRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNFTMinterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTMinterRequest.Merge(m, src) -} -func (m *QueryNFTMinterRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryNFTMinterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTMinterRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNFTMinterRequest proto.InternalMessageInfo - -func (m *QueryNFTMinterRequest) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" -} - -func (m *QueryNFTMinterRequest) GetNftId() string { +func (m *QueryClassAuthorityMetadataRequest) GetSubclass() string { if m != nil { - return m.NftId + return m.Subclass } return "" } -type QueryNFTMinterResponse struct { - Minter string `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter,omitempty"` +type QueryClassAuthorityMetadataResponse struct { + AuthorityMetadata ClassAuthorityMetadata `protobuf:"bytes,1,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` } -func (m *QueryNFTMinterResponse) Reset() { *m = QueryNFTMinterResponse{} } -func (m *QueryNFTMinterResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNFTMinterResponse) ProtoMessage() {} -func (*QueryNFTMinterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{5} -} -func (m *QueryNFTMinterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNFTMinterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNFTMinterResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryNFTMinterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTMinterResponse.Merge(m, src) -} -func (m *QueryNFTMinterResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryNFTMinterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTMinterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNFTMinterResponse proto.InternalMessageInfo - -func (m *QueryNFTMinterResponse) GetMinter() string { - if m != nil { - return m.Minter - } - return "" -} - -type QueryClassIdsByNameRequest struct { - ClassName string `protobuf:"bytes,1,opt,name=class_name,json=className,proto3" json:"class_name,omitempty"` -} - -func (m *QueryClassIdsByNameRequest) Reset() { *m = QueryClassIdsByNameRequest{} } -func (m *QueryClassIdsByNameRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByNameRequest) ProtoMessage() {} -func (*QueryClassIdsByNameRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{6} -} -func (m *QueryClassIdsByNameRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryClassIdsByNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryClassIdsByNameRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryClassIdsByNameRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByNameRequest.Merge(m, src) -} -func (m *QueryClassIdsByNameRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryClassIdsByNameRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByNameRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryClassIdsByNameRequest proto.InternalMessageInfo - -func (m *QueryClassIdsByNameRequest) GetClassName() string { - if m != nil { - return m.ClassName - } - return "" -} - -type QueryClassIdsByNameResponse struct { - ClassNameIdList *ClassNameIdList `protobuf:"bytes,1,opt,name=class_name_id_list,json=classNameIdList,proto3" json:"class_name_id_list,omitempty"` -} - -func (m *QueryClassIdsByNameResponse) Reset() { *m = QueryClassIdsByNameResponse{} } -func (m *QueryClassIdsByNameResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByNameResponse) ProtoMessage() {} -func (*QueryClassIdsByNameResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{7} +func (m *QueryClassAuthorityMetadataResponse) Reset() { *m = QueryClassAuthorityMetadataResponse{} } +func (m *QueryClassAuthorityMetadataResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassAuthorityMetadataResponse) ProtoMessage() {} +func (*QueryClassAuthorityMetadataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce869c90a3ee4b0a, []int{3} } -func (m *QueryClassIdsByNameResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryClassAuthorityMetadataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassIdsByNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassAuthorityMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassIdsByNameResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassAuthorityMetadataResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -362,41 +189,41 @@ func (m *QueryClassIdsByNameResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassIdsByNameResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByNameResponse.Merge(m, src) +func (m *QueryClassAuthorityMetadataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassAuthorityMetadataResponse.Merge(m, src) } -func (m *QueryClassIdsByNameResponse) XXX_Size() int { +func (m *QueryClassAuthorityMetadataResponse) XXX_Size() int { return m.Size() } -func (m *QueryClassIdsByNameResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByNameResponse.DiscardUnknown(m) +func (m *QueryClassAuthorityMetadataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassAuthorityMetadataResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassIdsByNameResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryClassAuthorityMetadataResponse proto.InternalMessageInfo -func (m *QueryClassIdsByNameResponse) GetClassNameIdList() *ClassNameIdList { +func (m *QueryClassAuthorityMetadataResponse) GetAuthorityMetadata() ClassAuthorityMetadata { if m != nil { - return m.ClassNameIdList + return m.AuthorityMetadata } - return nil + return ClassAuthorityMetadata{} } -type QueryClassIdsByOwnerRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +type QueryClassesFromCreatorRequest struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` } -func (m *QueryClassIdsByOwnerRequest) Reset() { *m = QueryClassIdsByOwnerRequest{} } -func (m *QueryClassIdsByOwnerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByOwnerRequest) ProtoMessage() {} -func (*QueryClassIdsByOwnerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{8} +func (m *QueryClassesFromCreatorRequest) Reset() { *m = QueryClassesFromCreatorRequest{} } +func (m *QueryClassesFromCreatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassesFromCreatorRequest) ProtoMessage() {} +func (*QueryClassesFromCreatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce869c90a3ee4b0a, []int{4} } -func (m *QueryClassIdsByOwnerRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryClassesFromCreatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassIdsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassesFromCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassIdsByOwnerRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassesFromCreatorRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -406,41 +233,41 @@ func (m *QueryClassIdsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassIdsByOwnerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByOwnerRequest.Merge(m, src) +func (m *QueryClassesFromCreatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassesFromCreatorRequest.Merge(m, src) } -func (m *QueryClassIdsByOwnerRequest) XXX_Size() int { +func (m *QueryClassesFromCreatorRequest) XXX_Size() int { return m.Size() } -func (m *QueryClassIdsByOwnerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByOwnerRequest.DiscardUnknown(m) +func (m *QueryClassesFromCreatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassesFromCreatorRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassIdsByOwnerRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryClassesFromCreatorRequest proto.InternalMessageInfo -func (m *QueryClassIdsByOwnerRequest) GetOwner() string { +func (m *QueryClassesFromCreatorRequest) GetCreator() string { if m != nil { - return m.Owner + return m.Creator } return "" } -type QueryClassIdsByOwnerResponse struct { - OwningClassIdList *OwningClassIdList `protobuf:"bytes,1,opt,name=owning_class_id_list,json=owningClassIdList,proto3" json:"owning_class_id_list,omitempty"` +type QueryClassesFromCreatorResponse struct { + Classes []string `protobuf:"bytes,1,rep,name=classes,proto3" json:"classes,omitempty" yaml:"classes"` } -func (m *QueryClassIdsByOwnerResponse) Reset() { *m = QueryClassIdsByOwnerResponse{} } -func (m *QueryClassIdsByOwnerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryClassIdsByOwnerResponse) ProtoMessage() {} -func (*QueryClassIdsByOwnerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce869c90a3ee4b0a, []int{9} +func (m *QueryClassesFromCreatorResponse) Reset() { *m = QueryClassesFromCreatorResponse{} } +func (m *QueryClassesFromCreatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassesFromCreatorResponse) ProtoMessage() {} +func (*QueryClassesFromCreatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce869c90a3ee4b0a, []int{5} } -func (m *QueryClassIdsByOwnerResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryClassesFromCreatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryClassIdsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryClassesFromCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryClassIdsByOwnerResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryClassesFromCreatorResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -450,21 +277,21 @@ func (m *QueryClassIdsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryClassIdsByOwnerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryClassIdsByOwnerResponse.Merge(m, src) +func (m *QueryClassesFromCreatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassesFromCreatorResponse.Merge(m, src) } -func (m *QueryClassIdsByOwnerResponse) XXX_Size() int { +func (m *QueryClassesFromCreatorResponse) XXX_Size() int { return m.Size() } -func (m *QueryClassIdsByOwnerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryClassIdsByOwnerResponse.DiscardUnknown(m) +func (m *QueryClassesFromCreatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassesFromCreatorResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryClassIdsByOwnerResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryClassesFromCreatorResponse proto.InternalMessageInfo -func (m *QueryClassIdsByOwnerResponse) GetOwningClassIdList() *OwningClassIdList { +func (m *QueryClassesFromCreatorResponse) GetClasses() []string { if m != nil { - return m.OwningClassIdList + return m.Classes } return nil } @@ -472,61 +299,50 @@ func (m *QueryClassIdsByOwnerResponse) GetOwningClassIdList() *OwningClassIdList func init() { proto.RegisterType((*QueryParamsRequest)(nil), "ununifi.nftfactory.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "ununifi.nftfactory.QueryParamsResponse") - proto.RegisterType((*QueryClassAttributesRequest)(nil), "ununifi.nftfactory.QueryClassAttributesRequest") - proto.RegisterType((*QueryClassAttributesResponse)(nil), "ununifi.nftfactory.QueryClassAttributesResponse") - proto.RegisterType((*QueryNFTMinterRequest)(nil), "ununifi.nftfactory.QueryNFTMinterRequest") - proto.RegisterType((*QueryNFTMinterResponse)(nil), "ununifi.nftfactory.QueryNFTMinterResponse") - proto.RegisterType((*QueryClassIdsByNameRequest)(nil), "ununifi.nftfactory.QueryClassIdsByNameRequest") - proto.RegisterType((*QueryClassIdsByNameResponse)(nil), "ununifi.nftfactory.QueryClassIdsByNameResponse") - proto.RegisterType((*QueryClassIdsByOwnerRequest)(nil), "ununifi.nftfactory.QueryClassIdsByOwnerRequest") - proto.RegisterType((*QueryClassIdsByOwnerResponse)(nil), "ununifi.nftfactory.QueryClassIdsByOwnerResponse") + proto.RegisterType((*QueryClassAuthorityMetadataRequest)(nil), "ununifi.nftfactory.QueryClassAuthorityMetadataRequest") + proto.RegisterType((*QueryClassAuthorityMetadataResponse)(nil), "ununifi.nftfactory.QueryClassAuthorityMetadataResponse") + proto.RegisterType((*QueryClassesFromCreatorRequest)(nil), "ununifi.nftfactory.QueryClassesFromCreatorRequest") + proto.RegisterType((*QueryClassesFromCreatorResponse)(nil), "ununifi.nftfactory.QueryClassesFromCreatorResponse") } func init() { proto.RegisterFile("ununifi/nftfactory/query.proto", fileDescriptor_ce869c90a3ee4b0a) } var fileDescriptor_ce869c90a3ee4b0a = []byte{ - // 654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x9b, 0xe9, 0xb7, 0xfc, 0x98, 0x91, 0x18, 0x98, 0x6e, 0x82, 0x30, 0x02, 0xf2, 0xc4, - 0xbf, 0x81, 0xe2, 0xa9, 0x43, 0x68, 0x82, 0x13, 0x43, 0x4c, 0xaa, 0x04, 0xdb, 0x98, 0x18, 0x07, - 0x2e, 0x51, 0xda, 0xa4, 0x99, 0xa5, 0xd6, 0xee, 0x62, 0x87, 0x51, 0x4d, 0xbd, 0xf0, 0x0a, 0x90, - 0xb8, 0x73, 0xe6, 0x00, 0x07, 0xde, 0xc5, 0x8e, 0x93, 0xb8, 0x70, 0x42, 0xa8, 0xe5, 0x85, 0xa0, - 0xd8, 0xce, 0x92, 0xa6, 0x19, 0xed, 0xa9, 0xf6, 0xf3, 0xf7, 0xd3, 0xc7, 0xcf, 0xb7, 0x05, 0x76, - 0x4c, 0x63, 0x4a, 0x5a, 0x04, 0xd3, 0x96, 0x68, 0x79, 0x4d, 0xc1, 0xa2, 0x1e, 0x3e, 0x88, 0x83, - 0xa8, 0xe7, 0x74, 0x23, 0x26, 0x18, 0x84, 0xda, 0xef, 0x64, 0x7e, 0xab, 0x1a, 0xb2, 0x90, 0x49, - 0x37, 0x4e, 0x4e, 0x2a, 0xd2, 0x5a, 0x0a, 0x19, 0x0b, 0xdb, 0x01, 0xf6, 0xba, 0x04, 0x7b, 0x94, - 0x32, 0xe1, 0x09, 0xc2, 0x28, 0xd7, 0xde, 0xe5, 0x92, 0x3e, 0xd9, 0x51, 0x05, 0xa1, 0x2a, 0x80, - 0xaf, 0x92, 0xde, 0x3b, 0x5e, 0xe4, 0x75, 0xf8, 0x6e, 0x70, 0x10, 0x07, 0x5c, 0xa0, 0x6d, 0x70, - 0x79, 0xc4, 0xca, 0xbb, 0x8c, 0xf2, 0x00, 0xae, 0x03, 0xb3, 0x2b, 0x2d, 0x57, 0x8c, 0x9b, 0xc6, - 0xdd, 0xf3, 0x35, 0xcb, 0x19, 0x47, 0x75, 0x54, 0xce, 0xc6, 0x7f, 0xc7, 0xbf, 0x6e, 0x54, 0x76, - 0x75, 0x3c, 0x5a, 0x07, 0xd7, 0x64, 0xc1, 0x67, 0x6d, 0x8f, 0xf3, 0xa7, 0x42, 0x44, 0xa4, 0x11, - 0x8b, 0x20, 0xed, 0x07, 0xaf, 0x82, 0x73, 0xcd, 0xc4, 0xe3, 0x12, 0x5f, 0x96, 0x9e, 0xdb, 0xfd, - 0x5f, 0xde, 0xeb, 0x3e, 0xa2, 0x60, 0xa9, 0x3c, 0x53, 0x33, 0x6d, 0x81, 0x8b, 0x2a, 0xd5, 0x3b, - 0xf5, 0x69, 0xba, 0xe5, 0x32, 0xba, 0x62, 0x99, 0xf9, 0xe6, 0xa8, 0x01, 0xd5, 0xc1, 0x82, 0xec, - 0xb7, 0xb5, 0xf9, 0xfa, 0x25, 0xa1, 0x22, 0x88, 0x26, 0x33, 0xc2, 0x05, 0x60, 0xd2, 0x96, 0x48, - 0x1c, 0x33, 0xd2, 0x31, 0x4b, 0x5b, 0xa2, 0xee, 0xa3, 0x55, 0xb0, 0x58, 0x2c, 0xa5, 0xa1, 0x17, - 0x81, 0xd9, 0x91, 0x16, 0x5d, 0x49, 0xdf, 0xd0, 0x13, 0x60, 0x65, 0x5f, 0xb6, 0xee, 0xf3, 0x8d, - 0xde, 0x96, 0xd7, 0x09, 0x52, 0x82, 0xeb, 0x00, 0x28, 0x02, 0xea, 0x75, 0x02, 0x9d, 0x39, 0x27, - 0x2d, 0x49, 0x14, 0x62, 0xf9, 0x19, 0xe7, 0x92, 0x75, 0xcf, 0x1d, 0x00, 0xb3, 0x6c, 0x97, 0xf8, - 0x6e, 0x9b, 0x70, 0x31, 0x71, 0x54, 0x49, 0x89, 0xba, 0xff, 0x82, 0x70, 0xa1, 0x47, 0x95, 0x19, - 0xd0, 0xda, 0x58, 0xc3, 0xed, 0x43, 0x9a, 0x0d, 0xac, 0x0a, 0x66, 0x59, 0x72, 0xd7, 0xa4, 0xea, - 0x82, 0xde, 0xe5, 0xdf, 0x33, 0x9f, 0xa4, 0x31, 0xdf, 0x80, 0x2a, 0x3b, 0xa4, 0x84, 0x86, 0x6e, - 0x3a, 0xed, 0x3c, 0xe8, 0xad, 0x32, 0xd0, 0x6d, 0x19, 0xaf, 0x0b, 0x4a, 0xd4, 0x4b, 0xac, 0x68, - 0xaa, 0x7d, 0x37, 0xc1, 0xac, 0x6c, 0x0c, 0xfb, 0xc0, 0x54, 0x3b, 0x0a, 0x6f, 0x97, 0x55, 0x1b, - 0x97, 0x83, 0x75, 0x67, 0x62, 0x9c, 0x82, 0x47, 0xe8, 0xc3, 0x8f, 0x3f, 0x9f, 0x66, 0x96, 0xa0, - 0x85, 0x4b, 0xb4, 0xa7, 0xa4, 0x00, 0xbf, 0x18, 0x60, 0xbe, 0xb0, 0x85, 0x10, 0x9f, 0xd9, 0xa0, - 0x5c, 0x30, 0xd6, 0xea, 0xf4, 0x09, 0x1a, 0xad, 0x26, 0xd1, 0x1e, 0xc0, 0x95, 0x32, 0x34, 0x35, - 0x6a, 0xf9, 0x40, 0xf8, 0x28, 0x9d, 0x7b, 0x1f, 0x7e, 0x36, 0xc0, 0xdc, 0xe9, 0xf2, 0xc2, 0x7b, - 0x67, 0xf6, 0x2c, 0x6a, 0xc5, 0x5a, 0x99, 0x26, 0x54, 0x83, 0x3d, 0x96, 0x60, 0x0f, 0x61, 0x0d, - 0x97, 0xff, 0x5e, 0xb9, 0x4a, 0x1b, 0x39, 0x2e, 0x7c, 0xa4, 0xd4, 0xd6, 0x87, 0xdf, 0x0c, 0x70, - 0x61, 0x74, 0xdd, 0xa1, 0xf3, 0xef, 0xc9, 0x14, 0x45, 0x65, 0xe1, 0xa9, 0xe3, 0xa7, 0xe1, 0x4d, - 0x19, 0xb9, 0xdb, 0xe8, 0x49, 0xa1, 0xa5, 0xd8, 0xc9, 0xb9, 0x0f, 0xbf, 0xa6, 0x6f, 0x9f, 0x2d, - 0x3e, 0x9c, 0x06, 0x20, 0xaf, 0xab, 0x49, 0x6f, 0x3f, 0xae, 0x29, 0xf4, 0x48, 0x22, 0xaf, 0x42, - 0x67, 0x22, 0xb2, 0x5e, 0x01, 0xf9, 0xd1, 0xdf, 0x78, 0x7e, 0x3c, 0xb0, 0x8d, 0x93, 0x81, 0x6d, - 0xfc, 0x1e, 0xd8, 0xc6, 0xc7, 0xa1, 0x5d, 0x39, 0x19, 0xda, 0x95, 0x9f, 0x43, 0xbb, 0xf2, 0xf6, - 0x7e, 0x48, 0xc4, 0x7e, 0xdc, 0x70, 0x9a, 0xac, 0x83, 0xf7, 0xe8, 0x1e, 0x25, 0x9b, 0x04, 0x37, - 0xf7, 0x3d, 0x42, 0xf1, 0xfb, 0x7c, 0x6d, 0xd1, 0xeb, 0x06, 0xbc, 0x61, 0xca, 0xbf, 0x9a, 0xb5, - 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x33, 0x6d, 0xb4, 0x4d, 0xf9, 0x06, 0x00, 0x00, + // 544 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xd1, 0x6a, 0x13, 0x4d, + 0x18, 0xcd, 0xf4, 0xef, 0x1f, 0x75, 0x04, 0xc5, 0x69, 0x91, 0xb8, 0x94, 0x4d, 0x9d, 0x82, 0x8a, + 0x9a, 0x0c, 0xa4, 0xa2, 0xd2, 0x3b, 0x53, 0x2c, 0x88, 0x68, 0xed, 0x42, 0x6f, 0xbc, 0x91, 0xc9, + 0x3a, 0xd9, 0x2c, 0x64, 0x67, 0xb6, 0x3b, 0xb3, 0xe0, 0x52, 0x73, 0xa3, 0x2f, 0x20, 0xf8, 0x04, + 0xe2, 0x53, 0xf8, 0x06, 0xbd, 0x2c, 0x78, 0xe3, 0x85, 0x04, 0x49, 0x7c, 0x82, 0x3c, 0x81, 0xec, + 0xcc, 0x6c, 0xa3, 0xcd, 0x26, 0x52, 0xef, 0x26, 0x7b, 0xce, 0x9c, 0xef, 0x9c, 0x6f, 0x0e, 0x81, + 0x6e, 0xca, 0x53, 0x1e, 0x76, 0x43, 0xc2, 0xbb, 0xaa, 0x4b, 0x7d, 0x25, 0x92, 0x8c, 0x1c, 0xa4, + 0x2c, 0xc9, 0x9a, 0x71, 0x22, 0x94, 0x40, 0xc8, 0xe2, 0xcd, 0x29, 0xee, 0xac, 0x06, 0x22, 0x10, + 0x1a, 0x26, 0xf9, 0xc9, 0x30, 0x9d, 0xb5, 0x40, 0x88, 0xa0, 0xcf, 0x08, 0x8d, 0x43, 0x42, 0x39, + 0x17, 0x8a, 0xaa, 0x50, 0x70, 0x69, 0xd1, 0x8d, 0x92, 0x39, 0xd3, 0xa3, 0x21, 0xe1, 0x55, 0x88, + 0xf6, 0xf2, 0xd9, 0x2f, 0x68, 0x42, 0x23, 0xe9, 0xb1, 0x83, 0x94, 0x49, 0x85, 0x77, 0xe1, 0xca, + 0x1f, 0x5f, 0x65, 0x2c, 0xb8, 0x64, 0xe8, 0x21, 0xac, 0xc6, 0xfa, 0x4b, 0x0d, 0xac, 0x83, 0x5b, + 0x17, 0x5b, 0x4e, 0x73, 0xd6, 0x6a, 0xd3, 0xdc, 0x69, 0x2f, 0x1f, 0x0d, 0xeb, 0x15, 0xcf, 0xf2, + 0xf1, 0x7b, 0x00, 0xb1, 0x56, 0xdc, 0xee, 0x53, 0x29, 0x1f, 0xa5, 0xaa, 0x27, 0x92, 0x50, 0x65, + 0xcf, 0x98, 0xa2, 0xaf, 0xa9, 0xa2, 0x76, 0x2e, 0xba, 0x0b, 0xcf, 0xf9, 0x09, 0xa3, 0x4a, 0x24, + 0x7a, 0xc2, 0x85, 0x36, 0x9a, 0x0c, 0xeb, 0x97, 0x32, 0x1a, 0xf5, 0xb7, 0xb0, 0x05, 0xb0, 0x57, + 0x50, 0x10, 0x81, 0xe7, 0x65, 0xda, 0xf1, 0x73, 0xc5, 0xda, 0x92, 0xa6, 0xaf, 0x4c, 0x86, 0xf5, + 0xcb, 0x86, 0x5e, 0x20, 0xd8, 0x3b, 0x21, 0xe1, 0xcf, 0x00, 0x6e, 0x2c, 0x74, 0x61, 0x73, 0xbe, + 0x85, 0x88, 0x16, 0xe0, 0xab, 0xc8, 0xa2, 0x36, 0xf3, 0xed, 0xb2, 0xcc, 0xe5, 0x7a, 0xed, 0xeb, + 0xf9, 0x0e, 0x26, 0xc3, 0xfa, 0x35, 0x63, 0x69, 0x56, 0x13, 0x7b, 0x57, 0xe8, 0xe9, 0x5b, 0xf8, + 0x39, 0x74, 0xa7, 0x26, 0x99, 0xdc, 0x49, 0x44, 0xb4, 0x6d, 0x12, 0xff, 0xd3, 0x9a, 0xf0, 0x2e, + 0xac, 0xcf, 0xd5, 0xb3, 0x81, 0x73, 0x41, 0x83, 0xd6, 0xc0, 0xfa, 0x7f, 0xa7, 0x04, 0x0d, 0x90, + 0x0b, 0x9a, 0x53, 0xeb, 0xd3, 0x32, 0xfc, 0x5f, 0x2b, 0xa2, 0x01, 0xac, 0x9a, 0xe7, 0x46, 0x37, + 0xca, 0xd6, 0x32, 0xdb, 0x2c, 0xe7, 0xe6, 0x5f, 0x79, 0xc6, 0x12, 0xc6, 0xef, 0xbe, 0xfe, 0xfc, + 0xb8, 0xb4, 0x86, 0x1c, 0x52, 0x52, 0x63, 0xd3, 0x2a, 0xf4, 0x1d, 0xc0, 0xab, 0xe5, 0xab, 0x47, + 0xf7, 0xe7, 0xce, 0x59, 0xd8, 0x40, 0xe7, 0xc1, 0x99, 0xef, 0x59, 0xbf, 0x7b, 0xda, 0xef, 0x53, + 0xf4, 0xa4, 0xcc, 0xaf, 0xde, 0x1c, 0x29, 0x7e, 0x1d, 0xda, 0x97, 0x19, 0x90, 0xc3, 0xa2, 0x9a, + 0x03, 0x72, 0xd2, 0x83, 0x46, 0x51, 0x0e, 0xf4, 0x05, 0x40, 0x34, 0xfb, 0x68, 0xa8, 0xb5, 0xd8, + 0x62, 0x59, 0x63, 0x9c, 0xcd, 0x33, 0xdd, 0xb1, 0x91, 0xb6, 0x74, 0xa4, 0x7b, 0xa8, 0x35, 0x37, + 0x12, 0x93, 0x8d, 0x6e, 0x22, 0xa2, 0x86, 0x0d, 0x34, 0x4d, 0xd6, 0x7e, 0x7c, 0x34, 0x72, 0xc1, + 0xf1, 0xc8, 0x05, 0x3f, 0x46, 0x2e, 0xf8, 0x30, 0x76, 0x2b, 0xc7, 0x63, 0xb7, 0xf2, 0x6d, 0xec, + 0x56, 0x5e, 0xde, 0x09, 0x42, 0xd5, 0x4b, 0x3b, 0x4d, 0x5f, 0x44, 0x64, 0x9f, 0xef, 0xf3, 0x70, + 0x27, 0x24, 0x7e, 0x8f, 0x86, 0x9c, 0xbc, 0xf9, 0x5d, 0x5f, 0x65, 0x31, 0x93, 0x9d, 0xaa, 0xfe, + 0x97, 0xda, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x0a, 0xef, 0x26, 0x34, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -542,10 +358,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - ClassAttributes(ctx context.Context, in *QueryClassAttributesRequest, opts ...grpc.CallOption) (*QueryClassAttributesResponse, error) - NFTMinter(ctx context.Context, in *QueryNFTMinterRequest, opts ...grpc.CallOption) (*QueryNFTMinterResponse, error) - ClassIdsByName(ctx context.Context, in *QueryClassIdsByNameRequest, opts ...grpc.CallOption) (*QueryClassIdsByNameResponse, error) - ClassIdsByOwner(ctx context.Context, in *QueryClassIdsByOwnerRequest, opts ...grpc.CallOption) (*QueryClassIdsByOwnerResponse, error) + ClassAuthorityMetadata(ctx context.Context, in *QueryClassAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryClassAuthorityMetadataResponse, error) + ClassesFromCreator(ctx context.Context, in *QueryClassesFromCreatorRequest, opts ...grpc.CallOption) (*QueryClassesFromCreatorResponse, error) } type queryClient struct { @@ -565,36 +379,18 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) ClassAttributes(ctx context.Context, in *QueryClassAttributesRequest, opts ...grpc.CallOption) (*QueryClassAttributesResponse, error) { - out := new(QueryClassAttributesResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassAttributes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) NFTMinter(ctx context.Context, in *QueryNFTMinterRequest, opts ...grpc.CallOption) (*QueryNFTMinterResponse, error) { - out := new(QueryNFTMinterResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/NFTMinter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ClassIdsByName(ctx context.Context, in *QueryClassIdsByNameRequest, opts ...grpc.CallOption) (*QueryClassIdsByNameResponse, error) { - out := new(QueryClassIdsByNameResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassIdsByName", in, out, opts...) +func (c *queryClient) ClassAuthorityMetadata(ctx context.Context, in *QueryClassAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryClassAuthorityMetadataResponse, error) { + out := new(QueryClassAuthorityMetadataResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassAuthorityMetadata", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ClassIdsByOwner(ctx context.Context, in *QueryClassIdsByOwnerRequest, opts ...grpc.CallOption) (*QueryClassIdsByOwnerResponse, error) { - out := new(QueryClassIdsByOwnerResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassIdsByOwner", in, out, opts...) +func (c *queryClient) ClassesFromCreator(ctx context.Context, in *QueryClassesFromCreatorRequest, opts ...grpc.CallOption) (*QueryClassesFromCreatorResponse, error) { + out := new(QueryClassesFromCreatorResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Query/ClassesFromCreator", in, out, opts...) if err != nil { return nil, err } @@ -604,10 +400,8 @@ func (c *queryClient) ClassIdsByOwner(ctx context.Context, in *QueryClassIdsByOw // QueryServer is the server API for Query service. type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - ClassAttributes(context.Context, *QueryClassAttributesRequest) (*QueryClassAttributesResponse, error) - NFTMinter(context.Context, *QueryNFTMinterRequest) (*QueryNFTMinterResponse, error) - ClassIdsByName(context.Context, *QueryClassIdsByNameRequest) (*QueryClassIdsByNameResponse, error) - ClassIdsByOwner(context.Context, *QueryClassIdsByOwnerRequest) (*QueryClassIdsByOwnerResponse, error) + ClassAuthorityMetadata(context.Context, *QueryClassAuthorityMetadataRequest) (*QueryClassAuthorityMetadataResponse, error) + ClassesFromCreator(context.Context, *QueryClassesFromCreatorRequest) (*QueryClassesFromCreatorResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -617,17 +411,11 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) ClassAttributes(ctx context.Context, req *QueryClassAttributesRequest) (*QueryClassAttributesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClassAttributes not implemented") +func (*UnimplementedQueryServer) ClassAuthorityMetadata(ctx context.Context, req *QueryClassAuthorityMetadataRequest) (*QueryClassAuthorityMetadataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassAuthorityMetadata not implemented") } -func (*UnimplementedQueryServer) NFTMinter(ctx context.Context, req *QueryNFTMinterRequest) (*QueryNFTMinterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NFTMinter not implemented") -} -func (*UnimplementedQueryServer) ClassIdsByName(ctx context.Context, req *QueryClassIdsByNameRequest) (*QueryClassIdsByNameResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClassIdsByName not implemented") -} -func (*UnimplementedQueryServer) ClassIdsByOwner(ctx context.Context, req *QueryClassIdsByOwnerRequest) (*QueryClassIdsByOwnerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClassIdsByOwner not implemented") +func (*UnimplementedQueryServer) ClassesFromCreator(ctx context.Context, req *QueryClassesFromCreatorRequest) (*QueryClassesFromCreatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassesFromCreator not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -652,74 +440,38 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_ClassAttributes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClassAttributesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ClassAttributes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftfactory.Query/ClassAttributes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClassAttributes(ctx, req.(*QueryClassAttributesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_NFTMinter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNFTMinterRequest) +func _Query_ClassAuthorityMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassAuthorityMetadataRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).NFTMinter(ctx, in) + return srv.(QueryServer).ClassAuthorityMetadata(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Query/NFTMinter", + FullMethod: "/ununifi.nftfactory.Query/ClassAuthorityMetadata", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NFTMinter(ctx, req.(*QueryNFTMinterRequest)) + return srv.(QueryServer).ClassAuthorityMetadata(ctx, req.(*QueryClassAuthorityMetadataRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ClassIdsByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClassIdsByNameRequest) +func _Query_ClassesFromCreator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassesFromCreatorRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ClassIdsByName(ctx, in) + return srv.(QueryServer).ClassesFromCreator(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Query/ClassIdsByName", + FullMethod: "/ununifi.nftfactory.Query/ClassesFromCreator", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClassIdsByName(ctx, req.(*QueryClassIdsByNameRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ClassIdsByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryClassIdsByOwnerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ClassIdsByOwner(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ununifi.nftfactory.Query/ClassIdsByOwner", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ClassIdsByOwner(ctx, req.(*QueryClassIdsByOwnerRequest)) + return srv.(QueryServer).ClassesFromCreator(ctx, req.(*QueryClassesFromCreatorRequest)) } return interceptor(ctx, in, info, handler) } @@ -733,20 +485,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Params_Handler, }, { - MethodName: "ClassAttributes", - Handler: _Query_ClassAttributes_Handler, + MethodName: "ClassAuthorityMetadata", + Handler: _Query_ClassAuthorityMetadata_Handler, }, { - MethodName: "NFTMinter", - Handler: _Query_NFTMinter_Handler, - }, - { - MethodName: "ClassIdsByName", - Handler: _Query_ClassIdsByName_Handler, - }, - { - MethodName: "ClassIdsByOwner", - Handler: _Query_ClassIdsByOwner_Handler, + MethodName: "ClassesFromCreator", + Handler: _Query_ClassesFromCreator_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -809,72 +553,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryClassAttributesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryClassAttributesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassAttributesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClassAttributesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryClassAttributesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassAttributesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClassAttributes != nil { - { - size, err := m.ClassAttributes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryNFTMinterRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryClassAuthorityMetadataRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -884,34 +563,34 @@ func (m *QueryNFTMinterRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNFTMinterRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNFTMinterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + if len(m.Subclass) > 0 { + i -= len(m.Subclass) + copy(dAtA[i:], m.Subclass) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subclass))) i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryNFTMinterResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryClassAuthorityMetadataResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -921,92 +600,30 @@ func (m *QueryNFTMinterResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNFTMinterResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNFTMinterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassAuthorityMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Minter) > 0 { - i -= len(m.Minter) - copy(dAtA[i:], m.Minter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Minter))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClassIdsByNameRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryClassIdsByNameRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassIdsByNameRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClassName) > 0 { - i -= len(m.ClassName) - copy(dAtA[i:], m.ClassName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryClassIdsByNameResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryClassIdsByNameResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryClassIdsByNameResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ClassNameIdList != nil { - { - size, err := m.ClassNameIdList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.AuthorityMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryClassIdsByOwnerRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryClassesFromCreatorRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1016,27 +633,27 @@ func (m *QueryClassIdsByOwnerRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClassIdsByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClassIdsByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryClassIdsByOwnerResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryClassesFromCreatorResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1046,27 +663,24 @@ func (m *QueryClassIdsByOwnerResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryClassIdsByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryClassIdsByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryClassesFromCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.OwningClassIdList != nil { - { - size, err := m.OwningClassIdList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.Classes) > 0 { + for iNdEx := len(m.Classes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Classes[iNdEx]) + copy(dAtA[i:], m.Classes[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Classes[iNdEx]))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1101,255 +715,70 @@ func (m *QueryParamsResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) return n } - -func (m *QueryClassAttributesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassAttributesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClassAttributes != nil { - l = m.ClassAttributes.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNFTMinterRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNFTMinterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Minter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByNameRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByNameResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClassNameIdList != nil { - l = m.ClassNameIdList.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByOwnerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryClassIdsByOwnerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OwningClassIdList != nil { - l = m.OwningClassIdList.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + +func (m *QueryClassAuthorityMetadataRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } + l = len(m.Subclass) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryClassAuthorityMetadataResponse) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = m.AuthorityMetadata.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryClassesFromCreatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryClassesFromCreatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Classes) > 0 { + for _, s := range m.Classes { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryClassAttributesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1372,44 +801,12 @@ func (m *QueryClassAttributesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassAttributesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassAttributesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -1431,7 +828,7 @@ func (m *QueryClassAttributesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1454,15 +851,15 @@ func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassAttributesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassAttributesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassAttributes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1489,10 +886,7 @@ func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClassAttributes == nil { - m.ClassAttributes = &ClassAttributes{} - } - if err := m.ClassAttributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1517,7 +911,7 @@ func (m *QueryClassAttributesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryNFTMinterRequest) Unmarshal(dAtA []byte) error { +func (m *QueryClassAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1540,15 +934,15 @@ func (m *QueryNFTMinterRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryNFTMinterRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassAuthorityMetadataRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTMinterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassAuthorityMetadataRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1576,175 +970,11 @@ func (m *QueryNFTMinterRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNFTMinterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryNFTMinterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTMinterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Minter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryClassIdsByNameRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByNameRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByNameRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subclass", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1772,7 +1002,7 @@ func (m *QueryClassIdsByNameRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassName = string(dAtA[iNdEx:postIndex]) + m.Subclass = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1795,7 +1025,7 @@ func (m *QueryClassIdsByNameRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { +func (m *QueryClassAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1818,15 +1048,15 @@ func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByNameResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassAuthorityMetadataResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByNameResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassNameIdList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1853,10 +1083,7 @@ func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClassNameIdList == nil { - m.ClassNameIdList = &ClassNameIdList{} - } - if err := m.ClassNameIdList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1881,7 +1108,7 @@ func (m *QueryClassIdsByNameResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { +func (m *QueryClassesFromCreatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1904,15 +1131,15 @@ func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByOwnerRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassesFromCreatorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassesFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1940,7 +1167,7 @@ func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1963,7 +1190,7 @@ func (m *QueryClassIdsByOwnerRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryClassIdsByOwnerResponse) Unmarshal(dAtA []byte) error { +func (m *QueryClassesFromCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1986,17 +1213,17 @@ func (m *QueryClassIdsByOwnerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryClassIdsByOwnerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryClassesFromCreatorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryClassIdsByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryClassesFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwningClassIdList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Classes", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2006,27 +1233,23 @@ func (m *QueryClassIdsByOwnerResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.OwningClassIdList == nil { - m.OwningClassIdList = &OwningClassIdList{} - } - if err := m.OwningClassIdList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Classes = append(m.Classes, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/nftfactory/types/query.pb.gw.go b/x/nftfactory/types/query.pb.gw.go index 0e0dfcd2a..07254967e 100644 --- a/x/nftfactory/types/query.pb.gw.go +++ b/x/nftfactory/types/query.pb.gw.go @@ -51,8 +51,8 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_ClassAttributes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassAttributesRequest +func request_Query_ClassAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassAuthorityMetadataRequest var metadata runtime.ServerMetadata var ( @@ -62,89 +62,35 @@ func request_Query_ClassAttributes_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.ClassId, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.ClassAttributes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClassAttributes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassAttributesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - msg, err := server.ClassAttributes(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_NFTMinter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNFTMinterRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] + val, ok = pathParams["subclass"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subclass") } - protoReq.NftId, err = runtime.String(val) + protoReq.Subclass, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subclass", err) } - msg, err := client.NFTMinter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ClassAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_NFTMinter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryNFTMinterRequest +func local_request_Query_ClassAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassAuthorityMetadataRequest var metadata runtime.ServerMetadata var ( @@ -154,89 +100,35 @@ func local_request_Query_NFTMinter_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.ClassId, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.NFTMinter(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ClassIdsByName_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByNameRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_name") - } - - protoReq.ClassName, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_name", err) - } - - msg, err := client.ClassIdsByName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ClassIdsByName_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByNameRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_name"] + val, ok = pathParams["subclass"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subclass") } - protoReq.ClassName, err = runtime.String(val) + protoReq.Subclass, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subclass", err) } - msg, err := server.ClassIdsByName(ctx, &protoReq) + msg, err := server.ClassAuthorityMetadata(ctx, &protoReq) return msg, metadata, err } -func request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByOwnerRequest +func request_Query_ClassesFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassesFromCreatorRequest var metadata runtime.ServerMetadata var ( @@ -246,24 +138,24 @@ func request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["owner"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Owner, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.ClassIdsByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ClassesFromCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryClassIdsByOwnerRequest +func local_request_Query_ClassesFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassesFromCreatorRequest var metadata runtime.ServerMetadata var ( @@ -273,18 +165,18 @@ func local_request_Query_ClassIdsByOwner_0(ctx context.Context, marshaler runtim _ = err ) - val, ok = pathParams["owner"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Owner, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := server.ClassIdsByOwner(ctx, &protoReq) + msg, err := server.ClassesFromCreator(ctx, &protoReq) return msg, metadata, err } @@ -318,30 +210,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ClassAttributes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ClassAttributes_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassAttributes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NFTMinter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -352,7 +221,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_NFTMinter_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ClassAuthorityMetadata_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -360,11 +229,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NFTMinter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClassIdsByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassesFromCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -375,7 +244,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ClassIdsByName_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ClassesFromCreator_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -383,30 +252,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ClassIdsByName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClassIdsByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ClassIdsByOwner_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassIdsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassesFromCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -471,27 +317,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ClassAttributes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ClassAttributes_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassAttributes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_NFTMinter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -500,18 +326,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_NFTMinter_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ClassAuthorityMetadata_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_NFTMinter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ClassIdsByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ClassesFromCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -520,34 +346,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ClassIdsByName_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ClassesFromCreator_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ClassIdsByName_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ClassIdsByOwner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ClassIdsByOwner_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ClassIdsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ClassesFromCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -557,23 +363,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"ununifi", "nftfactory", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ClassAttributes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "class_owner", "class_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ClassAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ununifi", "nftfactory", "class", "factory", "creator", "subclass", "authority-metadata"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NFTMinter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"ununifi", "nftfactory", "nft_minter", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ClassIdsByName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "class_ids_by_name", "class_name"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ClassIdsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "class_ids_by_owner", "owner"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ClassesFromCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"ununifi", "nftfactory", "classes-from-creator", "creator"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_ClassAttributes_0 = runtime.ForwardResponseMessage - - forward_Query_NFTMinter_0 = runtime.ForwardResponseMessage - - forward_Query_ClassIdsByName_0 = runtime.ForwardResponseMessage + forward_Query_ClassAuthorityMetadata_0 = runtime.ForwardResponseMessage - forward_Query_ClassIdsByOwner_0 = runtime.ForwardResponseMessage + forward_Query_ClassesFromCreator_0 = runtime.ForwardResponseMessage ) diff --git a/x/nftfactory/types/tx.pb.go b/x/nftfactory/types/tx.pb.go index cb16420cb..adbda36f7 100644 --- a/x/nftfactory/types/tx.pb.go +++ b/x/nftfactory/types/tx.pb.go @@ -6,6 +6,8 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -29,14 +31,13 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreateClass struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` - TokenSupplyCap uint64 `protobuf:"varint,4,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` - MintingPermission MintingPermission `protobuf:"varint,5,opt,name=minting_permission,json=mintingPermission,proto3,enum=ununifi.nftfactory.MintingPermission" json:"minting_permission,omitempty"` - Symbol string `protobuf:"bytes,7,opt,name=symbol,proto3" json:"symbol,omitempty"` - Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` - ClassUri string `protobuf:"bytes,9,opt,name=class_uri,json=classUri,proto3" json:"class_uri,omitempty"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Subclass string `protobuf:"bytes,2,opt,name=subclass,proto3" json:"subclass,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` } func (m *MsgCreateClass) Reset() { *m = MsgCreateClass{} } @@ -79,34 +80,20 @@ func (m *MsgCreateClass) GetSender() string { return "" } -func (m *MsgCreateClass) GetName() string { +func (m *MsgCreateClass) GetSubclass() string { if m != nil { - return m.Name + return m.Subclass } return "" } -func (m *MsgCreateClass) GetBaseTokenUri() string { +func (m *MsgCreateClass) GetName() string { if m != nil { - return m.BaseTokenUri + return m.Name } return "" } -func (m *MsgCreateClass) GetTokenSupplyCap() uint64 { - if m != nil { - return m.TokenSupplyCap - } - return 0 -} - -func (m *MsgCreateClass) GetMintingPermission() MintingPermission { - if m != nil { - return m.MintingPermission - } - return MintingPermission_OnlyOwner -} - func (m *MsgCreateClass) GetSymbol() string { if m != nil { return m.Symbol @@ -121,9 +108,16 @@ func (m *MsgCreateClass) GetDescription() string { return "" } -func (m *MsgCreateClass) GetClassUri() string { +func (m *MsgCreateClass) GetUri() string { + if m != nil { + return m.Uri + } + return "" +} + +func (m *MsgCreateClass) GetUriHash() string { if m != nil { - return m.ClassUri + return m.UriHash } return "" } @@ -164,24 +158,28 @@ func (m *MsgCreateClassResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateClassResponse proto.InternalMessageInfo -type MsgSendClassOwnership struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` +type MsgUpdateClass struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Uri string `protobuf:"bytes,6,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,7,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` } -func (m *MsgSendClassOwnership) Reset() { *m = MsgSendClassOwnership{} } -func (m *MsgSendClassOwnership) String() string { return proto.CompactTextString(m) } -func (*MsgSendClassOwnership) ProtoMessage() {} -func (*MsgSendClassOwnership) Descriptor() ([]byte, []int) { +func (m *MsgUpdateClass) Reset() { *m = MsgUpdateClass{} } +func (m *MsgUpdateClass) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateClass) ProtoMessage() {} +func (*MsgUpdateClass) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{2} } -func (m *MsgSendClassOwnership) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateClass) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSendClassOwnership.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateClass.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -191,54 +189,82 @@ func (m *MsgSendClassOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgSendClassOwnership) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendClassOwnership.Merge(m, src) +func (m *MsgUpdateClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateClass.Merge(m, src) } -func (m *MsgSendClassOwnership) XXX_Size() int { +func (m *MsgUpdateClass) XXX_Size() int { return m.Size() } -func (m *MsgSendClassOwnership) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendClassOwnership.DiscardUnknown(m) +func (m *MsgUpdateClass) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateClass.DiscardUnknown(m) } -var xxx_messageInfo_MsgSendClassOwnership proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateClass proto.InternalMessageInfo -func (m *MsgSendClassOwnership) GetSender() string { +func (m *MsgUpdateClass) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgSendClassOwnership) GetClassId() string { +func (m *MsgUpdateClass) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *MsgSendClassOwnership) GetRecipient() string { +func (m *MsgUpdateClass) GetName() string { if m != nil { - return m.Recipient + return m.Name + } + return "" +} + +func (m *MsgUpdateClass) GetSymbol() string { + if m != nil { + return m.Symbol + } + return "" +} + +func (m *MsgUpdateClass) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MsgUpdateClass) GetUri() string { + if m != nil { + return m.Uri + } + return "" +} + +func (m *MsgUpdateClass) GetUriHash() string { + if m != nil { + return m.UriHash } return "" } -type MsgSendClassOwnershipResponse struct { +type MsgUpdateClassResponse struct { } -func (m *MsgSendClassOwnershipResponse) Reset() { *m = MsgSendClassOwnershipResponse{} } -func (m *MsgSendClassOwnershipResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSendClassOwnershipResponse) ProtoMessage() {} -func (*MsgSendClassOwnershipResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateClassResponse) Reset() { *m = MsgUpdateClassResponse{} } +func (m *MsgUpdateClassResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateClassResponse) ProtoMessage() {} +func (*MsgUpdateClassResponse) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{3} } -func (m *MsgSendClassOwnershipResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateClassResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSendClassOwnershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateClassResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSendClassOwnershipResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateClassResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -248,36 +274,39 @@ func (m *MsgSendClassOwnershipResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgSendClassOwnershipResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendClassOwnershipResponse.Merge(m, src) +func (m *MsgUpdateClassResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateClassResponse.Merge(m, src) } -func (m *MsgSendClassOwnershipResponse) XXX_Size() int { +func (m *MsgUpdateClassResponse) XXX_Size() int { return m.Size() } -func (m *MsgSendClassOwnershipResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendClassOwnershipResponse.DiscardUnknown(m) +func (m *MsgUpdateClassResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateClassResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgSendClassOwnershipResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateClassResponse proto.InternalMessageInfo -type MsgUpdateBaseTokenUri struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - BaseTokenUri string `protobuf:"bytes,3,opt,name=base_token_uri,json=baseTokenUri,proto3" json:"base_token_uri,omitempty"` +type MsgMintNFT struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` + Uri string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,5,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + Recipient string `protobuf:"bytes,6,opt,name=recipient,proto3" json:"recipient,omitempty"` } -func (m *MsgUpdateBaseTokenUri) Reset() { *m = MsgUpdateBaseTokenUri{} } -func (m *MsgUpdateBaseTokenUri) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateBaseTokenUri) ProtoMessage() {} -func (*MsgUpdateBaseTokenUri) Descriptor() ([]byte, []int) { +func (m *MsgMintNFT) Reset() { *m = MsgMintNFT{} } +func (m *MsgMintNFT) String() string { return proto.CompactTextString(m) } +func (*MsgMintNFT) ProtoMessage() {} +func (*MsgMintNFT) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{4} } -func (m *MsgUpdateBaseTokenUri) XXX_Unmarshal(b []byte) error { +func (m *MsgMintNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateBaseTokenUri.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgMintNFT.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -287,54 +316,75 @@ func (m *MsgUpdateBaseTokenUri) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgUpdateBaseTokenUri) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateBaseTokenUri.Merge(m, src) +func (m *MsgMintNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintNFT.Merge(m, src) } -func (m *MsgUpdateBaseTokenUri) XXX_Size() int { +func (m *MsgMintNFT) XXX_Size() int { return m.Size() } -func (m *MsgUpdateBaseTokenUri) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateBaseTokenUri.DiscardUnknown(m) +func (m *MsgMintNFT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintNFT.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateBaseTokenUri proto.InternalMessageInfo +var xxx_messageInfo_MsgMintNFT proto.InternalMessageInfo -func (m *MsgUpdateBaseTokenUri) GetSender() string { +func (m *MsgMintNFT) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgUpdateBaseTokenUri) GetClassId() string { +func (m *MsgMintNFT) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *MsgUpdateBaseTokenUri) GetBaseTokenUri() string { +func (m *MsgMintNFT) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +func (m *MsgMintNFT) GetUri() string { + if m != nil { + return m.Uri + } + return "" +} + +func (m *MsgMintNFT) GetUriHash() string { + if m != nil { + return m.UriHash + } + return "" +} + +func (m *MsgMintNFT) GetRecipient() string { if m != nil { - return m.BaseTokenUri + return m.Recipient } return "" } -type MsgUpdateBaseTokenUriResponse struct { +type MsgMintNFTResponse struct { } -func (m *MsgUpdateBaseTokenUriResponse) Reset() { *m = MsgUpdateBaseTokenUriResponse{} } -func (m *MsgUpdateBaseTokenUriResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateBaseTokenUriResponse) ProtoMessage() {} -func (*MsgUpdateBaseTokenUriResponse) Descriptor() ([]byte, []int) { +func (m *MsgMintNFTResponse) Reset() { *m = MsgMintNFTResponse{} } +func (m *MsgMintNFTResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintNFTResponse) ProtoMessage() {} +func (*MsgMintNFTResponse) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{5} } -func (m *MsgUpdateBaseTokenUriResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgMintNFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateBaseTokenUriResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgMintNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateBaseTokenUriResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgMintNFTResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -344,36 +394,36 @@ func (m *MsgUpdateBaseTokenUriResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *MsgUpdateBaseTokenUriResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateBaseTokenUriResponse.Merge(m, src) +func (m *MsgMintNFTResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintNFTResponse.Merge(m, src) } -func (m *MsgUpdateBaseTokenUriResponse) XXX_Size() int { +func (m *MsgMintNFTResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateBaseTokenUriResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateBaseTokenUriResponse.DiscardUnknown(m) +func (m *MsgMintNFTResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintNFTResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateBaseTokenUriResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgMintNFTResponse proto.InternalMessageInfo -type MsgUpdateTokenSupplyCap struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - TokenSupplyCap uint64 `protobuf:"varint,3,opt,name=token_supply_cap,json=tokenSupplyCap,proto3" json:"token_supply_cap,omitempty"` +type MsgBurnNFT struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` } -func (m *MsgUpdateTokenSupplyCap) Reset() { *m = MsgUpdateTokenSupplyCap{} } -func (m *MsgUpdateTokenSupplyCap) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateTokenSupplyCap) ProtoMessage() {} -func (*MsgUpdateTokenSupplyCap) Descriptor() ([]byte, []int) { +func (m *MsgBurnNFT) Reset() { *m = MsgBurnNFT{} } +func (m *MsgBurnNFT) String() string { return proto.CompactTextString(m) } +func (*MsgBurnNFT) ProtoMessage() {} +func (*MsgBurnNFT) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{6} } -func (m *MsgUpdateTokenSupplyCap) XXX_Unmarshal(b []byte) error { +func (m *MsgBurnNFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateTokenSupplyCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateTokenSupplyCap.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgBurnNFT.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -383,54 +433,54 @@ func (m *MsgUpdateTokenSupplyCap) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *MsgUpdateTokenSupplyCap) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateTokenSupplyCap.Merge(m, src) +func (m *MsgBurnNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnNFT.Merge(m, src) } -func (m *MsgUpdateTokenSupplyCap) XXX_Size() int { +func (m *MsgBurnNFT) XXX_Size() int { return m.Size() } -func (m *MsgUpdateTokenSupplyCap) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateTokenSupplyCap.DiscardUnknown(m) +func (m *MsgBurnNFT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnNFT.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateTokenSupplyCap proto.InternalMessageInfo +var xxx_messageInfo_MsgBurnNFT proto.InternalMessageInfo -func (m *MsgUpdateTokenSupplyCap) GetSender() string { +func (m *MsgBurnNFT) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgUpdateTokenSupplyCap) GetClassId() string { +func (m *MsgBurnNFT) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *MsgUpdateTokenSupplyCap) GetTokenSupplyCap() uint64 { +func (m *MsgBurnNFT) GetTokenId() string { if m != nil { - return m.TokenSupplyCap + return m.TokenId } - return 0 + return "" } -type MsgUpdateTokenSupplyCapResponse struct { +type MsgBurnNFTResponse struct { } -func (m *MsgUpdateTokenSupplyCapResponse) Reset() { *m = MsgUpdateTokenSupplyCapResponse{} } -func (m *MsgUpdateTokenSupplyCapResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateTokenSupplyCapResponse) ProtoMessage() {} -func (*MsgUpdateTokenSupplyCapResponse) Descriptor() ([]byte, []int) { +func (m *MsgBurnNFTResponse) Reset() { *m = MsgBurnNFTResponse{} } +func (m *MsgBurnNFTResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBurnNFTResponse) ProtoMessage() {} +func (*MsgBurnNFTResponse) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{7} } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgBurnNFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgBurnNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateTokenSupplyCapResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgBurnNFTResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -440,37 +490,38 @@ func (m *MsgUpdateTokenSupplyCapResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateTokenSupplyCapResponse.Merge(m, src) +func (m *MsgBurnNFTResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnNFTResponse.Merge(m, src) } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_Size() int { +func (m *MsgBurnNFTResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateTokenSupplyCapResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateTokenSupplyCapResponse.DiscardUnknown(m) +func (m *MsgBurnNFTResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnNFTResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateTokenSupplyCapResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgBurnNFTResponse proto.InternalMessageInfo -type MsgMintNFT struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` +// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign +// adminship of a class to a new account +type MsgChangeAdmin struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty" yaml:"class_id"` + NewAdmin string `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty" yaml:"new_admin"` } -func (m *MsgMintNFT) Reset() { *m = MsgMintNFT{} } -func (m *MsgMintNFT) String() string { return proto.CompactTextString(m) } -func (*MsgMintNFT) ProtoMessage() {} -func (*MsgMintNFT) Descriptor() ([]byte, []int) { +func (m *MsgChangeAdmin) Reset() { *m = MsgChangeAdmin{} } +func (m *MsgChangeAdmin) String() string { return proto.CompactTextString(m) } +func (*MsgChangeAdmin) ProtoMessage() {} +func (*MsgChangeAdmin) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{8} } -func (m *MsgMintNFT) XXX_Unmarshal(b []byte) error { +func (m *MsgChangeAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgMintNFT.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgChangeAdmin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -480,61 +531,54 @@ func (m *MsgMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *MsgMintNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNFT.Merge(m, src) +func (m *MsgChangeAdmin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChangeAdmin.Merge(m, src) } -func (m *MsgMintNFT) XXX_Size() int { +func (m *MsgChangeAdmin) XXX_Size() int { return m.Size() } -func (m *MsgMintNFT) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNFT.DiscardUnknown(m) +func (m *MsgChangeAdmin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChangeAdmin.DiscardUnknown(m) } -var xxx_messageInfo_MsgMintNFT proto.InternalMessageInfo +var xxx_messageInfo_MsgChangeAdmin proto.InternalMessageInfo -func (m *MsgMintNFT) GetSender() string { +func (m *MsgChangeAdmin) GetSender() string { if m != nil { return m.Sender } return "" } -func (m *MsgMintNFT) GetClassId() string { +func (m *MsgChangeAdmin) GetClassId() string { if m != nil { return m.ClassId } return "" } -func (m *MsgMintNFT) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *MsgMintNFT) GetRecipient() string { +func (m *MsgChangeAdmin) GetNewAdmin() string { if m != nil { - return m.Recipient + return m.NewAdmin } return "" } -type MsgMintNFTResponse struct { +type MsgChangeAdminResponse struct { } -func (m *MsgMintNFTResponse) Reset() { *m = MsgMintNFTResponse{} } -func (m *MsgMintNFTResponse) String() string { return proto.CompactTextString(m) } -func (*MsgMintNFTResponse) ProtoMessage() {} -func (*MsgMintNFTResponse) Descriptor() ([]byte, []int) { +func (m *MsgChangeAdminResponse) Reset() { *m = MsgChangeAdminResponse{} } +func (m *MsgChangeAdminResponse) String() string { return proto.CompactTextString(m) } +func (*MsgChangeAdminResponse) ProtoMessage() {} +func (*MsgChangeAdminResponse) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{9} } -func (m *MsgMintNFTResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgChangeAdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgMintNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgChangeAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgMintNFTResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgChangeAdminResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -544,36 +588,35 @@ func (m *MsgMintNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgMintNFTResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNFTResponse.Merge(m, src) +func (m *MsgChangeAdminResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChangeAdminResponse.Merge(m, src) } -func (m *MsgMintNFTResponse) XXX_Size() int { +func (m *MsgChangeAdminResponse) XXX_Size() int { return m.Size() } -func (m *MsgMintNFTResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNFTResponse.DiscardUnknown(m) +func (m *MsgChangeAdminResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChangeAdminResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgMintNFTResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgChangeAdminResponse proto.InternalMessageInfo -type MsgBurnNFT struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +type MsgUpdateParams struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } -func (m *MsgBurnNFT) Reset() { *m = MsgBurnNFT{} } -func (m *MsgBurnNFT) String() string { return proto.CompactTextString(m) } -func (*MsgBurnNFT) ProtoMessage() {} -func (*MsgBurnNFT) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{10} } -func (m *MsgBurnNFT) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgBurnNFT.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -583,54 +626,33 @@ func (m *MsgBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *MsgBurnNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurnNFT.Merge(m, src) +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) } -func (m *MsgBurnNFT) XXX_Size() int { +func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } -func (m *MsgBurnNFT) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurnNFT.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBurnNFT proto.InternalMessageInfo - -func (m *MsgBurnNFT) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgBurnNFT) GetClassId() string { - if m != nil { - return m.ClassId - } - return "" +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } -func (m *MsgBurnNFT) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo -type MsgBurnNFTResponse struct { +type MsgUpdateParamsResponse struct { } -func (m *MsgBurnNFTResponse) Reset() { *m = MsgBurnNFTResponse{} } -func (m *MsgBurnNFTResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBurnNFTResponse) ProtoMessage() {} -func (*MsgBurnNFTResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_47805922275bdc64, []int{11} } -func (m *MsgBurnNFTResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgBurnNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgBurnNFTResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -640,76 +662,81 @@ func (m *MsgBurnNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgBurnNFTResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurnNFTResponse.Merge(m, src) +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } -func (m *MsgBurnNFTResponse) XXX_Size() int { +func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } -func (m *MsgBurnNFTResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurnNFTResponse.DiscardUnknown(m) +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgBurnNFTResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgCreateClass)(nil), "ununifi.nftfactory.MsgCreateClass") proto.RegisterType((*MsgCreateClassResponse)(nil), "ununifi.nftfactory.MsgCreateClassResponse") - proto.RegisterType((*MsgSendClassOwnership)(nil), "ununifi.nftfactory.MsgSendClassOwnership") - proto.RegisterType((*MsgSendClassOwnershipResponse)(nil), "ununifi.nftfactory.MsgSendClassOwnershipResponse") - proto.RegisterType((*MsgUpdateBaseTokenUri)(nil), "ununifi.nftfactory.MsgUpdateBaseTokenUri") - proto.RegisterType((*MsgUpdateBaseTokenUriResponse)(nil), "ununifi.nftfactory.MsgUpdateBaseTokenUriResponse") - proto.RegisterType((*MsgUpdateTokenSupplyCap)(nil), "ununifi.nftfactory.MsgUpdateTokenSupplyCap") - proto.RegisterType((*MsgUpdateTokenSupplyCapResponse)(nil), "ununifi.nftfactory.MsgUpdateTokenSupplyCapResponse") + proto.RegisterType((*MsgUpdateClass)(nil), "ununifi.nftfactory.MsgUpdateClass") + proto.RegisterType((*MsgUpdateClassResponse)(nil), "ununifi.nftfactory.MsgUpdateClassResponse") proto.RegisterType((*MsgMintNFT)(nil), "ununifi.nftfactory.MsgMintNFT") proto.RegisterType((*MsgMintNFTResponse)(nil), "ununifi.nftfactory.MsgMintNFTResponse") proto.RegisterType((*MsgBurnNFT)(nil), "ununifi.nftfactory.MsgBurnNFT") proto.RegisterType((*MsgBurnNFTResponse)(nil), "ununifi.nftfactory.MsgBurnNFTResponse") + proto.RegisterType((*MsgChangeAdmin)(nil), "ununifi.nftfactory.MsgChangeAdmin") + proto.RegisterType((*MsgChangeAdminResponse)(nil), "ununifi.nftfactory.MsgChangeAdminResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "ununifi.nftfactory.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ununifi.nftfactory.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("ununifi/nftfactory/tx.proto", fileDescriptor_47805922275bdc64) } var fileDescriptor_47805922275bdc64 = []byte{ - // 616 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xad, 0xdb, 0xf4, 0x27, 0xb7, 0x9f, 0xa2, 0x8f, 0x51, 0x5b, 0x8c, 0x0b, 0x6e, 0x30, 0x3f, - 0x0a, 0x54, 0x8a, 0x45, 0xfb, 0x06, 0xad, 0xa8, 0xc4, 0x22, 0xfc, 0xa4, 0x09, 0x0b, 0x24, 0x14, - 0x39, 0xf6, 0xc4, 0x19, 0x51, 0x8f, 0x47, 0x33, 0x63, 0x48, 0xde, 0x82, 0xd7, 0xe1, 0x0d, 0x58, - 0x76, 0xc9, 0x12, 0x25, 0x5b, 0x1e, 0x02, 0x79, 0xec, 0x38, 0x7f, 0x76, 0x29, 0x11, 0x3b, 0xcf, - 0x3d, 0x27, 0xf7, 0x9c, 0xb9, 0xf7, 0x38, 0x86, 0xc3, 0x88, 0x46, 0x94, 0xf4, 0x88, 0x4d, 0x7b, - 0xb2, 0xe7, 0xb8, 0x32, 0xe4, 0x43, 0x5b, 0x0e, 0xea, 0x8c, 0x87, 0x32, 0x44, 0x28, 0x05, 0xeb, - 0x53, 0xd0, 0xd8, 0xf3, 0x43, 0x3f, 0x54, 0xb0, 0x1d, 0x3f, 0x25, 0x4c, 0xe3, 0x51, 0x4e, 0x9b, - 0xe9, 0x63, 0x42, 0xb2, 0xbe, 0xad, 0x43, 0xa5, 0x21, 0xfc, 0x73, 0x8e, 0x1d, 0x89, 0xcf, 0xaf, - 0x1c, 0x21, 0xd0, 0x01, 0x6c, 0x09, 0x4c, 0x3d, 0xcc, 0x75, 0xad, 0xaa, 0xd5, 0xca, 0xcd, 0xf4, - 0x84, 0x10, 0x94, 0xa8, 0x13, 0x60, 0x7d, 0x5d, 0x55, 0xd5, 0x33, 0x7a, 0x0c, 0x95, 0xae, 0x23, - 0x70, 0x47, 0x86, 0x9f, 0x30, 0xed, 0x44, 0x9c, 0xe8, 0x1b, 0x0a, 0xfd, 0x2f, 0xae, 0xb6, 0xe2, - 0x62, 0x9b, 0x13, 0x54, 0x83, 0xff, 0x13, 0x82, 0x88, 0x18, 0xbb, 0x1a, 0x76, 0x5c, 0x87, 0xe9, - 0xa5, 0xaa, 0x56, 0x2b, 0x35, 0x2b, 0xaa, 0x7e, 0xa9, 0xca, 0xe7, 0x0e, 0x43, 0x2d, 0x40, 0x01, - 0xa1, 0x92, 0x50, 0xbf, 0xc3, 0x30, 0x0f, 0x88, 0x10, 0x24, 0xa4, 0xfa, 0x66, 0x55, 0xab, 0x55, - 0x4e, 0x9e, 0xd4, 0x97, 0xaf, 0x5e, 0x6f, 0x24, 0xec, 0xb7, 0x19, 0xb9, 0x79, 0x27, 0x58, 0x2c, - 0xa9, 0x1b, 0x0d, 0x83, 0x6e, 0x78, 0xa5, 0x6f, 0xa7, 0x37, 0x52, 0x27, 0x54, 0x85, 0x5d, 0x0f, - 0x0b, 0x97, 0x13, 0x26, 0x63, 0x99, 0x1d, 0x05, 0xce, 0x96, 0xd0, 0x21, 0x94, 0xdd, 0x78, 0x28, - 0xea, 0x6a, 0x65, 0x85, 0xef, 0xa8, 0x42, 0x9b, 0x13, 0x4b, 0x87, 0x83, 0xf9, 0xd1, 0x35, 0xb1, - 0x60, 0x21, 0x15, 0xd8, 0xea, 0xc3, 0x7e, 0x43, 0xf8, 0x97, 0x98, 0x7a, 0xaa, 0xfe, 0xe6, 0x0b, - 0xc5, 0x5c, 0xf4, 0x09, 0x2b, 0x9c, 0xed, 0x3d, 0x48, 0xda, 0x76, 0x88, 0x97, 0xce, 0x77, 0x5b, - 0x9d, 0x5f, 0x79, 0xe8, 0x3e, 0x94, 0x39, 0x76, 0x09, 0x23, 0x98, 0xca, 0x74, 0xba, 0xd3, 0x82, - 0x75, 0x04, 0x0f, 0x72, 0x95, 0x32, 0x2b, 0x4c, 0x59, 0x69, 0x33, 0xcf, 0x91, 0xf8, 0x6c, 0x76, - 0x29, 0x2b, 0x58, 0xb9, 0xd5, 0xb6, 0x53, 0x4b, 0xcb, 0x8a, 0x99, 0xa5, 0xcf, 0x70, 0x37, 0x23, - 0xb4, 0xe6, 0xf7, 0xbf, 0x82, 0xa9, 0xbc, 0x70, 0x6d, 0xe4, 0x85, 0xcb, 0x7a, 0x08, 0x47, 0x05, - 0xba, 0x99, 0x35, 0x09, 0xd0, 0x10, 0x7e, 0x1c, 0xaa, 0xd7, 0x17, 0xad, 0x55, 0xdc, 0xec, 0xc3, - 0x16, 0xed, 0xc9, 0x18, 0x48, 0x46, 0xb3, 0x49, 0x7b, 0x72, 0x71, 0x89, 0xa5, 0xc5, 0x25, 0xee, - 0x01, 0x9a, 0xaa, 0x66, 0x5e, 0xde, 0x2b, 0x2f, 0x67, 0x11, 0xa7, 0xff, 0xd4, 0x4b, 0xaa, 0x96, - 0xf6, 0x9d, 0xa8, 0x9d, 0xfc, 0x2a, 0xc1, 0x46, 0x43, 0xf8, 0xe8, 0x23, 0xec, 0xce, 0xfe, 0x19, - 0x58, 0xb9, 0x2f, 0xdd, 0x5c, 0xea, 0x8d, 0xe7, 0x7f, 0xe6, 0x4c, 0x64, 0x10, 0x07, 0x94, 0xf3, - 0x5a, 0x3c, 0x2b, 0xe8, 0xb0, 0x4c, 0x35, 0x5e, 0xdc, 0x9a, 0x3a, 0xab, 0x99, 0x93, 0xff, 0x22, - 0xcd, 0x65, 0x6a, 0xa1, 0x66, 0x71, 0xc6, 0xd1, 0x00, 0xf6, 0x72, 0x03, 0x7e, 0x7c, 0x63, 0xab, - 0x79, 0xb2, 0x71, 0xfa, 0x17, 0xe4, 0x4c, 0xf9, 0x1d, 0x6c, 0x4f, 0xf2, 0x6b, 0x16, 0xfc, 0x3e, - 0xc5, 0x8d, 0xa7, 0x37, 0xe3, 0xb3, 0x2d, 0x27, 0x31, 0x2c, 0x6a, 0x99, 0xe2, 0x85, 0x2d, 0x17, - 0xe2, 0x76, 0xf6, 0xf2, 0xfb, 0xc8, 0xd4, 0xae, 0x47, 0xa6, 0xf6, 0x73, 0x64, 0x6a, 0x5f, 0xc7, - 0xe6, 0xda, 0xf5, 0xd8, 0x5c, 0xfb, 0x31, 0x36, 0xd7, 0x3e, 0x1c, 0xfb, 0x44, 0xf6, 0xa3, 0x6e, - 0xdd, 0x0d, 0x03, 0xbb, 0x4d, 0xdb, 0x94, 0x5c, 0x10, 0xdb, 0xed, 0x3b, 0x84, 0xda, 0x83, 0xb9, - 0x0f, 0xe2, 0x90, 0x61, 0xd1, 0xdd, 0x52, 0x5f, 0xb1, 0xd3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x10, 0x8a, 0xf8, 0x28, 0x33, 0x07, 0x00, 0x00, + // 702 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xbf, 0x6f, 0xd3, 0x40, + 0x18, 0x8d, 0x69, 0x9a, 0xa4, 0x57, 0xa0, 0xe5, 0x1a, 0xb5, 0x4e, 0x40, 0x4e, 0xe5, 0x4a, 0x08, + 0x5a, 0x11, 0xd3, 0xb2, 0xa0, 0x6e, 0x4d, 0x45, 0x45, 0x87, 0x20, 0x08, 0x74, 0xa9, 0x84, 0x82, + 0x63, 0x5f, 0x9d, 0x13, 0xf5, 0xd9, 0xf2, 0xd9, 0xb4, 0x59, 0x99, 0x18, 0x11, 0x7f, 0x00, 0xea, + 0xc2, 0xc2, 0xc4, 0xc0, 0x0c, 0x6b, 0xc7, 0x8a, 0x89, 0x29, 0x42, 0xed, 0x00, 0x73, 0xff, 0x02, + 0xe4, 0xbb, 0xf3, 0x8f, 0xa4, 0x71, 0x8b, 0x10, 0x12, 0x53, 0xee, 0xbb, 0xf7, 0xee, 0x7d, 0xef, + 0x9d, 0xbe, 0x8b, 0xc1, 0xf5, 0x80, 0x04, 0x04, 0xef, 0x60, 0x8d, 0xec, 0xf8, 0x3b, 0xba, 0xe1, + 0x3b, 0x5e, 0x4f, 0xf3, 0xf7, 0xeb, 0xae, 0xe7, 0xf8, 0x0e, 0x84, 0x02, 0xac, 0x27, 0x60, 0xb5, + 0x6c, 0x39, 0x96, 0xc3, 0x60, 0x2d, 0x5c, 0x71, 0x66, 0x75, 0xce, 0x70, 0xa8, 0xed, 0x50, 0xcd, + 0xa6, 0x96, 0xf6, 0x6a, 0x39, 0xfc, 0x11, 0x40, 0x85, 0x03, 0x6d, 0x7e, 0x82, 0x17, 0x02, 0x5a, + 0x18, 0xd1, 0x3a, 0x59, 0x72, 0x92, 0xfa, 0x55, 0x02, 0x57, 0x9b, 0xd4, 0x5a, 0xf7, 0x90, 0xee, + 0xa3, 0xf5, 0x5d, 0x9d, 0x52, 0x38, 0x0b, 0x0a, 0x14, 0x11, 0x13, 0x79, 0xb2, 0x34, 0x2f, 0xdd, + 0x9a, 0x68, 0x89, 0x0a, 0x56, 0x41, 0x89, 0x06, 0x1d, 0x23, 0xe4, 0xc8, 0x97, 0x18, 0x12, 0xd7, + 0x10, 0x82, 0x3c, 0xd1, 0x6d, 0x24, 0x8f, 0xb1, 0x7d, 0xb6, 0x66, 0x3a, 0x3d, 0xbb, 0xe3, 0xec, + 0xca, 0x79, 0xa1, 0xc3, 0x2a, 0x38, 0x0f, 0x26, 0x4d, 0x44, 0x0d, 0x0f, 0xbb, 0x3e, 0x76, 0x88, + 0x3c, 0xce, 0xc0, 0xf4, 0x16, 0x9c, 0x06, 0x63, 0x81, 0x87, 0xe5, 0x02, 0x43, 0xc2, 0x25, 0xac, + 0x80, 0x52, 0xe0, 0xe1, 0x76, 0x57, 0xa7, 0x5d, 0xb9, 0xc8, 0xb6, 0x8b, 0x81, 0x87, 0x1f, 0xea, + 0xb4, 0xab, 0xca, 0x60, 0x76, 0x30, 0x40, 0x0b, 0x51, 0xd7, 0x21, 0x14, 0xa9, 0x5f, 0x78, 0xb6, + 0x2d, 0xd7, 0xbc, 0x30, 0x5b, 0x05, 0x94, 0x58, 0x90, 0x36, 0x36, 0x45, 0xb6, 0x22, 0xab, 0x37, + 0xcd, 0xff, 0x1f, 0x2d, 0xe5, 0x3f, 0x8e, 0xf6, 0x41, 0x02, 0xa0, 0x49, 0xad, 0x26, 0x26, 0xfe, + 0xa3, 0x8d, 0x67, 0x7f, 0x13, 0xab, 0x02, 0x4a, 0xbe, 0xf3, 0x12, 0x91, 0x10, 0xe2, 0xd1, 0x8a, + 0xac, 0xde, 0x34, 0x23, 0x8f, 0xf9, 0xd1, 0x1e, 0xc7, 0x07, 0x3c, 0xc2, 0x1b, 0x60, 0xc2, 0x43, + 0x06, 0x76, 0x31, 0x22, 0xbe, 0x88, 0x95, 0x6c, 0xa8, 0x65, 0x00, 0x13, 0x9b, 0xb1, 0xfb, 0x6d, + 0x66, 0xbe, 0x11, 0x78, 0xe4, 0x9f, 0x9b, 0x17, 0x1d, 0x85, 0x76, 0xdc, 0xf1, 0xbd, 0x18, 0xf3, + 0xae, 0x4e, 0x2c, 0xb4, 0x66, 0xda, 0x98, 0xc0, 0xdb, 0x83, 0x6d, 0x1b, 0xd7, 0x4e, 0xfb, 0xb5, + 0x2b, 0x3d, 0xdd, 0xde, 0x5d, 0x55, 0xf9, 0xbe, 0x1a, 0x3b, 0xa9, 0x0f, 0x3b, 0x69, 0xcc, 0x9c, + 0xf6, 0x6b, 0x53, 0x9c, 0x1c, 0x21, 0x6a, 0x62, 0x6f, 0x19, 0x4c, 0x10, 0xb4, 0xd7, 0xd6, 0xc3, + 0x3e, 0xdc, 0x5f, 0xa3, 0x7c, 0xda, 0xaf, 0x4d, 0xf3, 0x03, 0x31, 0xa4, 0xb6, 0x4a, 0x04, 0xed, + 0x31, 0x37, 0xd1, 0x14, 0x27, 0xfe, 0x62, 0xeb, 0xef, 0x24, 0x30, 0x15, 0x4f, 0xc1, 0x63, 0xdd, + 0xd3, 0x6d, 0x0a, 0xef, 0x0e, 0x79, 0x97, 0xbf, 0x7d, 0xbe, 0x53, 0x16, 0x8f, 0x7f, 0xcd, 0x34, + 0x3d, 0x44, 0xe9, 0x53, 0xdf, 0xc3, 0xc4, 0x8a, 0x23, 0xdc, 0x07, 0x05, 0x97, 0x9d, 0x65, 0x01, + 0x26, 0x57, 0xaa, 0xf5, 0xb3, 0xff, 0x3d, 0x75, 0xae, 0xde, 0xc8, 0x1f, 0xf6, 0x6b, 0xb9, 0x96, + 0xe0, 0xaf, 0xce, 0xbc, 0x39, 0xa8, 0xe5, 0x7e, 0x1d, 0xd4, 0x72, 0xaf, 0x7f, 0x7e, 0x5a, 0x14, + 0x72, 0x6a, 0x05, 0xcc, 0x0d, 0x79, 0x8a, 0xfc, 0xae, 0x7c, 0xcc, 0x83, 0xb1, 0x26, 0xb5, 0xe0, + 0x73, 0x30, 0x99, 0xfe, 0x57, 0x51, 0x47, 0x35, 0x1c, 0x7c, 0xb8, 0xd5, 0xc5, 0x8b, 0x39, 0x51, + 0x9b, 0x50, 0x3e, 0xfd, 0xb0, 0xb3, 0xe4, 0x53, 0x9c, 0x4c, 0xf9, 0x11, 0x0f, 0x0c, 0x3e, 0x01, + 0xc5, 0xe8, 0x71, 0x29, 0x19, 0xc7, 0x04, 0x5e, 0xbd, 0x79, 0x3e, 0x9e, 0x96, 0x8c, 0x46, 0x3e, + 0x4b, 0x52, 0xe0, 0x99, 0x92, 0x43, 0x63, 0xcd, 0xee, 0x38, 0x35, 0xd2, 0x99, 0x77, 0x9c, 0x70, + 0xb2, 0xef, 0xf8, 0xec, 0xe8, 0xc1, 0x17, 0xe0, 0xf2, 0xc0, 0xd8, 0x2d, 0x9c, 0x7b, 0x81, 0x9c, + 0x54, 0x5d, 0xfa, 0x03, 0x52, 0xd4, 0xa1, 0xf1, 0xe0, 0xf0, 0x58, 0x91, 0x8e, 0x8e, 0x15, 0xe9, + 0xc7, 0xb1, 0x22, 0xbd, 0x3d, 0x51, 0x72, 0x47, 0x27, 0x4a, 0xee, 0xfb, 0x89, 0x92, 0xdb, 0x5e, + 0xb2, 0xb0, 0xdf, 0x0d, 0x3a, 0x75, 0xc3, 0xb1, 0xb5, 0x2d, 0xb2, 0x45, 0xf0, 0x06, 0xd6, 0x8c, + 0xae, 0x8e, 0x89, 0xb6, 0x3f, 0xf0, 0x2d, 0xed, 0xb9, 0x88, 0x76, 0x0a, 0xec, 0x63, 0x76, 0xef, + 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x14, 0x09, 0xdf, 0x6e, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -725,11 +752,11 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { CreateClass(ctx context.Context, in *MsgCreateClass, opts ...grpc.CallOption) (*MsgCreateClassResponse, error) - SendClassOwnership(ctx context.Context, in *MsgSendClassOwnership, opts ...grpc.CallOption) (*MsgSendClassOwnershipResponse, error) - UpdateBaseTokenUri(ctx context.Context, in *MsgUpdateBaseTokenUri, opts ...grpc.CallOption) (*MsgUpdateBaseTokenUriResponse, error) - UpdateTokenSupplyCap(ctx context.Context, in *MsgUpdateTokenSupplyCap, opts ...grpc.CallOption) (*MsgUpdateTokenSupplyCapResponse, error) + UpdateClass(ctx context.Context, in *MsgUpdateClass, opts ...grpc.CallOption) (*MsgUpdateClassResponse, error) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.CallOption) (*MsgMintNFTResponse, error) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) + ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -749,45 +776,45 @@ func (c *msgClient) CreateClass(ctx context.Context, in *MsgCreateClass, opts .. return out, nil } -func (c *msgClient) SendClassOwnership(ctx context.Context, in *MsgSendClassOwnership, opts ...grpc.CallOption) (*MsgSendClassOwnershipResponse, error) { - out := new(MsgSendClassOwnershipResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/SendClassOwnership", in, out, opts...) +func (c *msgClient) UpdateClass(ctx context.Context, in *MsgUpdateClass, opts ...grpc.CallOption) (*MsgUpdateClassResponse, error) { + out := new(MsgUpdateClassResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateClass", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateBaseTokenUri(ctx context.Context, in *MsgUpdateBaseTokenUri, opts ...grpc.CallOption) (*MsgUpdateBaseTokenUriResponse, error) { - out := new(MsgUpdateBaseTokenUriResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateBaseTokenUri", in, out, opts...) +func (c *msgClient) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.CallOption) (*MsgMintNFTResponse, error) { + out := new(MsgMintNFTResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/MintNFT", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateTokenSupplyCap(ctx context.Context, in *MsgUpdateTokenSupplyCap, opts ...grpc.CallOption) (*MsgUpdateTokenSupplyCapResponse, error) { - out := new(MsgUpdateTokenSupplyCapResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateTokenSupplyCap", in, out, opts...) +func (c *msgClient) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) { + out := new(MsgBurnNFTResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/BurnNFT", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.CallOption) (*MsgMintNFTResponse, error) { - out := new(MsgMintNFTResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/MintNFT", in, out, opts...) +func (c *msgClient) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) { + out := new(MsgChangeAdminResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/ChangeAdmin", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) { - out := new(MsgBurnNFTResponse) - err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/BurnNFT", in, out, opts...) +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/ununifi.nftfactory.Msg/UpdateParams", in, out, opts...) if err != nil { return nil, err } @@ -797,11 +824,11 @@ func (c *msgClient) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.Ca // MsgServer is the server API for Msg service. type MsgServer interface { CreateClass(context.Context, *MsgCreateClass) (*MsgCreateClassResponse, error) - SendClassOwnership(context.Context, *MsgSendClassOwnership) (*MsgSendClassOwnershipResponse, error) - UpdateBaseTokenUri(context.Context, *MsgUpdateBaseTokenUri) (*MsgUpdateBaseTokenUriResponse, error) - UpdateTokenSupplyCap(context.Context, *MsgUpdateTokenSupplyCap) (*MsgUpdateTokenSupplyCapResponse, error) + UpdateClass(context.Context, *MsgUpdateClass) (*MsgUpdateClassResponse, error) MintNFT(context.Context, *MsgMintNFT) (*MsgMintNFTResponse, error) BurnNFT(context.Context, *MsgBurnNFT) (*MsgBurnNFTResponse, error) + ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -811,14 +838,8 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) CreateClass(ctx context.Context, req *MsgCreateClass) (*MsgCreateClassResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateClass not implemented") } -func (*UnimplementedMsgServer) SendClassOwnership(ctx context.Context, req *MsgSendClassOwnership) (*MsgSendClassOwnershipResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendClassOwnership not implemented") -} -func (*UnimplementedMsgServer) UpdateBaseTokenUri(ctx context.Context, req *MsgUpdateBaseTokenUri) (*MsgUpdateBaseTokenUriResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateBaseTokenUri not implemented") -} -func (*UnimplementedMsgServer) UpdateTokenSupplyCap(ctx context.Context, req *MsgUpdateTokenSupplyCap) (*MsgUpdateTokenSupplyCapResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateTokenSupplyCap not implemented") +func (*UnimplementedMsgServer) UpdateClass(ctx context.Context, req *MsgUpdateClass) (*MsgUpdateClassResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateClass not implemented") } func (*UnimplementedMsgServer) MintNFT(ctx context.Context, req *MsgMintNFT) (*MsgMintNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MintNFT not implemented") @@ -826,6 +847,12 @@ func (*UnimplementedMsgServer) MintNFT(ctx context.Context, req *MsgMintNFT) (*M func (*UnimplementedMsgServer) BurnNFT(ctx context.Context, req *MsgBurnNFT) (*MsgBurnNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BurnNFT not implemented") } +func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAdmin) (*MsgChangeAdminResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangeAdmin not implemented") +} +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -849,92 +876,92 @@ func _Msg_CreateClass_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Msg_SendClassOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSendClassOwnership) +func _Msg_UpdateClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateClass) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).SendClassOwnership(ctx, in) + return srv.(MsgServer).UpdateClass(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/SendClassOwnership", + FullMethod: "/ununifi.nftfactory.Msg/UpdateClass", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SendClassOwnership(ctx, req.(*MsgSendClassOwnership)) + return srv.(MsgServer).UpdateClass(ctx, req.(*MsgUpdateClass)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateBaseTokenUri_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateBaseTokenUri) +func _Msg_MintNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintNFT) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateBaseTokenUri(ctx, in) + return srv.(MsgServer).MintNFT(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/UpdateBaseTokenUri", + FullMethod: "/ununifi.nftfactory.Msg/MintNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateBaseTokenUri(ctx, req.(*MsgUpdateBaseTokenUri)) + return srv.(MsgServer).MintNFT(ctx, req.(*MsgMintNFT)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateTokenSupplyCap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateTokenSupplyCap) +func _Msg_BurnNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurnNFT) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateTokenSupplyCap(ctx, in) + return srv.(MsgServer).BurnNFT(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/UpdateTokenSupplyCap", + FullMethod: "/ununifi.nftfactory.Msg/BurnNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateTokenSupplyCap(ctx, req.(*MsgUpdateTokenSupplyCap)) + return srv.(MsgServer).BurnNFT(ctx, req.(*MsgBurnNFT)) } return interceptor(ctx, in, info, handler) } -func _Msg_MintNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgMintNFT) +func _Msg_ChangeAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgChangeAdmin) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).MintNFT(ctx, in) + return srv.(MsgServer).ChangeAdmin(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/MintNFT", + FullMethod: "/ununifi.nftfactory.Msg/ChangeAdmin", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).MintNFT(ctx, req.(*MsgMintNFT)) + return srv.(MsgServer).ChangeAdmin(ctx, req.(*MsgChangeAdmin)) } return interceptor(ctx, in, info, handler) } -func _Msg_BurnNFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBurnNFT) +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).BurnNFT(ctx, in) + return srv.(MsgServer).UpdateParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.nftfactory.Msg/BurnNFT", + FullMethod: "/ununifi.nftfactory.Msg/UpdateParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BurnNFT(ctx, req.(*MsgBurnNFT)) + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) } return interceptor(ctx, in, info, handler) } @@ -948,16 +975,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_CreateClass_Handler, }, { - MethodName: "SendClassOwnership", - Handler: _Msg_SendClassOwnership_Handler, - }, - { - MethodName: "UpdateBaseTokenUri", - Handler: _Msg_UpdateBaseTokenUri_Handler, - }, - { - MethodName: "UpdateTokenSupplyCap", - Handler: _Msg_UpdateTokenSupplyCap_Handler, + MethodName: "UpdateClass", + Handler: _Msg_UpdateClass_Handler, }, { MethodName: "MintNFT", @@ -967,9 +986,17 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "BurnNFT", Handler: _Msg_BurnNFT_Handler, }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ununifi/nftfactory/tx.proto", + { + MethodName: "ChangeAdmin", + Handler: _Msg_ChangeAdmin_Handler, + }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ununifi/nftfactory/tx.proto", } func (m *MsgCreateClass) Marshal() (dAtA []byte, err error) { @@ -992,49 +1019,46 @@ func (m *MsgCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ClassUri) > 0 { - i -= len(m.ClassUri) - copy(dAtA[i:], m.ClassUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassUri))) + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x3a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x32 } if len(m.Description) > 0 { i -= len(m.Description) copy(dAtA[i:], m.Description) i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x2a } if len(m.Symbol) > 0 { i -= len(m.Symbol) copy(dAtA[i:], m.Symbol) i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) i-- - dAtA[i] = 0x3a - } - if m.MintingPermission != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.MintingPermission)) - i-- - dAtA[i] = 0x28 - } - if m.TokenSupplyCap != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TokenSupplyCap)) - i-- - dAtA[i] = 0x20 - } - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.BaseTokenUri))) - i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) i-- + dAtA[i] = 0x1a + } + if len(m.Subclass) > 0 { + i -= len(m.Subclass) + copy(dAtA[i:], m.Subclass) + i = encodeVarintTx(dAtA, i, uint64(len(m.Subclass))) + i-- dAtA[i] = 0x12 } if len(m.Sender) > 0 { @@ -1070,7 +1094,7 @@ func (m *MsgCreateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgSendClassOwnership) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateClass) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1080,20 +1104,48 @@ func (m *MsgSendClassOwnership) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSendClassOwnership) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateClass) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x3a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x32 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x2a + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x1a } @@ -1114,7 +1166,7 @@ func (m *MsgSendClassOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgSendClassOwnershipResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateClassResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1124,12 +1176,12 @@ func (m *MsgSendClassOwnershipResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSendClassOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateClassResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSendClassOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1137,7 +1189,7 @@ func (m *MsgSendClassOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { +func (m *MsgMintNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1147,20 +1199,41 @@ func (m *MsgUpdateBaseTokenUri) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateBaseTokenUri) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgMintNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.BaseTokenUri) > 0 { - i -= len(m.BaseTokenUri) - copy(dAtA[i:], m.BaseTokenUri) - i = encodeVarintTx(dAtA, i, uint64(len(m.BaseTokenUri))) + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x32 + } + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x2a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x22 + } + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenId))) i-- dAtA[i] = 0x1a } @@ -1181,7 +1254,7 @@ func (m *MsgUpdateBaseTokenUri) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateBaseTokenUriResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgMintNFTResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1191,12 +1264,12 @@ func (m *MsgUpdateBaseTokenUriResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateBaseTokenUriResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgMintNFTResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateBaseTokenUriResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgMintNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1204,7 +1277,7 @@ func (m *MsgUpdateBaseTokenUriResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { +func (m *MsgBurnNFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1214,20 +1287,22 @@ func (m *MsgUpdateTokenSupplyCap) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateTokenSupplyCap) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgBurnNFT) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.TokenSupplyCap != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TokenSupplyCap)) + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenId))) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x1a } if len(m.ClassId) > 0 { i -= len(m.ClassId) @@ -1246,7 +1321,7 @@ func (m *MsgUpdateTokenSupplyCap) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgUpdateTokenSupplyCapResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgBurnNFTResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1256,12 +1331,12 @@ func (m *MsgUpdateTokenSupplyCapResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateTokenSupplyCapResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgBurnNFTResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateTokenSupplyCapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgBurnNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1269,7 +1344,7 @@ func (m *MsgUpdateTokenSupplyCapResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *MsgMintNFT) Marshal() (dAtA []byte, err error) { +func (m *MsgChangeAdmin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1279,27 +1354,20 @@ func (m *MsgMintNFT) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMintNFT) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgChangeAdmin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgChangeAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) - i-- - dAtA[i] = 0x22 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewAdmin))) i-- dAtA[i] = 0x1a } @@ -1320,7 +1388,7 @@ func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgMintNFTResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgChangeAdminResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1330,12 +1398,12 @@ func (m *MsgMintNFTResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMintNFTResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgChangeAdminResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgChangeAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1343,7 +1411,7 @@ func (m *MsgMintNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgBurnNFT) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1353,30 +1421,26 @@ func (m *MsgBurnNFT) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgBurnNFT) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Sender) > 0 { i -= len(m.Sender) copy(dAtA[i:], m.Sender) @@ -1387,7 +1451,7 @@ func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgBurnNFTResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1397,12 +1461,12 @@ func (m *MsgBurnNFTResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgBurnNFTResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgBurnNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1431,20 +1495,14 @@ func (m *MsgCreateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Name) + l = len(m.Subclass) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.BaseTokenUri) + l = len(m.Name) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.TokenSupplyCap != 0 { - n += 1 + sovTx(uint64(m.TokenSupplyCap)) - } - if m.MintingPermission != 0 { - n += 1 + sovTx(uint64(m.MintingPermission)) - } l = len(m.Symbol) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1453,7 +1511,11 @@ func (m *MsgCreateClass) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ClassUri) + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.UriHash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1469,7 +1531,7 @@ func (m *MsgCreateClassResponse) Size() (n int) { return n } -func (m *MsgSendClassOwnership) Size() (n int) { +func (m *MsgUpdateClass) Size() (n int) { if m == nil { return 0 } @@ -1483,14 +1545,30 @@ func (m *MsgSendClassOwnership) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Recipient) + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.UriHash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgSendClassOwnershipResponse) Size() (n int) { +func (m *MsgUpdateClassResponse) Size() (n int) { if m == nil { return 0 } @@ -1499,7 +1577,7 @@ func (m *MsgSendClassOwnershipResponse) Size() (n int) { return n } -func (m *MsgUpdateBaseTokenUri) Size() (n int) { +func (m *MsgMintNFT) Size() (n int) { if m == nil { return 0 } @@ -1513,14 +1591,26 @@ func (m *MsgUpdateBaseTokenUri) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.BaseTokenUri) + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Recipient) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgUpdateBaseTokenUriResponse) Size() (n int) { +func (m *MsgMintNFTResponse) Size() (n int) { if m == nil { return 0 } @@ -1529,7 +1619,7 @@ func (m *MsgUpdateBaseTokenUriResponse) Size() (n int) { return n } -func (m *MsgUpdateTokenSupplyCap) Size() (n int) { +func (m *MsgBurnNFT) Size() (n int) { if m == nil { return 0 } @@ -1543,13 +1633,14 @@ func (m *MsgUpdateTokenSupplyCap) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.TokenSupplyCap != 0 { - n += 1 + sovTx(uint64(m.TokenSupplyCap)) + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgUpdateTokenSupplyCapResponse) Size() (n int) { +func (m *MsgBurnNFTResponse) Size() (n int) { if m == nil { return 0 } @@ -1558,7 +1649,7 @@ func (m *MsgUpdateTokenSupplyCapResponse) Size() (n int) { return n } -func (m *MsgMintNFT) Size() (n int) { +func (m *MsgChangeAdmin) Size() (n int) { if m == nil { return 0 } @@ -1572,18 +1663,14 @@ func (m *MsgMintNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Recipient) + l = len(m.NewAdmin) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgMintNFTResponse) Size() (n int) { +func (m *MsgChangeAdminResponse) Size() (n int) { if m == nil { return 0 } @@ -1592,7 +1679,7 @@ func (m *MsgMintNFTResponse) Size() (n int) { return n } -func (m *MsgBurnNFT) Size() (n int) { +func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 } @@ -1602,18 +1689,12 @@ func (m *MsgBurnNFT) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgBurnNFTResponse) Size() (n int) { +func (m *MsgUpdateParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -1690,6 +1771,38 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subclass", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subclass = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } @@ -1721,9 +1834,301 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateClassResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateClassResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateClass) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateClass: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateClass: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1751,13 +2156,13 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } - m.TokenSupplyCap = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1767,33 +2172,27 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TokenSupplyCap |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MintingPermission", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx } - m.MintingPermission = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MintingPermission |= MintingPermission(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx } - case 7: + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1821,11 +2220,11 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Symbol = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1853,11 +2252,11 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Description = string(dAtA[iNdEx:postIndex]) + m.Uri = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassUri", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1885,7 +2284,7 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassUri = string(dAtA[iNdEx:postIndex]) + m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1908,7 +2307,7 @@ func (m *MsgCreateClass) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateClassResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1931,10 +2330,10 @@ func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateClassResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateClassResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateClassResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateClassResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1958,7 +2357,7 @@ func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { +func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1981,10 +2380,10 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSendClassOwnership: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMintNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendClassOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2053,7 +2452,7 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2081,111 +2480,11 @@ func (m *MsgSendClassOwnership) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Recipient = string(dAtA[iNdEx:postIndex]) + m.TokenId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSendClassOwnershipResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSendClassOwnershipResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendClassOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUri: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUri: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2213,11 +2512,11 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Uri = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2245,11 +2544,11 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.UriHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseTokenUri", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2277,7 +2576,7 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BaseTokenUri = string(dAtA[iNdEx:postIndex]) + m.Recipient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2300,7 +2599,7 @@ func (m *MsgUpdateBaseTokenUri) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateBaseTokenUriResponse) Unmarshal(dAtA []byte) error { +func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2323,10 +2622,10 @@ func (m *MsgUpdateBaseTokenUriResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUriResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMintNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateBaseTokenUriResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMintNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2350,7 +2649,7 @@ func (m *MsgUpdateBaseTokenUriResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { +func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2373,10 +2672,10 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCap: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnNFT: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCap: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2444,10 +2743,10 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenSupplyCap", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", wireType) } - m.TokenSupplyCap = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2457,11 +2756,24 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TokenSupplyCap |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2483,7 +2795,7 @@ func (m *MsgUpdateTokenSupplyCap) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateTokenSupplyCapResponse) Unmarshal(dAtA []byte) error { +func (m *MsgBurnNFTResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2506,10 +2818,10 @@ func (m *MsgUpdateTokenSupplyCapResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCapResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgBurnNFTResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateTokenSupplyCapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgBurnNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2533,7 +2845,7 @@ func (m *MsgUpdateTokenSupplyCapResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { +func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2556,10 +2868,10 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintNFT: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeAdmin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2628,39 +2940,7 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2688,7 +2968,7 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Recipient = string(dAtA[iNdEx:postIndex]) + m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2711,7 +2991,7 @@ func (m *MsgMintNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { +func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2734,10 +3014,10 @@ func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeAdminResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2761,7 +3041,7 @@ func (m *MsgMintNFTResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2784,10 +3064,10 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnNFT: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnNFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2824,9 +3104,9 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2836,55 +3116,24 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.NftId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2907,7 +3156,7 @@ func (m *MsgBurnNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnNFTResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2930,10 +3179,10 @@ func (m *MsgBurnNFTResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnNFTResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/nftfactory/types/validation.go b/x/nftfactory/types/validation.go deleted file mode 100644 index c6e0cc0e3..000000000 --- a/x/nftfactory/types/validation.go +++ /dev/null @@ -1,139 +0,0 @@ -package types - -import ( - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -func ValidateCreateClass( - params Params, - name, symbol, uri, description string, - mintingPermission MintingPermission, - tokenSupplyCap uint64, -) error { - if err := ValidateClassName(params.MinClassNameLen, params.MaxClassNameLen, name); err != nil { - return err - } - if err := ValidateSymbol(params.MaxSymbolLen, symbol); err != nil { - return err - } - if err := ValidateUri(params.MinUriLen, params.MaxUriLen, uri); err != nil { - return err - } - if err := ValidateDescription(params.MaxDescriptionLen, description); err != nil { - return err - } - if err := ValidateMintingPermission(mintingPermission, nil, nil); err != nil { - return err - } - if err := ValidateTokenSupplyCap(params.MaxNFTSupplyCap, tokenSupplyCap); err != nil { - return err - } - return nil -} - -func ValidateMintNFT( - params Params, - mintingPermission MintingPermission, - owner, minter sdk.AccAddress, - uri, nftID string, - currentTokenSupply, tokenSupplyCap uint64, -) error { - if err := ValidateMintingPermission(mintingPermission, owner, minter); err != nil { - return err - } - if err := ValidateUri(params.MinUriLen, params.MaxUriLen, uri); err != nil { - return err - } - if err := ValidateTokenSupply(currentTokenSupply, tokenSupplyCap); err != nil { - return err - } - if err := ValidateNFTID(nftID); err != nil { - return err - } - return nil -} - -func ValidateClassAttributes(classAttributes ClassAttributes, params Params) error { - if err := ValidateUri(params.MinUriLen, params.MaxUriLen, classAttributes.BaseTokenUri); err != nil { - return err - } - - if err := ValidateTokenSupplyCap(params.MaxNFTSupplyCap, classAttributes.TokenSupplyCap); err != nil { - return err - } - - return nil -} - -func ValidateMintingPermission(mintingPermission MintingPermission, owner, minter sdk.AccAddress) error { - switch mintingPermission { - case 0: - if !owner.Equals(minter) { - return ErrInvalidMintingPermission - } - return nil - case 1: - return nil - default: - return ErrInvalidMintingPermission - } -} - -// Measure length of the string as byte length -func ValidateClassName(minLen, maxLen uint64, className string) error { - len := len(className) - if len < int(minLen) || len > int(maxLen) { - return sdkerrors.Wrap(ErrClassNameInvalidLength, className) - } - return nil -} - -func ValidateUri(minLen, maxLen uint64, uri string) error { - len := len(uri) - if len == 0 { - return nil - } - - if len < int(minLen) || len > int(maxLen) { - return sdkerrors.Wrap(ErrUriInvalidLength, uri) - } - return nil -} - -func ValidateTokenSupplyCap(maxCap, tokenSupplyCap uint64) error { - if tokenSupplyCap > maxCap { - strTokenSupplyCap := strconv.FormatUint(tokenSupplyCap, 10) - return sdkerrors.Wrap(ErrInvalidTokenSupplyCap, strTokenSupplyCap) - } - return nil -} - -func ValidateTokenSupply(tokenSupply, tokenSupplyCap uint64) error { - if tokenSupply >= tokenSupplyCap { - strTokenSupply := strconv.FormatUint(tokenSupply, 10) - return sdkerrors.Wrap(ErrTokenSupplyCapOver, strTokenSupply) - } - return nil -} - -func ValidateSymbol(maxLen uint64, classSymbol string) error { - len := len(classSymbol) - if len > int(maxLen) { - return sdkerrors.Wrap(ErrClassSymbolInvalidLength, classSymbol) - } - return nil -} - -func ValidateDescription(maxLen uint64, classDescription string) error { - len := len(classDescription) - if len == 0 { - return nil - } - if len > int(maxLen) { - return sdkerrors.Wrap(ErrClassDescriptionInvalidLength, classDescription) - } - return nil -} diff --git a/x/nftfactory/types/validation_test.go b/x/nftfactory/types/validation_test.go deleted file mode 100644 index 92eb9e3fc..000000000 --- a/x/nftfactory/types/validation_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/UnUniFi/chain/x/nftfactory/types" -) - -const ( - // For the test, use "cosmos" prefix - testAddr = "cosmos1nyd8wdqyrnjfwfnfysv6t0rrpcj4pmzkykytjh" - testAddr2 = "cosmos1chjjqrherp2lgmj9wsqwe6leercydncqx2v209" - testAddr3 = "cosmos1hzgsxn26pn7zt0g3yssld7cmj86zr7fhhu2r3g" - testClassName = "UnUniFi" - testUri = "ipfs://test/" - testTokenSupplyCap = 10000 - testCurrentTokenSupply = 10 - testSymbol = "TEST" - testDescription = "This description is for the valdation uni test" -) - -func TestValidateMintingPermission(t *testing.T) { - // OnlyOwner case - owner, _ := sdk.AccAddressFromBech32(testAddr) - classAttirbutes := types.ClassAttributes{ - Owner: owner.Bytes(), - MintingPermission: 0, - } - err := types.ValidateMintingPermission(classAttirbutes.MintingPermission, owner, owner) - require.NoError(t, err) - - falseCase, _ := sdk.AccAddressFromBech32(testAddr2) - err = types.ValidateMintingPermission(classAttirbutes.MintingPermission, owner, falseCase) - require.Error(t, err) - - // AnyOne case - classAttirbutes = types.ClassAttributes{ - MintingPermission: 1, - } - anyoneCase, _ := sdk.AccAddressFromBech32(testAddr3) - err = types.ValidateMintingPermission(classAttirbutes.MintingPermission, owner, anyoneCase) - require.NoError(t, err) - - // In case of now allowed option - classAttirbutes = types.ClassAttributes{ - MintingPermission: 3, - } - err = types.ValidateMintingPermission(classAttirbutes.MintingPermission, nil, nil) - require.Error(t, err) -} - -func TestValidateClassName(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateClassName(params.MinClassNameLen, params.MaxClassNameLen, testClassName) - require.NoError(t, err) - - // invalid case which name is shorter than the default MinClassNameLen - invalidClassNameShort := testClassName[:2] - err = types.ValidateClassName(params.MinClassNameLen, 10000, invalidClassNameShort) - require.Error(t, err) - - // invalid case which name is longer than the default MaxClassNameLen - var invalidClassNameLong string - for i := 0; i <= (int(params.MaxClassNameLen) / 7); i++ { - invalidClassNameLong += testClassName - } - err = types.ValidateClassName(0, params.MaxClassNameLen, invalidClassNameLong) - require.Error(t, err) -} - -func TestValidateUri(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateUri(params.MinUriLen, params.MaxUriLen, testUri) - require.NoError(t, err) - - // invalid case which uri is shoter than the default MinUriLen - invalidUriShort := testUri[:4] - err = types.ValidateUri(params.MinUriLen, 10000, invalidUriShort) - require.Error(t, err) - - // invalid case which uri is longer than the default MaxUriLen - var invalidUriLong string - for i := 0; i <= (int(params.MaxUriLen) / len(testUri)); i++ { - invalidUriLong += testUri - } - err = types.ValidateUri(0, params.MaxUriLen, invalidUriLong) - require.Error(t, err) -} - -func TestValidateTokenSupplyCap(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateTokenSupplyCap(params.MaxNFTSupplyCap, testTokenSupplyCap) - require.NoError(t, err) - - // invalid case which token supply cap is bigger than the default MaxTokenSupplyCap - invalidTokenSupply := testTokenSupplyCap * ((params.MaxNFTSupplyCap)/testTokenSupplyCap + 1) - err = types.ValidateTokenSupplyCap(params.MaxNFTSupplyCap, invalidTokenSupply) - require.Error(t, err) -} - -func TestValidateTokenSupply(t *testing.T) { - err := types.ValidateTokenSupply(testCurrentTokenSupply, testTokenSupplyCap) - require.NoError(t, err) - - // invalid case which current token supply is over the token supply cap - invalidTokenSupplyCap := 5 - err = types.ValidateTokenSupply(testCurrentTokenSupply, uint64(invalidTokenSupplyCap)) - require.Error(t, err) -} - -func TestValidateSymbol(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateSymbol(params.MaxSymbolLen, testSymbol) - require.NoError(t, err) - - // invalid case which symbol is longer that the default MaxSymbolLen - var invalidSymbol string - for i := 0; i <= (int(params.MaxSymbolLen) / len(testSymbol)); i++ { - invalidSymbol += testSymbol - } - err = types.ValidateSymbol(params.MaxSymbolLen, invalidSymbol) - require.Error(t, err) -} - -func TestValidateDescription(t *testing.T) { - params := types.DefaultParams() - - // valid case - err := types.ValidateDescription(params.MaxDescriptionLen, testDescription) - require.NoError(t, err) - - // invalid case which description is longer than the default MaxDescriptionLen - var invalidDescription string - for i := 0; i <= (int(params.MaxDescriptionLen) / len(testDescription)); i++ { - invalidDescription += testDescription - } - err = types.ValidateDescription(params.MaxDescriptionLen, invalidDescription) - require.Error(t, err) -} diff --git a/x/nft-transfer/keeper/keeper.go b/x/nfttransfer/keeper/keeper.go similarity index 100% rename from x/nft-transfer/keeper/keeper.go rename to x/nfttransfer/keeper/keeper.go diff --git a/x/nft-transfer/keeper/msg_server.go b/x/nfttransfer/keeper/msg_server.go similarity index 100% rename from x/nft-transfer/keeper/msg_server.go rename to x/nfttransfer/keeper/msg_server.go diff --git a/x/nft-transfer/module.go b/x/nfttransfer/module.go similarity index 92% rename from x/nft-transfer/module.go rename to x/nfttransfer/module.go index 26c56acbb..dc4469792 100644 --- a/x/nft-transfer/module.go +++ b/x/nfttransfer/module.go @@ -6,7 +6,7 @@ package nfttransfer // "github.com/bianjieai/nft-transfer" // "github.com/bianjieai/nft-transfer/types" -// newkeeper "github.com/UnUniFi/chain/x/nft-transfer/keeper" +// newkeeper "github.com/UnUniFi/chain/x/nfttransfer/keeper" // ) // // AppModule represents the AppModule for this module diff --git a/x/pricefeed/client/cli/tx.go b/x/pricefeed/client/cli/tx.go index d2224a758..aa847f904 100644 --- a/x/pricefeed/client/cli/tx.go +++ b/x/pricefeed/client/cli/tx.go @@ -59,7 +59,7 @@ $ %s tx %s postprice uusdc:ubtc 24528.185864015486004064 60 --from myKeyName -- return err } expiry := now.Add(time.Second * time.Duration(expirySec)) - msg := types.NewMsgPostPrice(clientCtx.GetFromAddress().String(), marketId, price, expiry, sdk.NewCoin("uusdc", sdk.NewInt(1000))) // TODO: deposit + msg := types.NewMsgPostPrice(clientCtx.GetFromAddress().String(), marketId, price, expiry) if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/pricefeed/genesis.go b/x/pricefeed/genesis.go index 165836889..dc90c9d92 100644 --- a/x/pricefeed/genesis.go +++ b/x/pricefeed/genesis.go @@ -26,21 +26,19 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } } - params := genState.Params + params := k.GetParams(ctx) // Set the current price (if any) based on what's now in the store for _, market := range params.Markets { if !market.Active { continue } - rps, err := k.GetRawPrices(ctx, market.MarketId) - if err != nil { - panic(err) - } + rps := k.GetRawPrices(ctx, market.MarketId) + if len(rps) == 0 { continue } - err = k.SetCurrentPrices(ctx, market.MarketId) + err := k.SetCurrentPrices(ctx, market.MarketId) if err != nil { panic(err) } @@ -49,14 +47,12 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { + // Get the params for markets and oracles params := k.GetParams(ctx) var postedPrices []types.PostedPrice for _, market := range k.GetMarkets(ctx) { - pp, err := k.GetRawPrices(ctx, market.MarketId) - if err != nil { - panic(err) - } + pp := k.GetRawPrices(ctx, market.MarketId) postedPrices = append(postedPrices, pp...) } return types.NewGenesisState(params, postedPrices) diff --git a/x/pricefeed/keeper/grpc_query_params.go b/x/pricefeed/keeper/grpc_query_params.go index 457e1aa52..205a89bb2 100644 --- a/x/pricefeed/keeper/grpc_query_params.go +++ b/x/pricefeed/keeper/grpc_query_params.go @@ -4,7 +4,6 @@ import ( "context" "github.com/UnUniFi/chain/x/pricefeed/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -15,11 +14,9 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types return nil, status.Error(codes.InvalidArgument, "invalid request") } - var params types.Params ctx := sdk.UnwrapSDKContext(c) - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ParamsKey)) - k.cdc.MustUnmarshal(store.Get(types.KeyPrefix(types.ParamsKey)), ¶ms) + params := k.GetParams(ctx) return &types.QueryParamsResponse{Params: ¶ms}, nil } diff --git a/x/pricefeed/keeper/grpc_query_rawprice.go b/x/pricefeed/keeper/grpc_query_rawprice.go index 9e4198bc6..c98bd6c2c 100644 --- a/x/pricefeed/keeper/grpc_query_rawprice.go +++ b/x/pricefeed/keeper/grpc_query_rawprice.go @@ -14,13 +14,9 @@ func (k Keeper) RawPriceAll(c context.Context, req *types.QueryAllRawPriceReques return nil, status.Error(codes.InvalidArgument, "invalid request") } - var prices types.PostedPrices ctx := sdk.UnwrapSDKContext(c) - prices, err := k.GetRawPrices(ctx, req.MarketId) - if err != nil { - return nil, status.Error(codes.NotFound, "not found") - } + prices := k.GetRawPrices(ctx, req.MarketId) return &types.QueryAllRawPriceResponse{Prices: prices}, nil } diff --git a/x/pricefeed/keeper/keeper.go b/x/pricefeed/keeper/keeper.go index 9c3aa60b5..0907c4ba6 100644 --- a/x/pricefeed/keeper/keeper.go +++ b/x/pricefeed/keeper/keeper.go @@ -1,18 +1,16 @@ package keeper import ( - "encoding/json" "fmt" "sort" "time" "github.com/cometbft/cometbft/libs/log" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/UnUniFi/chain/x/pricefeed/types" @@ -46,22 +44,6 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) ValidateAuthorityAndDeposit(ctx sdk.Context, marketId string, address sdk.AccAddress, deposit sdk.Coin) error { - params := k.GetParams(ctx) - if deposit.IsLT(params.DepositForPosting) { - k.bankKeeper.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, sdk.NewCoins(deposit)) - return sdkerrors.Wrapf(types.ErrInvalidOracle, "price deposit %s is less than minimum price deposit %s", deposit, params.DepositForPosting) - } - - _, err := k.GetOracle(ctx, marketId, address) - if err != nil { - k.bankKeeper.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, sdk.NewCoins(deposit)) - return err - } - - return nil -} - // SetPrice updates the posted price for a specific oracle func (k Keeper) SetPrice( ctx sdk.Context, @@ -76,27 +58,8 @@ func (k Keeper) SetPrice( } store := ctx.KVStore(k.storeKey) - prices, err := k.GetRawPrices(ctx, marketID) - if err != nil { - return types.PostedPrice{}, err - } - var index int - found := false - for i := range prices { - if prices[i].OracleAddress == oracle.String() { - index = i - found = true - break - } - } - // set the price for that particular oracle - if found { - prices[index] = types.NewPostedPrice(marketID, oracle.String(), price, expiry) - } else { - prices = append(prices, types.NewPostedPrice(marketID, oracle.String(), price, expiry)) - index = len(prices) - 1 - } + newRawPrice := types.NewPostedPrice(marketID, oracle.String(), price, expiry) // Emit an event containing the oracle's new price ctx.EventManager().EmitEvent( @@ -109,16 +72,16 @@ func (k Keeper) SetPrice( ), ) - bz, _ := json.Marshal(prices) - store.Set(types.RawPriceKeySuffix(marketID), bz) - return prices[index], nil + // Sets the raw price for a single oracle instead of an array of all oracle's raw prices + store.Set(types.RawPriceKey(marketID, oracle), k.cdc.MustMarshal(&newRawPrice)) + return newRawPrice, nil } // SetCurrentPrices updates the price of an asset to the median of all valid oracle inputs func (k Keeper) SetCurrentPrices(ctx sdk.Context, marketID string) error { _, ok := k.GetMarket(ctx, marketID) if !ok { - return sdkerrors.Wrap(types.ErrInvalidMarket, marketID) + return errorsmod.Wrap(types.ErrInvalidMarket, marketID) } // store current price validPrevPrice := true @@ -127,11 +90,9 @@ func (k Keeper) SetCurrentPrices(ctx sdk.Context, marketID string) error { validPrevPrice = false } - prices, err := k.GetRawPrices(ctx, marketID) - if err != nil { - return err - } - var notExpiredPrices types.CurrentPrices + prices := k.GetRawPrices(ctx, marketID) + + var notExpiredPrices []types.CurrentPrice // filter out expired prices for _, v := range prices { if v.Expiry.After(ctx.BlockTime()) { @@ -143,12 +104,12 @@ func (k Keeper) SetCurrentPrices(ctx sdk.Context, marketID string) error { // NOTE: The current price stored will continue storing the most recent (expired) // price if this is not set. // This zero's out the current price stored value for that market and ensures - // that Cdp methods that GetCurrentPrice will return error. + // that CDP methods that GetCurrentPrice will return error. k.setCurrentPrice(ctx, marketID, types.CurrentPrice{}) return types.ErrNoValidPrice } - medianPrice := k.CalculateMedianPrice(ctx, notExpiredPrices) + medianPrice := k.CalculateMedianPrice(notExpiredPrices) // check case that market price was not set in genesis if validPrevPrice && !medianPrice.Equal(prevPrice.Price) { @@ -170,11 +131,11 @@ func (k Keeper) SetCurrentPrices(ctx sdk.Context, marketID string) error { func (k Keeper) setCurrentPrice(ctx sdk.Context, marketID string, currentPrice types.CurrentPrice) { store := ctx.KVStore(k.storeKey) - store.Set(types.CurrentPriceKeySuffix(marketID), k.cdc.MustMarshal(¤tPrice)) + store.Set(types.CurrentPriceKey(marketID), k.cdc.MustMarshal(¤tPrice)) } // CalculateMedianPrice calculates the median prices for the input prices. -func (k Keeper) CalculateMedianPrice(ctx sdk.Context, prices types.CurrentPrices) sdk.Dec { +func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdk.Dec { l := len(prices) if l == 1 { @@ -187,16 +148,15 @@ func (k Keeper) CalculateMedianPrice(ctx sdk.Context, prices types.CurrentPrices }) // for even numbers of prices, the median is calculated as the mean of the two middle prices if l%2 == 0 { - median := k.calculateMeanPrice(ctx, prices[l/2-1:l/2+1]) + median := k.calculateMeanPrice(prices[l/2-1], prices[l/2]) return median } // for odd numbers of prices, return the middle element return prices[l/2].Price - } -func (k Keeper) calculateMeanPrice(ctx sdk.Context, prices types.CurrentPrices) sdk.Dec { - sum := prices[0].Price.Add(prices[1].Price) +func (k Keeper) calculateMeanPrice(priceA, priceB types.CurrentPrice) sdk.Dec { + sum := priceA.Price.Add(priceB.Price) mean := sum.Quo(sdk.NewDec(2)) return mean } @@ -204,17 +164,16 @@ func (k Keeper) calculateMeanPrice(ctx sdk.Context, prices types.CurrentPrices) // GetCurrentPrice fetches the current median price of all oracles for a specific market func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.CurrentPrice, error) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.CurrentPriceKeySuffix(marketID)) + bz := store.Get(types.CurrentPriceKey(marketID)) + if bz == nil { return types.CurrentPrice{}, types.ErrNoValidPrice } - var price types.CurrentPrice err := k.cdc.Unmarshal(bz, &price) if err != nil { return types.CurrentPrice{}, err } - if price.Price.Equal(sdk.ZeroDec()) { return types.CurrentPrice{}, types.ErrNoValidPrice } @@ -223,8 +182,7 @@ func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.Current // IterateCurrentPrices iterates over all current price objects in the store and performs a callback function func (k Keeper) IterateCurrentPrices(ctx sdk.Context, cb func(cp types.CurrentPrice) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CurrentPriceKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.CurrentPricePrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var cp types.CurrentPrice @@ -237,7 +195,7 @@ func (k Keeper) IterateCurrentPrices(ctx sdk.Context, cb func(cp types.CurrentPr // GetCurrentPrices returns all current price objects from the store func (k Keeper) GetCurrentPrices(ctx sdk.Context) types.CurrentPrices { - cps := types.CurrentPrices{} + var cps types.CurrentPrices k.IterateCurrentPrices(ctx, func(cp types.CurrentPrice) (stop bool) { cps = append(cps, cp) return false @@ -246,16 +204,24 @@ func (k Keeper) GetCurrentPrices(ctx sdk.Context) types.CurrentPrices { } // GetRawPrices fetches the set of all prices posted by oracles for an asset -func (k Keeper) GetRawPrices(ctx sdk.Context, marketID string) (types.PostedPrices, error) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.RawPriceKeySuffix(marketID)) - if bz == nil { - return types.PostedPrices{}, nil - } - var prices types.PostedPrices - err := json.Unmarshal(bz, &prices) - if err != nil { - return types.PostedPrices{}, err +func (k Keeper) GetRawPrices(ctx sdk.Context, marketId string) types.PostedPrices { + var pps types.PostedPrices + k.IterateRawPricesByMarket(ctx, marketId, func(pp types.PostedPrice) (stop bool) { + pps = append(pps, pp) + return false + }) + return pps +} + +// IterateRawPrices iterates over all raw prices in the store and performs a callback function +func (k Keeper) IterateRawPricesByMarket(ctx sdk.Context, marketId string, cb func(record types.PostedPrice) (stop bool)) { + iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.RawPriceIteratorKey((marketId))) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var record types.PostedPrice + k.cdc.MustUnmarshal(iterator.Value(), &record) + if cb(record) { + break + } } - return prices, nil } diff --git a/x/pricefeed/keeper/keeper_test.go b/x/pricefeed/keeper/keeper_test.go index 81aff8408..cb1f1599d 100644 --- a/x/pricefeed/keeper/keeper_test.go +++ b/x/pricefeed/keeper/keeper_test.go @@ -9,20 +9,20 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/UnUniFi/chain/app" - pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types" + "github.com/UnUniFi/chain/x/pricefeed/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" ) // TestKeeper_SetGetMarket tests adding markets to the pricefeed, getting markets from the store func TestKeeper_SetGetMarket(t *testing.T) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{}) + ctx := tApp.NewContext(true, tmprototypes.Header{}) keeper := tApp.GetPriceFeedKeeper() - mp := pricefeedtypes.Params{ - Markets: pricefeedtypes.Markets{ - pricefeedtypes.Market{MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, + mp := types.Params{ + Markets: []types.Market{ + {MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, }, } keeper.SetParams(ctx, mp) @@ -31,12 +31,15 @@ func TestKeeper_SetGetMarket(t *testing.T) { require.Equal(t, markets[0].MarketId, "tstusd") _, found := keeper.GetMarket(ctx, "tstusd") - require.Equal(t, found, true) + require.True(t, found, "market should be found") - mp = pricefeedtypes.Params{ - Markets: pricefeedtypes.Markets{ - pricefeedtypes.Market{MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, - pricefeedtypes.Market{MarketId: "tst2usd", BaseAsset: "tst2", QuoteAsset: "usd", Oracles: []string{}, Active: true}, + _, found = keeper.GetMarket(ctx, "invalidmarket") + require.False(t, found, "invalidmarket should not be found") + + mp = types.Params{ + Markets: []types.Market{ + {MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, + {MarketId: "tst2usd", BaseAsset: "tst2", QuoteAsset: "usd", Oracles: []string{}, Active: true}, }, } keeper.SetParams(ctx, mp) @@ -53,90 +56,183 @@ func TestKeeper_SetGetMarket(t *testing.T) { func TestKeeper_GetSetPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(2) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{}) + ctx := tApp.NewContext(true, tmprototypes.Header{}) + keeper := tApp.GetPriceFeedKeeper() + + mp := types.Params{ + Markets: []types.Market{ + {MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, + }, + } + keeper.SetParams(ctx, mp) + + prices := []struct { + oracle sdk.AccAddress + marketId string + price sdk.Dec + total int + }{ + {addrs[0], "tstusd", sdk.MustNewDecFromStr("0.33"), 1}, + {addrs[1], "tstusd", sdk.MustNewDecFromStr("0.35"), 2}, + {addrs[0], "tstusd", sdk.MustNewDecFromStr("0.37"), 2}, + } + + for _, p := range prices { + // Set price by oracle 1 + pp, err := keeper.SetPrice( + ctx, + p.oracle, + p.marketId, + p.price, + time.Now().UTC().Add(1*time.Hour), + ) + + require.NoError(t, err) + + // Get raw prices + rawPrices := keeper.GetRawPrices(ctx, "tstusd") + + require.Equal(t, p.total, len(rawPrices)) + require.Contains(t, rawPrices, pp) + + // Find the oracle and require price to be same + for _, rp := range rawPrices { + if p.oracle.String() == rp.OracleAddress { + require.Equal(t, p.price, rp.Price) + } + } + } +} + +// TestKeeper_GetSetCurrentPrice Test Setting the median price of an Asset +func TestKeeper_GetSetCurrentPrice(t *testing.T) { + _, addrs := app.GeneratePrivKeyAddressPairs(5) + tApp := app.NewTestApp() + ctx := tApp.NewContext(true, tmprototypes.Header{}). + WithBlockTime(time.Now().UTC()) keeper := tApp.GetPriceFeedKeeper() - mp := pricefeedtypes.Params{ - Markets: pricefeedtypes.Markets{ - pricefeedtypes.Market{MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, + mp := types.Params{ + Markets: []types.Market{ + {MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, }, } keeper.SetParams(ctx, mp) - // Set price by oracle 1 + _, err := keeper.SetPrice( ctx, addrs[0], "tstusd", sdk.MustNewDecFromStr("0.33"), - time.Now().Add(1*time.Hour)) - require.NoError(t, err) - // Get raw prices - rawPrices, err := keeper.GetRawPrices(ctx, "tstusd") + time.Now().Add(time.Hour*1)) require.NoError(t, err) - require.Equal(t, len(rawPrices), 1) - require.Equal(t, rawPrices[0].Price.Equal(sdk.MustNewDecFromStr("0.33")), true) - // Set price by oracle 2 + _, err = keeper.SetPrice( ctx, addrs[1], "tstusd", sdk.MustNewDecFromStr("0.35"), time.Now().Add(time.Hour*1)) require.NoError(t, err) - rawPrices, err = keeper.GetRawPrices(ctx, "tstusd") + _, err = keeper.SetPrice( + ctx, addrs[2], "tstusd", + sdk.MustNewDecFromStr("0.34"), + time.Now().Add(time.Hour*1)) require.NoError(t, err) - require.Equal(t, len(rawPrices), 2) - require.Equal(t, rawPrices[1].Price.Equal(sdk.MustNewDecFromStr("0.35")), true) - // Update Price by Oracle 1 + // Add an expired one which should fail _, err = keeper.SetPrice( - ctx, addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.37"), + ctx, addrs[3], "tstusd", + sdk.MustNewDecFromStr("0.9"), + ctx.BlockTime().Add(-time.Hour*1)) + require.Error(t, err) + + // Add a non-expired price, but will not be counted when BlockTime is changed + _, err = keeper.SetPrice( + ctx, addrs[3], "tstusd", + sdk.MustNewDecFromStr("0.9"), + time.Now().Add(time.Minute*30)) + require.NoError(t, err) + + // Update block time such that first 3 prices valid but last one is expired + ctx = ctx.WithBlockTime(time.Now().Add(time.Minute * 45)) + + // Set current price + err = keeper.SetCurrentPrices(ctx, "tstusd") + require.NoError(t, err) + + // Get current price + price, err := keeper.GetCurrentPrice(ctx, "tstusd") + require.Nil(t, err) + + expCurPrice := sdk.MustNewDecFromStr("0.34") + require.Truef( + t, + price.Price.Equal(expCurPrice), + "expected current price to equal %v, actual %v", + expCurPrice, price.Price, + ) + + // Even number of oracles + _, err = keeper.SetPrice( + ctx, addrs[4], "tstusd", + sdk.MustNewDecFromStr("0.36"), time.Now().Add(time.Hour*1)) require.NoError(t, err) - rawPrices, err = keeper.GetRawPrices(ctx, "tstusd") + + err = keeper.SetCurrentPrices(ctx, "tstusd") require.NoError(t, err) - require.Equal(t, rawPrices[0].Price.Equal(sdk.MustNewDecFromStr("0.37")), true) + + price, err = keeper.GetCurrentPrice(ctx, "tstusd") + require.Nil(t, err) + + exp := sdk.MustNewDecFromStr("0.345") + require.Truef(t, price.Price.Equal(exp), + "current price %s should be %s", + price.Price.String(), + exp.String(), + ) + + prices := keeper.GetCurrentPrices(ctx) + require.Equal(t, 1, len(prices)) + require.Equal(t, price, prices[0]) } -// TestKeeper_GetSetCurrentPrice Test Setting the median price of an Asset -func TestKeeper_GetSetCurrentPrice(t *testing.T) { - _, addrs := app.GeneratePrivKeyAddressPairs(4) +func TestKeeper_ExpiredSetCurrentPrices(t *testing.T) { + _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{}) + ctx := tApp.NewContext(true, tmprototypes.Header{}). + WithBlockTime(time.Now().UTC()) keeper := tApp.GetPriceFeedKeeper() - mp := pricefeedtypes.Params{ - Markets: pricefeedtypes.Markets{ - pricefeedtypes.Market{MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, + mp := types.Params{ + Markets: []types.Market{ + {MarketId: "tstusd", BaseAsset: "tst", QuoteAsset: "usd", Oracles: []string{}, Active: true}, }, } keeper.SetParams(ctx, mp) - keeper.SetPrice( + + _, err := keeper.SetPrice( ctx, addrs[0], "tstusd", sdk.MustNewDecFromStr("0.33"), time.Now().Add(time.Hour*1)) - keeper.SetPrice( + require.NoError(t, err) + + _, err = keeper.SetPrice( ctx, addrs[1], "tstusd", sdk.MustNewDecFromStr("0.35"), time.Now().Add(time.Hour*1)) - keeper.SetPrice( + require.NoError(t, err) + + _, err = keeper.SetPrice( ctx, addrs[2], "tstusd", sdk.MustNewDecFromStr("0.34"), time.Now().Add(time.Hour*1)) - // Set current price - err := keeper.SetCurrentPrices(ctx, "tstusd") require.NoError(t, err) - // Get Current price - price, err := keeper.GetCurrentPrice(ctx, "tstusd") - require.Nil(t, err) - require.Equal(t, price.Price.Equal(sdk.MustNewDecFromStr("0.34")), true) - // Even number of oracles - keeper.SetPrice( - ctx, addrs[3], "tstusd", - sdk.MustNewDecFromStr("0.36"), - time.Now().Add(time.Hour*1)) + // Update block time such that all prices expire + ctx = ctx.WithBlockTime(time.Now().UTC().Add(time.Hour * 2)) + err = keeper.SetCurrentPrices(ctx, "tstusd") - require.NoError(t, err) - price, err = keeper.GetCurrentPrice(ctx, "tstusd") - require.Nil(t, err) - require.Equal(t, price.Price.Equal(sdk.MustNewDecFromStr("0.345")), true) + require.ErrorIs(t, types.ErrNoValidPrice, err, "there should be no valid prices to be set") + + _, err = keeper.GetCurrentPrice(ctx, "tstusd") + require.ErrorIs(t, types.ErrNoValidPrice, err, "current prices should be invalid") } diff --git a/x/pricefeed/keeper/msg_server.go b/x/pricefeed/keeper/msg_server.go index a9e258399..230deb7ba 100644 --- a/x/pricefeed/keeper/msg_server.go +++ b/x/pricefeed/keeper/msg_server.go @@ -24,20 +24,22 @@ var _ types.MsgServer = msgServer{} func (k msgServer) PostPrice(c context.Context, msg *types.MsgPostPrice) (*types.MsgPostPriceResponse, error) { ctx := sdk.UnwrapSDKContext(c) + from, err := sdk.AccAddressFromBech32(msg.From) if err != nil { return nil, err } - err = k.keeper.ValidateAuthorityAndDeposit(ctx, msg.MarketId, from, msg.Deposit) + + _, err = k.keeper.GetOracle(ctx, msg.MarketId, from) if err != nil { return nil, err } - // TODO: slash deposit if the oracle is malicious _, err = k.keeper.SetPrice(ctx, from, msg.MarketId, msg.Price, msg.Expiry) if err != nil { return nil, err } + ctx.EventManager().EmitEvent( sdk.NewEvent( sdk.EventTypeMessage, diff --git a/x/pricefeed/keeper/params.go b/x/pricefeed/keeper/params.go index 0e8d3517f..787fba172 100644 --- a/x/pricefeed/keeper/params.go +++ b/x/pricefeed/keeper/params.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -23,31 +21,6 @@ func (k Keeper) GetMarkets(ctx sdk.Context) []types.Market { return k.GetParams(ctx).Markets } -func (k Keeper) GetTicker(ctx sdk.Context, denom string) (string, error) { - metadata, exists := k.bankKeeper.GetDenomMetaData(ctx, denom) - if !exists { - return "", sdkerrors.Wrap(types.ErrInternalDenomNotFound, denom) - } - return metadata.Symbol, nil -} - -func (k Keeper) GetMarketId(ctx sdk.Context, lhsTicker string, rhsTicker string) string { - return fmt.Sprintf("%s:%s", lhsTicker, rhsTicker) -} - -func (k Keeper) GetMarketIdFromDenom(ctx sdk.Context, lhsDenom string, rhsDenom string) (string, error) { - lhsTicker, err := k.GetTicker(ctx, lhsDenom) - if err != nil { - return "", err - } - rhsTicker, err := k.GetTicker(ctx, rhsDenom) - if err != nil { - return "", err - } - - return k.GetMarketId(ctx, lhsTicker, rhsTicker), nil -} - // GetOracles returns the oracles in the pricefeed store func (k Keeper) GetOracles(ctx sdk.Context, marketID string) ([]string, error) { for _, m := range k.GetMarkets(ctx) { @@ -62,7 +35,7 @@ func (k Keeper) GetOracles(ctx sdk.Context, marketID string) ([]string, error) { func (k Keeper) GetOracle(ctx sdk.Context, marketID string, address sdk.AccAddress) (sdk.AccAddress, error) { oracles, err := k.GetOracles(ctx, marketID) if err != nil { - return sdk.AccAddress{}, sdkerrors.Wrap(types.ErrInvalidMarket, marketID) + return nil, err } for _, oracle := range oracles { addr, err := sdk.AccAddressFromBech32(oracle) @@ -73,7 +46,7 @@ func (k Keeper) GetOracle(ctx sdk.Context, marketID string, address sdk.AccAddre return addr, nil } } - return sdk.AccAddress{}, sdkerrors.Wrap(types.ErrInvalidOracle, address.String()) + return nil, sdkerrors.Wrap(types.ErrInvalidOracle, address.String()) } // GetMarket returns the market if it is in the pricefeed system diff --git a/x/pricefeed/keeper/ticker.go b/x/pricefeed/keeper/ticker.go new file mode 100644 index 000000000..3aead22fc --- /dev/null +++ b/x/pricefeed/keeper/ticker.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/pricefeed/types" +) + +func (k Keeper) GetTicker(ctx sdk.Context, denom string) (string, error) { + metadata, exists := k.bankKeeper.GetDenomMetaData(ctx, denom) + if !exists { + return "", sdkerrors.Wrap(types.ErrInternalDenomNotFound, denom) + } + return metadata.Base, nil +} + +func (k Keeper) GetMarketId(ctx sdk.Context, lhsTicker string, rhsTicker string) string { + return fmt.Sprintf("%s:%s", lhsTicker, rhsTicker) +} + +func (k Keeper) GetMarketIdFromDenom(ctx sdk.Context, lhsDenom string, rhsDenom string) (string, error) { + lhsTicker, err := k.GetTicker(ctx, lhsDenom) + if err != nil { + return "", err + } + rhsTicker, err := k.GetTicker(ctx, rhsDenom) + if err != nil { + return "", err + } + + return k.GetMarketId(ctx, lhsTicker, rhsTicker), nil +} diff --git a/x/pricefeed/types/keys.go b/x/pricefeed/types/keys.go index 02f2db373..98786d7d3 100644 --- a/x/pricefeed/types/keys.go +++ b/x/pricefeed/types/keys.go @@ -1,5 +1,7 @@ package types +import sdk "github.com/cosmos/cosmos-sdk/types" + const ( // ModuleName defines the module name ModuleName = "pricefeed" @@ -17,28 +19,43 @@ const ( MemStoreKey = "mem_capability" ) -func KeyPrefix(p string) []byte { - return []byte(p) -} +var ( + // CurrentPricePrefix prefix for the current price of an asset + CurrentPricePrefix = []byte{0x00} -const ( - ParamsKey = "Params-value-" - MarketKey = "Market-value-" - MarketCountKey = "Market-count-" - OracleKey = "Oracle-value-" - PriceKey = "Price-value-" - PriceCountKey = "Price-count-" - RawPriceKey = "RawPrice-value-" - CurrentPriceKey = "CurrentPrice-value-" - RawPriceFeedKey = "RawPriceFeed-value-" + // RawPriceFeedPrefix prefix for the raw pricefeed of an asset + RawPriceFeedPrefix = []byte{0x01} ) -// CurrentPriceKeySuffix returns the prefix for the current price -func CurrentPriceKeySuffix(marketID string) []byte { - return append(KeyPrefix(CurrentPriceKey), []byte(marketID)...) +// CurrentPriceKey returns the prefix for the current price +func CurrentPriceKey(marketID string) []byte { + return append(CurrentPricePrefix, []byte(marketID)...) +} + +// RawPriceIteratorKey returns the prefix for the raw price for a single market +func RawPriceIteratorKey(marketID string) []byte { + return append( + RawPriceFeedPrefix, + lengthPrefixWithByte([]byte(marketID))..., + ) } -// RawPriceKeySuffix returns the prefix for the raw price -func RawPriceKeySuffix(marketID string) []byte { - return append(KeyPrefix(RawPriceFeedKey), []byte(marketID)...) +// RawPriceKey returns the prefix for the raw price +func RawPriceKey(marketID string, oracleAddr sdk.AccAddress) []byte { + return append( + RawPriceIteratorKey(marketID), + lengthPrefixWithByte(oracleAddr)..., + ) +} + +// lengthPrefixWithByte returns the input bytes prefixes with one byte containing its length. +// It panics if the input is greater than 255 in length. +func lengthPrefixWithByte(bz []byte) []byte { + length := len(bz) + + if length > 255 { + panic("cannot length prefix more than 255 bytes with single byte") + } + + return append([]byte{byte(length)}, bz...) } diff --git a/x/pricefeed/types/msgs.go b/x/pricefeed/types/msgs.go index 999c33b9a..7fb4955b3 100644 --- a/x/pricefeed/types/msgs.go +++ b/x/pricefeed/types/msgs.go @@ -11,9 +11,6 @@ import ( ) const ( - // TypeMsgPostPrice type of PostPrice msg - TypeMsgPostPrice = "post-price" - // MaxExpiry defines the max expiry time defined as UNIX time (9999-12-31 23:59:59 +0000 UTC) MaxExpiry = 253402300799 ) @@ -27,35 +24,15 @@ func NewMsgPostPrice( assetCode string, price sdk.Dec, expiry time.Time, - deposit sdk.Coin, ) MsgPostPrice { return MsgPostPrice{ From: from, MarketId: assetCode, Price: price, Expiry: expiry, - Deposit: deposit, } } -// Route Implements Msg. -func (msg MsgPostPrice) Route() string { return RouterKey } - -// Type Implements Msg -func (msg MsgPostPrice) Type() string { return TypeMsgPostPrice } - -// GetSignBytes Implements Msg. -func (msg MsgPostPrice) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners Implements Msg. -func (msg MsgPostPrice) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(msg.From) - return []sdk.AccAddress{addr} -} - // ValidateBasic does a simple validation check that doesn't require access to any other information. func (msg MsgPostPrice) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.From) @@ -74,3 +51,9 @@ func (msg MsgPostPrice) ValidateBasic() error { } return nil } + +// GetSigners Implements Msg. +func (msg MsgPostPrice) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.From) + return []sdk.AccAddress{addr} +} diff --git a/x/pricefeed/types/msgs_test.go b/x/pricefeed/types/msgs_test.go index a4ce87952..a97489164 100644 --- a/x/pricefeed/types/msgs_test.go +++ b/x/pricefeed/types/msgs_test.go @@ -3,15 +3,15 @@ package types import ( "testing" - "github.com/stretchr/testify/require" - + tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" - tmtime "github.com/cometbft/cometbft/types/time" + "github.com/UnUniFi/chain/testutil/sample" ) -func TestMsgPlaceBid_ValidateBasic(t *testing.T) { - addr := "someName" +func TestMsgPostPrice_ValidateBasic(t *testing.T) { + addr := sample.AccAddress() price, _ := sdk.NewDecFromStr("0.3005") expiry := tmtime.Now() negativePrice, _ := sdk.NewDecFromStr("-3.05") @@ -21,10 +21,10 @@ func TestMsgPlaceBid_ValidateBasic(t *testing.T) { msg MsgPostPrice expectPass bool }{ - {"normal", MsgPostPrice{addr, "xrp", price, expiry, sdk.NewCoin("uguu", sdk.NewInt(1000))}, true}, - {"emptyAddr", MsgPostPrice{"", "xrp", price, expiry, sdk.NewCoin("uguu", sdk.NewInt(1000))}, false}, - {"emptyAsset", MsgPostPrice{addr, "", price, expiry, sdk.NewCoin("uguu", sdk.NewInt(1000))}, false}, - {"negativePrice", MsgPostPrice{addr, "xrp", negativePrice, expiry, sdk.NewCoin("uguu", sdk.NewInt(1000))}, false}, + {"normal", MsgPostPrice{addr, "xrp", price, expiry}, true}, + {"emptyAddr", MsgPostPrice{"", "xrp", price, expiry}, false}, + {"emptyAsset", MsgPostPrice{addr, "", price, expiry}, false}, + {"negativePrice", MsgPostPrice{addr, "xrp", negativePrice, expiry}, false}, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { diff --git a/x/pricefeed/types/tx.pb.go b/x/pricefeed/types/tx.pb.go index f0a4db4e9..87327448c 100644 --- a/x/pricefeed/types/tx.pb.go +++ b/x/pricefeed/types/tx.pb.go @@ -6,8 +6,8 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -39,7 +39,6 @@ type MsgPostPrice struct { MarketId string `protobuf:"bytes,2,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty" yaml:"market_id"` Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price" yaml:"price"` Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry" yaml:"expiry"` - Deposit types.Coin `protobuf:"bytes,5,opt,name=deposit,proto3" json:"deposit"` } func (m *MsgPostPrice) Reset() { *m = MsgPostPrice{} } @@ -96,13 +95,6 @@ func (m *MsgPostPrice) GetExpiry() time.Time { return time.Time{} } -func (m *MsgPostPrice) GetDeposit() types.Coin { - if m != nil { - return m.Deposit - } - return types.Coin{} -} - type MsgPostPriceResponse struct { } @@ -147,35 +139,33 @@ func init() { func init() { proto.RegisterFile("ununifi/pricefeed/tx.proto", fileDescriptor_c80dae9a726a94ad) } var fileDescriptor_c80dae9a726a94ad = []byte{ - // 435 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x6a, 0xd4, 0x40, - 0x1c, 0xc7, 0x93, 0x76, 0x5b, 0xdd, 0x69, 0x45, 0x0d, 0x8b, 0xa4, 0x39, 0x64, 0x4a, 0x04, 0x2d, - 0x82, 0x33, 0x6c, 0x3d, 0xe9, 0xc1, 0x43, 0x2c, 0x82, 0x87, 0x85, 0x12, 0xba, 0x17, 0x11, 0x24, - 0x7f, 0x26, 0xe9, 0xd0, 0x66, 0x26, 0x64, 0x26, 0xb2, 0xfb, 0x16, 0xfb, 0x54, 0xb2, 0xc7, 0x3d, - 0x8a, 0x87, 0x28, 0xbb, 0x6f, 0x90, 0x27, 0x90, 0xcc, 0x24, 0x6b, 0xc0, 0x83, 0xa7, 0x4c, 0xf2, - 0xfd, 0xce, 0x67, 0x7e, 0xf9, 0x24, 0xc0, 0xa9, 0x58, 0xc5, 0x68, 0x4a, 0x71, 0x51, 0xd2, 0x98, - 0xa4, 0x84, 0x24, 0x58, 0x2e, 0x50, 0x51, 0x72, 0xc9, 0xad, 0xa7, 0x5d, 0x86, 0xf6, 0x99, 0x33, - 0xc9, 0x78, 0xc6, 0x55, 0x8a, 0xdb, 0x95, 0x2e, 0x3a, 0x30, 0xe3, 0x3c, 0xbb, 0x27, 0x58, 0xdd, - 0x45, 0x55, 0x8a, 0x25, 0xcd, 0x89, 0x90, 0x61, 0x5e, 0x74, 0x05, 0x37, 0xe6, 0x22, 0xe7, 0x02, - 0x47, 0xa1, 0x20, 0xf8, 0xdb, 0x34, 0x22, 0x32, 0x9c, 0xe2, 0x98, 0x53, 0xa6, 0x73, 0xef, 0xfb, - 0x01, 0x38, 0x9d, 0x89, 0xec, 0x9a, 0x0b, 0x79, 0xdd, 0x9e, 0x65, 0x3d, 0x07, 0xa3, 0xb4, 0xe4, - 0xb9, 0x6d, 0x9e, 0x9b, 0x17, 0x63, 0xff, 0x71, 0x53, 0xc3, 0x93, 0x65, 0x98, 0xdf, 0xbf, 0xf3, - 0xda, 0xa7, 0x5e, 0xa0, 0x42, 0x6b, 0x0a, 0xc6, 0x79, 0x58, 0xde, 0x11, 0xf9, 0x95, 0x26, 0xf6, - 0x81, 0x6a, 0x4e, 0x9a, 0x1a, 0x3e, 0xd1, 0xcd, 0x7d, 0xe4, 0x05, 0x0f, 0xf5, 0xfa, 0x53, 0x62, - 0xdd, 0x80, 0x23, 0xf5, 0x32, 0xf6, 0xa1, 0xaa, 0xbf, 0x5f, 0xd7, 0xd0, 0xf8, 0x59, 0xc3, 0x17, - 0x19, 0x95, 0xb7, 0x55, 0x84, 0x62, 0x9e, 0xe3, 0x6e, 0x54, 0x7d, 0x79, 0x2d, 0x92, 0x3b, 0x2c, - 0x97, 0x05, 0x11, 0xe8, 0x8a, 0xc4, 0x4d, 0x0d, 0x4f, 0x35, 0x5c, 0x41, 0xbc, 0x40, 0xc3, 0xac, - 0x19, 0x38, 0x26, 0x8b, 0x82, 0x96, 0x4b, 0x7b, 0x74, 0x6e, 0x5e, 0x9c, 0x5c, 0x3a, 0x48, 0x0b, - 0x41, 0xbd, 0x10, 0x74, 0xd3, 0x0b, 0xf1, 0xcf, 0xda, 0x23, 0x9b, 0x1a, 0x3e, 0xd2, 0x20, 0xbd, - 0xcf, 0x5b, 0xfd, 0x82, 0x66, 0xd0, 0x41, 0xac, 0xb7, 0xe0, 0x41, 0x42, 0x0a, 0x2e, 0xa8, 0xb4, - 0x8f, 0x14, 0xef, 0x0c, 0xe9, 0x69, 0x50, 0xeb, 0x0f, 0x75, 0xfe, 0xd0, 0x07, 0x4e, 0x99, 0x3f, - 0x6a, 0x71, 0x41, 0xdf, 0xf7, 0x9e, 0x81, 0xc9, 0xd0, 0x63, 0x40, 0x44, 0xc1, 0x99, 0x20, 0x97, - 0x5f, 0xc0, 0xe1, 0x4c, 0x64, 0xd6, 0x1c, 0x8c, 0xff, 0x3a, 0x86, 0xe8, 0x9f, 0xef, 0x8b, 0x86, - 0x9b, 0x9d, 0x97, 0xff, 0x29, 0xf4, 0x74, 0xff, 0x6a, 0xbd, 0x75, 0xcd, 0xcd, 0xd6, 0x35, 0x7f, - 0x6f, 0x5d, 0x73, 0xb5, 0x73, 0x8d, 0xcd, 0xce, 0x35, 0x7e, 0xec, 0x5c, 0xe3, 0xf3, 0xab, 0x81, - 0xd8, 0x39, 0x9b, 0x33, 0xfa, 0x91, 0xe2, 0xf8, 0x36, 0xa4, 0x0c, 0x2f, 0x86, 0x7f, 0x5c, 0x2b, - 0x38, 0x3a, 0x56, 0xb6, 0xde, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x15, 0x25, 0x95, 0x7b, 0x93, - 0x02, 0x00, 0x00, + // 405 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0xaa, 0xd3, 0x40, + 0x14, 0xc6, 0x93, 0x7b, 0xaf, 0x17, 0x3b, 0xad, 0xa8, 0xa1, 0x48, 0xcc, 0x22, 0x53, 0x22, 0x68, + 0x11, 0x9c, 0xa1, 0x75, 0xe7, 0xc2, 0x45, 0x29, 0x82, 0x8b, 0x42, 0x09, 0xed, 0x46, 0x04, 0xc9, + 0x9f, 0x49, 0x3a, 0xb4, 0xc9, 0x84, 0xcc, 0x44, 0xda, 0x67, 0x70, 0xd3, 0xc7, 0xea, 0xb2, 0x4b, + 0x71, 0x11, 0xa5, 0x7d, 0x83, 0x3c, 0x81, 0x64, 0x26, 0xad, 0x01, 0x17, 0x77, 0x95, 0x93, 0x7c, + 0xdf, 0xf9, 0x4e, 0xce, 0x6f, 0x06, 0x58, 0x45, 0x5a, 0xa4, 0x34, 0xa2, 0x38, 0xcb, 0x69, 0x40, + 0x22, 0x42, 0x42, 0x2c, 0xb6, 0x28, 0xcb, 0x99, 0x60, 0xc6, 0xf3, 0x46, 0x43, 0x57, 0xcd, 0xea, + 0xc7, 0x2c, 0x66, 0x52, 0xc5, 0x75, 0xa5, 0x8c, 0x16, 0x8c, 0x19, 0x8b, 0x37, 0x04, 0xcb, 0x37, + 0xbf, 0x88, 0xb0, 0xa0, 0x09, 0xe1, 0xc2, 0x4b, 0xb2, 0xc6, 0x60, 0x07, 0x8c, 0x27, 0x8c, 0x63, + 0xdf, 0xe3, 0x04, 0x7f, 0x1f, 0xf9, 0x44, 0x78, 0x23, 0x1c, 0x30, 0x9a, 0x2a, 0xdd, 0xf9, 0x71, + 0x03, 0x7a, 0x33, 0x1e, 0xcf, 0x19, 0x17, 0xf3, 0x7a, 0x96, 0xf1, 0x0a, 0xdc, 0x45, 0x39, 0x4b, + 0x4c, 0x7d, 0xa0, 0x0f, 0x3b, 0x93, 0xa7, 0x55, 0x09, 0xbb, 0x3b, 0x2f, 0xd9, 0x7c, 0x70, 0xea, + 0xaf, 0x8e, 0x2b, 0x45, 0x63, 0x04, 0x3a, 0x89, 0x97, 0xaf, 0x89, 0xf8, 0x46, 0x43, 0xf3, 0x46, + 0x3a, 0xfb, 0x55, 0x09, 0x9f, 0x29, 0xe7, 0x55, 0x72, 0xdc, 0xc7, 0xaa, 0xfe, 0x1c, 0x1a, 0x0b, + 0xf0, 0x48, 0x2e, 0x63, 0xde, 0x4a, 0xfb, 0xc7, 0x43, 0x09, 0xb5, 0x5f, 0x25, 0x7c, 0x1d, 0x53, + 0xb1, 0x2a, 0x7c, 0x14, 0xb0, 0x04, 0x37, 0xbf, 0xaa, 0x1e, 0xef, 0x78, 0xb8, 0xc6, 0x62, 0x97, + 0x11, 0x8e, 0xa6, 0x24, 0xa8, 0x4a, 0xd8, 0x53, 0xe1, 0x32, 0xc4, 0x71, 0x55, 0x98, 0x31, 0x03, + 0xf7, 0x64, 0x9b, 0xd1, 0x7c, 0x67, 0xde, 0x0d, 0xf4, 0x61, 0x77, 0x6c, 0x21, 0x05, 0x04, 0x5d, + 0x80, 0xa0, 0xc5, 0x05, 0xc8, 0xe4, 0x65, 0x3d, 0xb2, 0x2a, 0xe1, 0x13, 0x15, 0xa4, 0xfa, 0x9c, + 0xfd, 0x6f, 0xa8, 0xbb, 0x4d, 0x88, 0xf3, 0x02, 0xf4, 0xdb, 0x30, 0x5c, 0xc2, 0x33, 0x96, 0x72, + 0x32, 0xfe, 0x0a, 0x6e, 0x67, 0x3c, 0x36, 0x96, 0xa0, 0xf3, 0x0f, 0x14, 0x44, 0xff, 0x1d, 0x12, + 0x6a, 0x37, 0x5b, 0x6f, 0x1e, 0x30, 0x5c, 0xd2, 0x27, 0xd3, 0xc3, 0xc9, 0xd6, 0x8f, 0x27, 0x5b, + 0xff, 0x73, 0xb2, 0xf5, 0xfd, 0xd9, 0xd6, 0x8e, 0x67, 0x5b, 0xfb, 0x79, 0xb6, 0xb5, 0x2f, 0x6f, + 0x5b, 0x74, 0x96, 0xe9, 0x32, 0xa5, 0x9f, 0x28, 0x0e, 0x56, 0x1e, 0x4d, 0xf1, 0xb6, 0x7d, 0x6d, + 0x6a, 0x4a, 0xfe, 0xbd, 0x5c, 0xf9, 0xfd, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0x43, 0x82, + 0xc8, 0x58, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -278,22 +268,12 @@ func (m *MsgPostPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Expiry, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry):]) - if err2 != nil { - return 0, err2 + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Expiry, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry):]) + if err1 != nil { + return 0, err1 } - i -= n2 - i = encodeVarintTx(dAtA, i, uint64(n2)) + i -= n1 + i = encodeVarintTx(dAtA, i, uint64(n1)) i-- dAtA[i] = 0x22 { @@ -375,8 +355,6 @@ func (m *MsgPostPrice) Size() (n int) { n += 1 + l + sovTx(uint64(l)) l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiry) n += 1 + l + sovTx(uint64(l)) - l = m.Deposit.Size() - n += 1 + l + sovTx(uint64(l)) return n } @@ -555,39 +533,6 @@ func (m *MsgPostPrice) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/yieldaggregator/LICENSE.md b/x/yieldaggregator/LICENSE.md new file mode 100644 index 000000000..e2ad27d0d --- /dev/null +++ b/x/yieldaggregator/LICENSE.md @@ -0,0 +1,102 @@ +Business Source License 1.1 + +License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. +"Business Source License" is a trademark of MariaDB Corporation Ab. + +----------------------------------------------------------------------------- + +Parameters + +Licensor: CAUCHYE ASIA PTE. LTD. + +Licensed Work: UnUniFi Core NFT Backed loan module + UnUniFi Core Interchain Yield Aggregator module + UnUniFi Core Derivatives module + The Licensed Work is (c) 2023 CAUCHYE ASIA PTE. LTD. + +Additional Use Grant: Non-commercial testnet building + Development of smart contracts that are integrated with the Licensed Work + Type definition files for developing interoperable modules or smart contracts that are integrated with the Licensed Work + +Change Date: The earlier of 2027-08-01 + +Change License: GNU General Public License v3.0 or later + +----------------------------------------------------------------------------- + +Terms + +The Licensor hereby grants you the right to copy, modify, create derivative +works, redistribute, and make non-production use of the Licensed Work. The +Licensor may make an Additional Use Grant, above, permitting limited +production use. + +Effective on the Change Date, or the fourth anniversary of the first publicly +available distribution of a specific version of the Licensed Work under this +License, whichever comes first, the Licensor hereby grants you rights under +the terms of the Change License, and the rights granted in the paragraph +above terminate. + +If your use of the Licensed Work does not comply with the requirements +currently in effect as described in this License, you must purchase a +commercial license from the Licensor, its affiliated entities, or authorized +resellers, or you must refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works +of the Licensed Work, are subject to this License. This License applies +separately for each version of the Licensed Work and the Change Date may vary +for each version of the Licensed Work released by Licensor. + +You must conspicuously display this License on each original or modified copy +of the Licensed Work. If you receive the Licensed Work in original or +modified form from a third party, the terms and conditions set forth in this +License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically +terminate your rights under this License for the current and all other +versions of the Licensed Work. + +This License does not grant you any right in any trademark or logo of +Licensor or its affiliates (provided that you may use a trademark or logo of +Licensor as expressly required by this License). + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +TITLE. + +MariaDB hereby grants you permission to use this License’s text to license +your works, and to refer to it using the trademark "Business Source License", +as long as you comply with the Covenants of Licensor below. + +----------------------------------------------------------------------------- + +Covenants of Licensor + +In consideration of the right to use this License’s text and the "Business +Source License" name and trademark, Licensor covenants to MariaDB, and to all +other recipients of the licensed work to be provided by Licensor: + +1. To specify as the Change License the GPL Version 2.0 or any later version, + or a license that is compatible with GPL Version 2.0 or a later version, + where "compatible" means that software provided under the Change License can + be included in a program with software provided under GPL Version 2.0 or a + later version. Licensor may specify additional Change Licenses without + limitation. + +2. To either: (a) specify an additional grant of rights to use that does not + impose any additional restriction on the right granted in this License, as + the Additional Use Grant; or (b) insert the text "None". + +3. To specify a Change Date. + +4. Not to modify this License in any other way. + +----------------------------------------------------------------------------- + +Notice + +The Business Source License (this document, or the "License") is not an Open +Source license. However, the Licensed Work will eventually be made available +under an Open Source License, as stated in this License. diff --git a/x/yieldaggregator/client/cli/tx.go b/x/yieldaggregator/client/cli/tx.go index 542d65deb..db2303fbb 100644 --- a/x/yieldaggregator/client/cli/tx.go +++ b/x/yieldaggregator/client/cli/tx.go @@ -2,54 +2,14 @@ package cli import ( "fmt" - "time" - - flag "github.com/spf13/pflag" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/UnUniFi/chain/x/yieldaggregator/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -const ( - FlagTitle = "title" - FlagDescription = "description" - FlagDenom = "denom" - FlagContractAddress = "contract-addr" - FlagName = "name" - FlagGitUrl = "git-url" -) - -func FlagProposalAddStrategyTx() *flag.FlagSet { - fs := flag.NewFlagSet("", flag.ContinueOnError) - - fs.String(FlagTitle, "", "title of the proposal") - fs.String(FlagDescription, "", "description of the proposal") - fs.String(govcli.FlagDeposit, "", "initial deposit on the proposal") - fs.String(FlagDenom, "", "denom of the strategy") - fs.String(FlagContractAddress, "", "contract address of the strategy") - fs.String(FlagName, "", "name of the strategy") - fs.String(FlagGitUrl, "", "git url of the strategy") - - return fs -} - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ @@ -61,85 +21,12 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand( - CmdTxCreateVault(), - CmdTxDeleteVault(), CmdTxDepositToVault(), CmdTxWithdrawFromVault(), + CmdTxCreateVault(), CmdTxTransferVaultOwnership(), - NewSubmitProposalAddStrategyTxCmd(), + CmdTxDeleteVault(), ) return cmd } - -// NewSubmitProposalAddStrategyTxCmd returns a CLI command handler for creating -// a proposal to add new strategy -func NewSubmitProposalAddStrategyTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "proposal-add-strategy", - Args: cobra.ExactArgs(0), - Short: "Submit a proposal to add a strategy", - Long: fmt.Sprintf(`Submit a proposal to add a strategy.`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - title, err := cmd.Flags().GetString(FlagTitle) - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(FlagDescription) - if err != nil { - return err - } - - denom, err := cmd.Flags().GetString(FlagDenom) - if err != nil { - return err - } - - contractAddr, err := cmd.Flags().GetString(FlagContractAddress) - if err != nil { - return err - } - - name, err := cmd.Flags().GetString(FlagName) - if err != nil { - return err - } - - gitUrl, err := cmd.Flags().GetString(FlagGitUrl) - if err != nil { - return err - } - - content := types.NewProposalAddStrategy(title, description, denom, contractAddr, name, gitUrl) - - depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().AddFlagSet(FlagProposalAddStrategyTx()) - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/yieldaggregator/client/proposal_handler.go b/x/yieldaggregator/client/proposal_handler.go deleted file mode 100644 index d7da985e1..000000000 --- a/x/yieldaggregator/client/proposal_handler.go +++ /dev/null @@ -1,9 +0,0 @@ -package client - -import ( - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - - "github.com/UnUniFi/chain/x/yieldaggregator/client/cli" -) - -var ProposalAddStrategyHandler = govclient.NewProposalHandler(cli.NewSubmitProposalAddStrategyTxCmd) diff --git a/x/yieldaggregator/genesis.go b/x/yieldaggregator/genesis.go index 3dc2958aa..0861d3f77 100644 --- a/x/yieldaggregator/genesis.go +++ b/x/yieldaggregator/genesis.go @@ -10,19 +10,23 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) - for _, Strategies := range genState.Strategies { - k.SetStrategy(ctx, Strategies.Denom, Strategies) + k.SetParams(ctx, &genState.Params) + + for _, strategy := range genState.Strategies { + k.AppendStrategy(ctx, strategy.Denom, strategy) } for _, vault := range genState.Vaults { - k.SetVault(ctx, vault) + k.AppendVault(ctx, vault) } } // ExportGenesis returns the module's exported genesis func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) + params, _ := k.GetParams(ctx) + if params != nil { + genesis.Params = *params + } genesis.Strategies = k.GetAllStrategy(ctx, "") genesis.Vaults = k.GetAllVault(ctx) diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/types.go b/x/yieldaggregator/ibcstaking/icacallbacks/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/yieldaggregator/ibcstaking/icacallbacks/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/simap.go b/x/yieldaggregator/ibcstaking/stakeibc/simulation/simap.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/simap.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/types.go b/x/yieldaggregator/ibcstaking/stakeibc/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/yieldaggregator/ibcstaking/stakeibc/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/yieldaggregator/keeper/grpc_query_estimate_mint_amount.go b/x/yieldaggregator/keeper/grpc_query_estimate_mint_amount.go index e6f00f0be..341e96e02 100644 --- a/x/yieldaggregator/keeper/grpc_query_estimate_mint_amount.go +++ b/x/yieldaggregator/keeper/grpc_query_estimate_mint_amount.go @@ -22,7 +22,12 @@ func (k Keeper) EstimateMintAmount(c context.Context, req *types.QueryEstimateMi if !found { return nil, types.ErrInvalidVaultId } - mintAmount := k.EstimateMintAmountInternal(ctx, vault.Denom, vault.Id, req.DepositAmount) + + depositAmount, ok := sdk.NewIntFromString(req.DepositAmount) + if !ok { + return nil, types.ErrInvalidAmount + } + mintAmount := k.EstimateMintAmountInternal(ctx, vault.Denom, vault.Id, depositAmount) return &types.QueryEstimateMintAmountResponse{ MintAmount: mintAmount, diff --git a/x/yieldaggregator/keeper/grpc_query_estimate_redeem_amount.go b/x/yieldaggregator/keeper/grpc_query_estimate_redeem_amount.go index df8ee79fc..cea62fd6f 100644 --- a/x/yieldaggregator/keeper/grpc_query_estimate_redeem_amount.go +++ b/x/yieldaggregator/keeper/grpc_query_estimate_redeem_amount.go @@ -22,7 +22,11 @@ func (k Keeper) EstimateRedeemAmount(c context.Context, req *types.QueryEstimate if !found { return nil, types.ErrInvalidVaultId } - redeemAmount := k.EstimateRedeemAmountInternal(ctx, vault.Denom, vault.Id, req.BurnAmount) + burnAmount, ok := sdk.NewIntFromString(req.BurnAmount) + if !ok { + return nil, types.ErrInvalidAmount + } + redeemAmount := k.EstimateRedeemAmountInternal(ctx, vault.Denom, vault.Id, burnAmount) return &types.QueryEstimateRedeemAmountResponse{ RedeemAmount: redeemAmount, diff --git a/x/yieldaggregator/keeper/grpc_query_params.go b/x/yieldaggregator/keeper/grpc_query_params.go index e5056b7d5..16c992f86 100644 --- a/x/yieldaggregator/keeper/grpc_query_params.go +++ b/x/yieldaggregator/keeper/grpc_query_params.go @@ -16,5 +16,10 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types } ctx := sdk.UnwrapSDKContext(c) - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + params, err := k.GetParams(ctx) + if err != nil { + return nil, err + } + + return &types.QueryParamsResponse{Params: *params}, nil } diff --git a/x/yieldaggregator/keeper/grpc_query_params_test.go b/x/yieldaggregator/keeper/grpc_query_params_test.go index baa22cfd5..2cf5a7b79 100644 --- a/x/yieldaggregator/keeper/grpc_query_params_test.go +++ b/x/yieldaggregator/keeper/grpc_query_params_test.go @@ -10,7 +10,7 @@ func (suite *KeeperTestSuite) TestParamsQuery() { keeper, ctx := suite.app.YieldaggregatorKeeper, suite.ctx wctx := sdk.WrapSDKContext(ctx) params := types.DefaultParams() - keeper.SetParams(ctx, params) + keeper.SetParams(ctx, ¶ms) response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) suite.Require().NoError(err) diff --git a/x/yieldaggregator/keeper/hooks.go b/x/yieldaggregator/keeper/hooks.go index 3377119f7..b83a89c99 100644 --- a/x/yieldaggregator/keeper/hooks.go +++ b/x/yieldaggregator/keeper/hooks.go @@ -44,6 +44,21 @@ func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochInfo epochstypes.EpochInf } } } + + strategies := k.GetAllStrategy(ctx, "") + for _, strategy := range strategies { + contractAddr, err := sdk.AccAddressFromBech32(strategy.ContractAddress) + if err != nil { + continue + } + if epochIdentifier == epochstypes.BASE_EPOCH { + wasmMsg := `{"execute_epoch":{}}` + _, err := k.wasmKeeper.Execute(ctx, contractAddr, contractAddr, []byte(wasmMsg), sdk.Coins{}) + if err != nil { + continue + } + } + } } func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochInfo epochstypes.EpochInfo) { diff --git a/x/yieldaggregator/keeper/keeper.go b/x/yieldaggregator/keeper/keeper.go index 46e925faa..c73656e1b 100644 --- a/x/yieldaggregator/keeper/keeper.go +++ b/x/yieldaggregator/keeper/keeper.go @@ -10,47 +10,43 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - stakeibckeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" + stakeibckeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" "github.com/UnUniFi/chain/x/yieldaggregator/types" ) type Keeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey - paramstore paramtypes.Subspace bankKeeper types.BankKeeper wasmKeeper wasmtypes.ContractOpsKeeper wasmReader wasmkeeper.Keeper stakeibcKeeper stakeibckeeper.Keeper recordsKeeper types.RecordsKeeper + + authority string } func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, - paramSpace paramtypes.Subspace, bk types.BankKeeper, wasmKeeper wasmtypes.ContractOpsKeeper, wasmReader wasmkeeper.Keeper, stakeibcKeeper stakeibckeeper.Keeper, recordsKeeper types.RecordsKeeper, + authority string, ) Keeper { - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } return Keeper{ cdc: cdc, storeKey: storeKey, - paramstore: paramSpace, bankKeeper: bk, wasmKeeper: wasmKeeper, wasmReader: wasmReader, stakeibcKeeper: stakeibcKeeper, recordsKeeper: recordsKeeper, + authority: authority, } } diff --git a/x/yieldaggregator/keeper/lp.go b/x/yieldaggregator/keeper/lp.go index b64f8f2b4..3ddba8cfe 100644 --- a/x/yieldaggregator/keeper/lp.go +++ b/x/yieldaggregator/keeper/lp.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -9,7 +10,7 @@ import ( "github.com/UnUniFi/chain/x/yieldaggregator/types" ) -func (k Keeper) VaultAmountInStrategies(ctx sdk.Context, vault types.Vault) sdk.Int { +func (k Keeper) VaultAmountInStrategies(ctx sdk.Context, vault types.Vault) sdkmath.Int { amountInStrategies := sdk.ZeroInt() // calculate amount in strategies @@ -27,7 +28,7 @@ func (k Keeper) VaultAmountInStrategies(ctx sdk.Context, vault types.Vault) sdk. return amountInStrategies } -func (k Keeper) VaultUnbondingAmountInStrategies(ctx sdk.Context, vault types.Vault) sdk.Int { +func (k Keeper) VaultUnbondingAmountInStrategies(ctx sdk.Context, vault types.Vault) sdkmath.Int { unbondingAmount := sdk.ZeroInt() // calculate amount in strategies @@ -63,7 +64,7 @@ func (k Keeper) VaultAmountTotal(ctx sdk.Context, vault types.Vault) sdk.Int { // lpAmount = lpSupply * (principalAmountToMint / principalAmountInVault) // If principalAmountInVault is zero, lpAmount = principalAmountToMint -func (k Keeper) EstimateMintAmountInternal(ctx sdk.Context, vaultDenom string, vaultId uint64, principalAmount sdk.Int) sdk.Coin { +func (k Keeper) EstimateMintAmountInternal(ctx sdk.Context, vaultDenom string, vaultId uint64, principalAmount sdkmath.Int) sdk.Coin { lpDenom := types.GetLPTokenDenom(vaultId) vault, found := k.GetVault(ctx, vaultId) if !found { @@ -83,7 +84,7 @@ func (k Keeper) EstimateMintAmountInternal(ctx sdk.Context, vaultDenom string, v // calculate principalAmount // principalAmount = principalAmountInVault * (lpAmountToBurn / lpSupply) -func (k Keeper) EstimateRedeemAmountInternal(ctx sdk.Context, vaultDenom string, vaultId uint64, lpAmount sdk.Int) sdk.Coin { +func (k Keeper) EstimateRedeemAmountInternal(ctx sdk.Context, vaultDenom string, vaultId uint64, lpAmount sdkmath.Int) sdk.Coin { vault, found := k.GetVault(ctx, vaultId) if !found { return sdk.NewCoin(vaultDenom, sdk.ZeroInt()) @@ -148,12 +149,17 @@ func (k Keeper) DepositAndMintLPToken(ctx sdk.Context, address sdk.AccAddress, v return nil } -func (k Keeper) BurnLPTokenAndRedeem(ctx sdk.Context, address sdk.AccAddress, vaultId uint64, lpAmount sdk.Int) error { +func (k Keeper) BurnLPTokenAndRedeem(ctx sdk.Context, address sdk.AccAddress, vaultId uint64, lpAmount sdkmath.Int) error { vault, found := k.GetVault(ctx, vaultId) if !found { return types.ErrInvalidVaultId } + params, err := k.GetParams(ctx) + if err != nil { + return err + } + principal := k.EstimateRedeemAmountInternal(ctx, vault.Denom, vaultId, lpAmount) // burn lp tokens after calculating withdrawal amount @@ -161,7 +167,7 @@ func (k Keeper) BurnLPTokenAndRedeem(ctx sdk.Context, address sdk.AccAddress, va vaultModAddr := authtypes.NewModuleAddress(vaultModName) lpDenom := types.GetLPTokenDenom(vaultId) lp := sdk.NewCoin(lpDenom, lpAmount) - err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, sdk.NewCoins(lp)) + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, sdk.NewCoins(lp)) if err != nil { return err } @@ -198,19 +204,32 @@ func (k Keeper) BurnLPTokenAndRedeem(ctx sdk.Context, address sdk.AccAddress, va withdrawFee := sdk.NewDecFromInt(principal.Amount).Mul(withdrawFeeRate).RoundInt() withdrawAmount := principal.Amount.Sub(withdrawFee) - withdrawCommissionFee := sdk.NewDecFromInt(withdrawAmount).Mul(vault.WithdrawCommissionRate).RoundInt() - withdrawAmountWithoutCommission := withdrawAmount.Sub(withdrawCommissionFee) + withdrawModuleCommissionFee := sdk.NewDecFromInt(withdrawAmount).Mul(params.CommissionRate).RoundInt() + withdrawVaultCommissionFee := sdk.NewDecFromInt(withdrawAmount).Mul(vault.WithdrawCommissionRate).RoundInt() + withdrawAmountWithoutCommission := withdrawAmount.Sub(withdrawModuleCommissionFee).Sub(withdrawVaultCommissionFee) - if withdrawCommissionFee.IsPositive() { + if withdrawModuleCommissionFee.IsPositive() { + feeCollector, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) + if err != nil { + return err + } + err = k.bankKeeper.SendCoins(ctx, vaultModAddr, feeCollector, sdk.NewCoins(sdk.NewCoin(principal.Denom, withdrawModuleCommissionFee))) + if err != nil { + return err + } + } + + if withdrawVaultCommissionFee.IsPositive() { vaultOwner, err := sdk.AccAddressFromBech32(vault.Owner) if err != nil { return err } - err = k.bankKeeper.SendCoins(ctx, vaultModAddr, vaultOwner, sdk.NewCoins(sdk.NewCoin(principal.Denom, withdrawCommissionFee))) + err = k.bankKeeper.SendCoins(ctx, vaultModAddr, vaultOwner, sdk.NewCoins(sdk.NewCoin(principal.Denom, withdrawVaultCommissionFee))) if err != nil { return err } } + err = k.bankKeeper.SendCoins(ctx, vaultModAddr, address, sdk.NewCoins(sdk.NewCoin(principal.Denom, withdrawAmountWithoutCommission))) if err != nil { return err diff --git a/x/yieldaggregator/keeper/msg_server_create_vault.go b/x/yieldaggregator/keeper/msg_server_create_vault.go index fd655972a..a866b5411 100644 --- a/x/yieldaggregator/keeper/msg_server_create_vault.go +++ b/x/yieldaggregator/keeper/msg_server_create_vault.go @@ -11,12 +11,19 @@ import ( func (k msgServer) CreateVault(goCtx context.Context, msg *types.MsgCreateVault) (*types.MsgCreateVaultResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - params := k.Keeper.GetParams(ctx) + params, err := k.Keeper.GetParams(ctx) + if err != nil { + return nil, err + } sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err } + feeCollector, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) + if err != nil { + return nil, err + } if msg.Fee.Denom != params.VaultCreationFee.Denom { return nil, types.ErrInvalidFeeDenom @@ -33,7 +40,7 @@ func (k msgServer) CreateVault(goCtx context.Context, msg *types.MsgCreateVault) } // transfer fee - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.NewCoins(msg.Fee)) + err = k.bankKeeper.SendCoins(ctx, sender, feeCollector, sdk.NewCoins(msg.Fee)) if err != nil { return nil, err } @@ -59,7 +66,9 @@ func (k msgServer) CreateVault(goCtx context.Context, msg *types.MsgCreateVault) WithdrawReserveRate: msg.WithdrawReserveRate, StrategyWeights: msg.StrategyWeights, } - k.Keeper.AppendVault(ctx, vault) + id := k.Keeper.AppendVault(ctx, vault) - return &types.MsgCreateVaultResponse{}, nil + return &types.MsgCreateVaultResponse{ + Id: id, + }, nil } diff --git a/x/yieldaggregator/keeper/msg_server_delete_vault.go b/x/yieldaggregator/keeper/msg_server_delete_vault.go index 1af9acadc..8604b6e8f 100644 --- a/x/yieldaggregator/keeper/msg_server_delete_vault.go +++ b/x/yieldaggregator/keeper/msg_server_delete_vault.go @@ -4,11 +4,16 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/UnUniFi/chain/x/yieldaggregator/types" ) func (k msgServer) DeleteVault(goCtx context.Context, msg *types.MsgDeleteVault) (*types.MsgDeleteVaultResponse, error) { + if k.authority != msg.Sender { + return nil, sdkerrors.ErrUnauthorized + } + ctx := sdk.UnwrapSDKContext(goCtx) sender, err := sdk.AccAddressFromBech32(msg.Sender) @@ -20,13 +25,11 @@ func (k msgServer) DeleteVault(goCtx context.Context, msg *types.MsgDeleteVault) return nil, types.ErrInvalidVaultId } - // TODO: reenable positive fund check - just disabled to remove invalid vaults on testnet - // // ensure no funds available on the vault - // totalVaultAmount := k.VaultAmountTotal(ctx, vault) - // if totalVaultAmount.IsPositive() { - // return nil, types.ErrVaultHasPositiveBalance - // } - // TODO: add owner check + // TODO: force all strategies to unstake for each holders + + if vault.Owner != msg.Sender { + return nil, sdkerrors.ErrUnauthorized + } // transfer deposit err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sender, sdk.NewCoins(vault.OwnerDeposit)) diff --git a/x/yieldaggregator/keeper/msg_server_register_strategy.go b/x/yieldaggregator/keeper/msg_server_register_strategy.go new file mode 100644 index 000000000..cdd7e8688 --- /dev/null +++ b/x/yieldaggregator/keeper/msg_server_register_strategy.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/yieldaggregator/types" +) + +func (k msgServer) RegisterStrategy(goCtx context.Context, msg *types.MsgRegisterStrategy) (*types.MsgRegisterStrategyResponse, error) { + if k.authority != msg.Sender { + return nil, sdkerrors.ErrUnauthorized + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + k.AppendStrategy(ctx, msg.Denom, types.Strategy{ + Denom: msg.Denom, + ContractAddress: msg.ContractAddress, + Name: msg.Name, + GitUrl: msg.GitUrl, + }) + + return &types.MsgRegisterStrategyResponse{}, nil +} diff --git a/x/yieldaggregator/keeper/msg_server_update_params.go b/x/yieldaggregator/keeper/msg_server_update_params.go new file mode 100644 index 000000000..3d2244ef6 --- /dev/null +++ b/x/yieldaggregator/keeper/msg_server_update_params.go @@ -0,0 +1,22 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/UnUniFi/chain/x/yieldaggregator/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.authority != msg.Sender { + return nil, sdkerrors.ErrUnauthorized + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + k.SetParams(ctx, &msg.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/yieldaggregator/keeper/params.go b/x/yieldaggregator/keeper/params.go index 8d1e40afd..2a0e7d8ff 100644 --- a/x/yieldaggregator/keeper/params.go +++ b/x/yieldaggregator/keeper/params.go @@ -2,17 +2,36 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/UnUniFi/chain/x/yieldaggregator/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return +func (k Keeper) GetParams(ctx sdk.Context) (*types.Params, error) { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(types.KeyParams) + if bz == nil { + return nil, sdkerrors.ErrNotFound.Wrap("x/yieldaggregator module params") + } + + var params types.Params + if err := k.cdc.Unmarshal(bz, ¶ms); err != nil { + return nil, types.ErrParsingParams.Wrap(err.Error()) + } + + return ¶ms, nil } -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { + store := ctx.KVStore(k.storeKey) + + bz, err := k.cdc.Marshal(params) + if err != nil { + return types.ErrParsingParams.Wrap(err.Error()) + } + + store.Set(types.KeyParams, bz) + + return nil } diff --git a/x/yieldaggregator/keeper/params_test.go b/x/yieldaggregator/keeper/params_test.go index da2ca9e39..734b692af 100644 --- a/x/yieldaggregator/keeper/params_test.go +++ b/x/yieldaggregator/keeper/params_test.go @@ -3,9 +3,12 @@ package keeper_test import sdk "github.com/cosmos/cosmos-sdk/types" func (suite *KeeperTestSuite) TestParamsGetSet() { - params := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) + params, err := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) + suite.Require().NoError(err) params.CommissionRate = sdk.NewDecWithPrec(1, 1) suite.app.YieldaggregatorKeeper.SetParams(suite.ctx, params) - newParams := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) + newParams, err := suite.app.YieldaggregatorKeeper.GetParams(suite.ctx) + suite.Require().NoError(err) + suite.Require().Equal(params, newParams) } diff --git a/x/yieldaggregator/keeper/strategy.go b/x/yieldaggregator/keeper/strategy.go index efbdf50c7..d4a0dcee0 100644 --- a/x/yieldaggregator/keeper/strategy.go +++ b/x/yieldaggregator/keeper/strategy.go @@ -206,31 +206,3 @@ func (k Keeper) GetUnbondingAmountFromStrategy(ctx sdk.Context, vault types.Vaul return sdk.NewCoin(strategy.Denom, amount), err } } - -func (k Keeper) GetAPRFromStrategy(ctx sdk.Context, strategy types.Strategy) (*sdk.Dec, error) { - switch strategy.ContractAddress { - case "x/ibc-staking": - { - - return nil, nil - } - } - // call `apr` function of the strategy contract - panic("not implemented") - - return nil, nil -} - -func (k Keeper) GetInterestFeeRate(ctx sdk.Context, strategy types.Strategy) (*sdk.Dec, error) { - switch strategy.ContractAddress { - case "x/ibc-staking": - { - - return nil, nil - } - } - // call `interest_fee_rate` function of the strategy contract - panic("not implemented") - - return nil, nil -} diff --git a/x/yieldaggregator/keeper/strategy_test.go b/x/yieldaggregator/keeper/strategy_test.go index 74e9db257..3a41760d4 100644 --- a/x/yieldaggregator/keeper/strategy_test.go +++ b/x/yieldaggregator/keeper/strategy_test.go @@ -11,9 +11,9 @@ import ( "github.com/UnUniFi/chain/testutil/nullify" epochtypes "github.com/UnUniFi/chain/x/epochs/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" "github.com/UnUniFi/chain/x/yieldaggregator/keeper" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + stakeibctypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" "github.com/UnUniFi/chain/x/yieldaggregator/types" ) diff --git a/x/yieldaggregator/keeper/vault.go b/x/yieldaggregator/keeper/vault.go index 1ddd99d14..394b1b8bb 100644 --- a/x/yieldaggregator/keeper/vault.go +++ b/x/yieldaggregator/keeper/vault.go @@ -106,22 +106,3 @@ func GetVaultIDBytes(id uint64) []byte { func GetVaultIDFromBytes(bz []byte) uint64 { return binary.BigEndian.Uint64(bz) } - -func (k Keeper) GetAPY(ctx sdk.Context, vaultId uint64) (*sdk.Dec, error) { - vault, found := k.GetVault(ctx, vaultId) - if !found { - return nil, types.ErrInvalidVaultId - } - - sum := sdk.ZeroDec() - for _, weight := range vault.StrategyWeights { - strategy, _ := k.GetStrategy(ctx, vault.Denom, weight.StrategyId) - apr, err := k.GetAPRFromStrategy(ctx, strategy) - if err != nil { - return nil, err - } - sum = sum.Add(apr.Mul(weight.Weight)) - } - - return &sum, nil -} diff --git a/x/yieldaggregator/proposal_handler.go b/x/yieldaggregator/proposal_handler.go deleted file mode 100644 index 5c354e801..000000000 --- a/x/yieldaggregator/proposal_handler.go +++ /dev/null @@ -1,33 +0,0 @@ -package yieldaggregator - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/UnUniFi/chain/x/yieldaggregator/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/types" -) - -// NewYieldAggregatorProposalHandler creates a new governance Handler -func NewYieldAggregatorProposalHandler(k keeper.Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *types.ProposalAddStrategy: - return handleProposalAddStrategy(ctx, k, c) - - default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized param proposal content type: %T", c) - } - } -} - -func handleProposalAddStrategy(ctx sdk.Context, k keeper.Keeper, p *types.ProposalAddStrategy) error { - k.AppendStrategy(ctx, p.Denom, types.Strategy{ - Denom: p.Denom, - ContractAddress: p.ContractAddress, - Name: p.Name, - GitUrl: p.GitUrl, - }) - return nil -} diff --git a/x/yieldaggregator/simulation/deposit_to_vault.go b/x/yieldaggregator/simulation/deposit_to_vault.go index 58c0648b4..59f92ade3 100644 --- a/x/yieldaggregator/simulation/deposit_to_vault.go +++ b/x/yieldaggregator/simulation/deposit_to_vault.go @@ -25,6 +25,6 @@ func SimulateMsgDepositToVault( // TODO: Handling the DepositToVault simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DepositToVault simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, msg.String(), "DepositToVault simulation not implemented"), nil, nil } } diff --git a/x/yieldaggregator/simulation/withdraw_from_vault.go b/x/yieldaggregator/simulation/withdraw_from_vault.go index 6a7c30aea..281e7ad54 100644 --- a/x/yieldaggregator/simulation/withdraw_from_vault.go +++ b/x/yieldaggregator/simulation/withdraw_from_vault.go @@ -25,6 +25,6 @@ func SimulateMsgWithdrawFromVault( // TODO: Handling the WithdrawFromVault simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "WithdrawFromVault simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, msg.String(), "WithdrawFromVault simulation not implemented"), nil, nil } } diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query.go b/x/yieldaggregator/submodules/icacallbacks/client/cli/query.go similarity index 93% rename from x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query.go rename to x/yieldaggregator/submodules/icacallbacks/client/cli/query.go index 82992a231..5ee4f5efa 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query.go +++ b/x/yieldaggregator/submodules/icacallbacks/client/cli/query.go @@ -10,7 +10,7 @@ import ( // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query_callback_data.go b/x/yieldaggregator/submodules/icacallbacks/client/cli/query_callback_data.go similarity index 96% rename from x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query_callback_data.go rename to x/yieldaggregator/submodules/icacallbacks/client/cli/query_callback_data.go index 703e78b6f..7f103474b 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query_callback_data.go +++ b/x/yieldaggregator/submodules/icacallbacks/client/cli/query_callback_data.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) func CmdListCallbackData() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query_params.go b/x/yieldaggregator/submodules/icacallbacks/client/cli/query_params.go similarity index 91% rename from x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query_params.go rename to x/yieldaggregator/submodules/icacallbacks/client/cli/query_params.go index 2259704a0..1972c24ba 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/query_params.go +++ b/x/yieldaggregator/submodules/icacallbacks/client/cli/query_params.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) func CmdQueryParams() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/tx.go b/x/yieldaggregator/submodules/icacallbacks/client/cli/tx.go similarity index 90% rename from x/yieldaggregator/ibcstaking/icacallbacks/client/cli/tx.go rename to x/yieldaggregator/submodules/icacallbacks/client/cli/tx.go index 9bf4cb979..41752f88d 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/client/cli/tx.go +++ b/x/yieldaggregator/submodules/icacallbacks/client/cli/tx.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/genesis.go b/x/yieldaggregator/submodules/icacallbacks/genesis.go similarity index 86% rename from x/yieldaggregator/ibcstaking/icacallbacks/genesis.go rename to x/yieldaggregator/submodules/icacallbacks/genesis.go index 1f3a1f432..edbc4982e 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/genesis.go +++ b/x/yieldaggregator/submodules/icacallbacks/genesis.go @@ -3,8 +3,8 @@ package icacallbacks import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) // InitGenesis initializes the capability module's state from a provided genesis diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/callback_data.go b/x/yieldaggregator/submodules/icacallbacks/keeper/callback_data.go similarity index 96% rename from x/yieldaggregator/ibcstaking/icacallbacks/keeper/callback_data.go rename to x/yieldaggregator/submodules/icacallbacks/keeper/callback_data.go index e6acfedee..b9de0f974 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/callback_data.go +++ b/x/yieldaggregator/submodules/icacallbacks/keeper/callback_data.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) // SetCallbackData set a specific callbackData in the store from its index diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/grpc_query.go b/x/yieldaggregator/submodules/icacallbacks/keeper/grpc_query.go similarity index 96% rename from x/yieldaggregator/ibcstaking/icacallbacks/keeper/grpc_query.go rename to x/yieldaggregator/submodules/icacallbacks/keeper/grpc_query.go index 9ff6d460c..29029d075 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/grpc_query.go +++ b/x/yieldaggregator/submodules/icacallbacks/keeper/grpc_query.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) var _ types.QueryServer = Keeper{} diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/keeper.go b/x/yieldaggregator/submodules/icacallbacks/keeper/keeper.go similarity index 97% rename from x/yieldaggregator/ibcstaking/icacallbacks/keeper/keeper.go rename to x/yieldaggregator/submodules/icacallbacks/keeper/keeper.go index 2b7113018..4ace9d5d4 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/keeper.go +++ b/x/yieldaggregator/submodules/icacallbacks/keeper/keeper.go @@ -14,8 +14,8 @@ import ( ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/msg_server.go b/x/yieldaggregator/submodules/icacallbacks/keeper/msg_server.go similarity index 82% rename from x/yieldaggregator/ibcstaking/icacallbacks/keeper/msg_server.go rename to x/yieldaggregator/submodules/icacallbacks/keeper/msg_server.go index 5684de2e7..f79995932 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/msg_server.go +++ b/x/yieldaggregator/submodules/icacallbacks/keeper/msg_server.go @@ -1,7 +1,7 @@ package keeper import ( - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) type msgServer struct { diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/params.go b/x/yieldaggregator/submodules/icacallbacks/keeper/params.go similarity index 84% rename from x/yieldaggregator/ibcstaking/icacallbacks/keeper/params.go rename to x/yieldaggregator/submodules/icacallbacks/keeper/params.go index 709d78409..116ce100c 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/keeper/params.go +++ b/x/yieldaggregator/submodules/icacallbacks/keeper/params.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) // GetParams get all parameters as types.Params diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/module.go b/x/yieldaggregator/submodules/icacallbacks/module.go similarity index 96% rename from x/yieldaggregator/ibcstaking/icacallbacks/module.go rename to x/yieldaggregator/submodules/icacallbacks/module.go index cd09a4ec1..2f6ebd826 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/module.go +++ b/x/yieldaggregator/submodules/icacallbacks/module.go @@ -17,9 +17,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/client/cli" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/client/cli" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) var ( diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/module_ibc.go b/x/yieldaggregator/submodules/icacallbacks/module_ibc.go similarity index 98% rename from x/yieldaggregator/ibcstaking/icacallbacks/module_ibc.go rename to x/yieldaggregator/submodules/icacallbacks/module_ibc.go index f8945dd0e..6dd41c4e2 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/module_ibc.go +++ b/x/yieldaggregator/submodules/icacallbacks/module_ibc.go @@ -12,7 +12,7 @@ import ( porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/keeper" ) // IBCModule implements the ICS26 interface for interchain accounts controller chains diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/module_simulation.go b/x/yieldaggregator/submodules/icacallbacks/module_simulation.go similarity index 94% rename from x/yieldaggregator/ibcstaking/icacallbacks/module_simulation.go rename to x/yieldaggregator/submodules/icacallbacks/module_simulation.go index 2b99b037c..e34820a63 100644 --- a/x/yieldaggregator/ibcstaking/icacallbacks/module_simulation.go +++ b/x/yieldaggregator/submodules/icacallbacks/module_simulation.go @@ -9,8 +9,8 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - icacallbackssimulation "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbackssimulation "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/simulation" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" ) // avoid unused import issue diff --git a/deprecated/x/yieldaggregatorv1/simulation/simap.go b/x/yieldaggregator/submodules/icacallbacks/simulation/simap.go similarity index 100% rename from deprecated/x/yieldaggregatorv1/simulation/simap.go rename to x/yieldaggregator/submodules/icacallbacks/simulation/simap.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/callback_data.pb.go b/x/yieldaggregator/submodules/icacallbacks/types/callback_data.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/callback_data.pb.go rename to x/yieldaggregator/submodules/icacallbacks/types/callback_data.pb.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/callbacks.go b/x/yieldaggregator/submodules/icacallbacks/types/callbacks.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/callbacks.go rename to x/yieldaggregator/submodules/icacallbacks/types/callbacks.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/codec.go b/x/yieldaggregator/submodules/icacallbacks/types/codec.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/codec.go rename to x/yieldaggregator/submodules/icacallbacks/types/codec.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/errors.go b/x/yieldaggregator/submodules/icacallbacks/types/errors.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/errors.go rename to x/yieldaggregator/submodules/icacallbacks/types/errors.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/events_ibc.go b/x/yieldaggregator/submodules/icacallbacks/types/events_ibc.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/events_ibc.go rename to x/yieldaggregator/submodules/icacallbacks/types/events_ibc.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/expected_keepers.go b/x/yieldaggregator/submodules/icacallbacks/types/expected_keepers.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/expected_keepers.go rename to x/yieldaggregator/submodules/icacallbacks/types/expected_keepers.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/genesis.go b/x/yieldaggregator/submodules/icacallbacks/types/genesis.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/genesis.go rename to x/yieldaggregator/submodules/icacallbacks/types/genesis.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/genesis.pb.go b/x/yieldaggregator/submodules/icacallbacks/types/genesis.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/genesis.pb.go rename to x/yieldaggregator/submodules/icacallbacks/types/genesis.pb.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/key_callback_data.go b/x/yieldaggregator/submodules/icacallbacks/types/key_callback_data.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/key_callback_data.go rename to x/yieldaggregator/submodules/icacallbacks/types/key_callback_data.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/keys.go b/x/yieldaggregator/submodules/icacallbacks/types/keys.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/keys.go rename to x/yieldaggregator/submodules/icacallbacks/types/keys.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/packet.pb.go b/x/yieldaggregator/submodules/icacallbacks/types/packet.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/packet.pb.go rename to x/yieldaggregator/submodules/icacallbacks/types/packet.pb.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/params.go b/x/yieldaggregator/submodules/icacallbacks/types/params.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/params.go rename to x/yieldaggregator/submodules/icacallbacks/types/params.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/params.pb.go b/x/yieldaggregator/submodules/icacallbacks/types/params.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/params.pb.go rename to x/yieldaggregator/submodules/icacallbacks/types/params.pb.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/query.pb.go b/x/yieldaggregator/submodules/icacallbacks/types/query.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/query.pb.go rename to x/yieldaggregator/submodules/icacallbacks/types/query.pb.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/query.pb.gw.go b/x/yieldaggregator/submodules/icacallbacks/types/query.pb.gw.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/query.pb.gw.go rename to x/yieldaggregator/submodules/icacallbacks/types/query.pb.gw.go diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/types/tx.pb.go b/x/yieldaggregator/submodules/icacallbacks/types/tx.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/types/tx.pb.go rename to x/yieldaggregator/submodules/icacallbacks/types/tx.pb.go diff --git a/deprecated/x/auction/types/types.go b/x/yieldaggregator/submodules/icacallbacks/types/types.go similarity index 100% rename from deprecated/x/auction/types/types.go rename to x/yieldaggregator/submodules/icacallbacks/types/types.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/README.md b/x/yieldaggregator/submodules/interchainquery/README.md similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/README.md rename to x/yieldaggregator/submodules/interchainquery/README.md diff --git a/x/yieldaggregator/ibcstaking/interchainquery/genesis.go b/x/yieldaggregator/submodules/interchainquery/genesis.go similarity index 83% rename from x/yieldaggregator/ibcstaking/interchainquery/genesis.go rename to x/yieldaggregator/submodules/interchainquery/genesis.go index 74e0b1902..409c0ccdb 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/genesis.go +++ b/x/yieldaggregator/submodules/interchainquery/genesis.go @@ -3,8 +3,8 @@ package interchainquery import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" ) // InitGenesis initializes the capability module's state from a provided genesis diff --git a/x/yieldaggregator/ibcstaking/interchainquery/keeper/abci.go b/x/yieldaggregator/submodules/interchainquery/keeper/abci.go similarity index 92% rename from x/yieldaggregator/ibcstaking/interchainquery/keeper/abci.go rename to x/yieldaggregator/submodules/interchainquery/keeper/abci.go index 6192d3658..2095b2bf8 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/keeper/abci.go +++ b/x/yieldaggregator/submodules/interchainquery/keeper/abci.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" ) // EndBlocker of interchainquery module @@ -20,6 +20,7 @@ func (k Keeper) EndBlocker(ctx sdk.Context) { k.IterateQueries(ctx, func(_ int64, queryInfo types.Query) (stop bool) { if queryInfo.LastHeight.Equal(sdk.ZeroInt()) || queryInfo.LastHeight.Add(queryInfo.Period).Equal(sdk.NewInt(ctx.BlockHeight())) { k.Logger(ctx).Info(fmt.Sprintf("Interchainquery event emitted %s", queryInfo.Id)) + k.Logger(ctx).Info(fmt.Sprintf("queryInfo: %+v", queryInfo)) event := sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), diff --git a/x/yieldaggregator/ibcstaking/interchainquery/keeper/keeper.go b/x/yieldaggregator/submodules/interchainquery/keeper/keeper.go similarity index 88% rename from x/yieldaggregator/ibcstaking/interchainquery/keeper/keeper.go rename to x/yieldaggregator/submodules/interchainquery/keeper/keeper.go index 2e46848d2..7c0f4fbd6 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/keeper/keeper.go +++ b/x/yieldaggregator/submodules/interchainquery/keeper/keeper.go @@ -13,24 +13,26 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" ) // Keeper of this module maintains collections of registered zones. type Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - callbacks map[string]types.QueryCallbacks - IBCKeeper *ibckeeper.Keeper + cdc codec.Codec + storeKey storetypes.StoreKey + callbacks map[string]types.QueryCallbacks + IBCKeeper *ibckeeper.Keeper + wasmKeeper types.WasmKeeper } // NewKeeper returns a new instance of zones Keeper -func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey, ibckeeper *ibckeeper.Keeper) Keeper { +func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey, ibckeeper *ibckeeper.Keeper, wasmKeeper types.WasmKeeper) Keeper { return Keeper{ - cdc: cdc, - storeKey: storeKey, - callbacks: make(map[string]types.QueryCallbacks), - IBCKeeper: ibckeeper, + cdc: cdc, + storeKey: storeKey, + callbacks: make(map[string]types.QueryCallbacks), + IBCKeeper: ibckeeper, + wasmKeeper: wasmKeeper, } } @@ -91,7 +93,7 @@ func (k *Keeper) MakeRequest(ctx sdk.Context, connection_id string, chain_id str key := GenerateQueryHash(connection_id, chain_id, query_type, request, module, height) existingQuery, found := k.GetQuery(ctx, key) if !found { - if module != "" { + if module != "" && module != types.ModuleName { if _, exists := k.callbacks[module]; !exists { err := fmt.Errorf("no callback handler registered for module %s", module) k.Logger(ctx).Error(err.Error()) @@ -101,7 +103,6 @@ func (k *Keeper) MakeRequest(ctx sdk.Context, connection_id string, chain_id str err := fmt.Errorf("no callback %s registered for module %s", callback_id, module) k.Logger(ctx).Error(err.Error()) return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "no callback handler registered for module") - } } newQuery := k.NewQuery(ctx, module, connection_id, chain_id, query_type, request, period, callback_id, ttl, height) diff --git a/x/yieldaggregator/ibcstaking/interchainquery/keeper/msg_server.go b/x/yieldaggregator/submodules/interchainquery/keeper/msg_server.go similarity index 68% rename from x/yieldaggregator/ibcstaking/interchainquery/keeper/msg_server.go rename to x/yieldaggregator/submodules/interchainquery/keeper/msg_server.go index 4506e3551..edadbbb15 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/keeper/msg_server.go +++ b/x/yieldaggregator/submodules/interchainquery/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "encoding/json" "fmt" "net/url" "sort" @@ -9,7 +10,6 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" @@ -17,7 +17,7 @@ import ( ics23 "github.com/cosmos/ics23/go" "github.com/spf13/cast" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" ) type msgServer struct { @@ -58,41 +58,28 @@ func (k Keeper) VerifyKeyProof(ctx sdk.Context, msg *types.MsgSubmitQueryRespons if !found { return errorsmod.Wrapf(types.ErrInvalidICQProof, "ConnectionId %s does not exist", query.ConnectionId) } - + consensusState, found := k.IBCKeeper.ClientKeeper.GetClientConsensusState(ctx, connection.ClientId, height) + if !found { + return errorsmod.Wrapf(types.ErrInvalidICQProof, "Consensus state not found for client %s and height %d", connection.ClientId, height) + } clientState, found := k.IBCKeeper.ClientKeeper.GetClientState(ctx, connection.ClientId) if !found { return errorsmod.Wrapf(types.ErrInvalidICQProof, "Unable to fetch client state for client %s", connection.ClientId) } - consensusState, found := k.IBCKeeper.ClientKeeper.GetClientConsensusState(ctx, connection.ClientId, height) - if !found { - return errorsmod.Wrapf(types.ErrInvalidICQProof, "Consensus state not found for client %s and height %d", connection.ClientId, height) + // Cast the client and consensus state to tendermint type + tendermintConsensusState, ok := consensusState.(*tendermint.ConsensusState) + if !ok { + return errorsmod.Wrapf(types.ErrInvalidICQProof, + "Only tendermint consensus state is supported (%s provided)", consensusState.ClientType()) } - var stateRoot exported.Root - var clientStateProof []*ics23.ProofSpec - - switch clientState.ClientType() { - case exported.Tendermint: - tendermintConsensusState, ok := consensusState.(*tendermint.ConsensusState) - if !ok { - errMsg := fmt.Sprintf("[ICQ Resp] for query %s, error unmarshaling client state %v", query.Id, clientState) - return sdkerrors.Wrapf(types.ErrInvalidICQProof, errMsg) - } - stateRoot = tendermintConsensusState.GetRoot() - // case exported.Wasm: - // wasmConsensusState, ok := consensusState.(*wasm.ConsensusState) - // if !ok { - // return errorsmod.Wrapf(types.ErrInvalidConsensusState, "Error casting consensus state: %s", err.Error()) - // } - // tmClientState, ok := clientState.(*tmclienttypes.ClientState) - // if !ok { - // return errorsmod.Wrapf(types.ErrInvalidICQProof, "Client state is not tendermint") - // } - // clientStateProof = tmClientState.ProofSpecs - // stateRoot = wasmConsensusState.GetRoot() - default: - panic("not implemented") + tendermintClientState, ok := clientState.(*tendermint.ClientState) + if !ok { + return errorsmod.Wrapf(types.ErrInvalidICQProof, + "Only tendermint client state is supported (%s provided)", clientState.ClientType()) } + var stateRoot exported.Root = tendermintConsensusState.Root + var clientStateProof []*ics23.ProofSpec = tendermintClientState.ProofSpecs // Get the merkle path and merkle proof path := commitmenttypes.NewMerklePath([]string{pathParts[1], url.PathEscape(string(query.Request))}...) @@ -128,10 +115,37 @@ func (k Keeper) InvokeCallback(ctx sdk.Context, msg *types.MsgSubmitQueryRespons } sort.Strings(moduleNames) + // if callback is an contract address execute contract call + contractAddress, err := sdk.AccAddressFromBech32(q.CallbackId) + if err == nil { + k.Logger(ctx).Info(fmt.Sprintf("ICQ debug: Q: %+v, result: %+v", q, msg.Result)) + + x := types.MessageKVQueryResult{} + x.KVQueryResult.ConnectionId = q.ConnectionId + x.KVQueryResult.ChainId = q.ChainId + x.KVQueryResult.QueryPrefix = q.QueryType + x.KVQueryResult.QueryKey = q.Request + x.KVQueryResult.Data = msg.Result + if x.KVQueryResult.Data == nil { + x.KVQueryResult.Data = []byte{} + } + + m, err := json.Marshal(x) + if err != nil { + return fmt.Errorf("failed to marshal MessageKVQueryResult: %v", err) + } + + _, err = k.wasmKeeper.Sudo(ctx, contractAddress, m) + if err != nil { + k.Logger(ctx).Info("SudoTxQueryResult: failed to Sudo", string(m), "error", err, "contract_address", contractAddress) + return fmt.Errorf("failed to Sudo: %v", err) + } + return nil + } + for _, moduleName := range moduleNames { k.Logger(ctx).Info(fmt.Sprintf("[ICQ Resp] executing callback for queryId (%s), module (%s)", q.Id, moduleName)) moduleCallbackHandler := k.callbacks[moduleName] - if moduleCallbackHandler.Has(q.CallbackId) { k.Logger(ctx).Info(fmt.Sprintf("[ICQ Resp] callback (%s) found for module (%s)", q.CallbackId, moduleName)) // call the correct callback function @@ -165,14 +179,14 @@ func (k Keeper) HasQueryExceededTtl(ctx sdk.Context, msg *types.MsgSubmitQueryRe return false, nil } +// Handle ICQ query responses by validating the proof, and calling the query's corresponding callback func (k msgServer) SubmitQueryResponse(goCtx context.Context, msg *types.MsgSubmitQueryResponse) (*types.MsgSubmitQueryResponseResponse, error) { - fmt.Println("DEBUG SubmitQueryResponse", string(k.cdc.MustMarshalJSON(msg))) ctx := sdk.UnwrapSDKContext(goCtx) // check if the response has an associated query stored on stride - q, found := k.GetQuery(ctx, msg.QueryId) + query, found := k.GetQuery(ctx, msg.QueryId) if !found { - k.Logger(ctx).Info("[ICQ Resp] ignoring non-existent query response (note: duplicate responses are nonexistent)") + k.Logger(ctx).Info("ICQ RESPONSE | Ignoring non-existent query response (note: duplicate responses are nonexistent)") return &types.MsgSubmitQueryResponseResponse{}, nil // technically this is an error, but will cause the entire tx to fail if we have one 'bad' message, so we can just no-op here. } @@ -180,42 +194,45 @@ func (k msgServer) SubmitQueryResponse(goCtx context.Context, msg *types.MsgSubm sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(types.AttributeKeyQueryId, q.Id), + sdk.NewAttribute(types.AttributeKeyQueryId, query.Id), ), sdk.NewEvent( "query_response", sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(types.AttributeKeyQueryId, q.Id), - sdk.NewAttribute(types.AttributeKeyChainId, q.ChainId), + sdk.NewAttribute(types.AttributeKeyQueryId, query.Id), + sdk.NewAttribute(types.AttributeKeyChainId, query.ChainId), ), }) - // 1. verify the response's proof, if one exists - err := k.VerifyKeyProof(ctx, msg, q) + // Verify the response's proof, if one exists + err := k.VerifyKeyProof(ctx, msg, query) if err != nil { + k.Logger(ctx).Error(fmt.Sprintf("QUERY PROOF VERIFICATION FAILED - QueryId: %s, Error: %s", query.Id, err.Error())) return nil, err } - // 2. immediately delete the query so it cannot process again - k.DeleteQuery(ctx, q.Id) - // 3. verify the query's ttl is unexpired - ttlExceeded, err := k.HasQueryExceededTtl(ctx, msg, q) + // Immediately delete the query so it cannot process again + k.DeleteQuery(ctx, query.Id) + + // Verify the query hasn't expired (if the block time is greater than the TTL timestamp, the query is expired) + currBlockTime, err := cast.ToUint64E(ctx.BlockTime().UnixNano()) if err != nil { return nil, err } - if ttlExceeded { - k.Logger(ctx).Info(fmt.Sprintf("[ICQ Resp] %s's ttl exceeded: %d < %d.", msg.QueryId, q.Ttl, ctx.BlockHeader().Time.UnixNano())) + if query.Ttl < currBlockTime { + k.Logger(ctx).Info(fmt.Sprintf("[ICQ Resp] %s's ttl exceeded: %d < %d.", msg.QueryId, query.Ttl, ctx.BlockHeader().Time.UnixNano())) return &types.MsgSubmitQueryResponseResponse{}, nil } - // 4. if the query is contentless, end - if len(msg.Result) == 0 { + // If the query is contentless while it's not sent from contract, end + _, err = sdk.AccAddressFromBech32(query.CallbackId) + if len(msg.Result) == 0 && err != nil { k.Logger(ctx).Info(fmt.Sprintf("[ICQ Resp] query %s is contentless, removing from store.", msg.QueryId)) return &types.MsgSubmitQueryResponseResponse{}, nil } - // 5. call the query's associated callback function - err = k.InvokeCallback(ctx, msg, q) + // Call the query's associated callback function + err = k.InvokeCallback(ctx, msg, query) if err != nil { return nil, err } diff --git a/x/yieldaggregator/ibcstaking/interchainquery/keeper/queries.go b/x/yieldaggregator/submodules/interchainquery/keeper/queries.go similarity index 97% rename from x/yieldaggregator/ibcstaking/interchainquery/keeper/queries.go rename to x/yieldaggregator/submodules/interchainquery/keeper/queries.go index c6581ea6a..0d3585081 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/keeper/queries.go +++ b/x/yieldaggregator/submodules/interchainquery/keeper/queries.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" ) func GenerateQueryHash(connection_id string, chain_id string, query_type string, request []byte, module string, height int64) string { diff --git a/x/yieldaggregator/ibcstaking/interchainquery/module.go b/x/yieldaggregator/submodules/interchainquery/module.go similarity index 98% rename from x/yieldaggregator/ibcstaking/interchainquery/module.go rename to x/yieldaggregator/submodules/interchainquery/module.go index 1af448b1a..82590c712 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/module.go +++ b/x/yieldaggregator/submodules/interchainquery/module.go @@ -17,9 +17,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" ) var ( diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/callbacks.go b/x/yieldaggregator/submodules/interchainquery/types/callbacks.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/callbacks.go rename to x/yieldaggregator/submodules/interchainquery/types/callbacks.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/codec.go b/x/yieldaggregator/submodules/interchainquery/types/codec.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/codec.go rename to x/yieldaggregator/submodules/interchainquery/types/codec.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/error.go b/x/yieldaggregator/submodules/interchainquery/types/error.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/error.go rename to x/yieldaggregator/submodules/interchainquery/types/error.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/events.go b/x/yieldaggregator/submodules/interchainquery/types/events.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/events.go rename to x/yieldaggregator/submodules/interchainquery/types/events.go diff --git a/x/yieldaggregator/submodules/interchainquery/types/expected_keepers.go b/x/yieldaggregator/submodules/interchainquery/types/expected_keepers.go new file mode 100644 index 000000000..a30614c63 --- /dev/null +++ b/x/yieldaggregator/submodules/interchainquery/types/expected_keepers.go @@ -0,0 +1,11 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// WasmKeeper defines the expected interface needed to cam cosmwasm contracts. +type WasmKeeper interface { + HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool + Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) +} diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/genesis.go b/x/yieldaggregator/submodules/interchainquery/types/genesis.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/genesis.go rename to x/yieldaggregator/submodules/interchainquery/types/genesis.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/genesis.pb.go b/x/yieldaggregator/submodules/interchainquery/types/genesis.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/genesis.pb.go rename to x/yieldaggregator/submodules/interchainquery/types/genesis.pb.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/keys.go b/x/yieldaggregator/submodules/interchainquery/types/keys.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/keys.go rename to x/yieldaggregator/submodules/interchainquery/types/keys.go diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/messages.pb.go b/x/yieldaggregator/submodules/interchainquery/types/messages.pb.go similarity index 82% rename from x/yieldaggregator/ibcstaking/interchainquery/types/messages.pb.go rename to x/yieldaggregator/submodules/interchainquery/types/messages.pb.go index cc65ac60d..bba3702b3 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/types/messages.pb.go +++ b/x/yieldaggregator/submodules/interchainquery/types/messages.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: interchainquery/v1/messages.proto +// source: stride/interchainquery/v1/messages.proto package types @@ -8,9 +8,9 @@ import ( fmt "fmt" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -45,7 +45,7 @@ func (m *MsgSubmitQueryResponse) Reset() { *m = MsgSubmitQueryResponse{} func (m *MsgSubmitQueryResponse) String() string { return proto.CompactTextString(m) } func (*MsgSubmitQueryResponse) ProtoMessage() {} func (*MsgSubmitQueryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9add76d337d1a013, []int{0} + return fileDescriptor_25adad4f8ed32400, []int{0} } func (m *MsgSubmitQueryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,7 +83,7 @@ func (m *MsgSubmitQueryResponseResponse) Reset() { *m = MsgSubmitQueryRe func (m *MsgSubmitQueryResponseResponse) String() string { return proto.CompactTextString(m) } func (*MsgSubmitQueryResponseResponse) ProtoMessage() {} func (*MsgSubmitQueryResponseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9add76d337d1a013, []int{1} + return fileDescriptor_25adad4f8ed32400, []int{1} } func (m *MsgSubmitQueryResponseResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,48 +113,48 @@ func (m *MsgSubmitQueryResponseResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitQueryResponseResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgSubmitQueryResponse)(nil), "stride.interchainquery.MsgSubmitQueryResponse") - proto.RegisterType((*MsgSubmitQueryResponseResponse)(nil), "stride.interchainquery.MsgSubmitQueryResponseResponse") + proto.RegisterType((*MsgSubmitQueryResponse)(nil), "stride.interchainquery.v1.MsgSubmitQueryResponse") + proto.RegisterType((*MsgSubmitQueryResponseResponse)(nil), "stride.interchainquery.v1.MsgSubmitQueryResponseResponse") } func init() { - // proto.RegisterFile("interchainquery/v1/messages.proto", fileDescriptor_9add76d337d1a013) -} - -var fileDescriptor_9add76d337d1a013 = []byte{ - // 503 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x31, 0x8f, 0xd3, 0x30, - 0x14, 0xc7, 0xe3, 0x16, 0x7a, 0x77, 0xb9, 0x22, 0x20, 0x57, 0x9d, 0x42, 0x81, 0x24, 0x78, 0xa1, - 0x20, 0x2e, 0x56, 0x8b, 0x60, 0x28, 0x13, 0xdd, 0x4e, 0xe2, 0x38, 0x48, 0x37, 0x96, 0x2a, 0x69, - 0x7c, 0xae, 0xa5, 0x26, 0x0e, 0xb6, 0x7b, 0xba, 0xae, 0x4c, 0x8c, 0x48, 0x2c, 0x8c, 0xfd, 0x0a, - 0x48, 0x2c, 0x7c, 0x03, 0xc6, 0x13, 0x2c, 0x4c, 0x15, 0x6a, 0x19, 0x60, 0xed, 0x27, 0x40, 0xb1, - 0x13, 0x40, 0xa5, 0x0b, 0x93, 0x5f, 0xde, 0xff, 0x97, 0xf7, 0xfe, 0xcf, 0x7e, 0xe6, 0x2d, 0x9a, - 0x4a, 0xcc, 0x87, 0xa3, 0x90, 0xa6, 0x2f, 0x27, 0x98, 0x4f, 0xd1, 0x69, 0x1b, 0x25, 0x58, 0x88, - 0x90, 0x60, 0xe1, 0x67, 0x9c, 0x49, 0x66, 0xed, 0x0b, 0xc9, 0x69, 0x8c, 0xfd, 0x35, 0xb2, 0xd9, - 0x20, 0x8c, 0x30, 0x85, 0xa0, 0x3c, 0xd2, 0x74, 0xf3, 0xda, 0x90, 0x89, 0x84, 0x89, 0x81, 0x16, - 0xf4, 0x47, 0x21, 0xdd, 0x20, 0x8c, 0x91, 0x31, 0x46, 0x61, 0x46, 0x51, 0x98, 0xa6, 0x4c, 0x86, - 0x92, 0xb2, 0xb4, 0x54, 0x6f, 0x4a, 0x9c, 0xc6, 0x98, 0x27, 0x34, 0x95, 0x68, 0xc8, 0xa7, 0x99, - 0x64, 0x28, 0xe3, 0x8c, 0x9d, 0x68, 0x19, 0xfe, 0xac, 0x98, 0xfb, 0x47, 0x82, 0xf4, 0x27, 0x51, - 0x42, 0xe5, 0xf3, 0xdc, 0x40, 0x80, 0x45, 0xc6, 0x52, 0x81, 0x2d, 0xdf, 0xdc, 0x56, 0xb6, 0x06, - 0x34, 0xb6, 0x81, 0x07, 0x5a, 0x3b, 0xbd, 0xbd, 0xd5, 0xdc, 0xbd, 0x3c, 0x0d, 0x93, 0x71, 0x17, - 0x96, 0x0a, 0x0c, 0xb6, 0x54, 0x78, 0x18, 0xe7, 0xbc, 0x9a, 0x20, 0xe7, 0x2b, 0xeb, 0x7c, 0xa9, - 0xc0, 0x60, 0x4b, 0x85, 0x87, 0xb1, 0x75, 0xc7, 0xac, 0x71, 0x2c, 0x26, 0x63, 0x69, 0x57, 0x3d, - 0xd0, 0xaa, 0xf7, 0xae, 0xae, 0xe6, 0xee, 0x25, 0x4d, 0xeb, 0x3c, 0x0c, 0x0a, 0xc0, 0x7a, 0x6a, - 0xee, 0x28, 0xd3, 0x03, 0x96, 0x09, 0xfb, 0x82, 0x07, 0x5a, 0xbb, 0x9d, 0xeb, 0xfe, 0x9f, 0xc1, - 0x7c, 0x3d, 0x98, 0xff, 0x2c, 0x67, 0x8e, 0x33, 0xd1, 0x6b, 0xac, 0xe6, 0xee, 0x15, 0x5d, 0xea, - 0xf7, 0x7f, 0x30, 0xd8, 0xce, 0x0a, 0x3d, 0x6f, 0x3d, 0xc2, 0x94, 0x8c, 0xa4, 0x7d, 0xd1, 0x03, - 0xad, 0xea, 0xdf, 0xad, 0x75, 0x1e, 0x06, 0x05, 0x60, 0x3d, 0x32, 0xeb, 0x27, 0x9c, 0x25, 0x83, - 0x30, 0x8e, 0x39, 0x16, 0xc2, 0xae, 0xa9, 0xc9, 0xec, 0xcf, 0x1f, 0x0e, 0x1a, 0xc5, 0x2b, 0x3c, - 0xd6, 0x4a, 0x5f, 0x72, 0x9a, 0x92, 0x60, 0x37, 0xa7, 0x8b, 0x54, 0xb7, 0xfe, 0x7a, 0xe6, 0x1a, - 0xef, 0x66, 0x2e, 0xf8, 0x31, 0x73, 0x0d, 0xe8, 0x99, 0xce, 0xe6, 0xab, 0x2e, 0xcf, 0xce, 0x47, - 0x60, 0x56, 0x8f, 0x04, 0xb1, 0xde, 0x03, 0x73, 0x6f, 0xe3, 0x93, 0xf8, 0x9b, 0x97, 0xc6, 0xdf, - 0x5c, 0xb7, 0xf9, 0xf0, 0xff, 0xf8, 0xf2, 0x84, 0x9d, 0x57, 0x5f, 0xbe, 0xbf, 0xad, 0xdc, 0x83, - 0xb7, 0xd1, 0xfa, 0x1e, 0xcb, 0x33, 0x74, 0xda, 0x8e, 0xb0, 0x0c, 0xdb, 0x48, 0xa8, 0x02, 0x2a, - 0xdd, 0x05, 0x77, 0x7b, 0xc7, 0x9f, 0x16, 0x0e, 0x38, 0x5f, 0x38, 0xe0, 0xdb, 0xc2, 0x01, 0x6f, - 0x96, 0x8e, 0x71, 0xbe, 0x74, 0x8c, 0xaf, 0x4b, 0xc7, 0x78, 0xf1, 0x80, 0x50, 0x39, 0x9a, 0x44, - 0xfe, 0x90, 0x25, 0xa8, 0xaf, 0xfc, 0x1c, 0x3c, 0x09, 0x23, 0x81, 0xb4, 0x37, 0x74, 0xf6, 0x6f, - 0x93, 0x69, 0x86, 0x45, 0x54, 0x53, 0x1b, 0x7a, 0xff, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, - 0x6e, 0x36, 0x14, 0x4c, 0x03, 0x00, 0x00, + proto.RegisterFile("stride/interchainquery/v1/messages.proto", fileDescriptor_25adad4f8ed32400) +} + +var fileDescriptor_25adad4f8ed32400 = []byte{ + // 510 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xbf, 0x8f, 0xd3, 0x30, + 0x14, 0xc7, 0xeb, 0x16, 0x7a, 0x77, 0xb9, 0x22, 0x20, 0x57, 0xa1, 0x5c, 0x81, 0xa4, 0xf2, 0x42, + 0x41, 0x9c, 0xad, 0x94, 0xe9, 0xca, 0x44, 0xb7, 0x93, 0x38, 0x7e, 0xa4, 0x1b, 0x4b, 0x95, 0x36, + 0x3e, 0xd7, 0x52, 0x13, 0x07, 0xdb, 0xad, 0xae, 0x2b, 0x13, 0x23, 0x12, 0x0b, 0x63, 0xff, 0x08, + 0x24, 0x46, 0x56, 0xc6, 0x13, 0x2c, 0x4c, 0x15, 0x6a, 0x19, 0x60, 0xed, 0x5f, 0x80, 0x62, 0x27, + 0x80, 0xee, 0xca, 0xc0, 0xe4, 0x97, 0xf7, 0xfd, 0xbc, 0x5f, 0xf1, 0xb3, 0xd5, 0x92, 0x4a, 0xb0, + 0x88, 0x60, 0x96, 0x28, 0x22, 0x86, 0xa3, 0x90, 0x25, 0x2f, 0x27, 0x44, 0xcc, 0xf0, 0xd4, 0xc7, + 0x31, 0x91, 0x32, 0xa4, 0x44, 0xa2, 0x54, 0x70, 0xc5, 0xed, 0x7d, 0x43, 0xa2, 0x73, 0x24, 0x9a, + 0xfa, 0x8d, 0x3a, 0xe5, 0x94, 0x6b, 0x0a, 0x67, 0x96, 0x09, 0x68, 0xec, 0x0f, 0xb9, 0x8c, 0xb9, + 0xec, 0x1b, 0xc1, 0x7c, 0xe4, 0xd2, 0x2d, 0xca, 0x39, 0x1d, 0x13, 0x1c, 0xa6, 0x0c, 0x87, 0x49, + 0xc2, 0x55, 0xa8, 0x18, 0x4f, 0x0a, 0xf5, 0xb6, 0x22, 0x49, 0x44, 0x44, 0xcc, 0x12, 0x85, 0x87, + 0x62, 0x96, 0x2a, 0x8e, 0x53, 0xc1, 0xf9, 0x89, 0x91, 0xe1, 0xcf, 0xb2, 0x75, 0xe3, 0x58, 0xd2, + 0xde, 0x64, 0x10, 0x33, 0xf5, 0x3c, 0xeb, 0x21, 0x20, 0x32, 0xe5, 0x89, 0x24, 0x36, 0xb2, 0xb6, + 0x75, 0x67, 0x7d, 0x16, 0x39, 0xa0, 0x09, 0x5a, 0x3b, 0xdd, 0xbd, 0xf5, 0xc2, 0xbb, 0x3a, 0x0b, + 0xe3, 0x71, 0x07, 0x16, 0x0a, 0x0c, 0xb6, 0xb4, 0x79, 0x14, 0x65, 0xbc, 0x1e, 0x22, 0xe3, 0xcb, + 0xe7, 0xf9, 0x42, 0x81, 0xc1, 0x96, 0x36, 0x8f, 0x22, 0xfb, 0xae, 0x55, 0x15, 0x44, 0x4e, 0xc6, + 0xca, 0xa9, 0x34, 0x41, 0xab, 0xd6, 0xbd, 0xbe, 0x5e, 0x78, 0x57, 0x0c, 0x6d, 0xfc, 0x30, 0xc8, + 0x01, 0xfb, 0x89, 0xb5, 0xa3, 0x9b, 0xee, 0xf3, 0x54, 0x3a, 0x97, 0x9a, 0xa0, 0xb5, 0xdb, 0xbe, + 0x89, 0xfe, 0x0c, 0x86, 0xcc, 0x60, 0xe8, 0x59, 0xc6, 0x3c, 0x4d, 0x65, 0xb7, 0xbe, 0x5e, 0x78, + 0xd7, 0x4c, 0xaa, 0xdf, 0x71, 0x30, 0xd8, 0x4e, 0x73, 0x3d, 0x2b, 0x3d, 0x22, 0x8c, 0x8e, 0x94, + 0x73, 0xb9, 0x09, 0x5a, 0x95, 0xbf, 0x4b, 0x1b, 0x3f, 0x0c, 0x72, 0xc0, 0x7e, 0x68, 0xd5, 0x4e, + 0x04, 0x8f, 0xfb, 0x61, 0x14, 0x09, 0x22, 0xa5, 0x53, 0xd5, 0x93, 0x39, 0x9f, 0xdf, 0x1f, 0xd4, + 0xf3, 0x5b, 0x78, 0x64, 0x94, 0x9e, 0x12, 0x2c, 0xa1, 0xc1, 0x6e, 0x46, 0xe7, 0xae, 0x4e, 0xed, + 0xf5, 0xdc, 0x2b, 0xbd, 0x9b, 0x7b, 0xe0, 0xc7, 0xdc, 0x2b, 0xc1, 0xa6, 0xe5, 0x6e, 0xfe, 0xd5, + 0xc5, 0xd9, 0xfe, 0x08, 0xac, 0xca, 0xb1, 0xa4, 0xf6, 0x07, 0x60, 0xed, 0x6d, 0xba, 0x12, 0x1f, + 0xfd, 0x73, 0x6f, 0xd0, 0xe6, 0xd4, 0x8d, 0xc3, 0xff, 0x0e, 0x29, 0x4e, 0xd8, 0x7e, 0xf5, 0xe5, + 0xfb, 0xdb, 0xf2, 0xfd, 0x0e, 0xb8, 0x07, 0xef, 0x5c, 0xd8, 0x69, 0x75, 0x8a, 0xa7, 0xfe, 0x80, + 0xa8, 0xd0, 0xc7, 0x52, 0xe7, 0xd0, 0xee, 0x6e, 0xef, 0xd3, 0xd2, 0x05, 0x67, 0x4b, 0x17, 0x7c, + 0x5b, 0xba, 0xe0, 0xcd, 0xca, 0x2d, 0x9d, 0xad, 0xdc, 0xd2, 0xd7, 0x95, 0x5b, 0x7a, 0x71, 0x48, + 0x99, 0x1a, 0x4d, 0x06, 0x68, 0xc8, 0x63, 0xdc, 0xd3, 0x2d, 0x1d, 0x3c, 0x0e, 0x07, 0x12, 0xe7, + 0x6f, 0x66, 0xea, 0xfb, 0xf8, 0xf4, 0x62, 0x95, 0x59, 0x4a, 0xe4, 0xa0, 0xaa, 0x77, 0xf5, 0xc1, + 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xb0, 0xee, 0xa3, 0x60, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -183,7 +183,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) SubmitQueryResponse(ctx context.Context, in *MsgSubmitQueryResponse, opts ...grpc.CallOption) (*MsgSubmitQueryResponseResponse, error) { out := new(MsgSubmitQueryResponseResponse) - err := c.cc.Invoke(ctx, "/stride.interchainquery.Msg/SubmitQueryResponse", in, out, opts...) + err := c.cc.Invoke(ctx, "/stride.interchainquery.v1.Msg/SubmitQueryResponse", in, out, opts...) if err != nil { return nil, err } @@ -218,7 +218,7 @@ func _Msg_SubmitQueryResponse_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stride.interchainquery.Msg/SubmitQueryResponse", + FullMethod: "/stride.interchainquery.v1.Msg/SubmitQueryResponse", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).SubmitQueryResponse(ctx, req.(*MsgSubmitQueryResponse)) @@ -227,7 +227,7 @@ func _Msg_SubmitQueryResponse_Handler(srv interface{}, ctx context.Context, dec } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "stride.interchainquery.Msg", + ServiceName: "stride.interchainquery.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { @@ -236,7 +236,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "interchainquery/v1/messages.proto", + Metadata: "stride/interchainquery/v1/messages.proto", } func (m *MsgSubmitQueryResponse) Marshal() (dAtA []byte, err error) { diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/messages.pb.gw.go b/x/yieldaggregator/submodules/interchainquery/types/messages.pb.gw.go similarity index 98% rename from x/yieldaggregator/ibcstaking/interchainquery/types/messages.pb.gw.go rename to x/yieldaggregator/submodules/interchainquery/types/messages.pb.gw.go index f1c46cfce..e883c2bd9 100644 --- a/x/yieldaggregator/ibcstaking/interchainquery/types/messages.pb.gw.go +++ b/x/yieldaggregator/submodules/interchainquery/types/messages.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: interchainquery/v1/messages.proto +// source: stride/interchainquery/v1/messages.proto /* Package types is a reverse proxy. @@ -161,7 +161,7 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } var ( - pattern_Msg_SubmitQueryResponse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchainquery", "tx", "v1beta1", "submitquery"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Msg_SubmitQueryResponse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchainquery", "tx", "v1beta1", "submitquery"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/yieldaggregator/ibcstaking/interchainquery/types/msgs.go b/x/yieldaggregator/submodules/interchainquery/types/msgs.go similarity index 100% rename from x/yieldaggregator/ibcstaking/interchainquery/types/msgs.go rename to x/yieldaggregator/submodules/interchainquery/types/msgs.go diff --git a/x/yieldaggregator/submodules/interchainquery/types/sudo.go b/x/yieldaggregator/submodules/interchainquery/types/sudo.go new file mode 100644 index 000000000..c7661a571 --- /dev/null +++ b/x/yieldaggregator/submodules/interchainquery/types/sudo.go @@ -0,0 +1,13 @@ +package types + +// MessageKVQueryResult is passed to a contract's sudo() entrypoint when a result +// was submitted for a kv-query. +type MessageKVQueryResult struct { + KVQueryResult struct { + ConnectionId string `json:"connection_id"` + ChainId string `json:"chain_id"` + QueryPrefix string `json:"query_prefix"` + QueryKey []byte `json:"query_key"` + Data []byte `json:"data"` + } `json:"kv_query_result"` +} diff --git a/x/yieldaggregator/ibcstaking/records/client/cli/query.go b/x/yieldaggregator/submodules/records/client/cli/query.go similarity index 94% rename from x/yieldaggregator/ibcstaking/records/client/cli/query.go rename to x/yieldaggregator/submodules/records/client/cli/query.go index 57bce0b5f..c7983ab7e 100644 --- a/x/yieldaggregator/ibcstaking/records/client/cli/query.go +++ b/x/yieldaggregator/submodules/records/client/cli/query.go @@ -10,7 +10,7 @@ import ( // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/yieldaggregator/ibcstaking/records/client/cli/query_deposit_record.go b/x/yieldaggregator/submodules/records/client/cli/query_deposit_record.go similarity index 96% rename from x/yieldaggregator/ibcstaking/records/client/cli/query_deposit_record.go rename to x/yieldaggregator/submodules/records/client/cli/query_deposit_record.go index 2418da41c..baee12ba2 100644 --- a/x/yieldaggregator/ibcstaking/records/client/cli/query_deposit_record.go +++ b/x/yieldaggregator/submodules/records/client/cli/query_deposit_record.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) func CmdListDepositRecord() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/records/client/cli/query_epoch_unbonding_record.go b/x/yieldaggregator/submodules/records/client/cli/query_epoch_unbonding_record.go similarity index 96% rename from x/yieldaggregator/ibcstaking/records/client/cli/query_epoch_unbonding_record.go rename to x/yieldaggregator/submodules/records/client/cli/query_epoch_unbonding_record.go index f394ab372..75d31d908 100644 --- a/x/yieldaggregator/ibcstaking/records/client/cli/query_epoch_unbonding_record.go +++ b/x/yieldaggregator/submodules/records/client/cli/query_epoch_unbonding_record.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) func CmdListEpochUnbondingRecord() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/records/client/cli/query_params.go b/x/yieldaggregator/submodules/records/client/cli/query_params.go similarity index 91% rename from x/yieldaggregator/ibcstaking/records/client/cli/query_params.go rename to x/yieldaggregator/submodules/records/client/cli/query_params.go index be4b26f45..418729514 100644 --- a/x/yieldaggregator/ibcstaking/records/client/cli/query_params.go +++ b/x/yieldaggregator/submodules/records/client/cli/query_params.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) func CmdQueryParams() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/records/client/cli/query_user_redemption_record.go b/x/yieldaggregator/submodules/records/client/cli/query_user_redemption_record.go similarity index 96% rename from x/yieldaggregator/ibcstaking/records/client/cli/query_user_redemption_record.go rename to x/yieldaggregator/submodules/records/client/cli/query_user_redemption_record.go index ee9e13aa6..33bf705bf 100644 --- a/x/yieldaggregator/ibcstaking/records/client/cli/query_user_redemption_record.go +++ b/x/yieldaggregator/submodules/records/client/cli/query_user_redemption_record.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) func CmdListUserRedemptionRecord() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/records/client/cli/tx.go b/x/yieldaggregator/submodules/records/client/cli/tx.go similarity index 92% rename from x/yieldaggregator/ibcstaking/records/client/cli/tx.go rename to x/yieldaggregator/submodules/records/client/cli/tx.go index a3c26ddcb..a6de756f9 100644 --- a/x/yieldaggregator/ibcstaking/records/client/cli/tx.go +++ b/x/yieldaggregator/submodules/records/client/cli/tx.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) var DefaultRelativePacketTimeoutTimestamp = cast.ToUint64((time.Duration(10) * time.Minute).Nanoseconds()) diff --git a/x/yieldaggregator/ibcstaking/records/genesis.go b/x/yieldaggregator/submodules/records/genesis.go similarity index 91% rename from x/yieldaggregator/ibcstaking/records/genesis.go rename to x/yieldaggregator/submodules/records/genesis.go index e376e691e..3fda0d60a 100644 --- a/x/yieldaggregator/ibcstaking/records/genesis.go +++ b/x/yieldaggregator/submodules/records/genesis.go @@ -3,8 +3,8 @@ package records import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // InitGenesis initializes the capability module's state from a provided genesis diff --git a/x/yieldaggregator/ibcstaking/records/keeper/callback_transfer.go b/x/yieldaggregator/submodules/records/keeper/callback_transfer.go similarity index 60% rename from x/yieldaggregator/ibcstaking/records/keeper/callback_transfer.go rename to x/yieldaggregator/submodules/records/keeper/callback_transfer.go index de1b80ce3..7008c807b 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/callback_transfer.go +++ b/x/yieldaggregator/submodules/records/keeper/callback_transfer.go @@ -1,16 +1,16 @@ package keeper import ( + "encoding/json" "fmt" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" "github.com/golang/protobuf/proto" //nolint:staticcheck + + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) func (k Keeper) MarshalTransferCallbackArgs(ctx sdk.Context, delegateCallback types.TransferCallback) ([]byte, error) { @@ -67,3 +67,49 @@ func TransferCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ack k.Logger(ctx).Info(fmt.Sprintf("[IBC-TRANSFER] success to %s", depositRecord.HostZoneId)) return nil } + +func ContractTransferCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ack *channeltypes.Acknowledgement, args []byte) error { + k.Logger(ctx).Info("TransferCallback executing", "packet", packet) + if ack.GetError() != "" { + k.Logger(ctx).Error(fmt.Sprintf("TransferCallback does not handle errors %s", ack.GetError())) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "TransferCallback does not handle errors: %s", ack.GetError()) + } + if ack == nil { + // timeout + k.Logger(ctx).Error(fmt.Sprintf("TransferCallback timeout, ack is nil, packet %v", packet)) + return nil + } + + var data ibctransfertypes.FungibleTokenPacketData + if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err != nil { + k.Logger(ctx).Error(fmt.Sprintf("Error unmarshalling packet %v", err.Error())) + return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal ICS-20 transfer packet data: %s", err.Error()) + } + k.Logger(ctx).Info(fmt.Sprintf("TransferCallback unmarshalled FungibleTokenPacketData %v", data)) + + contractAddress, err := sdk.AccAddressFromBech32(data.Sender) + if err != nil { + return sdkerrors.Wrapf(types.ErrUnmarshalFailure, "cannot retrieve contract address: %s", err.Error()) + } + + x := types.MessageTransferCallback{} + + x.TransferCallback.Denom = data.Denom + x.TransferCallback.Amount = data.Amount + x.TransferCallback.Sender = data.Sender + x.TransferCallback.Receiver = data.Receiver + x.TransferCallback.Memo = data.Memo + x.TransferCallback.Success = true + + m, err := json.Marshal(x) + if err != nil { + return fmt.Errorf("failed to marshal MessageTransferCallback: %v", err) + } + + _, err = k.wasmKeeper.Sudo(ctx, contractAddress, m) + if err != nil { + k.Logger(ctx).Info("SudoTxQueryResult: failed to Sudo", string(m), "error", err, "contract_address", contractAddress) + return fmt.Errorf("failed to Sudo: %v", err) + } + return nil +} diff --git a/x/yieldaggregator/ibcstaking/records/keeper/callbacks.go b/x/yieldaggregator/submodules/records/keeper/callbacks.go similarity index 80% rename from x/yieldaggregator/ibcstaking/records/keeper/callbacks.go rename to x/yieldaggregator/submodules/records/keeper/callbacks.go index cdcf298b5..4992daf37 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/callbacks.go +++ b/x/yieldaggregator/submodules/records/keeper/callbacks.go @@ -1,13 +1,14 @@ package keeper import ( - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" sdk "github.com/cosmos/cosmos-sdk/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ) const TRANSFER = "transfer" +const CONTRACT_TRANSFER = "contract_transfer" // ICACallbacks wrapper struct for stakeibc keeper type ICACallback func(Keeper, sdk.Context, channeltypes.Packet, *channeltypes.Acknowledgement, []byte) error @@ -38,6 +39,8 @@ func (c ICACallbacks) AddICACallback(id string, fn interface{}) icacallbackstype } func (c ICACallbacks) RegisterICACallbacks() icacallbackstypes.ICACallbackHandler { - a := c.AddICACallback(TRANSFER, ICACallback(TransferCallback)) + a := c. + AddICACallback(TRANSFER, ICACallback(TransferCallback)). + AddICACallback(CONTRACT_TRANSFER, ICACallback(ContractTransferCallback)) return a.(ICACallbacks) } diff --git a/x/yieldaggregator/ibcstaking/records/keeper/deposit_record.go b/x/yieldaggregator/submodules/records/keeper/deposit_record.go similarity index 98% rename from x/yieldaggregator/ibcstaking/records/keeper/deposit_record.go rename to x/yieldaggregator/submodules/records/keeper/deposit_record.go index a9a3deaed..f64f8af4e 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/deposit_record.go +++ b/x/yieldaggregator/submodules/records/keeper/deposit_record.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // GetDepositRecordCount get the total number of depositRecord diff --git a/x/yieldaggregator/ibcstaking/records/keeper/epoch_unbonding_record.go b/x/yieldaggregator/submodules/records/keeper/epoch_unbonding_record.go similarity index 98% rename from x/yieldaggregator/ibcstaking/records/keeper/epoch_unbonding_record.go rename to x/yieldaggregator/submodules/records/keeper/epoch_unbonding_record.go index d337143c2..c5f71ce9b 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/epoch_unbonding_record.go +++ b/x/yieldaggregator/submodules/records/keeper/epoch_unbonding_record.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // SetEpochUnbondingRecord set a specific epochUnbondingRecord in the store diff --git a/x/yieldaggregator/ibcstaking/records/keeper/grpc_query.go b/x/yieldaggregator/submodules/records/keeper/grpc_query.go similarity index 99% rename from x/yieldaggregator/ibcstaking/records/keeper/grpc_query.go rename to x/yieldaggregator/submodules/records/keeper/grpc_query.go index d9d7e851e..9541170ee 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/grpc_query.go +++ b/x/yieldaggregator/submodules/records/keeper/grpc_query.go @@ -10,7 +10,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) var _ types.QueryServer = Keeper{} diff --git a/x/yieldaggregator/ibcstaking/records/keeper/keeper.go b/x/yieldaggregator/submodules/records/keeper/keeper.go similarity index 75% rename from x/yieldaggregator/ibcstaking/records/keeper/keeper.go rename to x/yieldaggregator/submodules/records/keeper/keeper.go index 5bd8bcb1e..ca1f0997a 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/keeper.go +++ b/x/yieldaggregator/submodules/records/keeper/keeper.go @@ -7,7 +7,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,11 +18,12 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" ibctypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - icacallbackskeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/keeper" + icacallbackskeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/keeper" storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + icqtypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) type ( @@ -37,6 +38,7 @@ type ( TransferKeeper ibctransferkeeper.Keeper IBCKeeper ibckeeper.Keeper ICACallbacksKeeper icacallbackskeeper.Keeper + wasmKeeper icqtypes.WasmKeeper } ) @@ -50,6 +52,7 @@ func NewKeeper( TransferKeeper ibctransferkeeper.Keeper, ibcKeeper ibckeeper.Keeper, ICACallbacksKeeper icacallbackskeeper.Keeper, + WasmKeeper icqtypes.WasmKeeper, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -66,6 +69,7 @@ func NewKeeper( TransferKeeper: TransferKeeper, IBCKeeper: ibcKeeper, ICACallbacksKeeper: ICACallbacksKeeper, + wasmKeeper: WasmKeeper, } } @@ -121,3 +125,33 @@ func (k Keeper) Transfer(ctx sdk.Context, msg *ibctypes.MsgTransfer, depositReco k.ICACallbacksKeeper.SetCallbackData(ctx, callback) return nil } + +func (k Keeper) ContractTransfer(ctx sdk.Context, msg *ibctypes.MsgTransfer) error { + goCtx := sdk.WrapSDKContext(ctx) + sequence, found := k.IBCKeeper.ChannelKeeper.GetNextSequenceSend(ctx, msg.SourcePort, msg.SourceChannel) + if !found { + return sdkerrors.Wrapf( + channeltypes.ErrSequenceSendNotFound, + "source port: %s, source channel: %s", msg.SourcePort, msg.SourceChannel, + ) + } + + // trigger transfer + _, err := k.TransferKeeper.Transfer(goCtx, msg) + if err != nil { + return err + } + + // Store the callback data + callback := icacallbackstypes.CallbackData{ + CallbackKey: icacallbackstypes.PacketID(msg.SourcePort, msg.SourceChannel, sequence), + PortId: msg.SourcePort, + ChannelId: msg.SourceChannel, + Sequence: sequence, + CallbackId: CONTRACT_TRANSFER, + CallbackArgs: []byte{}, + } + k.Logger(ctx).Info(fmt.Sprintf("Storing callback data: %v", callback)) + k.ICACallbacksKeeper.SetCallbackData(ctx, callback) + return nil +} diff --git a/x/yieldaggregator/ibcstaking/records/keeper/msg_server.go b/x/yieldaggregator/submodules/records/keeper/msg_server.go similarity index 82% rename from x/yieldaggregator/ibcstaking/records/keeper/msg_server.go rename to x/yieldaggregator/submodules/records/keeper/msg_server.go index 24164b5f3..2973dfe04 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/msg_server.go +++ b/x/yieldaggregator/submodules/records/keeper/msg_server.go @@ -1,7 +1,7 @@ package keeper import ( - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) type msgServer struct { diff --git a/x/yieldaggregator/ibcstaking/records/keeper/params.go b/x/yieldaggregator/submodules/records/keeper/params.go similarity index 84% rename from x/yieldaggregator/ibcstaking/records/keeper/params.go rename to x/yieldaggregator/submodules/records/keeper/params.go index 70088f7b0..240a79e93 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/params.go +++ b/x/yieldaggregator/submodules/records/keeper/params.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // GetParams get all parameters as types.Params diff --git a/x/yieldaggregator/ibcstaking/records/keeper/user_redemption_record.go b/x/yieldaggregator/submodules/records/keeper/user_redemption_record.go similarity index 97% rename from x/yieldaggregator/ibcstaking/records/keeper/user_redemption_record.go rename to x/yieldaggregator/submodules/records/keeper/user_redemption_record.go index 24d8569d5..117016695 100644 --- a/x/yieldaggregator/ibcstaking/records/keeper/user_redemption_record.go +++ b/x/yieldaggregator/submodules/records/keeper/user_redemption_record.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // SetUserRedemptionRecord set a specific userRedemptionRecord in the store diff --git a/x/yieldaggregator/ibcstaking/records/module.go b/x/yieldaggregator/submodules/records/module.go similarity index 96% rename from x/yieldaggregator/ibcstaking/records/module.go rename to x/yieldaggregator/submodules/records/module.go index ab658d9b7..81b093330 100644 --- a/x/yieldaggregator/ibcstaking/records/module.go +++ b/x/yieldaggregator/submodules/records/module.go @@ -17,9 +17,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/client/cli" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/client/cli" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) var ( diff --git a/x/yieldaggregator/ibcstaking/records/module_ibc.go b/x/yieldaggregator/submodules/records/module_ibc.go similarity index 98% rename from x/yieldaggregator/ibcstaking/records/module_ibc.go rename to x/yieldaggregator/submodules/records/module_ibc.go index 6ef0e3b92..3ca0cb7f7 100644 --- a/x/yieldaggregator/ibcstaking/records/module_ibc.go +++ b/x/yieldaggregator/submodules/records/module_ibc.go @@ -10,9 +10,9 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - icacallbacktypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbacktypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" // "google.golang.org/protobuf/proto" <-- this breaks tx parsing diff --git a/x/yieldaggregator/ibcstaking/records/module_simulation.go b/x/yieldaggregator/submodules/records/module_simulation.go similarity index 96% rename from x/yieldaggregator/ibcstaking/records/module_simulation.go rename to x/yieldaggregator/submodules/records/module_simulation.go index dace171bc..1c065d104 100644 --- a/x/yieldaggregator/ibcstaking/records/module_simulation.go +++ b/x/yieldaggregator/submodules/records/module_simulation.go @@ -9,7 +9,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" ) // avoid unused import issue diff --git a/x/yieldaggregator/ibcstaking/records/types/callbacks.pb.go b/x/yieldaggregator/submodules/records/types/callbacks.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/callbacks.pb.go rename to x/yieldaggregator/submodules/records/types/callbacks.pb.go diff --git a/x/yieldaggregator/ibcstaking/records/types/codec.go b/x/yieldaggregator/submodules/records/types/codec.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/codec.go rename to x/yieldaggregator/submodules/records/types/codec.go diff --git a/x/yieldaggregator/ibcstaking/records/types/errors.go b/x/yieldaggregator/submodules/records/types/errors.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/errors.go rename to x/yieldaggregator/submodules/records/types/errors.go diff --git a/x/yieldaggregator/ibcstaking/records/types/events_ibc.go b/x/yieldaggregator/submodules/records/types/events_ibc.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/events_ibc.go rename to x/yieldaggregator/submodules/records/types/events_ibc.go diff --git a/x/yieldaggregator/ibcstaking/records/types/expected_keepers.go b/x/yieldaggregator/submodules/records/types/expected_keepers.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/expected_keepers.go rename to x/yieldaggregator/submodules/records/types/expected_keepers.go diff --git a/x/yieldaggregator/ibcstaking/records/types/genesis.go b/x/yieldaggregator/submodules/records/types/genesis.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/genesis.go rename to x/yieldaggregator/submodules/records/types/genesis.go diff --git a/x/yieldaggregator/ibcstaking/records/types/genesis.pb.go b/x/yieldaggregator/submodules/records/types/genesis.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/genesis.pb.go rename to x/yieldaggregator/submodules/records/types/genesis.pb.go diff --git a/x/yieldaggregator/ibcstaking/records/types/keys.go b/x/yieldaggregator/submodules/records/types/keys.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/keys.go rename to x/yieldaggregator/submodules/records/types/keys.go diff --git a/x/yieldaggregator/ibcstaking/records/types/params.go b/x/yieldaggregator/submodules/records/types/params.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/params.go rename to x/yieldaggregator/submodules/records/types/params.go diff --git a/x/yieldaggregator/ibcstaking/records/types/query.pb.go b/x/yieldaggregator/submodules/records/types/query.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/query.pb.go rename to x/yieldaggregator/submodules/records/types/query.pb.go diff --git a/x/yieldaggregator/ibcstaking/records/types/query.pb.gw.go b/x/yieldaggregator/submodules/records/types/query.pb.gw.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/query.pb.gw.go rename to x/yieldaggregator/submodules/records/types/query.pb.gw.go diff --git a/x/yieldaggregator/submodules/records/types/sudo.go b/x/yieldaggregator/submodules/records/types/sudo.go new file mode 100644 index 000000000..72240c741 --- /dev/null +++ b/x/yieldaggregator/submodules/records/types/sudo.go @@ -0,0 +1,13 @@ +package types + +// MessageTransferCallback is passed to a contract's sudo() entrypoint for ibc transfer callback. +type MessageTransferCallback struct { + TransferCallback struct { + Denom string `json:"denom"` + Amount string `json:"amount"` + Sender string `json:"sender"` + Receiver string `json:"receiver"` + Memo string `json:"memo"` + Success bool `json:"success"` + } `json:"transfer_callback"` +} diff --git a/x/yieldaggregator/ibcstaking/records/types/types.go b/x/yieldaggregator/submodules/records/types/types.go similarity index 100% rename from x/yieldaggregator/ibcstaking/records/types/types.go rename to x/yieldaggregator/submodules/records/types/types.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/abci.go b/x/yieldaggregator/submodules/stakeibc/abci.go similarity index 92% rename from x/yieldaggregator/ibcstaking/stakeibc/abci.go rename to x/yieldaggregator/submodules/stakeibc/abci.go index 9d03745ef..5c39228c6 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/abci.go +++ b/x/yieldaggregator/submodules/stakeibc/abci.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query.go index 243288563..92829337c 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query.go @@ -10,7 +10,7 @@ import ( // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_epoch_tracker.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_epoch_tracker.go similarity index 96% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_epoch_tracker.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_epoch_tracker.go index 783a5c9b1..af543321f 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_epoch_tracker.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_epoch_tracker.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func CmdListEpochTracker() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_host_zone.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_host_zone.go similarity index 95% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_host_zone.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_host_zone.go index 6552c8606..868de9a31 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_host_zone.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_host_zone.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func CmdListHostZone() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_ica_account.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_ica_account.go similarity index 91% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_ica_account.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_ica_account.go index 4148ac262..aaf2ae859 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_ica_account.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_ica_account.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func CmdShowICAAccount() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_module_address.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_module_address.go similarity index 92% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_module_address.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_module_address.go index d1a08f9ba..414a22915 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_module_address.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_module_address.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_params.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_params.go similarity index 91% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_params.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_params.go index 41f5d6e99..383dfeb02 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_params.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_params.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func CmdQueryParams() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_register_ica.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_register_ica.go similarity index 92% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_register_ica.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_register_ica.go index 55b326f87..55ab027ef 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_register_ica.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_register_ica.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func CmdShowInterchainAccount() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_validator.go b/x/yieldaggregator/submodules/stakeibc/client/cli/query_validator.go similarity index 92% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_validator.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/query_validator.go index d6bc65e49..926864233 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/query_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/query_validator.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func CmdShowValidators() *cobra.Command { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx.go index daba638cd..592812474 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var DefaultRelativePacketTimeoutTimestamp = cast.ToUint64((time.Duration(10) * time.Minute).Nanoseconds()) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_add_validator.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_add_validator.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_add_validator.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_add_validator.go index b9e31e7c4..edaf28fb6 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_add_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_add_validator.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_change_validator_weight.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_change_validator_weight.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_change_validator_weight.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_change_validator_weight.go index 9377f93b8..bb116e10a 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_change_validator_weight.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_change_validator_weight.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_claim_undelegated_tokens.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_claim_undelegated_tokens.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_claim_undelegated_tokens.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_claim_undelegated_tokens.go index ccd40e95d..5ea56dd6b 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_claim_undelegated_tokens.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_claim_undelegated_tokens.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_clear_balance.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_clear_balance.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_clear_balance.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_clear_balance.go index f874e1b24..1cd700b4d 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_clear_balance.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_clear_balance.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_delete_validator.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_delete_validator.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_delete_validator.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_delete_validator.go index 1d7df976c..39efed9f5 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_delete_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_delete_validator.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_liquid_stake.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_liquid_stake.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_liquid_stake.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_liquid_stake.go index b813025c7..f4ce6909f 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_liquid_stake.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_liquid_stake.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_rebalance_validators.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_rebalance_validators.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_rebalance_validators.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_rebalance_validators.go index 4de5acfa1..965a9e1d8 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_rebalance_validators.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_rebalance_validators.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_redeem_stake.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_redeem_stake.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_redeem_stake.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_redeem_stake.go index fc42c409b..fafc03f9a 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_redeem_stake.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_redeem_stake.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_register_host_zone.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_register_host_zone.go similarity index 95% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_register_host_zone.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_register_host_zone.go index cbb9af039..233d3aecd 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_register_host_zone.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_register_host_zone.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_restore_interchain_account.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_restore_interchain_account.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_restore_interchain_account.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_restore_interchain_account.go index 52bb1e002..87ca47c84 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_restore_interchain_account.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_restore_interchain_account.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_update_delegation.go b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_update_delegation.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_update_delegation.go rename to x/yieldaggregator/submodules/stakeibc/client/cli/tx_update_delegation.go index c1d141adf..2763e9b3a 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/client/cli/tx_update_delegation.go +++ b/x/yieldaggregator/submodules/stakeibc/client/cli/tx_update_delegation.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ = strconv.Itoa(0) diff --git a/x/yieldaggregator/ibcstaking/stakeibc/genesis.go b/x/yieldaggregator/submodules/stakeibc/genesis.go similarity index 92% rename from x/yieldaggregator/ibcstaking/stakeibc/genesis.go rename to x/yieldaggregator/submodules/stakeibc/genesis.go index e5613ce47..440d63a3c 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/genesis.go +++ b/x/yieldaggregator/submodules/stakeibc/genesis.go @@ -3,8 +3,8 @@ package stakeibc import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // InitGenesis initializes the capability module's state from a provided genesis diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/callbacks.go b/x/yieldaggregator/submodules/stakeibc/keeper/callbacks.go similarity index 99% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/callbacks.go rename to x/yieldaggregator/submodules/stakeibc/keeper/callbacks.go index 7f048289f..0ba5cf7fb 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/callbacks.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/callbacks.go @@ -11,8 +11,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" epochtypes "github.com/UnUniFi/chain/x/epochs/types" - icqtypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + icqtypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // ___________________________________________________________________________________________________ diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/delegation.go b/x/yieldaggregator/submodules/stakeibc/keeper/delegation.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/delegation.go rename to x/yieldaggregator/submodules/stakeibc/keeper/delegation.go index 41c6e8640..33b23e8cf 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/delegation.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/delegation.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // SetDelegation set delegation in the store diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/deposit_records.go b/x/yieldaggregator/submodules/stakeibc/keeper/deposit_records.go similarity index 97% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/deposit_records.go rename to x/yieldaggregator/submodules/stakeibc/keeper/deposit_records.go index 7ee79534d..a752b4b33 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/deposit_records.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/deposit_records.go @@ -12,8 +12,8 @@ import ( "github.com/spf13/cast" "github.com/UnUniFi/chain/utils" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k Keeper) CreateDepositRecordsForEpoch(ctx sdk.Context, epochNumber uint64) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/epoch_tracker.go b/x/yieldaggregator/submodules/stakeibc/keeper/epoch_tracker.go similarity index 96% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/epoch_tracker.go rename to x/yieldaggregator/submodules/stakeibc/keeper/epoch_tracker.go index 5acaced78..7af4b63ee 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/epoch_tracker.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/epoch_tracker.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // SetEpochTracker set a specific epochTracker in the store from its index diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/grpc_query.go b/x/yieldaggregator/submodules/stakeibc/keeper/grpc_query.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/grpc_query.go rename to x/yieldaggregator/submodules/stakeibc/keeper/grpc_query.go index da85ba802..c5ae6984e 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/grpc_query.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/grpc_query.go @@ -11,7 +11,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var _ types.QueryServer = Keeper{} diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/hooks.go b/x/yieldaggregator/submodules/stakeibc/keeper/hooks.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/hooks.go rename to x/yieldaggregator/submodules/stakeibc/keeper/hooks.go index 688a602f2..3f71f5e54 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/hooks.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/hooks.go @@ -8,8 +8,8 @@ import ( "github.com/UnUniFi/chain/utils" epochstypes "github.com/UnUniFi/chain/x/epochs/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // TODO [TEST-127]: ensure all timeouts are less than the epoch length diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/host_zone.go b/x/yieldaggregator/submodules/stakeibc/keeper/host_zone.go similarity index 99% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/host_zone.go rename to x/yieldaggregator/submodules/stakeibc/keeper/host_zone.go index 0d1f70524..e32bf37f6 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/host_zone.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/host_zone.go @@ -10,7 +10,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/spf13/cast" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // GetHostZoneCount get the total number of hostZone diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/ica_account.go b/x/yieldaggregator/submodules/stakeibc/keeper/ica_account.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/ica_account.go rename to x/yieldaggregator/submodules/stakeibc/keeper/ica_account.go index d1c3e7b89..586cb3ee4 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/ica_account.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/ica_account.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // SetICAAccount set iCAAccount in the store diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks.go b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks.go rename to x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks.go index d955cfee8..4c5dd9387 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks.go @@ -1,7 +1,7 @@ package keeper import ( - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" sdk "github.com/cosmos/cosmos-sdk/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_claim.go b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_claim.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_claim.go rename to x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_claim.go index 17dd67991..9227ea3e4 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_claim.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_claim.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_delegate.go b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_delegate.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_delegate.go rename to x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_delegate.go index 3d533cfad..e38f7ab08 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_delegate.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_delegate.go @@ -5,10 +5,10 @@ import ( "github.com/spf13/cast" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_redemption.go b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_redemption.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_redemption.go rename to x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_redemption.go index 0f64a3de3..a6b7c7cf4 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_redemption.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_redemption.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_reinvest.go b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_reinvest.go similarity index 90% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_reinvest.go rename to x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_reinvest.go index cdbbaf719..e667a94bc 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_reinvest.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_reinvest.go @@ -4,10 +4,10 @@ import ( "fmt" epochtypes "github.com/UnUniFi/chain/x/epochs/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_undelegate.go b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_undelegate.go similarity index 96% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_undelegate.go rename to x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_undelegate.go index 3a9acdb84..20a6fb8b4 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/icacallbacks_undelegate.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/icacallbacks_undelegate.go @@ -6,10 +6,10 @@ import ( "github.com/spf13/cast" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/invariants.go b/x/yieldaggregator/submodules/stakeibc/keeper/invariants.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/invariants.go rename to x/yieldaggregator/submodules/stakeibc/keeper/invariants.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/keeper.go b/x/yieldaggregator/submodules/stakeibc/keeper/keeper.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/keeper.go rename to x/yieldaggregator/submodules/stakeibc/keeper/keeper.go index 28d6005ee..3e141b30a 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/keeper.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/keeper.go @@ -14,8 +14,8 @@ import ( capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - icqkeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + icqkeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -28,8 +28,8 @@ import ( icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" epochstypes "github.com/UnUniFi/chain/x/epochs/types" - icacallbackskeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/keeper" - recordsmodulekeeper "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/keeper" + icacallbackskeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/keeper" + recordsmodulekeeper "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/keeper" ) type ( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/min_validator_requirements.go b/x/yieldaggregator/submodules/stakeibc/keeper/min_validator_requirements.go similarity index 94% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/min_validator_requirements.go rename to x/yieldaggregator/submodules/stakeibc/keeper/min_validator_requirements.go index f015eb643..f9a8a661b 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/min_validator_requirements.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/min_validator_requirements.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // SetMinValidatorRequirements set minValidatorRequirements in the store diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server.go similarity index 82% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server.go index 83a37672d..6d0cd57ce 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server.go @@ -1,7 +1,7 @@ package keeper import ( - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) type msgServer struct { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_add_validator.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_add_validator.go similarity index 96% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_add_validator.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_add_validator.go index b3d59cdf2..7c88737b2 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_add_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_add_validator.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k msgServer) AddValidator(goCtx context.Context, msg *types.MsgAddValidator) (*types.MsgAddValidatorResponse, error) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_change_validator_weight.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_change_validator_weight.go similarity index 93% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_change_validator_weight.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_change_validator_weight.go index 5158a9329..08844faba 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_change_validator_weight.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_change_validator_weight.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k msgServer) ChangeValidatorWeight(goCtx context.Context, msg *types.MsgChangeValidatorWeight) (*types.MsgChangeValidatorWeightResponse, error) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_claim_undelegated_tokens.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_claim_undelegated_tokens.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_claim_undelegated_tokens.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_claim_undelegated_tokens.go index 3a53fc415..1a5497cad 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_claim_undelegated_tokens.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_claim_undelegated_tokens.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cast" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -15,7 +15,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" epochstypes "github.com/UnUniFi/chain/x/epochs/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) type IcaTx struct { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_clear_balance.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_clear_balance.go similarity index 97% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_clear_balance.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_clear_balance.go index 404c5f7c3..10f519bd1 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_clear_balance.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_clear_balance.go @@ -9,7 +9,7 @@ import ( ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" "github.com/spf13/cast" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k msgServer) ClearBalance(goCtx context.Context, msg *types.MsgClearBalance) (*types.MsgClearBalanceResponse, error) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_delete_validator.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_delete_validator.go similarity index 91% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_delete_validator.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_delete_validator.go index 840a886c7..3bfcac9aa 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_delete_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_delete_validator.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k msgServer) DeleteValidator(goCtx context.Context, msg *types.MsgDeleteValidator) (*types.MsgDeleteValidatorResponse, error) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_liquid_stake.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_liquid_stake.go similarity index 99% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_liquid_stake.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_liquid_stake.go index fffc7717f..b0e1a2d8d 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_liquid_stake.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_liquid_stake.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cast" epochtypes "github.com/UnUniFi/chain/x/epochs/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k Keeper) LiquidStake(ctx sdk.Context, sender sdk.AccAddress, amount sdk.Coin) error { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_rebalance_validators.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_rebalance_validators.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_rebalance_validators.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_rebalance_validators.go index 771712bc3..72627050b 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_rebalance_validators.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_rebalance_validators.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cast" "github.com/UnUniFi/chain/utils" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func abs(n int64) int64 { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_redeem_stake.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_redeem_stake.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_redeem_stake.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_redeem_stake.go index d193334d1..9f5372ade 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_redeem_stake.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_redeem_stake.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cast" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_register_host_zone.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_register_host_zone.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_register_host_zone.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_register_host_zone.go index 89d75c4f3..bcc580567 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_register_host_zone.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_register_host_zone.go @@ -8,8 +8,8 @@ import ( icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" epochtypes "github.com/UnUniFi/chain/x/epochs/types" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_restore_interchain_account.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_restore_interchain_account.go similarity index 97% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_restore_interchain_account.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_restore_interchain_account.go index e33214653..18f9fc5f0 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_restore_interchain_account.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_restore_interchain_account.go @@ -8,7 +8,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k msgServer) RestoreInterchainAccount(goCtx context.Context, msg *types.MsgRestoreInterchainAccount) (*types.MsgRestoreInterchainAccountResponse, error) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_submit_tx.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_submit_tx.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_submit_tx.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_submit_tx.go index 3e9febca3..1c4026f55 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_submit_tx.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_submit_tx.go @@ -9,9 +9,9 @@ import ( proto "github.com/cosmos/gogoproto/proto" "github.com/spf13/cast" - icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbackstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -20,7 +20,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" epochstypes "github.com/UnUniFi/chain/x/epochs/types" - icqtypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/interchainquery/types" + icqtypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/interchainquery/types" sdk "github.com/cosmos/cosmos-sdk/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_update_validator_shares_exch_rate.go b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_update_validator_shares_exch_rate.go similarity index 91% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_update_validator_shares_exch_rate.go rename to x/yieldaggregator/submodules/stakeibc/keeper/msg_server_update_validator_shares_exch_rate.go index 3e45c9531..f28e33823 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/msg_server_update_validator_shares_exch_rate.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/msg_server_update_validator_shares_exch_rate.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // This kicks off two ICQs, each with a callback, that will update the number of tokens on a validator diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/params.go b/x/yieldaggregator/submodules/stakeibc/keeper/params.go similarity index 85% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/params.go rename to x/yieldaggregator/submodules/stakeibc/keeper/params.go index 89b5a2cbb..c882c7656 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/params.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/params.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // GetParams get all parameters as types.Params diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/unbonding_records.go b/x/yieldaggregator/submodules/stakeibc/keeper/unbonding_records.go similarity index 99% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/unbonding_records.go rename to x/yieldaggregator/submodules/stakeibc/keeper/unbonding_records.go index 7c939980b..a47b9a024 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/unbonding_records.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/unbonding_records.go @@ -12,8 +12,8 @@ import ( "github.com/UnUniFi/chain/utils" - recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + recordstypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k Keeper) CreateEpochUnbondingRecord(ctx sdk.Context, epochNumber uint64) bool { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/validator.go b/x/yieldaggregator/submodules/stakeibc/keeper/validator.go similarity index 95% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/validator.go rename to x/yieldaggregator/submodules/stakeibc/keeper/validator.go index 0c1e8ddac..c5307bdeb 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/validator.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/validator.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // SetValidator set validator in the store diff --git a/x/yieldaggregator/ibcstaking/stakeibc/keeper/validator_selection.go b/x/yieldaggregator/submodules/stakeibc/keeper/validator_selection.go similarity index 98% rename from x/yieldaggregator/ibcstaking/stakeibc/keeper/validator_selection.go rename to x/yieldaggregator/submodules/stakeibc/keeper/validator_selection.go index d7b37a394..ab863f891 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/keeper/validator_selection.go +++ b/x/yieldaggregator/submodules/stakeibc/keeper/validator_selection.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cast" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func (k Keeper) GetValidatorDelegationAmtDifferences(ctx sdk.Context, hostZone types.HostZone) (map[string]int64, error) { diff --git a/x/yieldaggregator/ibcstaking/stakeibc/module.go b/x/yieldaggregator/submodules/stakeibc/module.go similarity index 96% rename from x/yieldaggregator/ibcstaking/stakeibc/module.go rename to x/yieldaggregator/submodules/stakeibc/module.go index 0bc65e32c..35406e2e2 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/module.go +++ b/x/yieldaggregator/submodules/stakeibc/module.go @@ -19,9 +19,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/client/cli" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/client/cli" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) var ( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/module_ibc.go b/x/yieldaggregator/submodules/stakeibc/module_ibc.go similarity index 97% rename from x/yieldaggregator/ibcstaking/stakeibc/module_ibc.go rename to x/yieldaggregator/submodules/stakeibc/module_ibc.go index f03269c1e..1de64d878 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/module_ibc.go +++ b/x/yieldaggregator/submodules/stakeibc/module_ibc.go @@ -11,10 +11,10 @@ import ( host "github.com/cosmos/ibc-go/v7/modules/core/24-host" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - icacallbacktypes "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/icacallbacks/types" + icacallbacktypes "github.com/UnUniFi/chain/x/yieldaggregator/submodules/icacallbacks/types" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // IBCModule implements the ICS26 interface for interchain accounts controller chains @@ -162,8 +162,9 @@ func (im IBCModule) OnAcknowledgementPacket( err = im.keeper.ICACallbacksKeeper.CallRegisteredICACallback(ctx, modulePacket, &ack) if err != nil { - errMsg := fmt.Sprintf("Unable to call registered callback from stakeibc OnAcknowledgePacket | Sequence %d, from %s %s, to %s %s", - modulePacket.Sequence, modulePacket.SourceChannel, modulePacket.SourcePort, modulePacket.DestinationChannel, modulePacket.DestinationPort) + errMsg := fmt.Sprintf("Unable to call registered callback from stakeibc OnAcknowledgePacket | Sequence %d, from %s %s, to %s %s | Log: %s", + modulePacket.Sequence, modulePacket.SourceChannel, modulePacket.SourcePort, modulePacket.DestinationChannel, modulePacket.DestinationPort, err.Error()) + im.keeper.Logger(ctx).Error(errMsg) return sdkerrors.Wrapf(icacallbacktypes.ErrCallbackFailed, errMsg) } diff --git a/x/yieldaggregator/ibcstaking/stakeibc/module_simulation.go b/x/yieldaggregator/submodules/stakeibc/module_simulation.go similarity index 97% rename from x/yieldaggregator/ibcstaking/stakeibc/module_simulation.go rename to x/yieldaggregator/submodules/stakeibc/module_simulation.go index 509b6a325..8276f1cc7 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/module_simulation.go +++ b/x/yieldaggregator/submodules/stakeibc/module_simulation.go @@ -11,8 +11,8 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - stakeibcsimulation "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + stakeibcsimulation "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/simulation" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) // avoid unused import issue diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/add_validator.go b/x/yieldaggregator/submodules/stakeibc/simulation/add_validator.go similarity index 85% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/add_validator.go rename to x/yieldaggregator/submodules/stakeibc/simulation/add_validator.go index 3c423cf86..708d53fbb 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/add_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/add_validator.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgAddValidator( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/change_validator_weight.go b/x/yieldaggregator/submodules/stakeibc/simulation/change_validator_weight.go similarity index 86% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/change_validator_weight.go rename to x/yieldaggregator/submodules/stakeibc/simulation/change_validator_weight.go index 2ab62ddd3..331ff390a 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/change_validator_weight.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/change_validator_weight.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgChangeValidatorWeight( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/claim_undelegated_tokens.go b/x/yieldaggregator/submodules/stakeibc/simulation/claim_undelegated_tokens.go similarity index 86% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/claim_undelegated_tokens.go rename to x/yieldaggregator/submodules/stakeibc/simulation/claim_undelegated_tokens.go index dd9952d2e..98d354ae8 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/claim_undelegated_tokens.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/claim_undelegated_tokens.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgClaimUndelegatedTokens( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/delete_validator.go b/x/yieldaggregator/submodules/stakeibc/simulation/delete_validator.go similarity index 86% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/delete_validator.go rename to x/yieldaggregator/submodules/stakeibc/simulation/delete_validator.go index 080160b4a..69947aaa6 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/delete_validator.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/delete_validator.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgDeleteValidator( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/liquid_stake.go b/x/yieldaggregator/submodules/stakeibc/simulation/liquid_stake.go similarity index 85% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/liquid_stake.go rename to x/yieldaggregator/submodules/stakeibc/simulation/liquid_stake.go index beaf4cb2c..fc47a5652 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/liquid_stake.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/liquid_stake.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgLiquidStake( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/rebalance_validators.go b/x/yieldaggregator/submodules/stakeibc/simulation/rebalance_validators.go similarity index 86% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/rebalance_validators.go rename to x/yieldaggregator/submodules/stakeibc/simulation/rebalance_validators.go index 5b2fed8da..1d545f72c 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/rebalance_validators.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/rebalance_validators.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgRebalanceValidators( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/restore_interchain_account.go b/x/yieldaggregator/submodules/stakeibc/simulation/restore_interchain_account.go similarity index 86% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/restore_interchain_account.go rename to x/yieldaggregator/submodules/stakeibc/simulation/restore_interchain_account.go index 415322c83..37773d3ad 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/restore_interchain_account.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/restore_interchain_account.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgRestoreInterchainAccount( diff --git a/x/yieldaggregator/ibcstaking/icacallbacks/simulation/simap.go b/x/yieldaggregator/submodules/stakeibc/simulation/simap.go similarity index 100% rename from x/yieldaggregator/ibcstaking/icacallbacks/simulation/simap.go rename to x/yieldaggregator/submodules/stakeibc/simulation/simap.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/simulation/update_delegation.go b/x/yieldaggregator/submodules/stakeibc/simulation/update_delegation.go similarity index 86% rename from x/yieldaggregator/ibcstaking/stakeibc/simulation/update_delegation.go rename to x/yieldaggregator/submodules/stakeibc/simulation/update_delegation.go index 093ca07ff..60a323217 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/simulation/update_delegation.go +++ b/x/yieldaggregator/submodules/stakeibc/simulation/update_delegation.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/keeper" - "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/stakeibc/types" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/keeper" + "github.com/UnUniFi/chain/x/yieldaggregator/submodules/stakeibc/types" ) func SimulateMsgUpdateValidatorSharesExchRate( diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/callbacks.pb.go b/x/yieldaggregator/submodules/stakeibc/types/callbacks.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/callbacks.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/callbacks.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/codec.go b/x/yieldaggregator/submodules/stakeibc/types/codec.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/codec.go rename to x/yieldaggregator/submodules/stakeibc/types/codec.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/delegation.pb.go b/x/yieldaggregator/submodules/stakeibc/types/delegation.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/delegation.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/delegation.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/epoch_tracker.pb.go b/x/yieldaggregator/submodules/stakeibc/types/epoch_tracker.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/epoch_tracker.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/epoch_tracker.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/errors.go b/x/yieldaggregator/submodules/stakeibc/types/errors.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/errors.go rename to x/yieldaggregator/submodules/stakeibc/types/errors.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/events_ibc.go b/x/yieldaggregator/submodules/stakeibc/types/events_ibc.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/events_ibc.go rename to x/yieldaggregator/submodules/stakeibc/types/events_ibc.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/expected_keepers.go b/x/yieldaggregator/submodules/stakeibc/types/expected_keepers.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/expected_keepers.go rename to x/yieldaggregator/submodules/stakeibc/types/expected_keepers.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/genesis.go b/x/yieldaggregator/submodules/stakeibc/types/genesis.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/genesis.go rename to x/yieldaggregator/submodules/stakeibc/types/genesis.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/genesis.pb.go b/x/yieldaggregator/submodules/stakeibc/types/genesis.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/genesis.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/genesis.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/host_zone.pb.go b/x/yieldaggregator/submodules/stakeibc/types/host_zone.pb.go similarity index 99% rename from x/yieldaggregator/ibcstaking/stakeibc/types/host_zone.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/host_zone.pb.go index 5ab3d0bf5..289b8fb67 100644 --- a/x/yieldaggregator/ibcstaking/stakeibc/types/host_zone.pb.go +++ b/x/yieldaggregator/submodules/stakeibc/types/host_zone.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - _ "github.com/UnUniFi/chain/x/yieldaggregator/ibcstaking/records/types" + _ "github.com/UnUniFi/chain/x/yieldaggregator/submodules/records/types" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" proto "github.com/cosmos/gogoproto/proto" diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/ica_account.go b/x/yieldaggregator/submodules/stakeibc/types/ica_account.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/ica_account.go rename to x/yieldaggregator/submodules/stakeibc/types/ica_account.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/ica_account.pb.go b/x/yieldaggregator/submodules/stakeibc/types/ica_account.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/ica_account.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/ica_account.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/key_epoch_tracker.go b/x/yieldaggregator/submodules/stakeibc/types/key_epoch_tracker.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/key_epoch_tracker.go rename to x/yieldaggregator/submodules/stakeibc/types/key_epoch_tracker.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/keys.go b/x/yieldaggregator/submodules/stakeibc/types/keys.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/keys.go rename to x/yieldaggregator/submodules/stakeibc/types/keys.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_add_validator.go b/x/yieldaggregator/submodules/stakeibc/types/message_add_validator.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_add_validator.go rename to x/yieldaggregator/submodules/stakeibc/types/message_add_validator.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_change_validator_weight.go b/x/yieldaggregator/submodules/stakeibc/types/message_change_validator_weight.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_change_validator_weight.go rename to x/yieldaggregator/submodules/stakeibc/types/message_change_validator_weight.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_claim_undelegated_tokens.go b/x/yieldaggregator/submodules/stakeibc/types/message_claim_undelegated_tokens.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_claim_undelegated_tokens.go rename to x/yieldaggregator/submodules/stakeibc/types/message_claim_undelegated_tokens.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_clear_balance.go b/x/yieldaggregator/submodules/stakeibc/types/message_clear_balance.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_clear_balance.go rename to x/yieldaggregator/submodules/stakeibc/types/message_clear_balance.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_delete_validator.go b/x/yieldaggregator/submodules/stakeibc/types/message_delete_validator.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_delete_validator.go rename to x/yieldaggregator/submodules/stakeibc/types/message_delete_validator.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_liquid_stake.go b/x/yieldaggregator/submodules/stakeibc/types/message_liquid_stake.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_liquid_stake.go rename to x/yieldaggregator/submodules/stakeibc/types/message_liquid_stake.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_rebalance_validators.go b/x/yieldaggregator/submodules/stakeibc/types/message_rebalance_validators.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_rebalance_validators.go rename to x/yieldaggregator/submodules/stakeibc/types/message_rebalance_validators.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_redeem_stake.go b/x/yieldaggregator/submodules/stakeibc/types/message_redeem_stake.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_redeem_stake.go rename to x/yieldaggregator/submodules/stakeibc/types/message_redeem_stake.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_register_host_zone.go b/x/yieldaggregator/submodules/stakeibc/types/message_register_host_zone.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_register_host_zone.go rename to x/yieldaggregator/submodules/stakeibc/types/message_register_host_zone.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_restore_interchain_account.go b/x/yieldaggregator/submodules/stakeibc/types/message_restore_interchain_account.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_restore_interchain_account.go rename to x/yieldaggregator/submodules/stakeibc/types/message_restore_interchain_account.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/message_update_delegation.go b/x/yieldaggregator/submodules/stakeibc/types/message_update_delegation.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/message_update_delegation.go rename to x/yieldaggregator/submodules/stakeibc/types/message_update_delegation.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/min_validator_requirements.pb.go b/x/yieldaggregator/submodules/stakeibc/types/min_validator_requirements.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/min_validator_requirements.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/min_validator_requirements.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/packet.pb.go b/x/yieldaggregator/submodules/stakeibc/types/packet.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/packet.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/packet.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/params.go b/x/yieldaggregator/submodules/stakeibc/types/params.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/params.go rename to x/yieldaggregator/submodules/stakeibc/types/params.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/params.pb.go b/x/yieldaggregator/submodules/stakeibc/types/params.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/params.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/params.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/query.pb.go b/x/yieldaggregator/submodules/stakeibc/types/query.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/query.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/query.pb.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/query.pb.gw.go b/x/yieldaggregator/submodules/stakeibc/types/query.pb.gw.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/query.pb.gw.go rename to x/yieldaggregator/submodules/stakeibc/types/query.pb.gw.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/query_register_ica.go b/x/yieldaggregator/submodules/stakeibc/types/query_register_ica.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/query_register_ica.go rename to x/yieldaggregator/submodules/stakeibc/types/query_register_ica.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/tx.pb.go b/x/yieldaggregator/submodules/stakeibc/types/tx.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/tx.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/tx.pb.go diff --git a/deprecated/x/incentive/types/types.go b/x/yieldaggregator/submodules/stakeibc/types/types.go similarity index 100% rename from deprecated/x/incentive/types/types.go rename to x/yieldaggregator/submodules/stakeibc/types/types.go diff --git a/x/yieldaggregator/ibcstaking/stakeibc/types/validator.pb.go b/x/yieldaggregator/submodules/stakeibc/types/validator.pb.go similarity index 100% rename from x/yieldaggregator/ibcstaking/stakeibc/types/validator.pb.go rename to x/yieldaggregator/submodules/stakeibc/types/validator.pb.go diff --git a/x/yieldaggregator/types/codec.go b/x/yieldaggregator/types/codec.go index 01f066e59..b732abfb4 100644 --- a/x/yieldaggregator/types/codec.go +++ b/x/yieldaggregator/types/codec.go @@ -5,7 +5,6 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func RegisterCodec(cdc *codec.LegacyAmino) { @@ -17,11 +16,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDepositToVault{}, &MsgWithdrawFromVault{}, - ) - - registry.RegisterImplementations( - (*govtypes.Content)(nil), - &ProposalAddStrategy{}, + &MsgCreateVault{}, + &MsgTransferVaultOwnership{}, + &MsgUpdateParams{}, + &MsgRegisterStrategy{}, + &MsgDeleteVault{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/yieldaggregator/types/errors.go b/x/yieldaggregator/types/errors.go index 9299463cd..697e4a1bd 100644 --- a/x/yieldaggregator/types/errors.go +++ b/x/yieldaggregator/types/errors.go @@ -1,23 +1,23 @@ package types -// DONTCOVER - import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "cosmossdk.io/errors" ) // x/yieldaggregator module sentinel errors var ( - ErrInvalidFeeDenom = sdkerrors.Register(ModuleName, 1, "invalid fee denom") - ErrInsufficientFee = sdkerrors.Register(ModuleName, 2, "insufficient fee") - ErrInvalidDepositDenom = sdkerrors.Register(ModuleName, 3, "invalid deposit denom") - ErrInsufficientDeposit = sdkerrors.Register(ModuleName, 4, "insufficient deposit") - ErrInvalidVaultId = sdkerrors.Register(ModuleName, 5, "invalid vault id") - ErrNotVaultOwner = sdkerrors.Register(ModuleName, 6, "not a vault owner") - ErrVaultHasPositiveBalance = sdkerrors.Register(ModuleName, 7, "vault has positive balance") - ErrInvalidCommissionRate = sdkerrors.Register(ModuleName, 8, "invalid commission rate") - ErrDuplicatedStrategy = sdkerrors.Register(ModuleName, 9, "duplicated strategy") - ErrInvalidStrategyWeightSum = sdkerrors.Register(ModuleName, 10, "invalid strategy weight sum") - ErrInvalidStrategyInvolved = sdkerrors.Register(ModuleName, 11, "invalid strategy id involved") - ErrInvalidWithdrawReserveRate = sdkerrors.Register(ModuleName, 12, "invalid withdraw reserve rate") + ErrParsingParams = errors.Register(ModuleName, 1, "failed to marshal or unmarshal module params") + ErrInvalidFeeDenom = errors.Register(ModuleName, 2, "invalid fee denom") + ErrInsufficientFee = errors.Register(ModuleName, 3, "insufficient fee") + ErrInvalidDepositDenom = errors.Register(ModuleName, 4, "invalid deposit denom") + ErrInsufficientDeposit = errors.Register(ModuleName, 5, "insufficient deposit") + ErrInvalidVaultId = errors.Register(ModuleName, 6, "invalid vault id") + ErrNotVaultOwner = errors.Register(ModuleName, 7, "not a vault owner") + ErrVaultHasPositiveBalance = errors.Register(ModuleName, 8, "vault has positive balance") + ErrInvalidCommissionRate = errors.Register(ModuleName, 9, "invalid commission rate") + ErrDuplicatedStrategy = errors.Register(ModuleName, 10, "duplicated strategy") + ErrInvalidStrategyWeightSum = errors.Register(ModuleName, 11, "invalid strategy weight sum") + ErrInvalidStrategyInvolved = errors.Register(ModuleName, 12, "invalid strategy id involved") + ErrInvalidWithdrawReserveRate = errors.Register(ModuleName, 13, "invalid withdraw reserve rate") + ErrInvalidAmount = errors.Register(ModuleName, 14, "invalid amount") ) diff --git a/x/yieldaggregator/types/keys.go b/x/yieldaggregator/types/keys.go index 914c2ca2e..f32964e07 100644 --- a/x/yieldaggregator/types/keys.go +++ b/x/yieldaggregator/types/keys.go @@ -19,6 +19,11 @@ func KeyPrefix(p string) []byte { return []byte(p) } +var ( + // Module parameters + KeyParams = []byte{0x00} +) + const ( VaultKey = "Vault/value/" VaultCountKey = "Vault/count/" diff --git a/x/yieldaggregator/types/message_create_vault.go b/x/yieldaggregator/types/message_create_vault.go index d72273de9..821b2c3ca 100644 --- a/x/yieldaggregator/types/message_create_vault.go +++ b/x/yieldaggregator/types/message_create_vault.go @@ -8,8 +8,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgCreateVault = "create-vault" - var _ sdk.Msg = &MsgCreateVault{} func NewMsgCreateVault(sender string, denom string, commissionRate sdk.Dec, withdrawReserveRate sdk.Dec, strategyWeights []StrategyWeight, fee types.Coin, deposit types.Coin) *MsgCreateVault { @@ -58,18 +56,6 @@ func (msg MsgCreateVault) ValidateBasic() error { return nil } -func (msg *MsgCreateVault) Route() string { - return RouterKey -} - -func (msg *MsgCreateVault) Type() string { - return TypeMsgDepositToVault -} - -func (msg MsgCreateVault) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgCreateVault) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} diff --git a/x/yieldaggregator/types/message_delete_vault.go b/x/yieldaggregator/types/message_delete_vault.go index 8978c9f94..0cb1b7784 100644 --- a/x/yieldaggregator/types/message_delete_vault.go +++ b/x/yieldaggregator/types/message_delete_vault.go @@ -7,8 +7,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgDeleteVault = "delete-vault" - var _ sdk.Msg = &MsgCreateVault{} func NewMsgDeleteVault(sender string, vaultId uint64) *MsgDeleteVault { @@ -26,18 +24,6 @@ func (msg MsgDeleteVault) ValidateBasic() error { return nil } -func (msg *MsgDeleteVault) Route() string { - return RouterKey -} - -func (msg *MsgDeleteVault) Type() string { - return TypeMsgDeleteVault -} - -func (msg MsgDeleteVault) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgDeleteVault) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} diff --git a/x/yieldaggregator/types/message_deposit_to_vault.go b/x/yieldaggregator/types/message_deposit_to_vault.go index 4898a23ec..5524f94f2 100644 --- a/x/yieldaggregator/types/message_deposit_to_vault.go +++ b/x/yieldaggregator/types/message_deposit_to_vault.go @@ -6,8 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgDepositToVault = "deposit-to-vault" - var _ sdk.Msg = &MsgDepositToVault{} func NewMsgDepositToVault(sender string, vaultId uint64, amount sdk.Coin) *MsgDepositToVault { @@ -33,18 +31,6 @@ func (msg MsgDepositToVault) ValidateBasic() error { return nil } -func (msg *MsgDepositToVault) Route() string { - return RouterKey -} - -func (msg *MsgDepositToVault) Type() string { - return TypeMsgDepositToVault -} - -func (msg MsgDepositToVault) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgDepositToVault) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} diff --git a/x/yieldaggregator/types/message_register_strategy.go b/x/yieldaggregator/types/message_register_strategy.go new file mode 100644 index 000000000..1c80b60cc --- /dev/null +++ b/x/yieldaggregator/types/message_register_strategy.go @@ -0,0 +1,40 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// ensure Msg interface compliance at compile time +var _ sdk.Msg = &MsgRegisterStrategy{} + +func NewMsgRegisterStrategy(sender string, denom, contractAddr, name, gitUrl string) MsgRegisterStrategy { + return MsgRegisterStrategy{ + Sender: sender, + Denom: denom, + ContractAddress: contractAddr, + Name: name, + GitUrl: gitUrl, + } +} + +// ValidateBasic does a simple validation check that doesn't require access to state. +func (msg MsgRegisterStrategy) ValidateBasic() error { + if msg.Denom == "" { + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty strategy denom") + } + if msg.Name == "" { + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty strategy name") + } + if msg.ContractAddress == "" { + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "empty strategy contract address") + } + return nil +} + +// GetSigners returns the addresses of signers that must sign. +func (msg MsgRegisterStrategy) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Sender) + return []sdk.AccAddress{addr} +} diff --git a/x/yieldaggregator/types/message_transfer_vault_ownership.go b/x/yieldaggregator/types/message_transfer_vault_ownership.go index 4560f810f..798ff3ad0 100644 --- a/x/yieldaggregator/types/message_transfer_vault_ownership.go +++ b/x/yieldaggregator/types/message_transfer_vault_ownership.go @@ -7,8 +7,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgTransferVaultOwnership = "transfer-vault-ownership" - var _ sdk.Msg = &MsgCreateVault{} func NewMsgTransferVaultOwnership(sender string, vaultId uint64, recipient string) *MsgTransferVaultOwnership { @@ -31,18 +29,6 @@ func (msg MsgTransferVaultOwnership) ValidateBasic() error { return nil } -func (msg *MsgTransferVaultOwnership) Route() string { - return RouterKey -} - -func (msg *MsgTransferVaultOwnership) Type() string { - return TypeMsgTransferVaultOwnership -} - -func (msg MsgTransferVaultOwnership) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgTransferVaultOwnership) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} diff --git a/x/yieldaggregator/types/message_update_params.go b/x/yieldaggregator/types/message_update_params.go new file mode 100644 index 000000000..76e68f5bc --- /dev/null +++ b/x/yieldaggregator/types/message_update_params.go @@ -0,0 +1,29 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// ensure Msg interface compliance at compile time +var _ sdk.Msg = &MsgUpdateParams{} + +func NewMsgUpdateParams(sender string, params Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Sender: sender, + Params: params, + } +} + +// ValidateBasic does a simple validation check that doesn't require access to state. +func (msg MsgUpdateParams) ValidateBasic() error { + if err := msg.Params.Validate(); err != nil { + return err + } + return nil +} + +// GetSigners returns the addresses of signers that must sign. +func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Sender) + return []sdk.AccAddress{addr} +} diff --git a/x/yieldaggregator/types/message_withdraw_from_vault.go b/x/yieldaggregator/types/message_withdraw_from_vault.go index b8e9f3058..675866e0a 100644 --- a/x/yieldaggregator/types/message_withdraw_from_vault.go +++ b/x/yieldaggregator/types/message_withdraw_from_vault.go @@ -6,8 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgWithdrawFromVault = "withdraw-from-vault" - var _ sdk.Msg = &MsgWithdrawFromVault{} func NewMsgWithdrawFromVault(sender string, vaultId uint64, lpTokenAmount sdk.Int) *MsgWithdrawFromVault { @@ -30,18 +28,6 @@ func (msg MsgWithdrawFromVault) ValidateBasic() error { return nil } -func (msg *MsgWithdrawFromVault) Route() string { - return RouterKey -} - -func (msg *MsgWithdrawFromVault) Type() string { - return TypeMsgWithdrawFromVault -} - -func (msg MsgWithdrawFromVault) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - func (msg MsgWithdrawFromVault) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Sender) return []sdk.AccAddress{addr} diff --git a/x/yieldaggregator/types/params.go b/x/yieldaggregator/types/params.go index 928dbfe33..98197541e 100644 --- a/x/yieldaggregator/types/params.go +++ b/x/yieldaggregator/types/params.go @@ -4,49 +4,38 @@ import ( fmt "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" ) var ( - KeyCommissionRate = []byte("CommissionRate") - KeyVaultCreationFee = []byte("VaultCreationFee") - KeyVaultCreationDeposit = []byte("VaultCreationDeposit") + DefaultFeeCollectorAddress = "" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance func NewParams( - commissionRate sdk.Dec, + withdrawCommissionRate sdk.Dec, vaultCreationFee sdk.Coin, vaultCreationDeposit sdk.Coin, + feeCollectorAddress string, ) Params { return Params{ - CommissionRate: commissionRate, + CommissionRate: withdrawCommissionRate, VaultCreationFee: vaultCreationFee, VaultCreationDeposit: vaultCreationDeposit, + FeeCollectorAddress: feeCollectorAddress, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams(sdk.ZeroDec(), sdk.NewInt64Coin("stake", 1000), sdk.NewInt64Coin("stake", 1000)) -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramstypes.NewParamSetPair(KeyCommissionRate, &p.CommissionRate, validateCommissionRate), - paramstypes.NewParamSetPair(KeyVaultCreationFee, &p.VaultCreationFee, validateVaultCreationFee), - paramstypes.NewParamSetPair(KeyVaultCreationDeposit, &p.VaultCreationDeposit, validateVaultCreationDeposit), - } + return NewParams( + sdk.ZeroDec(), + sdk.NewInt64Coin("stake", 1000), + sdk.NewInt64Coin("stake", 1000), + DefaultFeeCollectorAddress, + ) } // Validate validates the set of params @@ -60,15 +49,12 @@ func (p Params) Validate() error { if err := validateVaultCreationDeposit(p.VaultCreationDeposit); err != nil { return err } + if err := validateFeeCollectorAddress(p.FeeCollectorAddress); err != nil { + return err + } return nil } -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - func validateCommissionRate(i interface{}) error { rate, ok := i.(sdk.Dec) if !ok { @@ -99,3 +85,45 @@ func validateVaultCreationDeposit(i interface{}) error { return nil } + +func validateFeeCollectorAddress(i interface{}) error { + addr, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + // Fee collector address might be explicitly empty in test environments + if len(addr) == 0 { + return nil + } + + _, err := sdk.AccAddressFromBech32(addr) + if err != nil { + return err + } + + return nil +} + +// Deprecated: Just for migration purpose +var ( + KeyCommissionRate = []byte("CommissionRate") + KeyVaultCreationFee = []byte("VaultCreationFee") + KeyVaultCreationDeposit = []byte("VaultCreationDeposit") +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramstypes.NewParamSetPair(KeyCommissionRate, &p.CommissionRate, validateCommissionRate), + paramstypes.NewParamSetPair(KeyVaultCreationFee, &p.VaultCreationFee, validateVaultCreationFee), + paramstypes.NewParamSetPair(KeyVaultCreationDeposit, &p.VaultCreationDeposit, validateVaultCreationDeposit), + } +} diff --git a/x/yieldaggregator/types/params.pb.go b/x/yieldaggregator/types/params.pb.go index db2920d61..816a19d04 100644 --- a/x/yieldaggregator/types/params.pb.go +++ b/x/yieldaggregator/types/params.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -26,15 +26,19 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params defines the parameters for the module. type Params struct { - CommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission_rate"` - VaultCreationFee types.Coin `protobuf:"bytes,2,opt,name=vault_creation_fee,json=vaultCreationFee,proto3" json:"vault_creation_fee"` - VaultCreationDeposit types.Coin `protobuf:"bytes,3,opt,name=vault_creation_deposit,json=vaultCreationDeposit,proto3" json:"vault_creation_deposit"` + // TODO: add deposit_commission_rate + // TODO: add reserve_annual_commission_rate + // TODO: rename to withdraw_commission_rate + CommissionRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=commission_rate,json=commissionRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission_rate"` + VaultCreationFee types.Coin `protobuf:"bytes,2,opt,name=vault_creation_fee,json=vaultCreationFee,proto3" json:"vault_creation_fee"` + VaultCreationDeposit types.Coin `protobuf:"bytes,3,opt,name=vault_creation_deposit,json=vaultCreationDeposit,proto3" json:"vault_creation_deposit"` + FeeCollectorAddress string `protobuf:"bytes,4,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` } -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_598607d39e276737, []int{0} } @@ -79,6 +83,13 @@ func (m *Params) GetVaultCreationDeposit() types.Coin { return types.Coin{} } +func (m *Params) GetFeeCollectorAddress() string { + if m != nil { + return m.FeeCollectorAddress + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "ununifi.yieldaggregator.Params") } @@ -88,29 +99,31 @@ func init() { } var fileDescriptor_598607d39e276737 = []byte{ - // 346 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xcf, 0x4a, 0x3a, 0x41, - 0x1c, 0xdf, 0xf5, 0x27, 0xc2, 0x6f, 0x83, 0x8a, 0x45, 0x4a, 0x3d, 0x8c, 0x12, 0x11, 0x5e, 0x9c, - 0xc9, 0xba, 0x45, 0x27, 0x15, 0x0f, 0x41, 0x10, 0x82, 0x97, 0x2e, 0x32, 0x3b, 0x7e, 0x5d, 0x87, - 0xdc, 0x99, 0x65, 0x67, 0x56, 0xf2, 0x2d, 0x3a, 0x06, 0x5d, 0x7a, 0x88, 0x1e, 0xc2, 0xa3, 0x74, - 0x8a, 0x0e, 0x12, 0xee, 0x8b, 0xc4, 0xee, 0x0e, 0x54, 0x76, 0xe9, 0xb4, 0xfb, 0xe5, 0xf3, 0x97, - 0xcf, 0x38, 0xc7, 0xb1, 0x88, 0x05, 0x9f, 0x70, 0xb2, 0xe0, 0x30, 0x1b, 0x53, 0xdf, 0x8f, 0xc0, - 0xa7, 0x5a, 0x46, 0x24, 0xa4, 0x11, 0x0d, 0x14, 0x0e, 0x23, 0xa9, 0xa5, 0x7b, 0x68, 0x58, 0x78, - 0x8b, 0x55, 0x2b, 0xfb, 0xd2, 0x97, 0x19, 0x87, 0xa4, 0x7f, 0x39, 0xbd, 0x56, 0x65, 0x52, 0x05, - 0x52, 0x8d, 0x72, 0x20, 0x3f, 0x0c, 0x84, 0xf2, 0x8b, 0x78, 0x54, 0x01, 0x99, 0xb7, 0x3d, 0xd0, - 0xb4, 0x4d, 0x98, 0xe4, 0x22, 0xc7, 0x8f, 0x9e, 0x0a, 0x4e, 0xe9, 0x26, 0x8b, 0x76, 0xc1, 0xd9, - 0x63, 0x32, 0x08, 0xb8, 0x52, 0x5c, 0x8a, 0x51, 0x44, 0x35, 0x54, 0xec, 0x86, 0xdd, 0xfc, 0xdf, - 0xb9, 0x5c, 0xae, 0xeb, 0xd6, 0xfb, 0xba, 0x7e, 0xe2, 0x73, 0x3d, 0x8d, 0x3d, 0xcc, 0x64, 0x60, - 0x42, 0xcc, 0xa7, 0xa5, 0xc6, 0x77, 0x44, 0x2f, 0x42, 0x50, 0xb8, 0x07, 0xec, 0xf5, 0xa5, 0xe5, - 0x98, 0x0e, 0x3d, 0x60, 0x83, 0xdd, 0x2f, 0xd3, 0x01, 0xd5, 0xe0, 0x5e, 0x3b, 0xee, 0x9c, 0xc6, - 0x33, 0x3d, 0x62, 0x11, 0x50, 0x9d, 0x46, 0x4d, 0x00, 0x2a, 0x85, 0x86, 0xdd, 0xdc, 0x39, 0xab, - 0x62, 0x23, 0x4c, 0xeb, 0x62, 0x53, 0x17, 0x77, 0x25, 0x17, 0x9d, 0x62, 0x5a, 0x62, 0xb0, 0x9f, - 0x49, 0xbb, 0x46, 0xd9, 0x07, 0x70, 0x87, 0xce, 0xc1, 0x96, 0xdd, 0x18, 0x42, 0xa9, 0xb8, 0xae, - 0xfc, 0xfb, 0x9b, 0x65, 0xf9, 0x87, 0x65, 0x2f, 0x17, 0x5f, 0x14, 0x1f, 0x9f, 0xeb, 0x56, 0xe7, - 0x6a, 0xb9, 0x41, 0xf6, 0x6a, 0x83, 0xec, 0x8f, 0x0d, 0xb2, 0x1f, 0x12, 0x64, 0xad, 0x12, 0x64, - 0xbd, 0x25, 0xc8, 0xba, 0x3d, 0xfd, 0xb6, 0xc5, 0x50, 0x0c, 0x05, 0xef, 0x73, 0xc2, 0xa6, 0x94, - 0x0b, 0x72, 0xff, 0xeb, 0x69, 0xb3, 0x65, 0xbc, 0x52, 0x36, 0xf8, 0xf9, 0x67, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x52, 0xb8, 0xd1, 0x3f, 0x02, 0x02, 0x00, 0x00, + // 373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0xca, 0xd3, 0x40, + 0x14, 0x85, 0x93, 0xdf, 0x9f, 0x82, 0x11, 0x54, 0x62, 0xd5, 0xb4, 0x42, 0x5a, 0xc4, 0x45, 0x37, + 0xce, 0xd8, 0xfa, 0x04, 0xb6, 0xa5, 0x0b, 0x51, 0x90, 0x40, 0x37, 0xdd, 0x84, 0xc9, 0xe4, 0x26, + 0x1d, 0x4c, 0xe6, 0x86, 0x99, 0x49, 0xb1, 0x6f, 0xe1, 0xc3, 0xb8, 0x76, 0xdd, 0x65, 0x71, 0x25, + 0x2e, 0x8a, 0xb4, 0x2f, 0x22, 0xc9, 0x44, 0xc4, 0xba, 0x71, 0x37, 0x97, 0x73, 0xce, 0x77, 0x2e, + 0x73, 0xbd, 0x17, 0xb5, 0xac, 0xa5, 0xc8, 0x04, 0xdd, 0x0b, 0x28, 0x52, 0x96, 0xe7, 0x0a, 0x72, + 0x66, 0x50, 0xd1, 0x8a, 0x29, 0x56, 0x6a, 0x52, 0x29, 0x34, 0xe8, 0x3f, 0xed, 0x5c, 0xe4, 0xca, + 0x35, 0xec, 0xe7, 0x98, 0x63, 0xeb, 0xa1, 0xcd, 0xcb, 0xda, 0x87, 0x03, 0x8e, 0xba, 0x44, 0x1d, + 0x5b, 0xc1, 0x0e, 0x9d, 0x14, 0xda, 0x89, 0x26, 0x4c, 0x03, 0xdd, 0x4d, 0x13, 0x30, 0x6c, 0x4a, + 0x39, 0x0a, 0x69, 0xf5, 0xe7, 0x5f, 0x6f, 0xbc, 0xde, 0x87, 0xb6, 0xda, 0xdf, 0x78, 0x0f, 0x38, + 0x96, 0xa5, 0xd0, 0x5a, 0xa0, 0x8c, 0x15, 0x33, 0x10, 0xb8, 0x63, 0x77, 0x72, 0x77, 0x3e, 0x3d, + 0x9c, 0x46, 0xce, 0x8f, 0xd3, 0xe8, 0x99, 0x65, 0xe9, 0xf4, 0x23, 0x11, 0x48, 0x4b, 0x66, 0xb6, + 0xe4, 0x1d, 0xe4, 0x8c, 0xef, 0x97, 0xc0, 0xbf, 0x7d, 0x79, 0xe9, 0x75, 0xc5, 0x4b, 0xe0, 0xd1, + 0xfd, 0x3f, 0xa4, 0x88, 0x19, 0xf0, 0xdf, 0x7b, 0xfe, 0x8e, 0xd5, 0x85, 0x89, 0xb9, 0x02, 0x66, + 0x1a, 0x7e, 0x06, 0x10, 0xdc, 0x8c, 0xdd, 0xc9, 0xbd, 0xd9, 0x80, 0x74, 0xc1, 0x66, 0x47, 0xd2, + 0xed, 0x48, 0x16, 0x28, 0xe4, 0xfc, 0xb6, 0x69, 0x8e, 0x1e, 0xb6, 0xd1, 0x45, 0x97, 0x5c, 0x01, + 0xf8, 0x6b, 0xef, 0xc9, 0x15, 0x2e, 0x85, 0x0a, 0xb5, 0x30, 0xc1, 0x9d, 0xff, 0x43, 0xf6, 0xff, + 0x42, 0x2e, 0x6d, 0xd8, 0x9f, 0x79, 0x8f, 0x33, 0x80, 0x98, 0x63, 0x51, 0x00, 0x37, 0xa8, 0x62, + 0x96, 0xa6, 0x0a, 0xb4, 0x0e, 0x6e, 0x9b, 0x7f, 0x88, 0x1e, 0x65, 0x00, 0x8b, 0xdf, 0xda, 0x1b, + 0x2b, 0xcd, 0xdf, 0x1e, 0xce, 0xa1, 0x7b, 0x3c, 0x87, 0xee, 0xcf, 0x73, 0xe8, 0x7e, 0xbe, 0x84, + 0xce, 0xf1, 0x12, 0x3a, 0xdf, 0x2f, 0xa1, 0xb3, 0x79, 0x95, 0x0b, 0xb3, 0xad, 0x13, 0xc2, 0xb1, + 0xa4, 0x6b, 0xb9, 0x96, 0x62, 0x25, 0x28, 0xdf, 0x32, 0x21, 0xe9, 0xa7, 0x7f, 0xae, 0x6f, 0xf6, + 0x15, 0xe8, 0xa4, 0xd7, 0xde, 0xe4, 0xf5, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x8d, 0x6a, + 0xe8, 0x25, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -133,6 +146,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.FeeCollectorAddress) > 0 { + i -= len(m.FeeCollectorAddress) + copy(dAtA[i:], m.FeeCollectorAddress) + i = encodeVarintParams(dAtA, i, uint64(len(m.FeeCollectorAddress))) + i-- + dAtA[i] = 0x22 + } { size, err := m.VaultCreationDeposit.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -189,6 +209,10 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.VaultCreationDeposit.Size() n += 1 + l + sovParams(uint64(l)) + l = len(m.FeeCollectorAddress) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -327,6 +351,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/yieldaggregator/types/proposal.go b/x/yieldaggregator/types/proposal.go deleted file mode 100644 index 8a53cdc68..000000000 --- a/x/yieldaggregator/types/proposal.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -const ( - // ProposalTypeAddStrategy defines the type for a ProposalAddStrategy - ProposalTypeAddStrategy = "AddStrategy" -) - -func init() { - govtypes.RegisterProposalType(ProposalTypeAddStrategy) -} - -// Assert ProposalAddStrategy implements govtypes.Content at compile-time -var _ govtypes.Content = &ProposalAddStrategy{} - -func NewProposalAddStrategy(title, description string, denom, contractAddr, name, gitUrl string) *ProposalAddStrategy { - return &ProposalAddStrategy{ - Title: title, - Description: description, - Denom: denom, - ContractAddress: contractAddr, - Name: name, - GitUrl: gitUrl, - } -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p *ProposalAddStrategy) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a parameter change proposal. -func (p *ProposalAddStrategy) ProposalType() string { return ProposalTypeAddStrategy } - -// ValidateBasic validates the parameter change proposal -func (p *ProposalAddStrategy) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - - return nil -} diff --git a/x/yieldaggregator/types/proposal.pb.go b/x/yieldaggregator/types/proposal.pb.go deleted file mode 100644 index 66ccbac10..000000000 --- a/x/yieldaggregator/types/proposal.pb.go +++ /dev/null @@ -1,582 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ununifi/yieldaggregator/proposal.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// proposal to add new strategy. -type ProposalAddStrategy struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` - ContractAddress string `protobuf:"bytes,4,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - GitUrl string `protobuf:"bytes,6,opt,name=git_url,json=gitUrl,proto3" json:"git_url,omitempty"` -} - -func (m *ProposalAddStrategy) Reset() { *m = ProposalAddStrategy{} } -func (m *ProposalAddStrategy) String() string { return proto.CompactTextString(m) } -func (*ProposalAddStrategy) ProtoMessage() {} -func (*ProposalAddStrategy) Descriptor() ([]byte, []int) { - return fileDescriptor_01c3067bf3695ed9, []int{0} -} -func (m *ProposalAddStrategy) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProposalAddStrategy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProposalAddStrategy.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProposalAddStrategy) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalAddStrategy.Merge(m, src) -} -func (m *ProposalAddStrategy) XXX_Size() int { - return m.Size() -} -func (m *ProposalAddStrategy) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalAddStrategy.DiscardUnknown(m) -} - -var xxx_messageInfo_ProposalAddStrategy proto.InternalMessageInfo - -func (m *ProposalAddStrategy) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *ProposalAddStrategy) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *ProposalAddStrategy) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *ProposalAddStrategy) GetContractAddress() string { - if m != nil { - return m.ContractAddress - } - return "" -} - -func (m *ProposalAddStrategy) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *ProposalAddStrategy) GetGitUrl() string { - if m != nil { - return m.GitUrl - } - return "" -} - -func init() { - proto.RegisterType((*ProposalAddStrategy)(nil), "ununifi.yieldaggregator.ProposalAddStrategy") -} - -func init() { - proto.RegisterFile("ununifi/yieldaggregator/proposal.proto", fileDescriptor_01c3067bf3695ed9) -} - -var fileDescriptor_01c3067bf3695ed9 = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xc1, 0x4a, 0x2b, 0x31, - 0x14, 0x86, 0x9b, 0x7b, 0xdb, 0x8a, 0x71, 0xa1, 0xc4, 0x42, 0x43, 0x17, 0xa1, 0x88, 0x88, 0x6e, - 0x1a, 0xc1, 0x27, 0xa8, 0x0b, 0x17, 0xae, 0x44, 0xe9, 0xc6, 0x4d, 0x49, 0x27, 0x31, 0x3d, 0x30, - 0x93, 0x0c, 0xc9, 0x19, 0x70, 0xde, 0xc2, 0xf7, 0xf1, 0x05, 0x5c, 0x76, 0xe9, 0x52, 0x66, 0x5e, - 0x44, 0x9a, 0xa9, 0x20, 0x8a, 0xbb, 0x73, 0xbe, 0xf3, 0xfd, 0x09, 0xfc, 0xf4, 0xac, 0x72, 0x95, - 0x83, 0x27, 0x90, 0x35, 0x98, 0x5c, 0x2b, 0x6b, 0x83, 0xb1, 0x0a, 0x7d, 0x90, 0x65, 0xf0, 0xa5, - 0x8f, 0x2a, 0x9f, 0x95, 0xc1, 0xa3, 0x67, 0xe3, 0x9d, 0x37, 0xfb, 0xe1, 0x4d, 0x46, 0xd6, 0x5b, - 0x9f, 0x1c, 0xb9, 0x9d, 0x3a, 0x7d, 0x72, 0xfa, 0xe7, 0xb3, 0x2a, 0xa8, 0x22, 0x76, 0xd6, 0xc9, - 0x2b, 0xa1, 0xc7, 0x77, 0xbb, 0x7f, 0xe6, 0x5a, 0x3f, 0x60, 0x50, 0x68, 0x6c, 0xcd, 0x46, 0x74, - 0x80, 0x80, 0xb9, 0xe1, 0x64, 0x4a, 0xce, 0xf7, 0xef, 0xbb, 0x85, 0x4d, 0xe9, 0x81, 0x36, 0x31, - 0x0b, 0x50, 0x22, 0x78, 0xc7, 0xff, 0xa5, 0xdb, 0x77, 0xb4, 0xcd, 0x69, 0xe3, 0x7c, 0xc1, 0xff, - 0x77, 0xb9, 0xb4, 0xb0, 0x0b, 0x7a, 0x94, 0x79, 0x87, 0x41, 0x65, 0xb8, 0x54, 0x5a, 0x07, 0x13, - 0x23, 0xef, 0x27, 0xe1, 0xf0, 0x8b, 0xcf, 0x3b, 0xcc, 0x18, 0xed, 0x3b, 0x55, 0x18, 0x3e, 0x48, - 0xe7, 0x34, 0xb3, 0x31, 0xdd, 0xb3, 0x80, 0xcb, 0x2a, 0xe4, 0x7c, 0x98, 0xf0, 0xd0, 0x02, 0x2e, - 0x42, 0x7e, 0x7d, 0xfb, 0xd6, 0x08, 0xb2, 0x69, 0x04, 0xf9, 0x68, 0x04, 0x79, 0x69, 0x45, 0x6f, - 0xd3, 0x8a, 0xde, 0x7b, 0x2b, 0x7a, 0x8f, 0x97, 0x16, 0x70, 0x5d, 0xad, 0x66, 0x99, 0x2f, 0xe4, - 0xc2, 0x2d, 0x1c, 0xdc, 0x80, 0xcc, 0xd6, 0x0a, 0x9c, 0x7c, 0xfe, 0x55, 0x08, 0xd6, 0xa5, 0x89, - 0xab, 0x61, 0x2a, 0xe4, 0xea, 0x33, 0x00, 0x00, 0xff, 0xff, 0xec, 0xa3, 0xe4, 0xd0, 0x8f, 0x01, - 0x00, 0x00, -} - -func (m *ProposalAddStrategy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProposalAddStrategy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProposalAddStrategy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GitUrl) > 0 { - i -= len(m.GitUrl) - copy(dAtA[i:], m.GitUrl) - i = encodeVarintProposal(dAtA, i, uint64(len(m.GitUrl))) - i-- - dAtA[i] = 0x32 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x2a - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintProposal(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0x22 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { - offset -= sovProposal(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ProposalAddStrategy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.GitUrl) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - return n -} - -func sovProposal(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProposal(x uint64) (n int) { - return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ProposalAddStrategy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProposalAddStrategy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalAddStrategy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GitUrl", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GitUrl = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProposal(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthProposal - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProposal - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProposal - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProposal = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/yieldaggregator/types/query.pb.go b/x/yieldaggregator/types/query.pb.go index 1accb9c34..4da9b3716 100644 --- a/x/yieldaggregator/types/query.pb.go +++ b/x/yieldaggregator/types/query.pb.go @@ -520,8 +520,8 @@ func (m *QueryGetStrategyResponse) GetStrategy() Strategy { } type QueryEstimateMintAmountRequest struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - DepositAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=deposit_amount,json=depositAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"deposit_amount"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + DepositAmount string `protobuf:"bytes,2,opt,name=deposit_amount,json=depositAmount,proto3" json:"deposit_amount,omitempty"` } func (m *QueryEstimateMintAmountRequest) Reset() { *m = QueryEstimateMintAmountRequest{} } @@ -564,6 +564,13 @@ func (m *QueryEstimateMintAmountRequest) GetId() uint64 { return 0 } +func (m *QueryEstimateMintAmountRequest) GetDepositAmount() string { + if m != nil { + return m.DepositAmount + } + return "" +} + type QueryEstimateMintAmountResponse struct { MintAmount types.Coin `protobuf:"bytes,1,opt,name=mint_amount,json=mintAmount,proto3" json:"mint_amount"` } @@ -609,8 +616,8 @@ func (m *QueryEstimateMintAmountResponse) GetMintAmount() types.Coin { } type QueryEstimateRedeemAmountRequest struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - BurnAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=burn_amount,json=burnAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"burn_amount"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + BurnAmount string `protobuf:"bytes,2,opt,name=burn_amount,json=burnAmount,proto3" json:"burn_amount,omitempty"` } func (m *QueryEstimateRedeemAmountRequest) Reset() { *m = QueryEstimateRedeemAmountRequest{} } @@ -653,6 +660,13 @@ func (m *QueryEstimateRedeemAmountRequest) GetId() uint64 { return 0 } +func (m *QueryEstimateRedeemAmountRequest) GetBurnAmount() string { + if m != nil { + return m.BurnAmount + } + return "" +} + type QueryEstimateRedeemAmountResponse struct { RedeemAmount types.Coin `protobuf:"bytes,1,opt,name=redeem_amount,json=redeemAmount,proto3" json:"redeem_amount"` } @@ -719,71 +733,71 @@ func init() { } var fileDescriptor_4dec8609c4c8573d = []byte{ - // 1020 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xb8, 0x89, 0x95, 0x3c, 0x37, 0x95, 0x98, 0x1a, 0xea, 0x5a, 0xc8, 0x4e, 0x36, 0x25, - 0x8d, 0xda, 0x7a, 0x37, 0x09, 0x07, 0xe8, 0x97, 0xc0, 0x0e, 0x34, 0x2a, 0x12, 0x52, 0x31, 0x04, - 0x24, 0x24, 0xb0, 0xc6, 0xde, 0x61, 0x33, 0x62, 0x3d, 0xe3, 0xee, 0x8e, 0x13, 0x2c, 0xc4, 0x85, - 0x33, 0x07, 0x3e, 0x4f, 0x48, 0x20, 0xae, 0x88, 0x23, 0x7f, 0x44, 0xc5, 0xa9, 0x2a, 0x17, 0xc4, - 0xa1, 0x42, 0x09, 0x7f, 0x48, 0xb5, 0x33, 0xb3, 0xae, 0x3f, 0xb2, 0xf6, 0x26, 0xf2, 0x29, 0xd9, - 0x99, 0xf7, 0x7e, 0x1f, 0x6f, 0xde, 0xbc, 0x49, 0x60, 0xad, 0xcb, 0xbb, 0x9c, 0x7d, 0xc6, 0x9c, - 0x1e, 0xa3, 0xbe, 0x4b, 0x3c, 0x2f, 0xa0, 0x1e, 0x91, 0x22, 0x70, 0x1e, 0x76, 0x69, 0xd0, 0xb3, - 0x3b, 0x81, 0x90, 0x02, 0x5f, 0x32, 0x41, 0xf6, 0x48, 0x50, 0x31, 0xef, 0x09, 0x4f, 0xa8, 0x18, - 0x27, 0xfa, 0x4d, 0x87, 0x17, 0x2f, 0xb7, 0x44, 0xd8, 0x16, 0x61, 0x43, 0x6f, 0xe8, 0x0f, 0xb3, - 0xf5, 0xb2, 0x27, 0x84, 0xe7, 0x53, 0x87, 0x74, 0x98, 0x43, 0x38, 0x17, 0x92, 0x48, 0x26, 0x78, - 0xbc, 0x7b, 0x4d, 0xc7, 0x3a, 0x4d, 0x12, 0x52, 0x2d, 0xc0, 0x39, 0xd8, 0x6a, 0x52, 0x49, 0xb6, - 0x9c, 0x0e, 0xf1, 0x18, 0x57, 0xc1, 0x26, 0xb6, 0x34, 0x18, 0x1b, 0x47, 0xb5, 0x04, 0x8b, 0xf7, - 0xaf, 0x24, 0x19, 0xeb, 0x90, 0x80, 0xb4, 0x63, 0xc6, 0x4a, 0x52, 0xd4, 0xc8, 0xb7, 0x0e, 0xb7, - 0xf2, 0x80, 0xdf, 0x8b, 0x64, 0x3d, 0x50, 0x18, 0x75, 0xfa, 0xb0, 0x4b, 0x43, 0x69, 0x7d, 0x00, - 0x17, 0x87, 0x56, 0xc3, 0x8e, 0xe0, 0x21, 0xc5, 0x77, 0x21, 0xab, 0xb9, 0x0a, 0x68, 0x05, 0x6d, - 0xe4, 0xb6, 0xcb, 0x76, 0x42, 0x19, 0x6d, 0x9d, 0x58, 0x9b, 0x7f, 0xf4, 0xb4, 0x3c, 0x57, 0x37, - 0x49, 0xd6, 0xa7, 0x90, 0x57, 0xa8, 0x55, 0xdf, 0xff, 0x90, 0x74, 0x7d, 0x69, 0xd8, 0xf0, 0x3d, - 0x80, 0xe7, 0xc5, 0x30, 0xd0, 0xeb, 0xb6, 0xa9, 0x72, 0x54, 0x0d, 0x5b, 0x1f, 0x9d, 0xa9, 0x89, - 0xfd, 0x80, 0x78, 0xd4, 0xe4, 0xd6, 0x07, 0x32, 0xad, 0x5f, 0x10, 0xbc, 0x38, 0x42, 0x60, 0x84, - 0xdf, 0x81, 0xec, 0x41, 0xb4, 0x10, 0x09, 0x3f, 0xb7, 0x91, 0xdb, 0x2e, 0x25, 0x0a, 0x57, 0x79, - 0xb1, 0x6e, 0x9d, 0x83, 0x77, 0x87, 0xf4, 0x65, 0x94, 0xbe, 0xab, 0x53, 0xf5, 0x69, 0xea, 0x21, - 0x81, 0xeb, 0xa6, 0x00, 0xbb, 0x54, 0x0e, 0x15, 0xe0, 0x02, 0x64, 0x98, 0xab, 0x8c, 0xcf, 0xd7, - 0x33, 0xcc, 0xb5, 0x7e, 0x9e, 0x37, 0x46, 0x9e, 0x07, 0x1a, 0x23, 0xb7, 0x60, 0x41, 0x89, 0x32, - 0x55, 0x4a, 0xe7, 0x43, 0xa7, 0x44, 0x36, 0x42, 0x19, 0x10, 0x49, 0x3d, 0x46, 0xc3, 0x42, 0x46, - 0x15, 0x62, 0x35, 0x11, 0xe0, 0x7d, 0x1d, 0xda, 0x33, 0x18, 0x03, 0xa9, 0x78, 0x0d, 0x96, 0x15, - 0x62, 0x83, 0xb8, 0x6e, 0x40, 0xc3, 0xb0, 0x70, 0x6e, 0x05, 0x6d, 0x2c, 0xd5, 0xcf, 0xab, 0xc5, - 0xaa, 0x5e, 0xc3, 0x3e, 0x5c, 0x94, 0x42, 0x12, 0xbf, 0xd1, 0x14, 0xdc, 0xa5, 0x6e, 0x83, 0xb4, - 0x45, 0x97, 0xcb, 0xc2, 0x7c, 0x14, 0x5a, 0xbb, 0x13, 0x61, 0xfe, 0xfb, 0xb4, 0xbc, 0xee, 0x31, - 0xb9, 0xdf, 0x6d, 0xda, 0x2d, 0xd1, 0x36, 0xb7, 0xca, 0xfc, 0xa8, 0x84, 0xee, 0xe7, 0x8e, 0xec, - 0x75, 0x68, 0x68, 0xdf, 0xe7, 0xf2, 0xc9, 0x9f, 0x15, 0x30, 0xe5, 0xbe, 0xcf, 0x65, 0xfd, 0x05, - 0x05, 0x5c, 0x53, 0xb8, 0x55, 0x05, 0x8b, 0x03, 0x78, 0x49, 0xb3, 0x75, 0x79, 0xc4, 0xc7, 0xb8, - 0x17, 0x13, 0x2e, 0xcc, 0x80, 0x30, 0xaf, 0xb0, 0xf7, 0x62, 0x68, 0xc3, 0x79, 0x00, 0x05, 0xcd, - 0x79, 0xc8, 0xe4, 0xbe, 0x1b, 0x90, 0xc3, 0xc8, 0x2c, 0xf1, 0x09, 0x6f, 0xd1, 0x42, 0x76, 0x06, - 0xac, 0xda, 0xd1, 0x47, 0x7d, 0xf0, 0x9a, 0xc6, 0xb6, 0x0e, 0xe1, 0x52, 0xdc, 0xe5, 0xf1, 0x21, - 0xc5, 0x8d, 0x94, 0x87, 0x05, 0x97, 0x72, 0xd1, 0x56, 0xed, 0xb1, 0x54, 0xd7, 0x1f, 0x23, 0xf7, - 0x2b, 0x73, 0xe6, 0xfb, 0xf5, 0x07, 0x82, 0xc2, 0x38, 0xb3, 0xe9, 0xcc, 0xe1, 0xee, 0x42, 0x67, - 0xef, 0xae, 0x99, 0xdd, 0xb6, 0x37, 0x4c, 0x9d, 0x76, 0xa9, 0x4c, 0x57, 0x27, 0x7d, 0x0d, 0x33, - 0xfd, 0x6b, 0xd8, 0x30, 0x76, 0x87, 0x00, 0x8c, 0xdd, 0x1d, 0x58, 0x34, 0x9a, 0x7b, 0xe6, 0x2e, - 0xa6, 0x36, 0xdb, 0x4f, 0xb4, 0x7e, 0x42, 0x50, 0x52, 0x0c, 0x6f, 0x87, 0x92, 0xb5, 0x89, 0xa4, - 0xef, 0x32, 0x2e, 0x75, 0x77, 0x25, 0x8c, 0x06, 0xdc, 0x82, 0x0b, 0x2e, 0xed, 0x88, 0x90, 0xc9, - 0xb8, 0xc1, 0x33, 0x33, 0x68, 0xb5, 0x65, 0x83, 0xa9, 0xb9, 0xad, 0x16, 0x94, 0x13, 0x65, 0x19, - 0xff, 0x6f, 0x42, 0xae, 0xcd, 0x78, 0x5f, 0x84, 0x2e, 0xc1, 0xe5, 0xa1, 0x63, 0x8a, 0x0f, 0x68, - 0x47, 0x30, 0x1e, 0x9f, 0x73, 0xbb, 0x8f, 0x64, 0x7d, 0x87, 0x60, 0x65, 0x88, 0xa5, 0x4e, 0x5d, - 0x4a, 0xdb, 0x93, 0xed, 0x7f, 0x02, 0xb9, 0x66, 0x37, 0xe0, 0xb3, 0xf4, 0x0e, 0x11, 0xa0, 0xd1, - 0xc4, 0x60, 0x75, 0x82, 0x24, 0x63, 0xfd, 0x2d, 0x58, 0x0e, 0xd4, 0xfa, 0x29, 0xcd, 0x9f, 0x0f, - 0x06, 0xd0, 0xb6, 0x7f, 0x5f, 0x82, 0x05, 0xc5, 0x85, 0xbf, 0x41, 0x90, 0xd5, 0xef, 0x25, 0xbe, - 0x9e, 0xd8, 0x43, 0xe3, 0x8f, 0x74, 0xf1, 0x46, 0xba, 0x60, 0xad, 0xda, 0xba, 0xfa, 0xf5, 0xdf, - 0xff, 0xff, 0x90, 0x59, 0xc5, 0x65, 0x67, 0xf2, 0x9f, 0x11, 0xf8, 0x7b, 0x04, 0x8b, 0xea, 0xf5, - 0xa8, 0xfa, 0x3e, 0xae, 0x4c, 0xe6, 0x18, 0x79, 0xc9, 0x8b, 0x76, 0xda, 0xf0, 0xd4, 0xa2, 0xcc, - 0x13, 0xfc, 0x23, 0x82, 0x05, 0x95, 0x3a, 0x4d, 0xd1, 0xc8, 0xd3, 0x3a, 0x4d, 0xd1, 0xe8, 0x03, - 0x6b, 0xdd, 0x50, 0x8a, 0xd6, 0xf1, 0x95, 0x29, 0x8a, 0x9c, 0x2f, 0x99, 0xfb, 0x15, 0xfe, 0x15, - 0x41, 0x2e, 0xbe, 0xdd, 0x51, 0xb9, 0x36, 0xa7, 0xfa, 0x1f, 0x99, 0x44, 0xc5, 0xad, 0x53, 0x64, - 0x18, 0x89, 0xd7, 0x95, 0xc4, 0x57, 0xf0, 0x5a, 0xa2, 0xc4, 0x81, 0x69, 0xfa, 0x1b, 0x82, 0xc5, - 0x18, 0x61, 0x9a, 0xbc, 0xf1, 0x41, 0x39, 0x4d, 0xde, 0x09, 0x93, 0xd1, 0xda, 0x54, 0xf2, 0xae, - 0xe1, 0x8d, 0x14, 0xf2, 0x74, 0x15, 0xff, 0x42, 0x80, 0xc7, 0x47, 0x0d, 0x7e, 0x6d, 0x32, 0x77, - 0xe2, 0xcc, 0x2c, 0xbe, 0x7e, 0xfa, 0x44, 0xa3, 0xbd, 0xaa, 0xb4, 0xdf, 0xc6, 0x37, 0xd3, 0x9c, - 0xbe, 0x43, 0x0d, 0x50, 0x25, 0x9a, 0x6a, 0x15, 0x3d, 0x0c, 0xf0, 0x13, 0x04, 0xf9, 0x93, 0xc6, - 0x07, 0xbe, 0x99, 0x4e, 0xd5, 0x09, 0x53, 0xb0, 0x78, 0xeb, 0x2c, 0xa9, 0xc6, 0xd2, 0x8e, 0xb2, - 0x74, 0x17, 0xdf, 0x3e, 0x9d, 0x25, 0x3d, 0xab, 0x8c, 0xa9, 0xda, 0x3b, 0x8f, 0x8e, 0x4a, 0xe8, - 0xf1, 0x51, 0x09, 0xfd, 0x77, 0x54, 0x42, 0xdf, 0x1e, 0x97, 0xe6, 0x1e, 0x1f, 0x97, 0xe6, 0xfe, - 0x39, 0x2e, 0xcd, 0x7d, 0xbc, 0x39, 0x30, 0x73, 0xf7, 0xf8, 0x1e, 0x67, 0xf7, 0x98, 0xd3, 0xda, - 0x27, 0x8c, 0x3b, 0x5f, 0x8c, 0x11, 0xa9, 0x09, 0xdc, 0xcc, 0xaa, 0x7f, 0x3c, 0x5e, 0x7d, 0x16, - 0x00, 0x00, 0xff, 0xff, 0x92, 0x00, 0xfe, 0x1b, 0xa8, 0x0d, 0x00, 0x00, + // 1016 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xba, 0xb1, 0x95, 0x3c, 0x37, 0x95, 0x98, 0x1a, 0xea, 0x5a, 0xc8, 0x4e, 0x36, 0x6d, + 0x1a, 0xb5, 0xf5, 0x6e, 0x12, 0x0e, 0xd0, 0x7f, 0x02, 0x3b, 0xd0, 0xa8, 0x48, 0x48, 0xc5, 0x25, + 0x54, 0xe2, 0x80, 0x35, 0xf6, 0x0e, 0x9b, 0x11, 0xeb, 0x19, 0x77, 0x77, 0x36, 0xc1, 0x42, 0x5c, + 0x38, 0x73, 0x40, 0xc0, 0x0d, 0x09, 0xc4, 0x15, 0x71, 0xe4, 0x43, 0x54, 0x9c, 0xaa, 0x72, 0x41, + 0x1c, 0x2a, 0x94, 0xf0, 0x41, 0xaa, 0x9d, 0x99, 0x75, 0xbd, 0x76, 0xd6, 0xde, 0x44, 0x39, 0xd9, + 0x3b, 0xfb, 0xde, 0xef, 0xcf, 0x9b, 0x79, 0x6f, 0x16, 0x56, 0x43, 0x16, 0x32, 0xfa, 0x05, 0xb5, + 0x07, 0x94, 0x78, 0x0e, 0x76, 0x5d, 0x9f, 0xb8, 0x58, 0x70, 0xdf, 0x7e, 0x12, 0x12, 0x7f, 0x60, + 0xf5, 0x7d, 0x2e, 0x38, 0xba, 0xa4, 0x83, 0xac, 0xb1, 0xa0, 0x4a, 0xc9, 0xe5, 0x2e, 0x97, 0x31, + 0x76, 0xf4, 0x4f, 0x85, 0x57, 0x2e, 0x77, 0x79, 0xd0, 0xe3, 0x41, 0x5b, 0xbd, 0x50, 0x0f, 0xfa, + 0xd5, 0x9b, 0x2e, 0xe7, 0xae, 0x47, 0x6c, 0xdc, 0xa7, 0x36, 0x66, 0x8c, 0x0b, 0x2c, 0x28, 0x67, + 0xf1, 0xdb, 0xeb, 0x2a, 0xd6, 0xee, 0xe0, 0x80, 0x28, 0x01, 0xf6, 0xfe, 0x66, 0x87, 0x08, 0xbc, + 0x69, 0xf7, 0xb1, 0x4b, 0x99, 0x0c, 0xd6, 0xb1, 0xd5, 0xd1, 0xd8, 0x38, 0xaa, 0xcb, 0x69, 0xfc, + 0xfe, 0x4a, 0x9a, 0xb1, 0x3e, 0xf6, 0x71, 0x2f, 0x66, 0xac, 0xa7, 0x45, 0x8d, 0x3d, 0xab, 0x70, + 0xb3, 0x04, 0xe8, 0xe3, 0x48, 0xd6, 0x43, 0x89, 0xd1, 0x22, 0x4f, 0x42, 0x12, 0x08, 0xf3, 0x13, + 0xb8, 0x98, 0x58, 0x0d, 0xfa, 0x9c, 0x05, 0x04, 0xdd, 0x83, 0x82, 0xe2, 0x2a, 0x1b, 0xcb, 0xc6, + 0x7a, 0x71, 0xab, 0x66, 0xa5, 0x94, 0xd1, 0x52, 0x89, 0xcd, 0xf9, 0xa7, 0x2f, 0x6a, 0x73, 0x2d, + 0x9d, 0x64, 0x7e, 0x0e, 0x25, 0x89, 0xda, 0xf0, 0xbc, 0x4f, 0x71, 0xe8, 0x09, 0xcd, 0x86, 0xee, + 0x03, 0xbc, 0x2a, 0x86, 0x86, 0x5e, 0xb3, 0x74, 0x95, 0xa3, 0x6a, 0x58, 0x6a, 0xeb, 0x74, 0x4d, + 0xac, 0x87, 0xd8, 0x25, 0x3a, 0xb7, 0x35, 0x92, 0x69, 0xfe, 0x62, 0xc0, 0xeb, 0x63, 0x04, 0x5a, + 0xf8, 0x5d, 0x28, 0xec, 0x47, 0x0b, 0x91, 0xf0, 0x73, 0xeb, 0xc5, 0xad, 0x6a, 0xaa, 0x70, 0x99, + 0x17, 0xeb, 0x56, 0x39, 0x68, 0x27, 0xa1, 0x2f, 0x27, 0xf5, 0x5d, 0x9b, 0xa9, 0x4f, 0x51, 0x27, + 0x04, 0xae, 0xe9, 0x02, 0xec, 0x10, 0x91, 0x28, 0xc0, 0x05, 0xc8, 0x51, 0x47, 0x1a, 0x9f, 0x6f, + 0xe5, 0xa8, 0x63, 0xfe, 0x3c, 0xaf, 0x8d, 0xbc, 0x0a, 0xd4, 0x46, 0x6e, 0x43, 0x5e, 0x8a, 0xd2, + 0x55, 0xca, 0xe6, 0x43, 0xa5, 0x44, 0x36, 0x02, 0xe1, 0x63, 0x41, 0x5c, 0x4a, 0x82, 0x72, 0x4e, + 0x16, 0x62, 0x25, 0x15, 0xe0, 0x91, 0x0a, 0x1d, 0x68, 0x8c, 0x91, 0x54, 0xb4, 0x0a, 0x4b, 0x12, + 0xb1, 0x8d, 0x1d, 0xc7, 0x27, 0x41, 0x50, 0x3e, 0xb7, 0x6c, 0xac, 0x2f, 0xb6, 0xce, 0xcb, 0xc5, + 0x86, 0x5a, 0x43, 0x1e, 0x5c, 0x14, 0x5c, 0x60, 0xaf, 0xdd, 0xe1, 0xcc, 0x21, 0x4e, 0x1b, 0xf7, + 0x78, 0xc8, 0x44, 0x79, 0x3e, 0x0a, 0x6d, 0xde, 0x8d, 0x30, 0xff, 0x7d, 0x51, 0x5b, 0x73, 0xa9, + 0xd8, 0x0b, 0x3b, 0x56, 0x97, 0xf7, 0x74, 0x57, 0xe9, 0x9f, 0x7a, 0xe0, 0x7c, 0x69, 0x8b, 0x41, + 0x9f, 0x04, 0xd6, 0x03, 0x26, 0x9e, 0xff, 0x59, 0x07, 0x5d, 0xee, 0x07, 0x4c, 0xb4, 0x5e, 0x93, + 0xc0, 0x4d, 0x89, 0xdb, 0x90, 0xb0, 0xc8, 0x87, 0x37, 0x14, 0x5b, 0xc8, 0x22, 0x3e, 0xca, 0xdc, + 0x98, 0x30, 0x7f, 0x06, 0x84, 0x25, 0x89, 0xbd, 0x1b, 0x43, 0x6b, 0xce, 0x7d, 0x28, 0x2b, 0xce, + 0x03, 0x2a, 0xf6, 0x1c, 0x1f, 0x1f, 0x44, 0x66, 0xb1, 0x87, 0x59, 0x97, 0x94, 0x0b, 0x67, 0xc0, + 0xaa, 0x1c, 0x3d, 0x1e, 0x82, 0x37, 0x15, 0xb6, 0x79, 0x00, 0x97, 0xe2, 0x53, 0x1e, 0x6f, 0x52, + 0x7c, 0x90, 0x4a, 0x90, 0x77, 0x08, 0xe3, 0x3d, 0x79, 0x3c, 0x16, 0x5b, 0xea, 0x61, 0xac, 0xbf, + 0x72, 0xa7, 0xee, 0xaf, 0x3f, 0x0c, 0x28, 0x4f, 0x32, 0xeb, 0x93, 0x99, 0x3c, 0x5d, 0xc6, 0xe9, + 0x4f, 0xd7, 0x99, 0x75, 0xdb, 0xbb, 0xba, 0x4e, 0x3b, 0x44, 0x64, 0xab, 0x93, 0x6a, 0xc3, 0xdc, + 0xb0, 0x0d, 0xdb, 0xda, 0x6e, 0x02, 0x40, 0xdb, 0xdd, 0x86, 0x05, 0xad, 0x79, 0xa0, 0x7b, 0x31, + 0xb3, 0xd9, 0x61, 0xa2, 0xf9, 0x18, 0xaa, 0x92, 0xe0, 0x83, 0x40, 0xd0, 0x1e, 0x16, 0xe4, 0x23, + 0xca, 0x84, 0x3a, 0x5c, 0x29, 0x93, 0x01, 0x5d, 0x85, 0x0b, 0x0e, 0xe9, 0xf3, 0x80, 0x8a, 0xf8, + 0x7c, 0xe7, 0xa4, 0x83, 0x25, 0xbd, 0xaa, 0xb2, 0xcd, 0x2e, 0xd4, 0x52, 0x81, 0xb5, 0x81, 0xf7, + 0xa0, 0xd8, 0xa3, 0x6c, 0x08, 0xa3, 0x3c, 0x5c, 0x4e, 0xd4, 0x39, 0xae, 0xf0, 0x36, 0xa7, 0x2c, + 0xde, 0xa8, 0xde, 0x10, 0xc9, 0x7c, 0x04, 0xcb, 0x09, 0x92, 0x16, 0x71, 0x08, 0xe9, 0x4d, 0xd7, + 0x5f, 0x83, 0x62, 0x27, 0xf4, 0x59, 0x52, 0x3c, 0x44, 0x4b, 0x1a, 0x94, 0xc2, 0xca, 0x14, 0x50, + 0xad, 0xfd, 0x7d, 0x58, 0xf2, 0xe5, 0xfa, 0x09, 0xd5, 0x9f, 0xf7, 0x47, 0xd0, 0xb6, 0x7e, 0x5f, + 0x84, 0xbc, 0xe4, 0x42, 0xdf, 0x19, 0x50, 0x50, 0x37, 0x16, 0xba, 0x91, 0xba, 0x8b, 0x93, 0xd7, + 0x64, 0xe5, 0x66, 0xb6, 0x60, 0xa5, 0xda, 0xbc, 0xf6, 0xed, 0xdf, 0xff, 0xff, 0x98, 0x5b, 0x41, + 0x35, 0x7b, 0xfa, 0x45, 0x8e, 0x7e, 0x30, 0x60, 0x41, 0xce, 0xef, 0x86, 0xe7, 0xa1, 0xfa, 0x74, + 0x8e, 0xb1, 0xbb, 0xb4, 0x62, 0x65, 0x0d, 0xcf, 0x2c, 0x4a, 0x5f, 0x82, 0x3f, 0x19, 0x90, 0x97, + 0xa9, 0xb3, 0x14, 0x8d, 0x5d, 0x6e, 0xb3, 0x14, 0x8d, 0x5f, 0x71, 0xe6, 0x4d, 0xa9, 0x68, 0x0d, + 0x5d, 0x99, 0xa1, 0xc8, 0xfe, 0x9a, 0x3a, 0xdf, 0xa0, 0x5f, 0x0d, 0x28, 0xc6, 0xfd, 0x15, 0x95, + 0x6b, 0x63, 0xa6, 0xff, 0xb1, 0x59, 0x50, 0xd9, 0x3c, 0x41, 0x86, 0x96, 0x78, 0x43, 0x4a, 0xbc, + 0x8a, 0x56, 0x53, 0x25, 0x8e, 0xcc, 0xb3, 0xdf, 0x0c, 0x58, 0x88, 0x11, 0x66, 0xc9, 0x9b, 0x1c, + 0x55, 0xb3, 0xe4, 0x1d, 0x33, 0x9b, 0xcc, 0x0d, 0x29, 0xef, 0x3a, 0x5a, 0xcf, 0x20, 0x4f, 0x55, + 0xf1, 0x2f, 0x03, 0xd0, 0xe4, 0xac, 0x40, 0x6f, 0x4f, 0xe7, 0x4e, 0x1d, 0x5b, 0x95, 0x77, 0x4e, + 0x9e, 0xa8, 0xb5, 0x37, 0xa4, 0xf6, 0x3b, 0xe8, 0x56, 0x96, 0xdd, 0xb7, 0x89, 0x06, 0xaa, 0x47, + 0x63, 0xa9, 0xae, 0x86, 0x01, 0x7a, 0x6e, 0x40, 0xe9, 0xb8, 0xf1, 0x81, 0x6e, 0x65, 0x53, 0x75, + 0xcc, 0x1c, 0xab, 0xdc, 0x3e, 0x4d, 0xaa, 0xb6, 0xb4, 0x2d, 0x2d, 0xdd, 0x43, 0x77, 0x4e, 0x66, + 0x49, 0xcd, 0x2a, 0x6d, 0xaa, 0xf9, 0xe1, 0xd3, 0xc3, 0xaa, 0xf1, 0xec, 0xb0, 0x6a, 0xfc, 0x77, + 0x58, 0x35, 0xbe, 0x3f, 0xaa, 0xce, 0x3d, 0x3b, 0xaa, 0xce, 0xfd, 0x73, 0x54, 0x9d, 0xfb, 0x6c, + 0x63, 0xe4, 0xe3, 0x62, 0x97, 0xed, 0x32, 0x7a, 0x9f, 0xda, 0xdd, 0x3d, 0x4c, 0x99, 0xfd, 0xd5, + 0x04, 0x91, 0xfc, 0xd4, 0xe8, 0x14, 0xe4, 0xa7, 0xff, 0x5b, 0x2f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0xe5, 0x12, 0xc1, 0x67, 0x2a, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1517,16 +1531,13 @@ func (m *QueryEstimateMintAmountRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - { - size := m.DepositAmount.Size() - i -= size - if _, err := m.DepositAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.DepositAmount) > 0 { + i -= len(m.DepositAmount) + copy(dAtA[i:], m.DepositAmount) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DepositAmount))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 if m.Id != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Id)) i-- @@ -1588,16 +1599,13 @@ func (m *QueryEstimateRedeemAmountRequest) MarshalToSizedBuffer(dAtA []byte) (in _ = i var l int _ = l - { - size := m.BurnAmount.Size() - i -= size - if _, err := m.BurnAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.BurnAmount) > 0 { + i -= len(m.BurnAmount) + copy(dAtA[i:], m.BurnAmount) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BurnAmount))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 if m.Id != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Id)) i-- @@ -1813,8 +1821,10 @@ func (m *QueryEstimateMintAmountRequest) Size() (n int) { if m.Id != 0 { n += 1 + sovQuery(uint64(m.Id)) } - l = m.DepositAmount.Size() - n += 1 + l + sovQuery(uint64(l)) + l = len(m.DepositAmount) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1838,8 +1848,10 @@ func (m *QueryEstimateRedeemAmountRequest) Size() (n int) { if m.Id != 0 { n += 1 + sovQuery(uint64(m.Id)) } - l = m.BurnAmount.Size() - n += 1 + l + sovQuery(uint64(l)) + l = len(m.BurnAmount) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -3019,9 +3031,7 @@ func (m *QueryEstimateMintAmountRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DepositAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DepositAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3205,9 +3215,7 @@ func (m *QueryEstimateRedeemAmountRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BurnAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.BurnAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/yieldaggregator/types/tx.pb.go b/x/yieldaggregator/types/tx.pb.go index e76d64d9f..c8de764d7 100644 --- a/x/yieldaggregator/types/tx.pb.go +++ b/x/yieldaggregator/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -109,9 +109,9 @@ func (m *MsgDepositToVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositToVaultResponse proto.InternalMessageInfo type MsgWithdrawFromVault struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - VaultId uint64 `protobuf:"varint,2,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` - LpTokenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=lp_token_amount,json=lpTokenAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"lp_token_amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + VaultId uint64 `protobuf:"varint,2,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + LpTokenAmount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=lp_token_amount,json=lpTokenAmount,proto3,customtype=cosmossdk.io/math.Int" json:"lp_token_amount"` } func (m *MsgWithdrawFromVault) Reset() { *m = MsgWithdrawFromVault{} } @@ -184,13 +184,13 @@ func (m *MsgWithdrawFromVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawFromVaultResponse proto.InternalMessageInfo type MsgCreateVault struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` - CommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission_rate"` - WithdrawReserveRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=withdraw_reserve_rate,json=withdrawReserveRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"withdraw_reserve_rate"` - StrategyWeights []StrategyWeight `protobuf:"bytes,5,rep,name=strategy_weights,json=strategyWeights,proto3" json:"strategy_weights"` - Fee types.Coin `protobuf:"bytes,6,opt,name=fee,proto3" json:"fee"` - Deposit types.Coin `protobuf:"bytes,7,opt,name=deposit,proto3" json:"deposit"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + CommissionRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission_rate"` + WithdrawReserveRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=withdraw_reserve_rate,json=withdrawReserveRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"withdraw_reserve_rate"` + StrategyWeights []StrategyWeight `protobuf:"bytes,5,rep,name=strategy_weights,json=strategyWeights,proto3" json:"strategy_weights"` + Fee types.Coin `protobuf:"bytes,6,opt,name=fee,proto3" json:"fee"` + Deposit types.Coin `protobuf:"bytes,7,opt,name=deposit,proto3" json:"deposit"` } func (m *MsgCreateVault) Reset() { *m = MsgCreateVault{} } @@ -227,6 +227,7 @@ func (m *MsgCreateVault) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateVault proto.InternalMessageInfo type MsgCreateVaultResponse struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } func (m *MsgCreateVaultResponse) Reset() { *m = MsgCreateVaultResponse{} } @@ -262,23 +263,31 @@ func (m *MsgCreateVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateVaultResponse proto.InternalMessageInfo -type MsgDeleteVault struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - VaultId uint64 `protobuf:"varint,2,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` +func (m *MsgCreateVaultResponse) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 } -func (m *MsgDeleteVault) Reset() { *m = MsgDeleteVault{} } -func (m *MsgDeleteVault) String() string { return proto.CompactTextString(m) } -func (*MsgDeleteVault) ProtoMessage() {} -func (*MsgDeleteVault) Descriptor() ([]byte, []int) { +type MsgTransferVaultOwnership struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + VaultId uint64 `protobuf:"varint,2,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` +} + +func (m *MsgTransferVaultOwnership) Reset() { *m = MsgTransferVaultOwnership{} } +func (m *MsgTransferVaultOwnership) String() string { return proto.CompactTextString(m) } +func (*MsgTransferVaultOwnership) ProtoMessage() {} +func (*MsgTransferVaultOwnership) Descriptor() ([]byte, []int) { return fileDescriptor_a6f503b1413abc44, []int{6} } -func (m *MsgDeleteVault) XXX_Unmarshal(b []byte) error { +func (m *MsgTransferVaultOwnership) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDeleteVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgTransferVaultOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDeleteVault.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgTransferVaultOwnership.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -288,33 +297,33 @@ func (m *MsgDeleteVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *MsgDeleteVault) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeleteVault.Merge(m, src) +func (m *MsgTransferVaultOwnership) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferVaultOwnership.Merge(m, src) } -func (m *MsgDeleteVault) XXX_Size() int { +func (m *MsgTransferVaultOwnership) XXX_Size() int { return m.Size() } -func (m *MsgDeleteVault) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeleteVault.DiscardUnknown(m) +func (m *MsgTransferVaultOwnership) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferVaultOwnership.DiscardUnknown(m) } -var xxx_messageInfo_MsgDeleteVault proto.InternalMessageInfo +var xxx_messageInfo_MsgTransferVaultOwnership proto.InternalMessageInfo -type MsgDeleteVaultResponse struct { +type MsgTransferVaultOwnershipResponse struct { } -func (m *MsgDeleteVaultResponse) Reset() { *m = MsgDeleteVaultResponse{} } -func (m *MsgDeleteVaultResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDeleteVaultResponse) ProtoMessage() {} -func (*MsgDeleteVaultResponse) Descriptor() ([]byte, []int) { +func (m *MsgTransferVaultOwnershipResponse) Reset() { *m = MsgTransferVaultOwnershipResponse{} } +func (m *MsgTransferVaultOwnershipResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTransferVaultOwnershipResponse) ProtoMessage() {} +func (*MsgTransferVaultOwnershipResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a6f503b1413abc44, []int{7} } -func (m *MsgDeleteVaultResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgTransferVaultOwnershipResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDeleteVaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgTransferVaultOwnershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDeleteVaultResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgTransferVaultOwnershipResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -324,36 +333,35 @@ func (m *MsgDeleteVaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *MsgDeleteVaultResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeleteVaultResponse.Merge(m, src) +func (m *MsgTransferVaultOwnershipResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferVaultOwnershipResponse.Merge(m, src) } -func (m *MsgDeleteVaultResponse) XXX_Size() int { +func (m *MsgTransferVaultOwnershipResponse) XXX_Size() int { return m.Size() } -func (m *MsgDeleteVaultResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeleteVaultResponse.DiscardUnknown(m) +func (m *MsgTransferVaultOwnershipResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferVaultOwnershipResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgDeleteVaultResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgTransferVaultOwnershipResponse proto.InternalMessageInfo -type MsgTransferVaultOwnership struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - VaultId uint64 `protobuf:"varint,2,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` - Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` +type MsgUpdateParams struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } -func (m *MsgTransferVaultOwnership) Reset() { *m = MsgTransferVaultOwnership{} } -func (m *MsgTransferVaultOwnership) String() string { return proto.CompactTextString(m) } -func (*MsgTransferVaultOwnership) ProtoMessage() {} -func (*MsgTransferVaultOwnership) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_a6f503b1413abc44, []int{8} } -func (m *MsgTransferVaultOwnership) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgTransferVaultOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgTransferVaultOwnership.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -363,33 +371,33 @@ func (m *MsgTransferVaultOwnership) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *MsgTransferVaultOwnership) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgTransferVaultOwnership.Merge(m, src) +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) } -func (m *MsgTransferVaultOwnership) XXX_Size() int { +func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } -func (m *MsgTransferVaultOwnership) XXX_DiscardUnknown() { - xxx_messageInfo_MsgTransferVaultOwnership.DiscardUnknown(m) +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } -var xxx_messageInfo_MsgTransferVaultOwnership proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo -type MsgTransferVaultOwnershipResponse struct { +type MsgUpdateParamsResponse struct { } -func (m *MsgTransferVaultOwnershipResponse) Reset() { *m = MsgTransferVaultOwnershipResponse{} } -func (m *MsgTransferVaultOwnershipResponse) String() string { return proto.CompactTextString(m) } -func (*MsgTransferVaultOwnershipResponse) ProtoMessage() {} -func (*MsgTransferVaultOwnershipResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a6f503b1413abc44, []int{9} } -func (m *MsgTransferVaultOwnershipResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgTransferVaultOwnershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgTransferVaultOwnershipResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -399,17 +407,168 @@ func (m *MsgTransferVaultOwnershipResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *MsgTransferVaultOwnershipResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgTransferVaultOwnershipResponse.Merge(m, src) +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } -func (m *MsgTransferVaultOwnershipResponse) XXX_Size() int { +func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } -func (m *MsgTransferVaultOwnershipResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgTransferVaultOwnershipResponse.DiscardUnknown(m) +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgTransferVaultOwnershipResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +type MsgRegisterStrategy struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + ContractAddress string `protobuf:"bytes,3,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + GitUrl string `protobuf:"bytes,5,opt,name=git_url,json=gitUrl,proto3" json:"git_url,omitempty"` +} + +func (m *MsgRegisterStrategy) Reset() { *m = MsgRegisterStrategy{} } +func (m *MsgRegisterStrategy) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterStrategy) ProtoMessage() {} +func (*MsgRegisterStrategy) Descriptor() ([]byte, []int) { + return fileDescriptor_a6f503b1413abc44, []int{10} +} +func (m *MsgRegisterStrategy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterStrategy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterStrategy.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterStrategy) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterStrategy.Merge(m, src) +} +func (m *MsgRegisterStrategy) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterStrategy) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterStrategy.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterStrategy proto.InternalMessageInfo + +type MsgRegisterStrategyResponse struct { +} + +func (m *MsgRegisterStrategyResponse) Reset() { *m = MsgRegisterStrategyResponse{} } +func (m *MsgRegisterStrategyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterStrategyResponse) ProtoMessage() {} +func (*MsgRegisterStrategyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a6f503b1413abc44, []int{11} +} +func (m *MsgRegisterStrategyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterStrategyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterStrategyResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterStrategyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterStrategyResponse.Merge(m, src) +} +func (m *MsgRegisterStrategyResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterStrategyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterStrategyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterStrategyResponse proto.InternalMessageInfo + +type MsgDeleteVault struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + VaultId uint64 `protobuf:"varint,2,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` +} + +func (m *MsgDeleteVault) Reset() { *m = MsgDeleteVault{} } +func (m *MsgDeleteVault) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteVault) ProtoMessage() {} +func (*MsgDeleteVault) Descriptor() ([]byte, []int) { + return fileDescriptor_a6f503b1413abc44, []int{12} +} +func (m *MsgDeleteVault) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteVault.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDeleteVault) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteVault.Merge(m, src) +} +func (m *MsgDeleteVault) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteVault) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteVault.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteVault proto.InternalMessageInfo + +type MsgDeleteVaultResponse struct { +} + +func (m *MsgDeleteVaultResponse) Reset() { *m = MsgDeleteVaultResponse{} } +func (m *MsgDeleteVaultResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteVaultResponse) ProtoMessage() {} +func (*MsgDeleteVaultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a6f503b1413abc44, []int{13} +} +func (m *MsgDeleteVaultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteVaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteVaultResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDeleteVaultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteVaultResponse.Merge(m, src) +} +func (m *MsgDeleteVaultResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteVaultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteVaultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteVaultResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgDepositToVault)(nil), "ununifi.yieldaggregator.MsgDepositToVault") @@ -418,64 +577,80 @@ func init() { proto.RegisterType((*MsgWithdrawFromVaultResponse)(nil), "ununifi.yieldaggregator.MsgWithdrawFromVaultResponse") proto.RegisterType((*MsgCreateVault)(nil), "ununifi.yieldaggregator.MsgCreateVault") proto.RegisterType((*MsgCreateVaultResponse)(nil), "ununifi.yieldaggregator.MsgCreateVaultResponse") - proto.RegisterType((*MsgDeleteVault)(nil), "ununifi.yieldaggregator.MsgDeleteVault") - proto.RegisterType((*MsgDeleteVaultResponse)(nil), "ununifi.yieldaggregator.MsgDeleteVaultResponse") proto.RegisterType((*MsgTransferVaultOwnership)(nil), "ununifi.yieldaggregator.MsgTransferVaultOwnership") proto.RegisterType((*MsgTransferVaultOwnershipResponse)(nil), "ununifi.yieldaggregator.MsgTransferVaultOwnershipResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "ununifi.yieldaggregator.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ununifi.yieldaggregator.MsgUpdateParamsResponse") + proto.RegisterType((*MsgRegisterStrategy)(nil), "ununifi.yieldaggregator.MsgRegisterStrategy") + proto.RegisterType((*MsgRegisterStrategyResponse)(nil), "ununifi.yieldaggregator.MsgRegisterStrategyResponse") + proto.RegisterType((*MsgDeleteVault)(nil), "ununifi.yieldaggregator.MsgDeleteVault") + proto.RegisterType((*MsgDeleteVaultResponse)(nil), "ununifi.yieldaggregator.MsgDeleteVaultResponse") } func init() { proto.RegisterFile("ununifi/yieldaggregator/tx.proto", fileDescriptor_a6f503b1413abc44) } var fileDescriptor_a6f503b1413abc44 = []byte{ - // 764 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0x49, 0x36, 0x25, 0x53, 0xd1, 0xb2, 0xde, 0xb0, 0xeb, 0x04, 0xe4, 0x84, 0x22, 0xd1, - 0x68, 0xa5, 0xd8, 0x9b, 0x20, 0x40, 0xac, 0xb8, 0x6c, 0x36, 0xaa, 0x54, 0xa4, 0x08, 0xc9, 0x6d, - 0x29, 0xe2, 0x12, 0x39, 0xf6, 0xab, 0x33, 0x6a, 0x3c, 0x63, 0xcd, 0x4c, 0x92, 0xe6, 0xca, 0xa9, - 0x27, 0xc4, 0x47, 0xe8, 0x27, 0x40, 0x1c, 0xca, 0x77, 0xe8, 0x8d, 0xaa, 0x27, 0xc4, 0xa1, 0x42, - 0xed, 0x01, 0x3e, 0x06, 0xb2, 0x3d, 0x49, 0xdd, 0xe6, 0x8f, 0xd2, 0xaa, 0x7b, 0x72, 0x26, 0xef, - 0xf7, 0xde, 0xef, 0xfd, 0xec, 0xdf, 0x7b, 0x1a, 0x54, 0xee, 0x93, 0x3e, 0xc1, 0x07, 0xd8, 0x1c, - 0x61, 0xe8, 0xb9, 0xb6, 0xe7, 0x31, 0xf0, 0x6c, 0x41, 0x99, 0x29, 0x8e, 0x8c, 0x80, 0x51, 0x41, - 0xd5, 0x17, 0x12, 0x61, 0xdc, 0x41, 0x14, 0xf3, 0x1e, 0xf5, 0x68, 0x84, 0x31, 0xc3, 0x5f, 0x31, - 0xbc, 0xf8, 0xc2, 0xa1, 0xdc, 0xa7, 0xdc, 0xf4, 0xb9, 0x67, 0x0e, 0x6a, 0xe1, 0x43, 0x06, 0x0a, - 0x71, 0xa0, 0x1d, 0x67, 0xc4, 0x07, 0x19, 0xd2, 0x65, 0x4e, 0xc7, 0xe6, 0x60, 0x0e, 0x6a, 0x1d, - 0x10, 0x76, 0xcd, 0x74, 0x28, 0x26, 0x32, 0x5e, 0x9d, 0xd7, 0xe4, 0x9d, 0x73, 0x0c, 0xdf, 0xf8, - 0x4d, 0x41, 0x4f, 0x5b, 0xdc, 0x6b, 0x42, 0x40, 0x39, 0x16, 0xbb, 0xf4, 0x07, 0xbb, 0xdf, 0x13, - 0xea, 0x2b, 0x94, 0xe5, 0x40, 0x5c, 0x60, 0x9a, 0x52, 0x56, 0x2a, 0xb9, 0x86, 0x76, 0x71, 0x5a, - 0xcd, 0xcb, 0x36, 0xde, 0xb8, 0x2e, 0x03, 0xce, 0x77, 0x04, 0xc3, 0xc4, 0xb3, 0x24, 0x4e, 0x2d, - 0xa0, 0xf7, 0x07, 0x61, 0x6a, 0x1b, 0xbb, 0xda, 0x7b, 0x65, 0xa5, 0x92, 0xb1, 0x56, 0xa2, 0xf3, - 0xb6, 0xab, 0x7e, 0x8d, 0xb2, 0xb6, 0x4f, 0xfb, 0x44, 0x68, 0xe9, 0xb2, 0x52, 0x59, 0xad, 0x17, - 0x0c, 0x59, 0x29, 0x94, 0x60, 0x48, 0x09, 0xc6, 0x5b, 0x8a, 0x49, 0x23, 0x73, 0x76, 0x59, 0x4a, - 0x59, 0x12, 0xfe, 0xfa, 0xd9, 0xf1, 0x49, 0x29, 0xf5, 0xdf, 0x49, 0x29, 0xf5, 0xf3, 0xbf, 0xbf, - 0xbf, 0x94, 0x44, 0x1b, 0x1f, 0xa3, 0xc2, 0x54, 0xbf, 0x16, 0xf0, 0x80, 0x12, 0x0e, 0x1b, 0x97, - 0x0a, 0xca, 0xb7, 0xb8, 0xb7, 0x8f, 0x45, 0xd7, 0x65, 0xf6, 0x70, 0x8b, 0x51, 0xff, 0x1d, 0x08, - 0x72, 0xd1, 0x7a, 0x2f, 0x68, 0x0b, 0x7a, 0x08, 0xa4, 0x9d, 0x50, 0x96, 0x6b, 0x7c, 0x1b, 0xb6, - 0xff, 0xf7, 0x65, 0xe9, 0x73, 0x0f, 0x8b, 0x6e, 0xbf, 0x63, 0x38, 0xd4, 0x97, 0x1f, 0x4f, 0x3e, - 0xaa, 0xdc, 0x3d, 0x34, 0xc5, 0x28, 0x00, 0x6e, 0x6c, 0x13, 0x71, 0x71, 0x5a, 0x45, 0xb2, 0x87, - 0x6d, 0x22, 0xac, 0x0f, 0x7a, 0xc1, 0x6e, 0x58, 0xf3, 0xcd, 0x02, 0xf5, 0x3a, 0xfa, 0x64, 0x96, - 0xbe, 0xc9, 0x0b, 0xf8, 0x25, 0x83, 0xd6, 0x5a, 0xdc, 0x7b, 0xcb, 0xc0, 0x16, 0xf0, 0x50, 0xe9, - 0x79, 0xf4, 0xc4, 0x05, 0x42, 0xfd, 0x48, 0x77, 0xce, 0x8a, 0x0f, 0x2a, 0xa0, 0x75, 0x87, 0xfa, - 0x3e, 0xe6, 0x1c, 0x53, 0xd2, 0x66, 0xb6, 0x80, 0x07, 0xa8, 0x6e, 0x82, 0x93, 0x50, 0xdd, 0x04, - 0xc7, 0x5a, 0xbb, 0x29, 0x6a, 0xd9, 0x02, 0xd4, 0x00, 0x7d, 0x34, 0x94, 0xf2, 0xda, 0x0c, 0x38, - 0xb0, 0x01, 0xc4, 0x64, 0x99, 0x47, 0x20, 0x7b, 0x36, 0x2e, 0x6d, 0xc5, 0x95, 0x23, 0xc6, 0x1f, - 0xd1, 0x87, 0x5c, 0x84, 0x14, 0xde, 0xa8, 0x3d, 0x04, 0xec, 0x75, 0x05, 0xd7, 0x9e, 0x94, 0xd3, - 0x95, 0xd5, 0xfa, 0xa6, 0x31, 0x67, 0x9e, 0x8d, 0x1d, 0x99, 0xb0, 0x1f, 0xe1, 0xa5, 0x6f, 0xd7, - 0xf9, 0xad, 0x7f, 0xb9, 0x5a, 0x43, 0xe9, 0x03, 0x00, 0x2d, 0xbb, 0x9c, 0xed, 0x43, 0xac, 0xfa, - 0x0d, 0x5a, 0x71, 0x63, 0x6f, 0x6b, 0x2b, 0xcb, 0xa5, 0x8d, 0xf1, 0xb3, 0x0d, 0xa3, 0xa1, 0xe7, - 0xb7, 0xfd, 0x30, 0xb1, 0x0a, 0x8b, 0x9c, 0xd2, 0x84, 0x1e, 0x3c, 0xdc, 0x29, 0xf3, 0x87, 0x64, - 0x51, 0x37, 0x09, 0xce, 0x49, 0x37, 0x7f, 0x28, 0xd1, 0x5c, 0xef, 0x32, 0x9b, 0xf0, 0x03, 0x60, - 0x51, 0xf0, 0xfb, 0x21, 0x01, 0xc6, 0xbb, 0x38, 0x78, 0xdc, 0xf1, 0xfd, 0x0a, 0xe5, 0x18, 0x38, - 0x38, 0xc0, 0x30, 0x19, 0xdc, 0xf9, 0xf5, 0x6e, 0xa0, 0xb3, 0x15, 0x7d, 0x86, 0x3e, 0x9d, 0xdb, - 0xf6, 0x58, 0x5c, 0xfd, 0xcf, 0x0c, 0x4a, 0xb7, 0xb8, 0xa7, 0x06, 0x68, 0xed, 0xce, 0xa2, 0x7d, - 0x39, 0xd7, 0x61, 0x53, 0x4b, 0xae, 0x58, 0x5f, 0x1e, 0x3b, 0x66, 0x56, 0x47, 0xe8, 0xe9, 0xf4, - 0x32, 0xac, 0x2e, 0x2a, 0x34, 0x05, 0x2f, 0x7e, 0x79, 0x2f, 0xf8, 0x84, 0xda, 0x43, 0xab, 0xc9, - 0x35, 0xb4, 0xb9, 0xa8, 0x4a, 0x02, 0x58, 0x34, 0x97, 0x04, 0x26, 0x89, 0x92, 0x2e, 0xde, 0x5c, - 0xfc, 0x9a, 0x26, 0xc0, 0xc5, 0x44, 0x33, 0x3c, 0xaa, 0x1e, 0x2b, 0xe8, 0xf9, 0x1c, 0x83, 0x2e, - 0xfc, 0x36, 0xb3, 0x73, 0x8a, 0xaf, 0xef, 0x9f, 0x33, 0x6e, 0xa5, 0xf1, 0xdd, 0xd9, 0x95, 0xae, - 0x9c, 0x5f, 0xe9, 0xca, 0x3f, 0x57, 0xba, 0xf2, 0xeb, 0xb5, 0x9e, 0x3a, 0xbf, 0xd6, 0x53, 0x7f, - 0x5d, 0xeb, 0xa9, 0x9f, 0x5e, 0x25, 0x16, 0xe3, 0x1e, 0xd9, 0x23, 0x78, 0x0b, 0x9b, 0x4e, 0xd7, - 0xc6, 0xc4, 0x3c, 0x9a, 0xbe, 0xb7, 0x84, 0x6b, 0xb2, 0x93, 0x8d, 0x6e, 0x02, 0x5f, 0xfc, 0x1f, - 0x00, 0x00, 0xff, 0xff, 0x59, 0x8e, 0x55, 0x22, 0xdf, 0x08, 0x00, 0x00, + // 950 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0x8e, 0x43, 0x26, 0x10, 0xa7, 0x9b, 0xb4, 0xb1, 0x1d, 0xb0, 0x4d, 0x40, 0x8a, + 0x29, 0x64, 0x37, 0x36, 0xbf, 0x44, 0x25, 0x0e, 0x4d, 0xa3, 0x4a, 0x41, 0x58, 0xa0, 0x4d, 0x42, + 0x51, 0x2f, 0xd6, 0x64, 0xf7, 0x65, 0x3c, 0xd4, 0x3b, 0xb3, 0x9a, 0x19, 0x3b, 0xf5, 0x95, 0x53, + 0x8f, 0xdc, 0xb8, 0xf6, 0x2f, 0x40, 0x48, 0x94, 0xff, 0xa1, 0x42, 0x42, 0xaa, 0x7a, 0x42, 0x1c, + 0x2a, 0x94, 0x1c, 0xe0, 0x4f, 0xe0, 0x88, 0xbc, 0x3b, 0xde, 0x3a, 0xb6, 0xd7, 0x72, 0xa2, 0x72, + 0xf2, 0xce, 0xce, 0xf7, 0xbe, 0xf7, 0x3e, 0xcf, 0xfb, 0xde, 0x2c, 0xaa, 0x74, 0x58, 0x87, 0xd1, + 0x13, 0x6a, 0xf7, 0x28, 0xb4, 0x3d, 0x4c, 0x88, 0x00, 0x82, 0x15, 0x17, 0xb6, 0x7a, 0x68, 0x05, + 0x82, 0x2b, 0x6e, 0xae, 0x6b, 0x84, 0x35, 0x82, 0x28, 0xae, 0x11, 0x4e, 0x78, 0x88, 0xb1, 0xfb, + 0x4f, 0x11, 0xbc, 0xb8, 0xee, 0x72, 0xe9, 0x73, 0x69, 0xfb, 0x92, 0xd8, 0xdd, 0x5a, 0xff, 0x47, + 0x6f, 0x14, 0xa2, 0x8d, 0x66, 0x14, 0x11, 0x2d, 0xf4, 0x56, 0x49, 0xc7, 0x1c, 0x63, 0x09, 0x76, + 0xb7, 0x76, 0x0c, 0x0a, 0xd7, 0x6c, 0x97, 0x53, 0xa6, 0xf7, 0xb7, 0x93, 0x8a, 0x1c, 0x59, 0x6b, + 0xf8, 0xbb, 0x49, 0xf0, 0x00, 0x0b, 0xec, 0xeb, 0xa4, 0x9b, 0x3f, 0x19, 0xe8, 0x5a, 0x43, 0x92, + 0x3d, 0x08, 0xb8, 0xa4, 0xea, 0x90, 0x7f, 0x83, 0x3b, 0x6d, 0x65, 0xee, 0xa0, 0xac, 0x04, 0xe6, + 0x81, 0xc8, 0x1b, 0x15, 0xa3, 0xba, 0xb8, 0x9b, 0x7f, 0xfe, 0x64, 0x7b, 0x4d, 0x17, 0x7b, 0xdb, + 0xf3, 0x04, 0x48, 0x79, 0xa0, 0x04, 0x65, 0xc4, 0xd1, 0x38, 0xb3, 0x80, 0x5e, 0xeb, 0xf6, 0x43, + 0x9b, 0xd4, 0xcb, 0xcf, 0x55, 0x8c, 0x6a, 0xc6, 0x59, 0x08, 0xd7, 0xfb, 0x9e, 0xf9, 0x29, 0xca, + 0x62, 0x9f, 0x77, 0x98, 0xca, 0xa7, 0x2b, 0x46, 0x75, 0xa9, 0x5e, 0xb0, 0x34, 0x53, 0x5f, 0xa8, + 0xa5, 0x85, 0x5a, 0x77, 0x38, 0x65, 0xbb, 0x99, 0xa7, 0x2f, 0xca, 0x29, 0x47, 0xc3, 0x6f, 0xad, + 0x3e, 0x7a, 0x5c, 0x4e, 0xfd, 0xf3, 0xb8, 0x9c, 0xfa, 0xfe, 0xef, 0x9f, 0x6f, 0xea, 0x44, 0x9b, + 0x1b, 0xa8, 0x30, 0x56, 0xaf, 0x03, 0x32, 0xe0, 0x4c, 0xc2, 0xe6, 0xef, 0x06, 0x5a, 0x6b, 0x48, + 0x72, 0x8f, 0xaa, 0x96, 0x27, 0xf0, 0xe9, 0x5d, 0xc1, 0xfd, 0xff, 0x41, 0xd0, 0x01, 0xca, 0xb5, + 0x83, 0xa6, 0xe2, 0x0f, 0x80, 0x35, 0x87, 0x94, 0x2d, 0xee, 0xbe, 0xdf, 0x2f, 0xff, 0xcf, 0x17, + 0xe5, 0xeb, 0x11, 0xb3, 0xf4, 0x1e, 0x58, 0x94, 0xdb, 0x3e, 0x56, 0x2d, 0x6b, 0x9f, 0xa9, 0xe7, + 0x4f, 0xb6, 0x91, 0x4e, 0xb9, 0xcf, 0x94, 0xf3, 0x46, 0x3b, 0x38, 0xec, 0x53, 0xdc, 0x9e, 0x22, + 0xb6, 0x84, 0xde, 0x9c, 0x24, 0x27, 0xd6, 0xfb, 0x6f, 0x1a, 0x2d, 0x37, 0x24, 0xb9, 0x23, 0x00, + 0x2b, 0xb8, 0xaa, 0xd2, 0x35, 0x34, 0xef, 0x01, 0xe3, 0x7e, 0x28, 0x73, 0xd1, 0x89, 0x16, 0xe6, + 0x7d, 0x94, 0x73, 0xb9, 0xef, 0x53, 0x29, 0x29, 0x67, 0x4d, 0x81, 0x15, 0x68, 0x91, 0x35, 0x2d, + 0x72, 0x63, 0x5c, 0xe4, 0x97, 0x40, 0xb0, 0xdb, 0xdb, 0x03, 0x77, 0x48, 0xea, 0x1e, 0xb8, 0xce, + 0xf2, 0x4b, 0x26, 0x07, 0x2b, 0x30, 0x01, 0x5d, 0x3f, 0xd5, 0x9a, 0x9a, 0x02, 0x24, 0x88, 0x2e, + 0x44, 0x19, 0x32, 0x57, 0xcd, 0xb0, 0x3a, 0xe0, 0x73, 0x22, 0xba, 0x30, 0xcd, 0xb7, 0x68, 0x45, + 0xaa, 0x3e, 0x2f, 0xe9, 0x35, 0x4f, 0x81, 0x92, 0x96, 0x92, 0xf9, 0xf9, 0x4a, 0xba, 0xba, 0x54, + 0xdf, 0xb2, 0x12, 0xec, 0x6c, 0x1d, 0xe8, 0x80, 0x7b, 0x21, 0x5e, 0x37, 0x64, 0x4e, 0x5e, 0x78, + 0x2b, 0xcd, 0x1a, 0x4a, 0x9f, 0x00, 0xe4, 0xb3, 0xb3, 0xf5, 0x73, 0x1f, 0x6b, 0x7e, 0x86, 0x16, + 0xbc, 0xa8, 0x69, 0xf3, 0x0b, 0xb3, 0x85, 0x0d, 0xf0, 0x93, 0x5b, 0xa3, 0x8a, 0x6e, 0x5c, 0x3c, + 0xf9, 0x41, 0x53, 0x98, 0xcb, 0x68, 0x8e, 0x7a, 0xe1, 0xe9, 0x67, 0x9c, 0x39, 0xea, 0x6d, 0xfe, + 0x6a, 0x84, 0x96, 0x39, 0x14, 0x98, 0xc9, 0x13, 0x10, 0x21, 0xf8, 0xab, 0x53, 0x06, 0x42, 0xb6, + 0x68, 0xf0, 0x6a, 0x9d, 0xf1, 0x09, 0x5a, 0x14, 0xe0, 0xd2, 0x80, 0x42, 0xec, 0x89, 0x64, 0xbe, + 0x97, 0xd0, 0xc9, 0x0a, 0xdf, 0x41, 0x6f, 0x27, 0x96, 0x1d, 0x3b, 0xe0, 0x47, 0x03, 0xe5, 0x1a, + 0x92, 0x1c, 0x05, 0x1e, 0x56, 0xf0, 0x75, 0x38, 0xd9, 0xae, 0x20, 0xe9, 0x73, 0x94, 0x8d, 0xa6, + 0x62, 0x28, 0x68, 0xa9, 0x5e, 0x4e, 0xec, 0x8f, 0x28, 0xc5, 0x60, 0x50, 0x45, 0x41, 0x93, 0xcb, + 0x2f, 0xa0, 0xf5, 0x91, 0xc2, 0xe2, 0xa2, 0x7f, 0x33, 0xd0, 0x6a, 0x43, 0x12, 0x07, 0x08, 0x95, + 0x0a, 0xc4, 0xa0, 0xe7, 0x5e, 0x99, 0x77, 0xdf, 0x43, 0x2b, 0x2e, 0x67, 0x4a, 0x60, 0x57, 0x35, + 0x71, 0x14, 0x17, 0x9d, 0x86, 0x93, 0x1b, 0xbc, 0xd7, 0x74, 0xa6, 0x89, 0x32, 0x0c, 0xfb, 0xda, + 0x79, 0x4e, 0xf8, 0x6c, 0xae, 0xa3, 0x05, 0x42, 0x55, 0xb3, 0x23, 0xda, 0xf9, 0xf9, 0xf0, 0x75, + 0x96, 0x50, 0x75, 0x24, 0xda, 0x93, 0x75, 0xbe, 0x85, 0x36, 0x26, 0x68, 0x89, 0xb5, 0x8a, 0x70, + 0x42, 0xed, 0x41, 0x1b, 0xae, 0x3e, 0xa1, 0x92, 0x3b, 0x6e, 0x72, 0x49, 0xf9, 0xd0, 0x1b, 0x43, + 0x39, 0x07, 0xd5, 0xd4, 0x7f, 0xc9, 0xa2, 0x74, 0x43, 0x12, 0x33, 0x40, 0xcb, 0x23, 0x57, 0xde, + 0xcd, 0xc4, 0x23, 0x1f, 0xbb, 0x6e, 0x8a, 0xf5, 0xd9, 0xb1, 0xb1, 0x2b, 0x7b, 0xe8, 0xda, 0xf8, + 0xb5, 0xb4, 0x3d, 0x8d, 0x68, 0x0c, 0x5e, 0xfc, 0xf8, 0x52, 0xf0, 0x38, 0x35, 0x41, 0x4b, 0xc3, + 0x37, 0xc4, 0xd6, 0x34, 0x96, 0x21, 0x60, 0xd1, 0x9e, 0x11, 0x18, 0x27, 0x7a, 0x64, 0xa0, 0x1b, + 0x09, 0x63, 0x66, 0xea, 0x5f, 0x36, 0x39, 0xa6, 0x78, 0xeb, 0xf2, 0x31, 0x71, 0x29, 0xdf, 0xa1, + 0xd7, 0x2f, 0xcc, 0x84, 0xea, 0x34, 0xae, 0x61, 0x64, 0x71, 0x67, 0x56, 0x64, 0x9c, 0xab, 0x8b, + 0x56, 0xc6, 0xac, 0xfc, 0xc1, 0x34, 0x96, 0x51, 0x74, 0xf1, 0xa3, 0xcb, 0xa0, 0x87, 0xcf, 0x75, + 0xd8, 0x57, 0x5b, 0xd3, 0xbb, 0x32, 0x06, 0x4e, 0x3f, 0xd7, 0x09, 0xae, 0xd9, 0xfd, 0xe2, 0xe9, + 0x59, 0xc9, 0x78, 0x76, 0x56, 0x32, 0xfe, 0x3a, 0x2b, 0x19, 0x3f, 0x9c, 0x97, 0x52, 0xcf, 0xce, + 0x4b, 0xa9, 0x3f, 0xce, 0x4b, 0xa9, 0xfb, 0x3b, 0x84, 0xaa, 0x56, 0xe7, 0xd8, 0x72, 0xb9, 0x6f, + 0x1f, 0xb1, 0x23, 0x46, 0xef, 0x52, 0xdb, 0x6d, 0x61, 0xca, 0xec, 0x87, 0xe3, 0xdf, 0xd2, 0xbd, + 0x00, 0xe4, 0x71, 0x36, 0xfc, 0xee, 0xfc, 0xf0, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, 0x57, + 0xb9, 0x76, 0x73, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -494,8 +669,10 @@ type MsgClient interface { DepositToVault(ctx context.Context, in *MsgDepositToVault, opts ...grpc.CallOption) (*MsgDepositToVaultResponse, error) WithdrawFromVault(ctx context.Context, in *MsgWithdrawFromVault, opts ...grpc.CallOption) (*MsgWithdrawFromVaultResponse, error) CreateVault(ctx context.Context, in *MsgCreateVault, opts ...grpc.CallOption) (*MsgCreateVaultResponse, error) - DeleteVault(ctx context.Context, in *MsgDeleteVault, opts ...grpc.CallOption) (*MsgDeleteVaultResponse, error) TransferVaultOwnership(ctx context.Context, in *MsgTransferVaultOwnership, opts ...grpc.CallOption) (*MsgTransferVaultOwnershipResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + RegisterStrategy(ctx context.Context, in *MsgRegisterStrategy, opts ...grpc.CallOption) (*MsgRegisterStrategyResponse, error) + DeleteVault(ctx context.Context, in *MsgDeleteVault, opts ...grpc.CallOption) (*MsgDeleteVaultResponse, error) } type msgClient struct { @@ -533,18 +710,36 @@ func (c *msgClient) CreateVault(ctx context.Context, in *MsgCreateVault, opts .. return out, nil } -func (c *msgClient) DeleteVault(ctx context.Context, in *MsgDeleteVault, opts ...grpc.CallOption) (*MsgDeleteVaultResponse, error) { - out := new(MsgDeleteVaultResponse) - err := c.cc.Invoke(ctx, "/ununifi.yieldaggregator.Msg/DeleteVault", in, out, opts...) +func (c *msgClient) TransferVaultOwnership(ctx context.Context, in *MsgTransferVaultOwnership, opts ...grpc.CallOption) (*MsgTransferVaultOwnershipResponse, error) { + out := new(MsgTransferVaultOwnershipResponse) + err := c.cc.Invoke(ctx, "/ununifi.yieldaggregator.Msg/TransferVaultOwnership", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) TransferVaultOwnership(ctx context.Context, in *MsgTransferVaultOwnership, opts ...grpc.CallOption) (*MsgTransferVaultOwnershipResponse, error) { - out := new(MsgTransferVaultOwnershipResponse) - err := c.cc.Invoke(ctx, "/ununifi.yieldaggregator.Msg/TransferVaultOwnership", in, out, opts...) +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/ununifi.yieldaggregator.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RegisterStrategy(ctx context.Context, in *MsgRegisterStrategy, opts ...grpc.CallOption) (*MsgRegisterStrategyResponse, error) { + out := new(MsgRegisterStrategyResponse) + err := c.cc.Invoke(ctx, "/ununifi.yieldaggregator.Msg/RegisterStrategy", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeleteVault(ctx context.Context, in *MsgDeleteVault, opts ...grpc.CallOption) (*MsgDeleteVaultResponse, error) { + out := new(MsgDeleteVaultResponse) + err := c.cc.Invoke(ctx, "/ununifi.yieldaggregator.Msg/DeleteVault", in, out, opts...) if err != nil { return nil, err } @@ -557,8 +752,10 @@ type MsgServer interface { DepositToVault(context.Context, *MsgDepositToVault) (*MsgDepositToVaultResponse, error) WithdrawFromVault(context.Context, *MsgWithdrawFromVault) (*MsgWithdrawFromVaultResponse, error) CreateVault(context.Context, *MsgCreateVault) (*MsgCreateVaultResponse, error) - DeleteVault(context.Context, *MsgDeleteVault) (*MsgDeleteVaultResponse, error) TransferVaultOwnership(context.Context, *MsgTransferVaultOwnership) (*MsgTransferVaultOwnershipResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + RegisterStrategy(context.Context, *MsgRegisterStrategy) (*MsgRegisterStrategyResponse, error) + DeleteVault(context.Context, *MsgDeleteVault) (*MsgDeleteVaultResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -574,12 +771,18 @@ func (*UnimplementedMsgServer) WithdrawFromVault(ctx context.Context, req *MsgWi func (*UnimplementedMsgServer) CreateVault(ctx context.Context, req *MsgCreateVault) (*MsgCreateVaultResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateVault not implemented") } -func (*UnimplementedMsgServer) DeleteVault(ctx context.Context, req *MsgDeleteVault) (*MsgDeleteVaultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteVault not implemented") -} func (*UnimplementedMsgServer) TransferVaultOwnership(ctx context.Context, req *MsgTransferVaultOwnership) (*MsgTransferVaultOwnershipResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferVaultOwnership not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (*UnimplementedMsgServer) RegisterStrategy(ctx context.Context, req *MsgRegisterStrategy) (*MsgRegisterStrategyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterStrategy not implemented") +} +func (*UnimplementedMsgServer) DeleteVault(ctx context.Context, req *MsgDeleteVault) (*MsgDeleteVaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteVault not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -639,38 +842,74 @@ func _Msg_CreateVault_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Msg_DeleteVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeleteVault) +func _Msg_TransferVaultOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTransferVaultOwnership) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).DeleteVault(ctx, in) + return srv.(MsgServer).TransferVaultOwnership(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.yieldaggregator.Msg/DeleteVault", + FullMethod: "/ununifi.yieldaggregator.Msg/TransferVaultOwnership", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DeleteVault(ctx, req.(*MsgDeleteVault)) + return srv.(MsgServer).TransferVaultOwnership(ctx, req.(*MsgTransferVaultOwnership)) } return interceptor(ctx, in, info, handler) } -func _Msg_TransferVaultOwnership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgTransferVaultOwnership) +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).TransferVaultOwnership(ctx, in) + return srv.(MsgServer).UpdateParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ununifi.yieldaggregator.Msg/TransferVaultOwnership", + FullMethod: "/ununifi.yieldaggregator.Msg/UpdateParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).TransferVaultOwnership(ctx, req.(*MsgTransferVaultOwnership)) + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RegisterStrategy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterStrategy) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterStrategy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ununifi.yieldaggregator.Msg/RegisterStrategy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterStrategy(ctx, req.(*MsgRegisterStrategy)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DeleteVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeleteVault) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeleteVault(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ununifi.yieldaggregator.Msg/DeleteVault", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeleteVault(ctx, req.(*MsgDeleteVault)) } return interceptor(ctx, in, info, handler) } @@ -691,14 +930,22 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "CreateVault", Handler: _Msg_CreateVault_Handler, }, - { - MethodName: "DeleteVault", - Handler: _Msg_DeleteVault_Handler, - }, { MethodName: "TransferVaultOwnership", Handler: _Msg_TransferVaultOwnership_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "RegisterStrategy", + Handler: _Msg_RegisterStrategy_Handler, + }, + { + MethodName: "DeleteVault", + Handler: _Msg_DeleteVault_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ununifi/yieldaggregator/tx.proto", @@ -951,10 +1198,15 @@ func (m *MsgCreateVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } -func (m *MsgDeleteVault) Marshal() (dAtA []byte, err error) { +func (m *MsgTransferVaultOwnership) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -964,16 +1216,23 @@ func (m *MsgDeleteVault) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDeleteVault) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgTransferVaultOwnership) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDeleteVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgTransferVaultOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x1a + } if m.VaultId != 0 { i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) i-- @@ -989,7 +1248,7 @@ func (m *MsgDeleteVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgDeleteVaultResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgTransferVaultOwnershipResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -999,12 +1258,12 @@ func (m *MsgDeleteVaultResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDeleteVaultResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgTransferVaultOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDeleteVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgTransferVaultOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1012,7 +1271,7 @@ func (m *MsgDeleteVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgTransferVaultOwnership) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1022,23 +1281,160 @@ func (m *MsgTransferVaultOwnership) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgTransferVaultOwnership) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgTransferVaultOwnership) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRegisterStrategy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterStrategy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterStrategy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GitUrl) > 0 { + i -= len(m.GitUrl) + copy(dAtA[i:], m.GitUrl) + i = encodeVarintTx(dAtA, i, uint64(len(m.GitUrl))) + i-- + dAtA[i] = 0x2a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x22 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) i-- dAtA[i] = 0x1a } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterStrategyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterStrategyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterStrategyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeleteVault) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDeleteVault) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if m.VaultId != 0 { i = encodeVarintTx(dAtA, i, uint64(m.VaultId)) i-- @@ -1054,7 +1450,7 @@ func (m *MsgTransferVaultOwnership) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *MsgTransferVaultOwnershipResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgDeleteVaultResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1064,12 +1460,12 @@ func (m *MsgTransferVaultOwnershipResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgTransferVaultOwnershipResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgDeleteVaultResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgTransferVaultOwnershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgDeleteVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1179,10 +1575,13 @@ func (m *MsgCreateVaultResponse) Size() (n int) { } var l int _ = l + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } return n } -func (m *MsgDeleteVault) Size() (n int) { +func (m *MsgTransferVaultOwnership) Size() (n int) { if m == nil { return 0 } @@ -1195,10 +1594,14 @@ func (m *MsgDeleteVault) Size() (n int) { if m.VaultId != 0 { n += 1 + sovTx(uint64(m.VaultId)) } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } -func (m *MsgDeleteVaultResponse) Size() (n int) { +func (m *MsgTransferVaultOwnershipResponse) Size() (n int) { if m == nil { return 0 } @@ -1207,7 +1610,7 @@ func (m *MsgDeleteVaultResponse) Size() (n int) { return n } -func (m *MsgTransferVaultOwnership) Size() (n int) { +func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 } @@ -1217,17 +1620,50 @@ func (m *MsgTransferVaultOwnership) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.VaultId != 0 { - n += 1 + sovTx(uint64(m.VaultId)) + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 } - l = len(m.Recipient) + var l int + _ = l + return n +} + +func (m *MsgRegisterStrategy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.GitUrl) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgTransferVaultOwnershipResponse) Size() (n int) { +func (m *MsgRegisterStrategyResponse) Size() (n int) { if m == nil { return 0 } @@ -1236,17 +1672,42 @@ func (m *MsgTransferVaultOwnershipResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx +func (m *MsgDeleteVault) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.VaultId != 0 { + n += 1 + sovTx(uint64(m.VaultId)) + } + return n +} + +func (m *MsgDeleteVaultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -1273,9 +1734,510 @@ func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDepositToVaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositToVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawFromVault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawFromVault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + m.VaultId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LpTokenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LpTokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawFromVaultResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawFromVaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawFromVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateVault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawReserveRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WithdrawReserveRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StrategyWeights", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1285,29 +2247,31 @@ func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.StrategyWeights = append(m.StrategyWeights, StrategyWeight{}) + if err := m.StrategyWeights[len(m.StrategyWeights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) } - m.VaultId = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1317,14 +2281,28 @@ func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VaultId |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 3: + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1351,7 +2329,7 @@ func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1376,7 +2354,7 @@ func (m *MsgDepositToVault) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateVaultResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1399,12 +2377,31 @@ func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositToVaultResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateVaultResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositToVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1426,7 +2423,7 @@ func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { +func (m *MsgTransferVaultOwnership) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1449,10 +2446,10 @@ func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawFromVault: wiretype end group for non-group") + return fmt.Errorf("proto: MsgTransferVaultOwnership: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawFromVault: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgTransferVaultOwnership: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1508,7 +2505,7 @@ func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { } case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LpTokenAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1536,9 +2533,7 @@ func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LpTokenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Recipient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1561,7 +2556,7 @@ func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawFromVaultResponse) Unmarshal(dAtA []byte) error { +func (m *MsgTransferVaultOwnershipResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1584,233 +2579,67 @@ func (m *MsgWithdrawFromVaultResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawFromVaultResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgTransferVaultOwnershipResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawFromVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgTransferVaultOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateVault: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVault: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawReserveRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if err := m.WithdrawReserveRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StrategyWeights", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.StrategyWeights = append(m.StrategyWeights, StrategyWeight{}) - if err := m.StrategyWeights[len(m.StrategyWeights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex - case 6: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1820,28 +2649,27 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1868,7 +2696,7 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1893,7 +2721,7 @@ func (m *MsgCreateVault) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateVaultResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1916,10 +2744,10 @@ func (m *MsgCreateVaultResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateVaultResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1943,7 +2771,7 @@ func (m *MsgCreateVaultResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeleteVault) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterStrategy) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1966,10 +2794,10 @@ func (m *MsgDeleteVault) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeleteVault: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterStrategy: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeleteVault: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterStrategy: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2005,10 +2833,10 @@ func (m *MsgDeleteVault) Unmarshal(dAtA []byte) error { m.Sender = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } - m.VaultId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2018,11 +2846,120 @@ func (m *MsgDeleteVault) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VaultId |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GitUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GitUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2044,7 +2981,7 @@ func (m *MsgDeleteVault) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeleteVaultResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterStrategyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2067,10 +3004,10 @@ func (m *MsgDeleteVaultResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeleteVaultResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterStrategyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeleteVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterStrategyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2094,7 +3031,7 @@ func (m *MsgDeleteVaultResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgTransferVaultOwnership) Unmarshal(dAtA []byte) error { +func (m *MsgDeleteVault) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2117,10 +3054,10 @@ func (m *MsgTransferVaultOwnership) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgTransferVaultOwnership: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDeleteVault: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgTransferVaultOwnership: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDeleteVault: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2174,38 +3111,6 @@ func (m *MsgTransferVaultOwnership) Unmarshal(dAtA []byte) error { break } } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Recipient = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2227,7 +3132,7 @@ func (m *MsgTransferVaultOwnership) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgTransferVaultOwnershipResponse) Unmarshal(dAtA []byte) error { +func (m *MsgDeleteVaultResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2250,10 +3155,10 @@ func (m *MsgTransferVaultOwnershipResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgTransferVaultOwnershipResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDeleteVaultResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgTransferVaultOwnershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDeleteVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/yieldaggregator/types/yieldaggregator.pb.go b/x/yieldaggregator/types/yieldaggregator.pb.go index b91b9bd98..120f5b306 100644 --- a/x/yieldaggregator/types/yieldaggregator.pb.go +++ b/x/yieldaggregator/types/yieldaggregator.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -27,8 +27,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type StrategyWeight struct { - StrategyId uint64 `protobuf:"varint,1,opt,name=strategy_id,json=strategyId,proto3" json:"strategy_id,omitempty"` - Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` + StrategyId uint64 `protobuf:"varint,1,opt,name=strategy_id,json=strategyId,proto3" json:"strategy_id,omitempty"` + Weight cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight"` } func (m *StrategyWeight) Reset() { *m = StrategyWeight{} } @@ -72,13 +72,13 @@ func (m *StrategyWeight) GetStrategyId() uint64 { } type Vault struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` - OwnerDeposit types.Coin `protobuf:"bytes,4,opt,name=owner_deposit,json=ownerDeposit,proto3" json:"owner_deposit"` - WithdrawCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=withdraw_commission_rate,json=withdrawCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"withdraw_commission_rate"` - WithdrawReserveRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=withdraw_reserve_rate,json=withdrawReserveRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"withdraw_reserve_rate"` - StrategyWeights []StrategyWeight `protobuf:"bytes,7,rep,name=strategy_weights,json=strategyWeights,proto3" json:"strategy_weights"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + OwnerDeposit types.Coin `protobuf:"bytes,4,opt,name=owner_deposit,json=ownerDeposit,proto3" json:"owner_deposit"` + WithdrawCommissionRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=withdraw_commission_rate,json=withdrawCommissionRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"withdraw_commission_rate"` + WithdrawReserveRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=withdraw_reserve_rate,json=withdrawReserveRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"withdraw_reserve_rate"` + StrategyWeights []StrategyWeight `protobuf:"bytes,7,rep,name=strategy_weights,json=strategyWeights,proto3" json:"strategy_weights"` } func (m *Vault) Reset() { *m = Vault{} } @@ -225,88 +225,10 @@ func (m *Strategy) GetGitUrl() string { return "" } -type VaultMetrics struct { - Allocation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=allocation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"allocation"` - Apy github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=apy,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"apy"` -} - -func (m *VaultMetrics) Reset() { *m = VaultMetrics{} } -func (m *VaultMetrics) String() string { return proto.CompactTextString(m) } -func (*VaultMetrics) ProtoMessage() {} -func (*VaultMetrics) Descriptor() ([]byte, []int) { - return fileDescriptor_7877bd9c4573997d, []int{3} -} -func (m *VaultMetrics) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VaultMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VaultMetrics.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *VaultMetrics) XXX_Merge(src proto.Message) { - xxx_messageInfo_VaultMetrics.Merge(m, src) -} -func (m *VaultMetrics) XXX_Size() int { - return m.Size() -} -func (m *VaultMetrics) XXX_DiscardUnknown() { - xxx_messageInfo_VaultMetrics.DiscardUnknown(m) -} - -var xxx_messageInfo_VaultMetrics proto.InternalMessageInfo - -type StrategyMetrics struct { - Allocation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=allocation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"allocation"` - Apr github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=apr,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"apr"` -} - -func (m *StrategyMetrics) Reset() { *m = StrategyMetrics{} } -func (m *StrategyMetrics) String() string { return proto.CompactTextString(m) } -func (*StrategyMetrics) ProtoMessage() {} -func (*StrategyMetrics) Descriptor() ([]byte, []int) { - return fileDescriptor_7877bd9c4573997d, []int{4} -} -func (m *StrategyMetrics) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StrategyMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StrategyMetrics.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *StrategyMetrics) XXX_Merge(src proto.Message) { - xxx_messageInfo_StrategyMetrics.Merge(m, src) -} -func (m *StrategyMetrics) XXX_Size() int { - return m.Size() -} -func (m *StrategyMetrics) XXX_DiscardUnknown() { - xxx_messageInfo_StrategyMetrics.DiscardUnknown(m) -} - -var xxx_messageInfo_StrategyMetrics proto.InternalMessageInfo - func init() { proto.RegisterType((*StrategyWeight)(nil), "ununifi.yieldaggregator.StrategyWeight") proto.RegisterType((*Vault)(nil), "ununifi.yieldaggregator.Vault") proto.RegisterType((*Strategy)(nil), "ununifi.yieldaggregator.Strategy") - proto.RegisterType((*VaultMetrics)(nil), "ununifi.yieldaggregator.VaultMetrics") - proto.RegisterType((*StrategyMetrics)(nil), "ununifi.yieldaggregator.StrategyMetrics") } func init() { @@ -314,45 +236,41 @@ func init() { } var fileDescriptor_7877bd9c4573997d = []byte{ - // 600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3d, 0x6f, 0x13, 0x31, - 0x18, 0x8e, 0xf3, 0x55, 0xea, 0x96, 0xa6, 0x32, 0x81, 0x5e, 0x3b, 0x5c, 0xa2, 0x0c, 0x10, 0x86, - 0xdc, 0xd1, 0xb2, 0xb2, 0x90, 0x46, 0x48, 0x41, 0x82, 0xe1, 0x4a, 0x00, 0x21, 0xa4, 0x93, 0x73, - 0x67, 0x2e, 0x16, 0x77, 0x76, 0x64, 0x3b, 0x09, 0xf9, 0x05, 0x30, 0xf2, 0x63, 0x3a, 0x22, 0xb1, - 0x76, 0xac, 0x3a, 0x21, 0x86, 0x0a, 0x25, 0x03, 0x7f, 0x03, 0xe5, 0xec, 0x0b, 0x69, 0x11, 0x03, - 0x52, 0xc4, 0x14, 0xbf, 0x1f, 0x7e, 0x9e, 0xd7, 0xcf, 0xf3, 0xe6, 0x60, 0x6b, 0xc4, 0x46, 0x8c, - 0xbe, 0xa3, 0xee, 0x94, 0x92, 0x38, 0xc4, 0x51, 0x24, 0x48, 0x84, 0x15, 0x17, 0xd7, 0x63, 0x67, - 0x28, 0xb8, 0xe2, 0x68, 0xcf, 0xb4, 0x3b, 0xd7, 0xca, 0x07, 0xd5, 0x88, 0x47, 0x3c, 0xed, 0x71, - 0x17, 0x27, 0xdd, 0x7e, 0xb0, 0x1f, 0x70, 0x99, 0x70, 0xe9, 0xeb, 0x82, 0x0e, 0x4c, 0xc9, 0xd6, - 0x91, 0xdb, 0xc7, 0x92, 0xb8, 0xe3, 0xc3, 0x3e, 0x51, 0xf8, 0xd0, 0x0d, 0x38, 0x65, 0xba, 0xde, - 0xf8, 0x08, 0xe0, 0xce, 0x89, 0x12, 0x58, 0x91, 0x68, 0xfa, 0x8a, 0xd0, 0x68, 0xa0, 0x50, 0x0d, - 0x6e, 0x49, 0x93, 0xf1, 0x69, 0x68, 0x81, 0x3a, 0x68, 0x16, 0x3d, 0x98, 0xa5, 0xba, 0x21, 0x7a, - 0x01, 0xcb, 0x93, 0xb4, 0xd5, 0xca, 0xd7, 0x41, 0x73, 0xb3, 0xfd, 0xe8, 0xec, 0xb2, 0x96, 0xfb, - 0x7e, 0x59, 0xbb, 0x1b, 0x51, 0x35, 0x18, 0xf5, 0x9d, 0x80, 0x27, 0x66, 0x08, 0xf3, 0xd3, 0x92, - 0xe1, 0x7b, 0x57, 0x4d, 0x87, 0x44, 0x3a, 0x1d, 0x12, 0x5c, 0x9c, 0xb6, 0xa0, 0x99, 0xb1, 0x43, - 0x02, 0xcf, 0x60, 0x35, 0x7e, 0x16, 0x60, 0xe9, 0x25, 0x1e, 0xc5, 0x0a, 0xed, 0xc0, 0xfc, 0x92, - 0x37, 0x4f, 0x43, 0x54, 0x85, 0xa5, 0x90, 0x30, 0x9e, 0x68, 0x3a, 0x4f, 0x07, 0xc8, 0x81, 0x25, - 0x3e, 0x61, 0x44, 0x58, 0x85, 0x74, 0x08, 0xeb, 0xe2, 0xb4, 0x55, 0x35, 0xb0, 0x8f, 0xc3, 0x50, - 0x10, 0x29, 0x4f, 0x94, 0xa0, 0x2c, 0xf2, 0x74, 0x1b, 0xea, 0xc0, 0x9b, 0xe9, 0xc1, 0x0f, 0xc9, - 0x90, 0x4b, 0xaa, 0xac, 0x62, 0x1d, 0x34, 0xb7, 0x8e, 0xf6, 0x1d, 0x73, 0x69, 0xa1, 0x90, 0x63, - 0x14, 0x72, 0x8e, 0x39, 0x65, 0xed, 0xe2, 0xe2, 0x5d, 0xde, 0x76, 0x7a, 0xab, 0xa3, 0x2f, 0xa1, - 0x31, 0xb4, 0x26, 0x54, 0x0d, 0x42, 0x81, 0x27, 0x7e, 0xc0, 0x93, 0x84, 0x4a, 0x49, 0x39, 0xf3, - 0x17, 0xda, 0x58, 0xa5, 0x35, 0xa8, 0x71, 0x27, 0x43, 0x3f, 0x5e, 0x82, 0x7b, 0x58, 0x11, 0x34, - 0x84, 0xb7, 0x97, 0xbc, 0x82, 0x48, 0x22, 0xc6, 0x44, 0x93, 0x96, 0xd7, 0x40, 0x7a, 0x2b, 0x83, - 0xf6, 0x34, 0x72, 0xca, 0xf8, 0x1a, 0xee, 0x2e, 0xd7, 0x40, 0x5b, 0x24, 0xad, 0x8d, 0x7a, 0xa1, - 0xb9, 0x75, 0x74, 0xcf, 0xf9, 0xcb, 0x7a, 0x3a, 0x57, 0x37, 0xc9, 0x08, 0x58, 0x91, 0x57, 0xb2, - 0xb2, 0xf1, 0x09, 0xc0, 0x1b, 0x59, 0xe7, 0x6f, 0x73, 0xc1, 0xaa, 0xb9, 0x7a, 0x05, 0xf2, 0xcb, - 0x15, 0xb8, 0x0f, 0x77, 0x03, 0xce, 0x94, 0xc0, 0x81, 0xf2, 0xb1, 0x76, 0x57, 0xfb, 0xee, 0x55, - 0xb2, 0xbc, 0x31, 0x1d, 0x21, 0x58, 0x64, 0x38, 0x21, 0xa9, 0xbd, 0x9b, 0x5e, 0x7a, 0x46, 0x7b, - 0x70, 0x23, 0xa2, 0xca, 0x1f, 0x89, 0x58, 0x9b, 0xe4, 0x95, 0x23, 0xaa, 0x7a, 0x22, 0x6e, 0x7c, - 0x01, 0x70, 0x3b, 0x5d, 0xba, 0x67, 0x44, 0x09, 0x1a, 0x48, 0xf4, 0x16, 0x42, 0x1c, 0xc7, 0x3c, - 0xc0, 0x8a, 0x72, 0xa6, 0x67, 0xfa, 0x27, 0x71, 0xbb, 0x4c, 0xad, 0x88, 0xdb, 0x65, 0xca, 0x5b, - 0xc1, 0x43, 0xcf, 0x61, 0x01, 0x0f, 0xa7, 0x6b, 0xf9, 0xdb, 0x2c, 0x80, 0x1a, 0x5f, 0x01, 0xac, - 0x64, 0x4a, 0xfe, 0xc7, 0x17, 0x88, 0x75, 0xbd, 0x40, 0xb4, 0x9f, 0x9e, 0xcd, 0x6c, 0x70, 0x3e, - 0xb3, 0xc1, 0x8f, 0x99, 0x0d, 0x3e, 0xcf, 0xed, 0xdc, 0xf9, 0xdc, 0xce, 0x7d, 0x9b, 0xdb, 0xb9, - 0x37, 0x0f, 0x56, 0x40, 0x7b, 0xac, 0xc7, 0xe8, 0x13, 0xea, 0x06, 0x03, 0x4c, 0x99, 0xfb, 0xe1, - 0x8f, 0xaf, 0x68, 0x4a, 0xd1, 0x2f, 0xa7, 0x9f, 0xb4, 0x87, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xf5, 0xa1, 0xe4, 0x7e, 0x6d, 0x05, 0x00, 0x00, + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcd, 0x6e, 0x13, 0x3d, + 0x14, 0x86, 0x33, 0xf9, 0xeb, 0x57, 0xe7, 0xa3, 0xad, 0x4c, 0xa0, 0xd3, 0x22, 0x4d, 0xa2, 0x6c, + 0x08, 0x8b, 0x78, 0x48, 0xb9, 0x02, 0xd2, 0x08, 0xa9, 0x88, 0xd5, 0x54, 0x01, 0xc4, 0x66, 0xe4, + 0xcc, 0x18, 0xe7, 0xa8, 0x19, 0x3b, 0xb2, 0x9d, 0x86, 0x48, 0x5c, 0x00, 0x4b, 0x2e, 0xa6, 0x17, + 0xd1, 0x65, 0xe9, 0x0a, 0xb1, 0xa8, 0x50, 0x72, 0x23, 0x28, 0x63, 0x27, 0xd0, 0x22, 0x36, 0xdd, + 0xf9, 0xfc, 0xbd, 0xef, 0xcc, 0x79, 0x6c, 0xd4, 0x99, 0x8a, 0xa9, 0x80, 0x8f, 0x10, 0xce, 0x81, + 0x8d, 0x53, 0xca, 0xb9, 0x62, 0x9c, 0x1a, 0xa9, 0xee, 0xc6, 0x64, 0xa2, 0xa4, 0x91, 0x78, 0xdf, + 0xb5, 0x93, 0x3b, 0xe5, 0xc3, 0x3a, 0x97, 0x5c, 0xe6, 0x3d, 0xe1, 0xea, 0x64, 0xdb, 0x0f, 0x0f, + 0x12, 0xa9, 0x33, 0xa9, 0x63, 0x5b, 0xb0, 0x81, 0x2b, 0x05, 0x36, 0x0a, 0x87, 0x54, 0xb3, 0xf0, + 0xbc, 0x3b, 0x64, 0x86, 0x76, 0xc3, 0x44, 0x82, 0xb0, 0xf5, 0xd6, 0x67, 0xb4, 0x73, 0x6a, 0x14, + 0x35, 0x8c, 0xcf, 0xdf, 0x31, 0xe0, 0x23, 0x83, 0x1b, 0xa8, 0xa6, 0x5d, 0x26, 0x86, 0xd4, 0xf7, + 0x9a, 0x5e, 0xbb, 0x1c, 0xa1, 0x75, 0xea, 0x24, 0xc5, 0x27, 0xa8, 0x3a, 0xcb, 0x5b, 0xfd, 0x62, + 0xd3, 0x6b, 0x6f, 0xf7, 0xba, 0x97, 0x37, 0x8d, 0xc2, 0x8f, 0x9b, 0xc6, 0x13, 0x6b, 0xa5, 0xd3, + 0x33, 0x02, 0x32, 0xcc, 0xa8, 0x19, 0x91, 0x37, 0x8c, 0xd3, 0x64, 0xde, 0x67, 0xc9, 0xf5, 0x45, + 0x07, 0xb9, 0xef, 0xea, 0xb3, 0x24, 0x72, 0x02, 0xad, 0x6f, 0x25, 0x54, 0x79, 0x4b, 0xa7, 0x63, + 0x83, 0x77, 0x50, 0x71, 0x63, 0x56, 0x84, 0x14, 0xd7, 0x51, 0x25, 0x65, 0x42, 0x66, 0xd6, 0x23, + 0xb2, 0x01, 0x26, 0xa8, 0x22, 0x67, 0x82, 0x29, 0xbf, 0x94, 0x3b, 0xfb, 0xd7, 0x17, 0x9d, 0xba, + 0x93, 0x7d, 0x99, 0xa6, 0x8a, 0x69, 0x7d, 0x6a, 0x14, 0x08, 0x1e, 0xd9, 0x36, 0xdc, 0x47, 0x0f, + 0xf2, 0x43, 0x9c, 0xb2, 0x89, 0xd4, 0x60, 0xfc, 0x72, 0xd3, 0x6b, 0xd7, 0x8e, 0x0e, 0x88, 0x1b, + 0x5a, 0x6d, 0x85, 0xb8, 0xad, 0x90, 0x63, 0x09, 0xa2, 0x57, 0x5e, 0xfd, 0x4c, 0xf4, 0x7f, 0x3e, + 0xd5, 0xb7, 0x43, 0xf8, 0x0c, 0xf9, 0x33, 0x30, 0xa3, 0x54, 0xd1, 0x59, 0x9c, 0xc8, 0x2c, 0x03, + 0xad, 0x41, 0x8a, 0x78, 0xb5, 0x10, 0xbf, 0x72, 0xdf, 0x15, 0x3c, 0x5e, 0x4b, 0x1e, 0x6f, 0x14, + 0x23, 0x6a, 0x18, 0x66, 0xe8, 0xd1, 0xc6, 0x4c, 0x31, 0xcd, 0xd4, 0x39, 0xb3, 0x4e, 0xd5, 0xfb, + 0x3a, 0x3d, 0x5c, 0xeb, 0x45, 0x56, 0x2e, 0xb7, 0x79, 0x8f, 0xf6, 0x36, 0x94, 0x2d, 0x0c, 0xed, + 0x6f, 0x35, 0x4b, 0xed, 0xda, 0xd1, 0x53, 0xf2, 0x8f, 0xcb, 0x47, 0x6e, 0x5f, 0x14, 0xb7, 0xaa, + 0x5d, 0x7d, 0x2b, 0xab, 0x5b, 0x5f, 0x3c, 0xf4, 0xdf, 0xba, 0xf3, 0x37, 0x46, 0xef, 0x4f, 0x8c, + 0x16, 0x76, 0x71, 0x03, 0xfb, 0x19, 0xda, 0x4b, 0xa4, 0x30, 0x8a, 0x26, 0x26, 0xa6, 0x96, 0xa3, + 0x25, 0x1c, 0xed, 0xae, 0xf3, 0x0e, 0x2f, 0xc6, 0xa8, 0x2c, 0x68, 0xc6, 0x72, 0x90, 0xdb, 0x51, + 0x7e, 0xc6, 0xfb, 0x68, 0x8b, 0x83, 0x89, 0xa7, 0x6a, 0x6c, 0x71, 0x44, 0x55, 0x0e, 0x66, 0xa0, + 0xc6, 0xbd, 0xd7, 0x97, 0x8b, 0xc0, 0xbb, 0x5a, 0x04, 0xde, 0xcf, 0x45, 0xe0, 0x7d, 0x5d, 0x06, + 0x85, 0xab, 0x65, 0x50, 0xf8, 0xbe, 0x0c, 0x0a, 0x1f, 0x9e, 0x73, 0x30, 0xa3, 0xe9, 0x90, 0x24, + 0x32, 0x0b, 0x07, 0x62, 0x20, 0xe0, 0x15, 0x84, 0xc9, 0x88, 0x82, 0x08, 0x3f, 0xfd, 0xf5, 0x44, + 0xcd, 0x7c, 0xc2, 0xf4, 0xb0, 0x9a, 0xbf, 0x97, 0x17, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x09, + 0xf3, 0x35, 0x62, 0xca, 0x03, 0x00, 0x00, } func (m *StrategyWeight) Marshal() (dAtA []byte, err error) { @@ -535,92 +453,6 @@ func (m *Strategy) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *VaultMetrics) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VaultMetrics) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VaultMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Apy.Size() - i -= size - if _, err := m.Apy.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintYieldaggregator(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Allocation.Size() - i -= size - if _, err := m.Allocation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintYieldaggregator(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *StrategyMetrics) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StrategyMetrics) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StrategyMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Apr.Size() - i -= size - if _, err := m.Apr.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintYieldaggregator(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Allocation.Size() - i -= size - if _, err := m.Allocation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintYieldaggregator(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func encodeVarintYieldaggregator(dAtA []byte, offset int, v uint64) int { offset -= sovYieldaggregator(v) base := offset @@ -706,32 +538,6 @@ func (m *Strategy) Size() (n int) { return n } -func (m *VaultMetrics) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Allocation.Size() - n += 1 + l + sovYieldaggregator(uint64(l)) - l = m.Apy.Size() - n += 1 + l + sovYieldaggregator(uint64(l)) - return n -} - -func (m *StrategyMetrics) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Allocation.Size() - n += 1 + l + sovYieldaggregator(uint64(l)) - l = m.Apr.Size() - n += 1 + l + sovYieldaggregator(uint64(l)) - return n -} - func sovYieldaggregator(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1306,242 +1112,6 @@ func (m *Strategy) Unmarshal(dAtA []byte) error { } return nil } -func (m *VaultMetrics) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldaggregator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VaultMetrics: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VaultMetrics: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Allocation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldaggregator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthYieldaggregator - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthYieldaggregator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Allocation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Apy", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldaggregator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthYieldaggregator - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthYieldaggregator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Apy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipYieldaggregator(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthYieldaggregator - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StrategyMetrics) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldaggregator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StrategyMetrics: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StrategyMetrics: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Allocation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldaggregator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthYieldaggregator - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthYieldaggregator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Allocation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Apr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowYieldaggregator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthYieldaggregator - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthYieldaggregator - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Apr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipYieldaggregator(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthYieldaggregator - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipYieldaggregator(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0