├── .env.sample ├── .gitignore ├── LICENSE ├── README.md ├── doc ├── Step6-0.png ├── admin_panel.png ├── logo-white.svg ├── matcher.wasm ├── metadata.json ├── primary_market.png ├── secondary_market.png ├── step1-1.png ├── step1-2.png ├── step2-1.png ├── step3-1.png ├── step4-1.png ├── step4-2.png ├── step4-3.png ├── step4-4.png ├── step4-5.png ├── step4-6.png ├── step4-7.png ├── step6-2.png ├── step6-3.png ├── step9-1.png └── step9-2.png ├── docker-compose.local.yml ├── docker-compose.yml ├── nginx ├── nginx.conf ├── nginx.local.conf └── ssl │ ├── certificate.sample.crt │ └── private.sample.key └── static ├── footer.html ├── logo.svg └── variables.css /.env.sample: -------------------------------------------------------------------------------- 1 | # ESCROW_SEED='...' 2 | # AUCTION_SEED='...' 3 | # CONTRACT_ETH_OWNER_SEED='...' 4 | # CONTRACT_ADDRESS='...' 5 | # UNIQUE_COLLECTION_IDS='1,2' 6 | MARKET_VERSION='latest' 7 | 8 | # Market type configuration 9 | MARKET_TYPE='secondary' 10 | # MAINSALE_SEED='' 11 | # ADMIN_LIST='' 12 | 13 | # Backend envs 14 | API_PORT='5000' 15 | DISABLE_SECURITY='false' 16 | UNIQUE_WS_ENDPOINT='wss://ws-quartz.unique.network' 17 | KUSAMA_WS_ENDPOINT='wss://kusama-rpc.polkadot.io' 18 | UNIQUE_NETWORK='quartz' 19 | KUSAMA_NETWORK='ksm' 20 | COMMISSION_PERCENT='10' 21 | UNIQUE_START_FROM_BLOCK='current' 22 | KUSAMA_START_FROM_BLOCK='current' 23 | AUTO_DB_MIGRATIONS='true' 24 | SENTRY_ENABLED='false' 25 | # SENTRY_ENV: production 26 | # SENTRY_DSN: https://hash@domain.tld/sentryId 27 | 28 | # Frontend envs 29 | IPFS_GATEWAY=https://ipfs.unique.network/ipfs 30 | DOCUMENT_TITLE='Unique Market' 31 | UNIQUE_API_URL='/' 32 | 33 | # Postgres envs 34 | POSTGRES_URL='postgres://marketplace:12345@postgres:5432/marketplace_db' 35 | POSTGRES_DB='marketplace_db' 36 | POSTGRES_USER='marketplace' 37 | POSTGRES_PASSWORD='12345' 38 | POSTGRES_PORT='5432' 39 | POSTGRES_INITDB_ARGS='--auth-local=trust' 40 | 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /pgdata 2 | .env 3 | .DS_Store 4 | 5 | certificate.crt 6 | private.key 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021, Unique Network, Usetech Professional 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | Unique White Label Market 3 |
4 | 5 | [![polkadotjs](https://img.shields.io/badge/polkadot-js-orange?style=flat-square)](https://polkadot.js.org) 6 | [![uniquenetwork](https://img.shields.io/badge/unique-network-blue?style=flat-square)](https://unique.network/) 7 | ![Docker Automated build](https://img.shields.io/docker/cloud/automated/uniquenetwork/marketplace-frontend?style=flat-square) 8 | ![language](https://img.shields.io/github/languages/top/uniquenetwork/unique-marketplace-frontend?style=flat-square) 9 | ![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square) 10 | 12 | 13 | 14 | ## Table of Contents 15 | 16 | - [Marketplace Deployment - Getting Started Guide](#marketplace-deployment---getting-started-guide) 17 | - [Prerequisites](#prerequisites) 18 | - [Step 1 - Create Escrow and Auction Accounts](#step-1---create-escrow-and-auction-accounts) 19 | - [Start Configuring](#start-configuring) 20 | - [Step 2 - Get QTZ](#step-2---get-qtz) 21 | - [Step 3 - Deploy a Marketplace Smart Contract](#step-3---deploy-a-marketplace-smart-contract) 22 | - [Step 4 - Create a Sponsored Collection](#step-4---create-a-sponsored-collection) 23 | - [1. Set Collection Sponsor](#1-set-collection-sponsor) 24 | - [2. Confirm Sponsorship](#2-confirm-sponsorship) 25 | - [3. Set a Transfer Sponsorship Limit](#3-set-a-transfer-sponsorship-limit) 26 | - [Step 5 - Check Configuration](#step-5---check-configuration) 27 | - [Step 6 - Add a Certificate to the Trusted List](#step-6---add-a-certificate-to-the-trusted-list) 28 | - [Step 7 - Build and Run](#step-7---build-and-run) 29 | - [Step 8 - Enjoy](#step-8---enjoy) 30 | - [Advanced Guide](#advanced-guide) 31 | - [Frontend](#frontend) 32 | - [Backend](#backend) 33 | - [API](#api) 34 | - [Playgrounds](#playgrounds) 35 | - [Unique Escrow and Kusama Escrow](#unique-escrow-and-kusama-escrow) 36 | - [Postgres](#postgres) 37 | - [Nginx](#nginx) 38 | - [Version Control and Updates](#version-control-and-updates) 39 | - [Sponsoring](#sponsoring) 40 | - [Using a Private Blockchain](#using-a-private-blockchain) 41 | - [Primary Marketplace](#primary-marketplace) 42 | - [Chats and Communities](#chats-and-communities) 43 | - [License Information](#license-information) 44 | 45 | 46 | # Marketplace Deployment - Getting Started Guide 47 | 48 | Who is this document for: 49 | 50 | 51 | > * Full stack engineers 52 | > * IT administrators 53 | 54 | This tutorial shows the steps that need to be performed to carry out an install of the marketplace on a computer in a local environment or in a virtual machine with Ubuntu OS. The process of installing it in a production environment is identical, with the caveat that your IT administrator will need to setup the supporting infrastructure (such as a globally accessible domain name, hosting, firewall, nginx, and SSL certificates) so that the server that hosts the marketplace can be accessed by the users on the Internet. Visit [https://unqnft.io](https://unqnft.io) to experience an example of a self-hosted, globally accessible marketplace. 55 | 56 | ## Prerequisites 57 | 58 | > * OS: Ubuntu 18.04 or 20.04 59 | > * docker CE 20.10 or up 60 | > * git 61 | > * Google Chrome Browser 62 | 63 | ## Step 1 - Create Escrow and Auction Accounts 64 | 65 | An escrow account is a substrate address that manages the NFT and Kusama tokens put up for sale. 66 | The easiest way to create such an address is to use the browser wallet extension available at [https://polkadot.js.org/extension/](https://polkadot.js.org/extension/). During the creation of the address, you will be provided with a 12-word mnemonic seed phrase, further referred to in the text as `ESCROW_SEED`. 67 | 68 | Follow the same steps again to get `AUCTION_SEED` 69 | 70 | > :warning: Be sure to make sure that `ESCROW_SEED` and `AUCTION_SEED` have different values, otherwise the market will not be able to work correctly, and it will create vulnerabilities 71 | 72 | > :warning: Do not share the mnemonic phrase with anybody as this phrase is all that’s needed for someone to obtain access to the funds and NFTs that are stored on this account. 73 | 74 | > :warning: Note down the address of the newly created accounts. It will be used in the upcoming steps and will be referred to as the `ESCROW_ADDRESS` and `AUCTION_ADDRESS`. 75 | 76 | ### Start Configuring 77 | 78 | From within the root directory create a fresh `.env` file and copy the entire contents of the `.env.sample` into it. Set the corresponding variable in the `.env` file to the `ESCROW_SEED` and `AUCTION_SEED` phrases we obtained above. 79 | 80 | ## Step 2 - Get QTZ 81 | 82 | In order to get the marketplace running, the `ESCROW_ADDRESS` needs some QTZ tokens to be deposited into it. The minimum amount for launching a marketplace is around 60 QTZ (~50 QTZ for contract deployment, and ~10 QTZ for creating collection, and 50 NFTs). For a production setup, however, consider obtaining a bit more QTZ in advance – 1000 should cover all foreseeable expenses. At the time of writing of this tutorial QTZ can be obtained on the [MEXC Global](https://www.mexc.com/exchange/QTZ_USDT) exchange. 83 | 84 | 85 | ## Step 3 - Deploy a Marketplace Smart Contract 86 | 87 | There are two ways to put a token up for sale – at a fixed price or through an auction. All fixed price asks get handled via a special smart contract which can be explored in the `unique-marketplace-api` project on github - https://github.com/UniqueNetwork/unique-marketplace-api/tree/master/blockchain. 88 | 89 | A special utility is provided that is by far the easiest way to deploy a smart contract. 90 | 91 | > :warning: Take note, there will need to be ~50 QTZ in the `ESCROW_ADDRESS` to ensure a successful execution of the utility. Also the `ESCROW_SEED` environment variable must be set in `.env` file. 92 | 93 | The following script runs this utility and will create the ethereum address, deploy the smart contract, set the ethereum calls sponsor, and send it 40 QTZ: 94 | 95 | ``` 96 | docker compose up -d backend 97 | docker exec backend node dist/cli.js playground deploy_contract 98 | ``` 99 | 100 | After a short interval an operational summary will be output to the terminal: 101 | 102 | ``` 103 | ... 104 | 105 | SUMMARY: 106 | 107 | CONTRACT_ETH_OWNER_SEED: '0x6d853337ab45b20aa5231c33979330e2806465fb4ab...' 108 | CONTRACT_ADDRESS: '0x74C2d83b868f7E7B7C02B7D0b87C3532a06f392c' 109 | 110 | 111 | Substrate mirror of contract address (for balances): 5F2NmgKvWHYZBTCoXVgkJay3sBEzpzmamU3ARmAgbf4tvx1C 112 | Current contract balance: 40000000000000000000 113 | ``` 114 | > NOTE: please save carefully substrate mirror of contract address because it is used for replenishment the balance. 115 | 116 | The actual output content will differ to the one above and will correspond to the data set in the variables of the `.env` file. 117 | 118 | > :warning: **Never share your `CONTRACT_ETH_OWNER_SEED` or commit it in the git repository** because this data is all that is needed for someone to obtain access to the funds and NFTs that are stored on the sale. Keep it in a safe and inaccessible place! 119 | 120 | > :warning: Take note of the `Substrate mirror of contract address` and have it handy as later on all contract calls will be sponsored by it. Also, don't forget to deposit some QTZ balance to the account as well. 121 | 122 | ## Step 4 - Create a Sponsored Collection 123 | 124 | The simplest way create collection for a marketplace is using the [Minter](https://minter-quartz.unique.network) tool. Note down the `collection id` during the creation process as it will come in handy later on in the steps that follow. You will only need about 10 QTZ to create a collection and 50 NFTs. 125 | 126 | ![Minter](./doc/Step6-0.png) 127 | 128 | Set the list of ids of the created collections in the `.env` file: 129 | 130 | ``` 131 | UNIQUE_COLLECTION_IDS='3,4,5' 132 | ``` 133 | 134 | The marketplace can operate without sponsored collections. However, in this case, your users will be forced to pay a commission of the Quartz network. For a smoother experience, you may sponsor transfers of nft tokens made by your users. A sponsorship can be set up using [polkadot.js.org/apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fquartz.unique.network#/extrinsics) in 2 steps, as follows: 135 | 136 | ### 1. Set Collection Sponsor 137 | 138 | - Choose `unique` - `setCollectionSponsor` method 139 | - Set the collectionId parameter to the id of the newly created collection 140 | - Provide [`ESCROW_ADDRESS`](#step-1---create-escrow-and-auction-accounts) as the new sponsor 141 | - Click `Submit Transaction` and follow the instructions 142 | 143 | ### 2. Confirm Sponsorship 144 | 145 | - Choose `unique` - `confirmSponsorship` method 146 | - Provide [`ESCROW_ADDRESS`](#step-1---create-escrow-and-auction-accounts) as the transaction sender 147 | - Set the collectionId parameter to the id of the newly created collection 148 | - Click `Submit Transaction` and follow the instructions 149 | 150 | > :warning: Take note of the sponsor address and have it handy as later on all transfers will be sponsored by it. Don't forget to make sure there is some QTZ in the account. 151 | 152 | ### 3. Set a Transfer Sponsorship Limit 153 | 154 | - Choose `unique` - `setCollectionLimits` method 155 | - Provide [`ESCROW_ADDRESS`](#step-1---create-escrow-and-auction-accounts) as the transaction sender 156 | - Set the `sponsorTransferTimeout` parameter to `0` 157 | - Click `Submit Transaction` and follow the instructions 158 | 159 | 160 | ## Step 5 - Check Configuration 161 | 162 | There is a handy utility that will run a check to test if everything is set properly up. To use it execute the script below: 163 | 164 | ``` 165 | docker compose up -d backend 166 | docker exec backend node dist/cli.js playground check_config 167 | ``` 168 | 169 | If everything is configured correctly, a bunch of green checkboxes will get ticked in the console, as shown below: 170 | 171 | ``` 172 | Checking CONTRACT_ADDRESS 173 | [v] Contract address valid: 0x3c9931eA16D1048D7e22F3630844EC25eFD6B26f 174 | [v] Contract balance is 40 tokens (40000000000000000000) 175 | [v] Contract self-sponsoring is enabled 176 | [v] Rate limit is zero blocks 177 | [v] Contract owner valid, owner address: 0x3CA7393F1C8Df383c0f35d7BC1a5a938168c7d4b 178 | Contract owner balance is 4 tokens (4492008910681246304) 179 | 180 | Checking UNIQUE_COLLECTION_IDS 181 | Collection #3 182 | [v] Sponsor is confirmed, yGGxcBQUCymdHtjQUdJDiXDTTXuonGv8HyRJiH5YDUcmfUyhr 183 | [v] Sponsor has 999999999948 tokens (999999999948126753000000000000) on its wallet 184 | [v] Transfer timeout is zero blocks 185 | [v] Approve timeout is zero blocks 186 | ``` 187 | 188 | At this point, the setup is almost done. 189 | 190 | ## Step 6 - Add a Certificate to the Trusted List 191 | 192 | To simplify the process of setting the marketplace up, a self-signed ssl certificate is provided for a test implementation. It is located in the `nginx/ssl` folder. It should never be used in a production context, but for a test environment it provides a convenient, workable solution. Create a copy of `certificate.sample.crt`, name it `certificate.crt`. Also rename `private.sample.key`, call it `private.key`. You will need to add this newly created certificate to your list of trusted certificates. Otherwise, there is always the option to generate a personal domain ssl certificate via an on-line ssl certificate issuing authority. 193 | 194 | 195 | 196 | ## Step 7 - Build and Run 197 | 198 | Execute the following command in the terminal and wait for it to complete: 199 | 200 | ``` 201 | docker compose up -d 202 | ``` 203 | 204 | ## Step 8 - Enjoy 205 | 206 | Open [https://localhost](http://localhost:80) in your Chrome browser. On first launch a Polkadot{.js}’s request to authorize the website will pop-up. Approve this request. 207 | 208 | The marketplace will connect to the blockchain and the local backend and will display the empty Market page. It is now ready to rumble. 209 | 210 | # Advanced Guide 211 | 212 | ## Frontend 213 | 214 | [GitHub repo and docs](https://github.com/UniqueNetwork/unique-marketplace-frontend#readme) 215 | 216 | Unique marketplace provides a simple solution for customizing UI. Just try it – feel free to change some styles or layout in `static` folder. 217 | 218 | If you want to customize the UI and still be able to receive updates from team Unique – follow this [instruction](https://github.com/UniqueNetwork/unique-marketplace-api#readme). 219 | 220 | ## Backend 221 | 222 | [GitHub repo and docs](https://github.com/UniqueNetwork/unique-marketplace-api/tree/release/v1.1.0#readme). 223 | 224 | ### API 225 | 226 | #### Playgrounds 227 | 228 | There are some tools that you may come in handy when configuring and exploiting the marketplace that are a part of the marketplace API. In the process of setting up the marketplace some of them were used in the [deploying a smart contract](#step-3---deploy-a-marketplace-smart-contract) and [checkeing the marketplace configuration](#step-5---check-configuration) steps. 229 | 230 | All the information about these playgrounds utilities can be found in the marketplace [docs](https://github.com/UniqueNetwork/unique-marketplace-api/tree/release/v1.1.0#readme). Feel free to dive into the deep end of the pool. 231 | 232 | ### Unique Escrow and Kusama Escrow 233 | 234 | These two crowlers are part of unique-marketplace-api project, and do a simple thing - subscribe to receive new blocks of the corresponding blockchain and look for events related to the marketplace such as the transfer of NFTs or Kusama tokens to the escrow address. 235 | 236 | ### Postgres 237 | 238 | Postgres can be configured by changing the environment variables inside the `.env` file. The default settings are already provided in the `.env.sample` file. 239 | 240 | ### Nginx 241 | 242 | ... 243 | 244 | ## Version Control and Updates 245 | 246 | To avoid incompatibility, you should always use the same tag for [frontend](https://hub.docker.com/r/uniquenetwork/marketplace-frontend) and [backend](https://hub.docker.com/r/uniquenetwork/marketplace-backend) images from dockerhub. For this purposes we included `MARKET_VERSION` environment variable in `.env.sample`, which is used inside `docker-compose.yml` file. 247 | 248 | By default we specified the `latest` tag. Nevertheless, for production it is advisable to fix the versions by specifying for the `MARKET_VERSION` variable the tag on which the market has already been tested by you, and update as needed manually. 249 | 250 | ## Sponsoring 251 | 252 | [Main article](https://docs.unique.network/unique-and-quartz-wiki/build/reference/sponsoring-and-fees) 253 | 254 | > The Unique Network allows sponsoring of user transactions for NFT, Fungible, and Refungible collections and smart contracts. When a collection (or a smart contract) is sponsored, the only thing the sponsored users need to have is a Unique wallet and an address. There is no requirement to have any QTZ or UNQ on balance in the wallet on their part. This feature removes the extra friction for the end user and creates a nice, flawless user experience for the brand new user in the unique chain. 255 | 256 | However, it is always worth remembering that the sponsor accounts should have a balance of QTZ in order to be able provide for the sponsored user transactions. 257 | 258 | The full list of appearance of the marketplace sponsors: 259 | 260 | - Contract owner. In [step 3](#step-3---deploy-a-marketplace-smart-contract) 261 | - Сontract itself, also created in [step 3](#step-3---deploy-a-marketplace-smart-contract) 262 | - Sponsor of collection tokens transfers. Assigned in [step 4.1](#1-set-collection-sponsor) 263 | 264 | 265 | ## Using a Private Blockchain 266 | 267 | For testing purposes it makes sense to launch a local version of a Quartz blockchain. To do this use the [image from docker hub](https://hub.docker.com/r/uniquenetwork/quartz-node-private). 268 | 269 | ## Primary Marketplace 270 | 271 | There are two possible states of the marketplace **Secondary** and **Primary**. 272 | 273 | When the marketplace is switched to the **Primary**: 274 | - Only administrators can put up tokens for sale. This is applicable for both - fixed price and auction selling methods; 275 | - Other users cannot put up tokens for sale. The 'Sell' button is not available on the token pages; 276 | - At the same time 'Transfer' button is available for all users in any state of the marketplace. 277 | 278 | ![Primary](./doc/primary_market.png) 279 | 280 | When the marketplace is **Secondary**, all the users can put up tokens for sale. Both 'Sell' and 'Transfer' buttons are available. 281 | 282 | ![Secondary](./doc/secondary_market.png) 283 | 284 | There are **three environment variables** under the 'Market type configuration' section inside the `.env` file. 285 | 286 | 1. The type of the marketplace can be configured by changing `MARKET_TYPE` variable. By default it is set as 'secondary'. Update the value as 'primary' to enable the appropriate type. 287 | 288 | 2. `MAINSALE_SEED` variable is a substrate address of the account which is granted: 289 | - to perform mass placement of tokens for sale with a fixed price; 290 | - to perform mass placement of tokens for auction sale; 291 | - to perform the cancellation of all offers and auctions of the secondary marketplace; 292 | 293 | **PLEASE NOTICE** 294 | 295 | + There can only be one `MAINSALE_SEED` address for the marketplace; 296 | + You have to add an address to the `MAINSALE_SEED` variable, otherwise the marketplace will not be able to work correctly; 297 | + `MAINSALE_SEED` address must be added to the administrators list. If you miss this step, the address will be automatically added to the `ADMIN_LIST` just after running the marketplace. 298 | 299 | 3. `ADMIN_LIST` is an array of substrate addresses of all the administrators including `MAINSALE_SEED`. 300 | > Add Substrate addresses of marketplace administrators separated by commas. Works since version marketplace API v1.6.0 301 | 302 | **WARNING!!!** 303 | Make sure that `MAINSALE_SEED` has different from `ESCROW_SEED` and `AUCTION_SEED` value, otherwise the marketplace will not be able to work correctly and it will create vulnerabilities. 304 | 305 | It is supposed that type is set when deploying the marketplace and there are no other collections added. 306 | However, if the owner of a secondary marketplace switches it to the primary type when there are lots of offers created the following approach is used: 307 | 308 | Auctions: 309 | - all auctions are stopped. The last high bid wins the auction; 310 | - the token is given to the winner; 311 | - the losers are refunded their bid amount. 312 | 313 | Offers: 314 | - the offer is transferred to the status `removed_by_admin`; 315 | - the owner of the offer can remove the token from sale in the 'My tokens' section. 316 | 317 | **ADMIN PANEL** 318 | 319 | For all accounts added to the `ADMIN_LIST` variable access to the **Admin panel** of the marketplace is provided regardless of its state. 320 | 321 | The main goal of the **Admin panel** is adding collections for sale and enabling collection sponsoring. You can find additional information in the [create a sponsored collection](#step-4---create-a-sponsored-collection) and [sponsoring](#sponsoring) sections. 322 | 323 | To log into the **Admin panel** do the following: 324 | - Open your browser and navigate to [https://localhost/administration/login](http://localhost:80/administration/login). You will be prompted to authorize with Polkadot{.js}’s request; 325 | - Sign the message in the extension to authorize. 326 | 327 | You will navigate to the **Admin panel**. 328 | 329 | ![AdminPanel](./doc/admin_panel.png) 330 | 331 | **Admin panel** provides a number of main options: 332 | 1. Add collections for sale; 333 | 2. Remove collections from sale; 334 | 3. Accept sponsorship; 335 | 4. Reject sponsorship; 336 | 5. Listing particular tokens of a collection to the marketplace (or all the tokens). 337 | 338 | Additional functionalities are available as well: 339 | + Navigate to the 'Scan' page of the collection; 340 | + Navigate to the wallet where the user can create a new collection; 341 | + Search by collection ID or Name; 342 | + Sorting collections. 343 | 344 | In **Admin panel** when you are logged in under `MAINSALE_SEED` account there is no way to perform mass placement of tokens for sale or mass cancellation. 345 | 346 | For such purposes you can use the marketplace Swagger Api: 347 | - Open your browser and navigate to [https://localhost/api/docs](http://localhost:5000/api/docs); 348 | - Use appropriate methods 349 | - `/api/admin/login` to authorize; 350 | - `/api/admin/collections/fixprice` for mass fixprice sale; 351 | - `/api/admin/collections/auction` for mass auction sale; 352 | - `/api/admin/mass-cancel` to perform the cancellation of all offers and auctions. 353 | 354 | Note that `MAINSALE_SEED` has to be the owner of the tokens supposed to be put up for sale. 355 | 356 | # Chats and Communities 357 | 358 | You can find all developer related news in our \#dev-announcements channel on Discord: [https://discord.gg/hbhYeJfT](https://discord.gg/hbhYeJfT) 359 | 360 | If you have questions or you need assistance feel free to reach out to our friendly team in the Unique Network Developer Support Telegram channel: [https://t.me/unique_network_support](https://t.me/unique_network_support). 361 | 362 | # License Information 363 | 364 | Copyright 2021, Unique Network, Usetech Professional 365 | 366 | Licensed under the Apache License, Version 2.0 (the "License"); 367 | you may not use this file except in compliance with the License. 368 | You may obtain a copy of the License at 369 | 370 | http://www.apache.org/licenses/LICENSE-2.0 371 | 372 | Unless required by applicable law or agreed to in writing, software 373 | distributed under the License is distributed on an "AS IS" BASIS, 374 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 375 | See the License for the specific language governing permissions and 376 | limitations under the License. 377 | -------------------------------------------------------------------------------- /doc/Step6-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/Step6-0.png -------------------------------------------------------------------------------- /doc/admin_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/admin_panel.png -------------------------------------------------------------------------------- /doc/logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /doc/matcher.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/matcher.wasm -------------------------------------------------------------------------------- /doc/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": { 3 | "hash": "0x3349c2f1bf35f0283f9ce9182ea9093f9d00895f69877322e4d77150a23a0eb8", 4 | "language": "ink! 3.0.0-rc6", 5 | "compiler": "rustc 1.58.0-nightly" 6 | }, 7 | "contract": { 8 | "name": "matcher", 9 | "version": "0.2.0", 10 | "authors": [ 11 | "Greg Zaitsev " 12 | ] 13 | }, 14 | "V1": { 15 | "spec": { 16 | "constructors": [ 17 | { 18 | "args": [], 19 | "docs": [], 20 | "name": [ 21 | "new" 22 | ], 23 | "selector": "0x9bae9d5e" 24 | } 25 | ], 26 | "docs": [], 27 | "events": [ 28 | { 29 | "args": [ 30 | { 31 | "docs": [], 32 | "indexed": true, 33 | "name": "address", 34 | "type": { 35 | "displayName": [ 36 | "AccountId" 37 | ], 38 | "type": 0 39 | } 40 | }, 41 | { 42 | "docs": [], 43 | "indexed": true, 44 | "name": "quote_id", 45 | "type": { 46 | "displayName": [ 47 | "u64" 48 | ], 49 | "type": 7 50 | } 51 | }, 52 | { 53 | "docs": [], 54 | "indexed": true, 55 | "name": "amount", 56 | "type": { 57 | "displayName": [ 58 | "Balance" 59 | ], 60 | "type": 10 61 | } 62 | } 63 | ], 64 | "docs": [ 65 | " Event emitted when a quote withdraw is needed on a match" 66 | ], 67 | "name": "WithdrawQuoteMatched" 68 | }, 69 | { 70 | "args": [ 71 | { 72 | "docs": [], 73 | "indexed": true, 74 | "name": "address", 75 | "type": { 76 | "displayName": [ 77 | "AccountId" 78 | ], 79 | "type": 0 80 | } 81 | }, 82 | { 83 | "docs": [], 84 | "indexed": true, 85 | "name": "quote_id", 86 | "type": { 87 | "displayName": [ 88 | "u64" 89 | ], 90 | "type": 7 91 | } 92 | }, 93 | { 94 | "docs": [], 95 | "indexed": true, 96 | "name": "amount", 97 | "type": { 98 | "displayName": [ 99 | "Balance" 100 | ], 101 | "type": 10 102 | } 103 | } 104 | ], 105 | "docs": [ 106 | " Event emitted when a unused quote withdraw is needed" 107 | ], 108 | "name": "WithdrawQuoteUnused" 109 | }, 110 | { 111 | "args": [ 112 | { 113 | "docs": [], 114 | "indexed": true, 115 | "name": "address", 116 | "type": { 117 | "displayName": [ 118 | "AccountId" 119 | ], 120 | "type": 0 121 | } 122 | }, 123 | { 124 | "docs": [], 125 | "indexed": true, 126 | "name": "collection_id", 127 | "type": { 128 | "displayName": [ 129 | "u64" 130 | ], 131 | "type": 7 132 | } 133 | }, 134 | { 135 | "docs": [], 136 | "indexed": true, 137 | "name": "token_id", 138 | "type": { 139 | "displayName": [ 140 | "u64" 141 | ], 142 | "type": 7 143 | } 144 | } 145 | ], 146 | "docs": [ 147 | " Event emitted when an NFT withdraw is needed" 148 | ], 149 | "name": "WithdrawNFT" 150 | } 151 | ], 152 | "messages": [ 153 | { 154 | "args": [], 155 | "docs": [ 156 | " Returns the contract owner" 157 | ], 158 | "mutates": false, 159 | "name": [ 160 | "get_owner" 161 | ], 162 | "payable": false, 163 | "returnType": { 164 | "displayName": [ 165 | "AccountId" 166 | ], 167 | "type": 0 168 | }, 169 | "selector": "0x07fcd0b1" 170 | }, 171 | { 172 | "args": [ 173 | { 174 | "name": "admin", 175 | "type": { 176 | "displayName": [ 177 | "AccountId" 178 | ], 179 | "type": 0 180 | } 181 | } 182 | ], 183 | "docs": [ 184 | " Set contract admin" 185 | ], 186 | "mutates": true, 187 | "name": [ 188 | "set_admin" 189 | ], 190 | "payable": false, 191 | "returnType": null, 192 | "selector": "0x798dcad5" 193 | }, 194 | { 195 | "args": [ 196 | { 197 | "name": "quote_id", 198 | "type": { 199 | "displayName": [ 200 | "u64" 201 | ], 202 | "type": 7 203 | } 204 | } 205 | ], 206 | "docs": [ 207 | " Get total" 208 | ], 209 | "mutates": false, 210 | "name": [ 211 | "get_total" 212 | ], 213 | "payable": false, 214 | "returnType": { 215 | "displayName": [ 216 | "Balance" 217 | ], 218 | "type": 10 219 | }, 220 | "selector": "0xbb42822c" 221 | }, 222 | { 223 | "args": [ 224 | { 225 | "name": "quote_id", 226 | "type": { 227 | "displayName": [ 228 | "u64" 229 | ], 230 | "type": 7 231 | } 232 | } 233 | ], 234 | "docs": [ 235 | " Reset total" 236 | ], 237 | "mutates": true, 238 | "name": [ 239 | "reset_total" 240 | ], 241 | "payable": false, 242 | "returnType": null, 243 | "selector": "0xf3d2a6e8" 244 | }, 245 | { 246 | "args": [ 247 | { 248 | "name": "quote_id", 249 | "type": { 250 | "displayName": [ 251 | "u64" 252 | ], 253 | "type": 7 254 | } 255 | }, 256 | { 257 | "name": "deposit_balance", 258 | "type": { 259 | "displayName": [ 260 | "Balance" 261 | ], 262 | "type": 10 263 | } 264 | }, 265 | { 266 | "name": "user", 267 | "type": { 268 | "displayName": [ 269 | "AccountId" 270 | ], 271 | "type": 0 272 | } 273 | } 274 | ], 275 | "docs": [ 276 | " Admin: Make a deposit for a user" 277 | ], 278 | "mutates": true, 279 | "name": [ 280 | "register_deposit" 281 | ], 282 | "payable": false, 283 | "returnType": null, 284 | "selector": "0xe70cfcac" 285 | }, 286 | { 287 | "args": [ 288 | { 289 | "name": "quote_id", 290 | "type": { 291 | "displayName": [ 292 | "u64" 293 | ], 294 | "type": 7 295 | } 296 | } 297 | ], 298 | "docs": [ 299 | " Get address balance in quote currency" 300 | ], 301 | "mutates": false, 302 | "name": [ 303 | "get_balance" 304 | ], 305 | "payable": false, 306 | "returnType": { 307 | "displayName": [ 308 | "Balance" 309 | ], 310 | "type": 10 311 | }, 312 | "selector": "0xea817e65" 313 | }, 314 | { 315 | "args": [ 316 | { 317 | "name": "quote_id", 318 | "type": { 319 | "displayName": [ 320 | "u64" 321 | ], 322 | "type": 7 323 | } 324 | }, 325 | { 326 | "name": "withdraw_balance", 327 | "type": { 328 | "displayName": [ 329 | "Balance" 330 | ], 331 | "type": 10 332 | } 333 | } 334 | ], 335 | "docs": [ 336 | " User: Withdraw funds" 337 | ], 338 | "mutates": true, 339 | "name": [ 340 | "withdraw" 341 | ], 342 | "payable": false, 343 | "returnType": null, 344 | "selector": "0x410fcc9d" 345 | }, 346 | { 347 | "args": [ 348 | { 349 | "name": "collection_id", 350 | "type": { 351 | "displayName": [ 352 | "u64" 353 | ], 354 | "type": 7 355 | } 356 | }, 357 | { 358 | "name": "token_id", 359 | "type": { 360 | "displayName": [ 361 | "u64" 362 | ], 363 | "type": 7 364 | } 365 | }, 366 | { 367 | "name": "user", 368 | "type": { 369 | "displayName": [ 370 | "AccountId" 371 | ], 372 | "type": 0 373 | } 374 | } 375 | ], 376 | "docs": [ 377 | " Admin: Tell the market about a successful NFT deposit" 378 | ], 379 | "mutates": true, 380 | "name": [ 381 | "register_nft_deposit" 382 | ], 383 | "payable": false, 384 | "returnType": null, 385 | "selector": "0x087c9b16" 386 | }, 387 | { 388 | "args": [ 389 | { 390 | "name": "collection_id", 391 | "type": { 392 | "displayName": [ 393 | "u64" 394 | ], 395 | "type": 7 396 | } 397 | }, 398 | { 399 | "name": "token_id", 400 | "type": { 401 | "displayName": [ 402 | "u64" 403 | ], 404 | "type": 7 405 | } 406 | } 407 | ], 408 | "docs": [ 409 | " Get deposit " 410 | ], 411 | "mutates": false, 412 | "name": [ 413 | "get_nft_deposit" 414 | ], 415 | "payable": false, 416 | "returnType": { 417 | "displayName": [ 418 | "AccountId" 419 | ], 420 | "type": 0 421 | }, 422 | "selector": "0xa5c435ad" 423 | }, 424 | { 425 | "args": [ 426 | { 427 | "name": "collection_id", 428 | "type": { 429 | "displayName": [ 430 | "u64" 431 | ], 432 | "type": 7 433 | } 434 | }, 435 | { 436 | "name": "token_id", 437 | "type": { 438 | "displayName": [ 439 | "u64" 440 | ], 441 | "type": 7 442 | } 443 | }, 444 | { 445 | "name": "quote_id", 446 | "type": { 447 | "displayName": [ 448 | "u64" 449 | ], 450 | "type": 7 451 | } 452 | }, 453 | { 454 | "name": "price", 455 | "type": { 456 | "displayName": [ 457 | "Balance" 458 | ], 459 | "type": 10 460 | } 461 | } 462 | ], 463 | "docs": [ 464 | " User: Place a deposited NFT for sale" 465 | ], 466 | "mutates": true, 467 | "name": [ 468 | "ask" 469 | ], 470 | "payable": false, 471 | "returnType": null, 472 | "selector": "0x020f741e" 473 | }, 474 | { 475 | "args": [], 476 | "docs": [ 477 | " Get last ask ID" 478 | ], 479 | "mutates": false, 480 | "name": [ 481 | "get_last_ask_id" 482 | ], 483 | "payable": false, 484 | "returnType": { 485 | "displayName": [ 486 | "u128" 487 | ], 488 | "type": 10 489 | }, 490 | "selector": "0x77125c55" 491 | }, 492 | { 493 | "args": [ 494 | { 495 | "name": "ask_id", 496 | "type": { 497 | "displayName": [ 498 | "u128" 499 | ], 500 | "type": 10 501 | } 502 | } 503 | ], 504 | "docs": [ 505 | " Get ask by ID" 506 | ], 507 | "mutates": false, 508 | "name": [ 509 | "get_ask_by_id" 510 | ], 511 | "payable": false, 512 | "returnType": { 513 | "displayName": [], 514 | "type": 17 515 | }, 516 | "selector": "0xf10a2ce3" 517 | }, 518 | { 519 | "args": [ 520 | { 521 | "name": "collection_id", 522 | "type": { 523 | "displayName": [ 524 | "u64" 525 | ], 526 | "type": 7 527 | } 528 | }, 529 | { 530 | "name": "token_id", 531 | "type": { 532 | "displayName": [ 533 | "u64" 534 | ], 535 | "type": 7 536 | } 537 | } 538 | ], 539 | "docs": [ 540 | " Get ask by token" 541 | ], 542 | "mutates": false, 543 | "name": [ 544 | "get_ask_id_by_token" 545 | ], 546 | "payable": false, 547 | "returnType": { 548 | "displayName": [ 549 | "u128" 550 | ], 551 | "type": 10 552 | }, 553 | "selector": "0x23d17ab2" 554 | }, 555 | { 556 | "args": [ 557 | { 558 | "name": "collection_id", 559 | "type": { 560 | "displayName": [ 561 | "u64" 562 | ], 563 | "type": 7 564 | } 565 | }, 566 | { 567 | "name": "token_id", 568 | "type": { 569 | "displayName": [ 570 | "u64" 571 | ], 572 | "type": 7 573 | } 574 | } 575 | ], 576 | "docs": [ 577 | " Cancel an ask" 578 | ], 579 | "mutates": true, 580 | "name": [ 581 | "cancel" 582 | ], 583 | "payable": false, 584 | "returnType": null, 585 | "selector": "0x9796e9a7" 586 | }, 587 | { 588 | "args": [ 589 | { 590 | "name": "collection_id", 591 | "type": { 592 | "displayName": [ 593 | "u64" 594 | ], 595 | "type": 7 596 | } 597 | }, 598 | { 599 | "name": "token_id", 600 | "type": { 601 | "displayName": [ 602 | "u64" 603 | ], 604 | "type": 7 605 | } 606 | } 607 | ], 608 | "docs": [ 609 | " Match an ask" 610 | ], 611 | "mutates": true, 612 | "name": [ 613 | "buy" 614 | ], 615 | "payable": false, 616 | "returnType": null, 617 | "selector": "0x15d62801" 618 | } 619 | ] 620 | }, 621 | "storage": { 622 | "struct": { 623 | "fields": [ 624 | { 625 | "layout": { 626 | "cell": { 627 | "key": "0x0000000000000000000000000000000000000000000000000000000000000000", 628 | "ty": 0 629 | } 630 | }, 631 | "name": "owner" 632 | }, 633 | { 634 | "layout": { 635 | "cell": { 636 | "key": "0x0100000000000000000000000000000000000000000000000000000000000000", 637 | "ty": 0 638 | } 639 | }, 640 | "name": "admin" 641 | }, 642 | { 643 | "layout": { 644 | "struct": { 645 | "fields": [ 646 | { 647 | "layout": { 648 | "struct": { 649 | "fields": [ 650 | { 651 | "layout": { 652 | "cell": { 653 | "key": "0x0200000000000000000000000000000000000000000000000000000000000000", 654 | "ty": 3 655 | } 656 | }, 657 | "name": "header" 658 | }, 659 | { 660 | "layout": { 661 | "struct": { 662 | "fields": [ 663 | { 664 | "layout": { 665 | "cell": { 666 | "key": "0x0300000000000000000000000000000000000000000000000000000000000000", 667 | "ty": 4 668 | } 669 | }, 670 | "name": "len" 671 | }, 672 | { 673 | "layout": { 674 | "array": { 675 | "cellsPerElem": 1, 676 | "layout": { 677 | "cell": { 678 | "key": "0x0300000001000000000000000000000000000000000000000000000000000000", 679 | "ty": 5 680 | } 681 | }, 682 | "len": 4294967295, 683 | "offset": "0x0400000000000000000000000000000000000000000000000000000000000000" 684 | } 685 | }, 686 | "name": "elems" 687 | } 688 | ] 689 | } 690 | }, 691 | "name": "entries" 692 | } 693 | ] 694 | } 695 | }, 696 | "name": "keys" 697 | }, 698 | { 699 | "layout": { 700 | "hash": { 701 | "layout": { 702 | "cell": { 703 | "key": "0x0400000001000000000000000000000000000000000000000000000000000000", 704 | "ty": 9 705 | } 706 | }, 707 | "offset": "0x0300000001000000000000000000000000000000000000000000000000000000", 708 | "strategy": { 709 | "hasher": "Blake2x256", 710 | "postfix": "", 711 | "prefix": "0x696e6b20686173686d6170" 712 | } 713 | } 714 | }, 715 | "name": "values" 716 | } 717 | ] 718 | } 719 | }, 720 | "name": "quote_balance" 721 | }, 722 | { 723 | "layout": { 724 | "struct": { 725 | "fields": [ 726 | { 727 | "layout": { 728 | "struct": { 729 | "fields": [ 730 | { 731 | "layout": { 732 | "cell": { 733 | "key": "0x0400000001000000000000000000000000000000000000000000000000000000", 734 | "ty": 3 735 | } 736 | }, 737 | "name": "header" 738 | }, 739 | { 740 | "layout": { 741 | "struct": { 742 | "fields": [ 743 | { 744 | "layout": { 745 | "cell": { 746 | "key": "0x0500000001000000000000000000000000000000000000000000000000000000", 747 | "ty": 4 748 | } 749 | }, 750 | "name": "len" 751 | }, 752 | { 753 | "layout": { 754 | "array": { 755 | "cellsPerElem": 1, 756 | "layout": { 757 | "cell": { 758 | "key": "0x0500000002000000000000000000000000000000000000000000000000000000", 759 | "ty": 11 760 | } 761 | }, 762 | "len": 4294967295, 763 | "offset": "0x0600000001000000000000000000000000000000000000000000000000000000" 764 | } 765 | }, 766 | "name": "elems" 767 | } 768 | ] 769 | } 770 | }, 771 | "name": "entries" 772 | } 773 | ] 774 | } 775 | }, 776 | "name": "keys" 777 | }, 778 | { 779 | "layout": { 780 | "hash": { 781 | "layout": { 782 | "cell": { 783 | "key": "0x0600000002000000000000000000000000000000000000000000000000000000", 784 | "ty": 9 785 | } 786 | }, 787 | "offset": "0x0500000002000000000000000000000000000000000000000000000000000000", 788 | "strategy": { 789 | "hasher": "Blake2x256", 790 | "postfix": "", 791 | "prefix": "0x696e6b20686173686d6170" 792 | } 793 | } 794 | }, 795 | "name": "values" 796 | } 797 | ] 798 | } 799 | }, 800 | "name": "total_traded" 801 | }, 802 | { 803 | "layout": { 804 | "struct": { 805 | "fields": [ 806 | { 807 | "layout": { 808 | "struct": { 809 | "fields": [ 810 | { 811 | "layout": { 812 | "cell": { 813 | "key": "0x0600000002000000000000000000000000000000000000000000000000000000", 814 | "ty": 3 815 | } 816 | }, 817 | "name": "header" 818 | }, 819 | { 820 | "layout": { 821 | "struct": { 822 | "fields": [ 823 | { 824 | "layout": { 825 | "cell": { 826 | "key": "0x0700000002000000000000000000000000000000000000000000000000000000", 827 | "ty": 4 828 | } 829 | }, 830 | "name": "len" 831 | }, 832 | { 833 | "layout": { 834 | "array": { 835 | "cellsPerElem": 1, 836 | "layout": { 837 | "cell": { 838 | "key": "0x0700000003000000000000000000000000000000000000000000000000000000", 839 | "ty": 12 840 | } 841 | }, 842 | "len": 4294967295, 843 | "offset": "0x0800000002000000000000000000000000000000000000000000000000000000" 844 | } 845 | }, 846 | "name": "elems" 847 | } 848 | ] 849 | } 850 | }, 851 | "name": "entries" 852 | } 853 | ] 854 | } 855 | }, 856 | "name": "keys" 857 | }, 858 | { 859 | "layout": { 860 | "hash": { 861 | "layout": { 862 | "cell": { 863 | "key": "0x0800000003000000000000000000000000000000000000000000000000000000", 864 | "ty": 14 865 | } 866 | }, 867 | "offset": "0x0700000003000000000000000000000000000000000000000000000000000000", 868 | "strategy": { 869 | "hasher": "Blake2x256", 870 | "postfix": "", 871 | "prefix": "0x696e6b20686173686d6170" 872 | } 873 | } 874 | }, 875 | "name": "values" 876 | } 877 | ] 878 | } 879 | }, 880 | "name": "nft_deposits" 881 | }, 882 | { 883 | "layout": { 884 | "struct": { 885 | "fields": [ 886 | { 887 | "layout": { 888 | "struct": { 889 | "fields": [ 890 | { 891 | "layout": { 892 | "cell": { 893 | "key": "0x0800000003000000000000000000000000000000000000000000000000000000", 894 | "ty": 3 895 | } 896 | }, 897 | "name": "header" 898 | }, 899 | { 900 | "layout": { 901 | "struct": { 902 | "fields": [ 903 | { 904 | "layout": { 905 | "cell": { 906 | "key": "0x0900000003000000000000000000000000000000000000000000000000000000", 907 | "ty": 4 908 | } 909 | }, 910 | "name": "len" 911 | }, 912 | { 913 | "layout": { 914 | "array": { 915 | "cellsPerElem": 1, 916 | "layout": { 917 | "cell": { 918 | "key": "0x0900000004000000000000000000000000000000000000000000000000000000", 919 | "ty": 15 920 | } 921 | }, 922 | "len": 4294967295, 923 | "offset": "0x0a00000003000000000000000000000000000000000000000000000000000000" 924 | } 925 | }, 926 | "name": "elems" 927 | } 928 | ] 929 | } 930 | }, 931 | "name": "entries" 932 | } 933 | ] 934 | } 935 | }, 936 | "name": "keys" 937 | }, 938 | { 939 | "layout": { 940 | "hash": { 941 | "layout": { 942 | "cell": { 943 | "key": "0x0a00000004000000000000000000000000000000000000000000000000000000", 944 | "ty": 16 945 | } 946 | }, 947 | "offset": "0x0900000004000000000000000000000000000000000000000000000000000000", 948 | "strategy": { 949 | "hasher": "Blake2x256", 950 | "postfix": "", 951 | "prefix": "0x696e6b20686173686d6170" 952 | } 953 | } 954 | }, 955 | "name": "values" 956 | } 957 | ] 958 | } 959 | }, 960 | "name": "asks" 961 | }, 962 | { 963 | "layout": { 964 | "struct": { 965 | "fields": [ 966 | { 967 | "layout": { 968 | "struct": { 969 | "fields": [ 970 | { 971 | "layout": { 972 | "cell": { 973 | "key": "0x0a00000004000000000000000000000000000000000000000000000000000000", 974 | "ty": 3 975 | } 976 | }, 977 | "name": "header" 978 | }, 979 | { 980 | "layout": { 981 | "struct": { 982 | "fields": [ 983 | { 984 | "layout": { 985 | "cell": { 986 | "key": "0x0b00000004000000000000000000000000000000000000000000000000000000", 987 | "ty": 4 988 | } 989 | }, 990 | "name": "len" 991 | }, 992 | { 993 | "layout": { 994 | "array": { 995 | "cellsPerElem": 1, 996 | "layout": { 997 | "cell": { 998 | "key": "0x0b00000005000000000000000000000000000000000000000000000000000000", 999 | "ty": 12 1000 | } 1001 | }, 1002 | "len": 4294967295, 1003 | "offset": "0x0c00000004000000000000000000000000000000000000000000000000000000" 1004 | } 1005 | }, 1006 | "name": "elems" 1007 | } 1008 | ] 1009 | } 1010 | }, 1011 | "name": "entries" 1012 | } 1013 | ] 1014 | } 1015 | }, 1016 | "name": "keys" 1017 | }, 1018 | { 1019 | "layout": { 1020 | "hash": { 1021 | "layout": { 1022 | "cell": { 1023 | "key": "0x0c00000005000000000000000000000000000000000000000000000000000000", 1024 | "ty": 9 1025 | } 1026 | }, 1027 | "offset": "0x0b00000005000000000000000000000000000000000000000000000000000000", 1028 | "strategy": { 1029 | "hasher": "Blake2x256", 1030 | "postfix": "", 1031 | "prefix": "0x696e6b20686173686d6170" 1032 | } 1033 | } 1034 | }, 1035 | "name": "values" 1036 | } 1037 | ] 1038 | } 1039 | }, 1040 | "name": "asks_by_token" 1041 | }, 1042 | { 1043 | "layout": { 1044 | "cell": { 1045 | "key": "0x0c00000005000000000000000000000000000000000000000000000000000000", 1046 | "ty": 10 1047 | } 1048 | }, 1049 | "name": "last_ask_id" 1050 | } 1051 | ] 1052 | } 1053 | }, 1054 | "types": [ 1055 | { 1056 | "id": 0, 1057 | "type": { 1058 | "def": { 1059 | "composite": { 1060 | "fields": [ 1061 | { 1062 | "type": 1, 1063 | "typeName": "[u8; 32]" 1064 | } 1065 | ] 1066 | } 1067 | }, 1068 | "path": [ 1069 | "ink_env", 1070 | "types", 1071 | "AccountId" 1072 | ] 1073 | } 1074 | }, 1075 | { 1076 | "id": 1, 1077 | "type": { 1078 | "def": { 1079 | "array": { 1080 | "len": 32, 1081 | "type": 2 1082 | } 1083 | } 1084 | } 1085 | }, 1086 | { 1087 | "id": 2, 1088 | "type": { 1089 | "def": { 1090 | "primitive": "u8" 1091 | } 1092 | } 1093 | }, 1094 | { 1095 | "id": 3, 1096 | "type": { 1097 | "def": { 1098 | "composite": { 1099 | "fields": [ 1100 | { 1101 | "name": "last_vacant", 1102 | "type": 4, 1103 | "typeName": "Index" 1104 | }, 1105 | { 1106 | "name": "len", 1107 | "type": 4, 1108 | "typeName": "u32" 1109 | }, 1110 | { 1111 | "name": "len_entries", 1112 | "type": 4, 1113 | "typeName": "u32" 1114 | } 1115 | ] 1116 | } 1117 | }, 1118 | "path": [ 1119 | "ink_storage", 1120 | "collections", 1121 | "stash", 1122 | "Header" 1123 | ] 1124 | } 1125 | }, 1126 | { 1127 | "id": 4, 1128 | "type": { 1129 | "def": { 1130 | "primitive": "u32" 1131 | } 1132 | } 1133 | }, 1134 | { 1135 | "id": 5, 1136 | "type": { 1137 | "def": { 1138 | "variant": { 1139 | "variants": [ 1140 | { 1141 | "fields": [ 1142 | { 1143 | "type": 8, 1144 | "typeName": "VacantEntry" 1145 | } 1146 | ], 1147 | "index": 0, 1148 | "name": "Vacant" 1149 | }, 1150 | { 1151 | "fields": [ 1152 | { 1153 | "type": 6, 1154 | "typeName": "T" 1155 | } 1156 | ], 1157 | "index": 1, 1158 | "name": "Occupied" 1159 | } 1160 | ] 1161 | } 1162 | }, 1163 | "params": [ 1164 | { 1165 | "name": "T", 1166 | "type": 6 1167 | } 1168 | ], 1169 | "path": [ 1170 | "ink_storage", 1171 | "collections", 1172 | "stash", 1173 | "Entry" 1174 | ] 1175 | } 1176 | }, 1177 | { 1178 | "id": 6, 1179 | "type": { 1180 | "def": { 1181 | "tuple": [ 1182 | 7, 1183 | 0 1184 | ] 1185 | } 1186 | } 1187 | }, 1188 | { 1189 | "id": 7, 1190 | "type": { 1191 | "def": { 1192 | "primitive": "u64" 1193 | } 1194 | } 1195 | }, 1196 | { 1197 | "id": 8, 1198 | "type": { 1199 | "def": { 1200 | "composite": { 1201 | "fields": [ 1202 | { 1203 | "name": "next", 1204 | "type": 4, 1205 | "typeName": "Index" 1206 | }, 1207 | { 1208 | "name": "prev", 1209 | "type": 4, 1210 | "typeName": "Index" 1211 | } 1212 | ] 1213 | } 1214 | }, 1215 | "path": [ 1216 | "ink_storage", 1217 | "collections", 1218 | "stash", 1219 | "VacantEntry" 1220 | ] 1221 | } 1222 | }, 1223 | { 1224 | "id": 9, 1225 | "type": { 1226 | "def": { 1227 | "composite": { 1228 | "fields": [ 1229 | { 1230 | "name": "value", 1231 | "type": 10, 1232 | "typeName": "V" 1233 | }, 1234 | { 1235 | "name": "key_index", 1236 | "type": 4, 1237 | "typeName": "KeyIndex" 1238 | } 1239 | ] 1240 | } 1241 | }, 1242 | "params": [ 1243 | { 1244 | "name": "V", 1245 | "type": 10 1246 | } 1247 | ], 1248 | "path": [ 1249 | "ink_storage", 1250 | "collections", 1251 | "hashmap", 1252 | "ValueEntry" 1253 | ] 1254 | } 1255 | }, 1256 | { 1257 | "id": 10, 1258 | "type": { 1259 | "def": { 1260 | "primitive": "u128" 1261 | } 1262 | } 1263 | }, 1264 | { 1265 | "id": 11, 1266 | "type": { 1267 | "def": { 1268 | "variant": { 1269 | "variants": [ 1270 | { 1271 | "fields": [ 1272 | { 1273 | "type": 8, 1274 | "typeName": "VacantEntry" 1275 | } 1276 | ], 1277 | "index": 0, 1278 | "name": "Vacant" 1279 | }, 1280 | { 1281 | "fields": [ 1282 | { 1283 | "type": 7, 1284 | "typeName": "T" 1285 | } 1286 | ], 1287 | "index": 1, 1288 | "name": "Occupied" 1289 | } 1290 | ] 1291 | } 1292 | }, 1293 | "params": [ 1294 | { 1295 | "name": "T", 1296 | "type": 7 1297 | } 1298 | ], 1299 | "path": [ 1300 | "ink_storage", 1301 | "collections", 1302 | "stash", 1303 | "Entry" 1304 | ] 1305 | } 1306 | }, 1307 | { 1308 | "id": 12, 1309 | "type": { 1310 | "def": { 1311 | "variant": { 1312 | "variants": [ 1313 | { 1314 | "fields": [ 1315 | { 1316 | "type": 8, 1317 | "typeName": "VacantEntry" 1318 | } 1319 | ], 1320 | "index": 0, 1321 | "name": "Vacant" 1322 | }, 1323 | { 1324 | "fields": [ 1325 | { 1326 | "type": 13, 1327 | "typeName": "T" 1328 | } 1329 | ], 1330 | "index": 1, 1331 | "name": "Occupied" 1332 | } 1333 | ] 1334 | } 1335 | }, 1336 | "params": [ 1337 | { 1338 | "name": "T", 1339 | "type": 13 1340 | } 1341 | ], 1342 | "path": [ 1343 | "ink_storage", 1344 | "collections", 1345 | "stash", 1346 | "Entry" 1347 | ] 1348 | } 1349 | }, 1350 | { 1351 | "id": 13, 1352 | "type": { 1353 | "def": { 1354 | "tuple": [ 1355 | 7, 1356 | 7 1357 | ] 1358 | } 1359 | } 1360 | }, 1361 | { 1362 | "id": 14, 1363 | "type": { 1364 | "def": { 1365 | "composite": { 1366 | "fields": [ 1367 | { 1368 | "name": "value", 1369 | "type": 0, 1370 | "typeName": "V" 1371 | }, 1372 | { 1373 | "name": "key_index", 1374 | "type": 4, 1375 | "typeName": "KeyIndex" 1376 | } 1377 | ] 1378 | } 1379 | }, 1380 | "params": [ 1381 | { 1382 | "name": "V", 1383 | "type": 0 1384 | } 1385 | ], 1386 | "path": [ 1387 | "ink_storage", 1388 | "collections", 1389 | "hashmap", 1390 | "ValueEntry" 1391 | ] 1392 | } 1393 | }, 1394 | { 1395 | "id": 15, 1396 | "type": { 1397 | "def": { 1398 | "variant": { 1399 | "variants": [ 1400 | { 1401 | "fields": [ 1402 | { 1403 | "type": 8, 1404 | "typeName": "VacantEntry" 1405 | } 1406 | ], 1407 | "index": 0, 1408 | "name": "Vacant" 1409 | }, 1410 | { 1411 | "fields": [ 1412 | { 1413 | "type": 10, 1414 | "typeName": "T" 1415 | } 1416 | ], 1417 | "index": 1, 1418 | "name": "Occupied" 1419 | } 1420 | ] 1421 | } 1422 | }, 1423 | "params": [ 1424 | { 1425 | "name": "T", 1426 | "type": 10 1427 | } 1428 | ], 1429 | "path": [ 1430 | "ink_storage", 1431 | "collections", 1432 | "stash", 1433 | "Entry" 1434 | ] 1435 | } 1436 | }, 1437 | { 1438 | "id": 16, 1439 | "type": { 1440 | "def": { 1441 | "composite": { 1442 | "fields": [ 1443 | { 1444 | "name": "value", 1445 | "type": 17, 1446 | "typeName": "V" 1447 | }, 1448 | { 1449 | "name": "key_index", 1450 | "type": 4, 1451 | "typeName": "KeyIndex" 1452 | } 1453 | ] 1454 | } 1455 | }, 1456 | "params": [ 1457 | { 1458 | "name": "V", 1459 | "type": 17 1460 | } 1461 | ], 1462 | "path": [ 1463 | "ink_storage", 1464 | "collections", 1465 | "hashmap", 1466 | "ValueEntry" 1467 | ] 1468 | } 1469 | }, 1470 | { 1471 | "id": 17, 1472 | "type": { 1473 | "def": { 1474 | "tuple": [ 1475 | 7, 1476 | 7, 1477 | 7, 1478 | 10, 1479 | 0 1480 | ] 1481 | } 1482 | } 1483 | } 1484 | ] 1485 | } 1486 | } -------------------------------------------------------------------------------- /doc/primary_market.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/primary_market.png -------------------------------------------------------------------------------- /doc/secondary_market.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/secondary_market.png -------------------------------------------------------------------------------- /doc/step1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step1-1.png -------------------------------------------------------------------------------- /doc/step1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step1-2.png -------------------------------------------------------------------------------- /doc/step2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step2-1.png -------------------------------------------------------------------------------- /doc/step3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step3-1.png -------------------------------------------------------------------------------- /doc/step4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-1.png -------------------------------------------------------------------------------- /doc/step4-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-2.png -------------------------------------------------------------------------------- /doc/step4-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-3.png -------------------------------------------------------------------------------- /doc/step4-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-4.png -------------------------------------------------------------------------------- /doc/step4-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-5.png -------------------------------------------------------------------------------- /doc/step4-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-6.png -------------------------------------------------------------------------------- /doc/step4-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step4-7.png -------------------------------------------------------------------------------- /doc/step6-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step6-2.png -------------------------------------------------------------------------------- /doc/step6-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step6-3.png -------------------------------------------------------------------------------- /doc/step9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step9-1.png -------------------------------------------------------------------------------- /doc/step9-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniqueNetwork/marketplace-docker/001a85c6ef89c31c93d9b2f307544ada6a03bc96/doc/step9-2.png -------------------------------------------------------------------------------- /docker-compose.local.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | x-marketplace: &marketplace-backend 4 | image: uniquenetwork/marketplace-backend:${MARKET_VERSION} 5 | restart: unless-stopped 6 | env_file: 7 | - ./.env 8 | depends_on: 9 | - postgres 10 | 11 | services: 12 | 13 | nginx: 14 | container_name: nginx 15 | image: nginx:alpine 16 | volumes: 17 | - ./nginx/nginx.local.conf:/etc/nginx/templates/default.conf.template:ro 18 | ports: 19 | - 80:80 20 | - 443:443 21 | depends_on: 22 | - frontend 23 | 24 | frontend: 25 | container_name: frontend 26 | image: uniquenetwork/marketplace-frontend:${MARKET_VERSION} 27 | env_file: 28 | - ./.env 29 | volumes: 30 | - ./static/footer.html:/usr/share/nginx/html/footer.html:ro 31 | - ./static/logo.svg:/usr/share/nginx/html/logos/logo.svg:ro 32 | - ./static/variables.css:/usr/share/nginx/html/variables.css:ro 33 | depends_on: 34 | - backend 35 | 36 | 37 | backend: 38 | container_name: backend 39 | <<: *marketplace-backend 40 | 41 | escrow-unique: 42 | container_name: escrow-unique 43 | command: [ "npm", "run", "escrow:unique" ] 44 | <<: *marketplace-backend 45 | 46 | escrow-kusama: 47 | container_name: escrow-kusama 48 | command: [ "npm", "run", "escrow:kusama" ] 49 | <<: *marketplace-backend 50 | 51 | postgres: 52 | image: postgres:14.1-alpine 53 | container_name: postgres 54 | env_file: 55 | - ./.env 56 | volumes: 57 | - ./pgdata:/var/lib/postgresql/data 58 | - /etc/localtime:/etc/localtime:ro 59 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | x-marketplace: &marketplace-backend 4 | image: uniquenetwork/marketplace-backend:${MARKET_VERSION} 5 | restart: unless-stopped 6 | env_file: 7 | - ./.env 8 | depends_on: 9 | - postgres 10 | 11 | services: 12 | 13 | nginx: 14 | container_name: nginx 15 | image: nginx:alpine 16 | volumes: 17 | - ./nginx/nginx.conf:/etc/nginx/templates/default.conf.template:ro 18 | - ./nginx/ssl:/etc/nginx/ssl:ro 19 | ports: 20 | - 80:80 21 | - 443:443 22 | depends_on: 23 | - frontend 24 | 25 | frontend: 26 | container_name: frontend 27 | image: uniquenetwork/marketplace-frontend:${MARKET_VERSION} 28 | env_file: 29 | - ./.env 30 | volumes: 31 | - ./static/footer.html:/usr/share/nginx/html/footer.html:ro 32 | - ./static/logo.svg:/usr/share/nginx/html/logos/logo.svg:ro 33 | - ./static/variables.css:/usr/share/nginx/html/variables.css:ro 34 | depends_on: 35 | - backend 36 | 37 | 38 | backend: 39 | container_name: backend 40 | <<: *marketplace-backend 41 | 42 | escrow-unique: 43 | container_name: escrow-unique 44 | command: [ "npm", "run", "escrow:unique" ] 45 | <<: *marketplace-backend 46 | 47 | escrow-kusama: 48 | container_name: escrow-kusama 49 | command: [ "npm", "run", "escrow:kusama" ] 50 | <<: *marketplace-backend 51 | 52 | postgres: 53 | image: postgres:14.1-alpine 54 | container_name: postgres 55 | env_file: 56 | - ./.env 57 | volumes: 58 | - ./pgdata:/var/lib/postgresql/data 59 | - /etc/localtime:/etc/localtime:ro 60 | 61 | 62 | -------------------------------------------------------------------------------- /nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | map $http_upgrade $connection_upgrade { 2 | default upgrade; 3 | '' close; 4 | } 5 | 6 | server { 7 | listen 80 default; 8 | return 301 https://$host$request_uri; 9 | } 10 | 11 | server { 12 | 13 | listen 443 ssl; 14 | 15 | ssl_certificate /etc/nginx/ssl/certificate.crt; 16 | ssl_certificate_key /etc/nginx/ssl/private.key; 17 | 18 | location / { 19 | proxy_pass http://frontend:80; 20 | } 21 | 22 | location ~ ^/(api|socket\.io)/ { 23 | proxy_pass http://backend:5000; 24 | proxy_http_version 1.1; 25 | proxy_set_header Upgrade $http_upgrade; 26 | proxy_set_header Connection "upgrade"; 27 | proxy_read_timeout 300; 28 | proxy_connect_timeout 300; 29 | proxy_send_timeout 300; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /nginx/nginx.local.conf: -------------------------------------------------------------------------------- 1 | map $http_upgrade $connection_upgrade { 2 | default upgrade; 3 | '' close; 4 | } 5 | 6 | server { 7 | listen 80 default; 8 | 9 | location / { 10 | proxy_pass http://frontend:80; 11 | } 12 | 13 | location ~ ^/(api|socket\.io)/ { 14 | proxy_pass http://backend:5000; 15 | proxy_http_version 1.1; 16 | proxy_set_header Upgrade $http_upgrade; 17 | proxy_set_header Connection "upgrade"; 18 | proxy_read_timeout 300; 19 | proxy_connect_timeout 300; 20 | proxy_send_timeout 300; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /nginx/ssl/certificate.sample.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDxDCCAqwCCQCJe3/O6ilU/jANBgkqhkiG9w0BAQsFADCBozELMAkGA1UEBhMC 3 | R0kxEjAQBgNVBAgMCUdpYnJhbHRhcjESMBAGA1UEBwwJR2licmFsdGFyMR8wHQYD 4 | VQQKDBZVbmlxdWUgTmV0d29yayBMaW1pdGVkMQwwCgYDVQQLDANXZWIxFDASBgNV 5 | BAMMC01hcmtldHBsYWNlMScwJQYJKoZIhvcNAQkBFhhkZXZlbG9wZXJAdW5pcXVl 6 | Lm5ldHdvcmswHhcNMjIwMzI5MTEwNTMwWhcNMjMwMzI5MTEwNTMwWjCBozELMAkG 7 | A1UEBhMCR0kxEjAQBgNVBAgMCUdpYnJhbHRhcjESMBAGA1UEBwwJR2licmFsdGFy 8 | MR8wHQYDVQQKDBZVbmlxdWUgTmV0d29yayBMaW1pdGVkMQwwCgYDVQQLDANXZWIx 9 | FDASBgNVBAMMC01hcmtldHBsYWNlMScwJQYJKoZIhvcNAQkBFhhkZXZlbG9wZXJA 10 | dW5pcXVlLm5ldHdvcmswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC/ 11 | ekHnLuIoaFU2ngUezAMUFdnzfGPfHbGEMYRnxVx4ljpqxc9kKOeI2Li5FJIN2N7y 12 | Nn0fHa+lk7cnfCJJ+E9zAIjxrok9mLPQJO1x6RWdo7duvuMhcHvMevl8DU68pmXG 13 | 0jalE8N/ujoUp6gLNvKl8hlv28Ukzbb7AdLaFeBp4z4i+hE23P8f2F54vv/F3g3k 14 | ITyvRmP5OfwQ/cKfIZrOPXOpa/RhqWZcl0ll/ezhiCw1ScWIz8B2KqbH66CbIZXX 15 | S0H3Ns9MKeDMAVd362YtJIqc5kVO888Scw5S/DYTAFT4IAYqY5ilsasDZI+HxdBl 16 | 7h8NpdXBeeebREL8wvNfAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAK74PW06xgMc 17 | BazGSakU0YGSRpKDx3BUcaBo7xW9rrBffylmQ8dbmhlOS4lVXKmRapSrAWugVG/6 18 | XzLQcPNPbwNHwKxJs+hlIQqThOLpe7GNVquGqYVjNL0qsDdFP6JpP9x42Q1GY62K 19 | O3PVf7xayNgTiE4vS2jK0IHIjLO9piHHcM0QEUH7HpKfLsCCZmeU95QkGyjnxbmT 20 | U8EiA0H7wlcdHXuVTG5sDaFBGY8+qOcJalI1qMu3P0PTkKT6+Iapsum8GdP02fhF 21 | Iv9Yp7C2Rop+BRSBJuPvbCjV/G86MyfMs/eeWt2GDSNx6CLueVNlCChRMnLYu1oR 22 | IM5zPiSCRD0= 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /nginx/ssl/private.sample.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC/ekHnLuIoaFU2 3 | ngUezAMUFdnzfGPfHbGEMYRnxVx4ljpqxc9kKOeI2Li5FJIN2N7yNn0fHa+lk7cn 4 | fCJJ+E9zAIjxrok9mLPQJO1x6RWdo7duvuMhcHvMevl8DU68pmXG0jalE8N/ujoU 5 | p6gLNvKl8hlv28Ukzbb7AdLaFeBp4z4i+hE23P8f2F54vv/F3g3kITyvRmP5OfwQ 6 | /cKfIZrOPXOpa/RhqWZcl0ll/ezhiCw1ScWIz8B2KqbH66CbIZXXS0H3Ns9MKeDM 7 | AVd362YtJIqc5kVO888Scw5S/DYTAFT4IAYqY5ilsasDZI+HxdBl7h8NpdXBeeeb 8 | REL8wvNfAgMBAAECggEAAXI78zIQdTusgRgac8wYrdsoZUVoP7QqthPlqx77ftGr 9 | qUjLMzd34Dm603MLU11y+aNduJFx1S9Tb9HpNGPSvcygPCsUUEnJ+eV9gaHADwvA 10 | g+6fKo598OJw5fX3xUcAd8r4rLCEhn9ylttZUpRcqtI0TPr89zUyj5zI6erGYiZY 11 | 5fUPj2vA7ph4Y97ugJ/iRe4qI4YEe+rCHsx0u7MVb28Owkv5JkRuqKGoZ5cfAgGl 12 | QEwm21S6pXRXzC4ejG5WHZ2lNqYYxhSjBoIgT4V2yVpftKRYcuFm/8dn/R1MLdIr 13 | U8ks00GJ6cixoILnwqGX4aaGiDVFYBRwPU0/wXMxwQKBgQDmKOvMKA7QT7XZ4dVg 14 | 47W3+7b8S/nvMlsoFujVk2kPMHUEZTf6yumOqDKv78MfzA7lPOZ3XGlpI4TnrA7Z 15 | iCAFLqmVQl7Z6qrZb9ftzY/wjhRa/OYgLP9PsDM8Oxmznk/7IsF5EaBRpvGgWfN/ 16 | R6l2Gy0Xvb8XK1s2qrc/UYrm4QKBgQDU+Y9LiC2tVuiaImHtuRnoXRHHh+/g5krl 17 | yjQyyJVO1u8fcE0V6K3Ho64E57xNRsjJ2B1oTK24+S6qqyl1l/qPIcX3BunXSwul 18 | Bbc2IWxd7RK91stYu6HP+AT7twaPUuSCMjNPVJEGLoh94pKKBoWXMTO/C7yNRg35 19 | /sdsz3JiPwKBgBnyKwLM0T6yfbGeP8u4X9fpzGsMtZQ9fQE78+t/vqwzrj1cm77t 20 | +P5X/77NrJV9D4DQKLrz8/4iPu1O/C2RpupupDdrT/4I8lGoxhLMxZk8qxbGw7qE 21 | 2BNHrb7weqlBA4swE9duIUCTLVICUezbS0NBNQgkH9Kg1JuJCzdcHeiBAoGARADD 22 | jnyXCSgc8UpVNpDKAvXkvW9cWtVtyN29uRFvC1N52vICyyIWiw5qfEp6R7p4VmrZ 23 | SPpi5hM6oWgxvsieSqGgEnZ0qDfgKfsfOvuFHKCcQV2aZGTVEBDDlpQkVhNDv4bD 24 | 92qrO+wTzQ5ReB0I/vPI8BGRTRK3V8HQb5/1iAUCgYAV9qTJuKnkh6PgQ+doQacj 25 | hdypYrL7b0+k3elFPOEaenwpaf4d8V5dJdxlqQZlnx9sYEKeAxEWLnnbfEqMuP6B 26 | KFxME5FC7L02Oka36Pd3M3K0EzFX8QC+P7e0OEm0d0odSsV1GnQutmF2GMHJH2K7 27 | XeXvlighw1R4u5CPUS1dSQ== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /static/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /static/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /static/variables.css: -------------------------------------------------------------------------------- 1 | :root {} 2 | --------------------------------------------------------------------------------