Skip to content

Commit

Permalink
Merge pull request #8 from bogacyigitbasi/low-code-nft-marketplace
Browse files Browse the repository at this point in the history
initial commit of the low-code nft marketplace
  • Loading branch information
abizjak authored Aug 22, 2023
2 parents 6463fe7 + b1125d1 commit 01481ca
Show file tree
Hide file tree
Showing 125 changed files with 45,677 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ node_modules
dist
package.json
!.storybook
build

1 change: 0 additions & 1 deletion .github/workflows/rust-fmt-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ jobs:
with:
command: clippy
args: --manifest-path ${{ matrix.crates }} -- -D warnings

5 changes: 5 additions & 0 deletions low-code-nft-marketplace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
target
.vscode
build
tsconfig.tsbuildinfo
80 changes: 80 additions & 0 deletions low-code-nft-marketplace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Low Code NFT Marketplace & Low Code Minting Tool for [CIS2 Token](https://proposals.concordium.software/CIS/cis-2.html)

- Prerequisites for running the marketplace:

- Clone this Repository
- Install Concordium Browser Wallet
- **node.js** version 14.17.0 or above. If you already have node.js run `node -v` to check the version. You can use nvm to manage multiple Node versions installed on a single machine.
- **yarn** - a package manager for JavaScript; replaces the npm client.
- A code editor of your choice, such as Visual Studio Code.
- [`cargo-concordium`](https://developer.concordium.software/en/mainnet/smart-contracts/guides/setup-tools.html) : Used to build smart contracts
- [`concordium-client`](https://developer.concordium.software/en/mainnet/net/references/concordium-client.html) : Used to deploy smart contracts

- Run

```bash
yarn && yarn build:all
```

- Deploy Contracts: **Make sure to setup `concordium-client` with a account before executing this**

```bash
yarn deploy:smart-contract wallet-account
```

**Here `wallet-account` reffers to the account which you have setup in [`concordium-client`](https://developer.concordium.software/en/mainnet/net/references/concordium-client.html)**

- Copy deployed contracts schema and module ref in the frontend constants file [Constants.ts (market-ui)](./market-ui/src/Constants.ts)
- Replace value of `MARKET_CONTRACT_SCHEMA` with the contents of the [schema file](./cis2-market/schema_base64.txt)
- Replace value of `MARKET_CONTRACT_MODULE_REF` with the value of `ModuleRef` from the output of `yarn deploy:smart-contract`

- Run the frontend

```bash
yarn debug:market-ui
```

Or

```bash
yarn debug:mint-ui
```

Detailed Documentation about installation, running the dApp and other configurations can be found in the [Developer Portal](https://developer.concordium.software/en/mainnet/net/guides/low-code-nft-marketplace/introduction.html)

This repository provides sample code implementations for interacting with on chain contracts on Concordium.This repo includes both minting tool and the NFT Marketplace.

- Using Frontend React Code (using [Web SDK](https://github.com/Concordium/concordium-node-sdk-js/tree/main/packages/web) and [Concordium Browser Wallet](https://chrome.google.com/webstore/detail/concordium-wallet/mnnkpffndmickbiakofclnpoiajlegmg?hl=en-US))

Please do note that this is **not** an exhaustive list of the languages supported by Concordium.
There are are SDK's present to interact with the contracts using multiple other languages. A complete list can be found [here](https://developer.concordium.software/en/mainnet/net/guides/sdks-apis.html)
## Contents of Repository
- [CIS2 Token Contract](./cis2-multi/README.md)
- [CIS2 Market Contract](./cis2-multi/README.md)
- [Market React Application](./market-ui/README.md) :
React based frontend DAPP for marketplace contract. This is the typescript code which can be used with Concordium Browser Wallet to interact with CIS2-Multi and Marketplace Contract in Browser based environments. It has following features
- Initialize a new CIS2 Token Contract
- Mint a CIS2 Token
- List a CIS2 Token on the Market
- Buy a CIS2 Token from Market
- Pinata (IPFS) based metadata Upload for the Token Metadata
- [Mint React Application](./mint-ui/README.md)
React based frontend DAPP for [cis2-multi](./cis2-multi/src/lib.rs) contract. It allows to Initialize a new contract & mint a token.
## Get Started
Throughout this repository [Concordium Testnet](https://testnet.ccdscan.io/) is being used to demo the functionality.
- Prerequisites for changing, deploying the smart contracts:
- [Install tools for Smart Contract development](https://developer.concordium.software/en/mainnet/smart-contracts/guides/setup-tools.html#setup-tools)
- [For IOS, IPhone](https://developer.concordium.software/en/mainnet/net/installation/downloads-testnet.html#ios)
- [For Android](https://developer.concordium.software/en/mainnet/net/installation/downloads-testnet.html#android)
- [Create Testnet Account](https://developer.concordium.software/en/mainnet/net/guides/create-account.html)
- [Export wallet](https://developer.concordium.software/en/mainnet/net/guides/export-import.html#export-import)
- Interact with Contracts
- Sell / Buy / Mint CIS2 Token(s) : Using [Frontend React Code](./market-ui/README.md)
- Mint CIS2 Token(s) : Using [Frontend React Code](./mint-ui/README.md)
3 changes: 3 additions & 0 deletions low-code-nft-marketplace/cis2-market/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
module.wasm
schema_base64.txt
161 changes: 161 additions & 0 deletions low-code-nft-marketplace/cis2-market/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions low-code-nft-marketplace/cis2-market/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "cis2-market"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
concordium-std = { version = "8.0.0", default-features = false }
concordium-cis2 = { version = "5.0.0", default-features = false }

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
codegen-units = 1
opt-level = "s"
panic = "abort"

[profile.dev]
panic = "abort"

[features]
default = ["std"]
std = ["concordium-std/std", "concordium-cis2/std"]
20 changes: 20 additions & 0 deletions low-code-nft-marketplace/cis2-market/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CIS2-Marketplace contract for [CIS2 Tokens](https://proposals.concordium.software/CIS/cis-2.html)

In order to build, deploy, mint, transfer, etc all functions using concordium-client you can check the [Developer Portal](https://developer.concordium.software/en/mainnet/smart-contracts/tutorials/nft-marketplace/index.html)

## Build

```bash
yarn build
```

## Deploy

Uses [`concordium-client`](https://developer.concordium.software/en/mainnet/net/references/concordium-client.html) to deploy the contract to the chain.
Uses `node.testnet.concordium.com` node for deployment.

```bash
yarn deploy wallet-account
```

**Here `wallet-account` reffers to the account which you have setup in [`concordium-client`](https://developer.concordium.software/en/mainnet/net/references/concordium-client.html)**
14 changes: 14 additions & 0 deletions low-code-nft-marketplace/cis2-market/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "cis2-market",
"version": "1.0.0",
"description": "Smart Contract",
"main": " ",
"repository": " ",
"author": "[email protected]",
"license": "MIT",
"private": true,
"scripts": {
"build": "cargo concordium build --out=module.wasm --schema-base64-out=schema_base64.txt",
"deploy": "concordium-client --grpc-ip node.testnet.concordium.com module deploy ./module.wasm --no-confirm --sender"
}
}
20 changes: 20 additions & 0 deletions low-code-nft-marketplace/cis2-market/src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Provides error types which can be returned by Marketplace Contract.
//! Read more about errors which can be returned by a Concordium Contract [here](https://developer.concordium.software/en/mainnet/smart-contracts/guides/custom-errors.html)

use concordium_std::*;

#[derive(Debug, Reject, Serial, SchemaType)]
pub enum MarketplaceError {
ParseParams,
CalledByAContract,
TokenNotListed,
Cis2ClientError,
CollectionNotCis2,
InvalidAmountPaid,
InvokeTransferError,
NoBalance,
NotOperator,
InvalidCommission,
InvalidTokenQuantity,
InvalidRoyalty,
}
Loading

0 comments on commit 01481ca

Please sign in to comment.