git.delta.rocks / unique-network / refs/commits / 6b7300defa13

difftreelog

source

README.md5.3 KiBsourcehistory
1![Docker build](https://github.com/usetech-llc/nft_parachain/workflows/Docker%20build/badge.svg)23# Unique Parachain45## Project Description67The Unique Pallet is the core of NFT functionality. Like ERC-721 standard in Ethereum ecosystem, this pallet provides the8basement for creating collections of unique non-divisible things, also called Non Fungible Tokens (NFTs), minting NFT of9a given Collection, and managing their ownership.1011The pallet also enables storing NFT properties. Though (according to ERC-721) NFT properties belong to logic of a12concrete application that operates a Collection, so purposefully the NFT Tracking Module does not have any knowledge13about properties except their byte size leaving application logic out to be controlled by Smart Contracts.1415The Unique Chain also provides:1617-   Smart Contracts Pallet and example smart contract that interacts with Unique Runtime18-   ERC-1155 Functionality (currently PoC as Re-Fungible tokens, i.e. items that are still unique, but that can be split19    between multiple users)20-   Variety of economic options for dapp producers to choose from to create freemium games and other ways to attract21    users. As a step one, we implemented an economic model when a collection sponsor can be set to pay for collection22    Transfer transactions.2324Wider Unique Ecosystem (most of it was developed during Hackusama):2526-   [SubstraPunks Game hosted on IPFS](https://github.com/usetech-llc/substrapunks)27-   [Unique Wallet and UI](https://uniqueapps.usetech.com/#/nft)28-   [NFT Asset for Unity Framework](https://github.com/usetech-llc/nft_unity)2930Please see our [walk-through instructions](doc/hackusama_walk_through.md) to try everything out!3132## Application Development3334If you are building an application that operates NFT tokens, use [this document](doc/application_development.md).353637## Building3839Building Unique chain requires special versions of Rust and toolchain. We don't use the most recent versions of everything40so that we can keep the builds stable.41421. Install Rust:4344```bash45sudo apt-get install git curl libssl-dev llvm pkg-config libclang-dev clang46curl https://sh.rustup.rs -sSf | sh47```48492. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.50513. Install install nightly 2021-11-11 and make it default:5253```bash54rustup toolchain install nightly-2021-11-1155rustup default nightly-2021-11-1156```57584. Add wasm target for nightly toolchain:5960```bash61rustup target add wasm32-unknown-unknown --toolchain nightly-2021-11-1162```63645. Build:65```bash66cargo build67```6869optionally, build in release:70```bash71cargo build --release72```7374##### _Building the node using the Quartz Runtime (optional)_75* Build debug version76```bash77cargo build --package unique-rpc --package unique-node --no-default-features --features quartz-runtime78```7980* Build release version81```bash82cargo build --release --package unique-rpc --package unique-node --no-default-features --features quartz-runtime83```8485##### _Building the node using the Opal Runtime (optional)_86* Build debug version87```bash88cargo build --package unique-rpc --package unique-node --no-default-features --features opal-runtime89```9091* Build release version92```bash93cargo build --release --package unique-rpc --package unique-node --no-default-features --features opal-runtime94```9596## Building as Parachain locally9798Note: checkout this project and all related projects (see below) in the sibling folders (both under the same folder)99100### Polkadot launch utility101102```103git clone https://github.com/paritytech/polkadot-launch104```105106### Build relay107108```109git clone https://github.com/paritytech/polkadot.git110cd polkadot111git checkout release-v0.9.17112cargo build --release113```114115### Build Unique parachain116117Run in the root of this project:118```119cargo build --release120```121122### Build Acala parachain (optional, full config only)123124```125git clone https://github.com/AcalaNetwork/Acala126cd Acala127git checkout 54db3acd409a0b787f116f20e163a3b24101ce38128make build-release129```130131## Running as Parachain locally132133```134./launch-testnet.sh135```136137Optional, full setup with Acala and Statemint138```139./launch-testnet-full.sh140```141142## Run Integration Tests1431441. Install all needed dependecies145```146cd tests147yarn install148```1491502. Run tests151```152yarn test153```154155156## Code Formatting157158### Apply formatting and clippy fixes159```bash160cargo clippy161cargo fmt162```163164### Format tests165```bash166pushd tests && yarn fix ; popd167```168169### Check code style in tests170```bash171cd tests && yarn eslint --ext .ts,.js src/172```173174175## Karura token transfer176177To get started, you need to open inbound and outbound hrmp channels.178179### Next, we need to register our asset at Karura.180```181assetRegistry -> registerForeignAsset(location, metadata)182location:183	V0(X2(Parent, Parachain(PARA_ID)))184metadata:185	name         OPL186	symbol       OPL187	decimals     18188minimalBalance	 1189```190191### Next, we can send tokens from Opal to Karura:192```193polkadotXcm -> reserveTransferAssets194dest:195	V0(X2(Parent, Parachain(<KARURA_PARA_ID>)))196beneficiary:197	X1(AccountId(Any, <ACCOUNT>))198assets:199	V1(Concrete(0,Here), Fungible(<AMOUNT>))200feeAssetItem:201	0202weightLimit:203	<LIMIT>204```205206The result will be displayed in ChainState207tokens -> accounts208209### To send tokens from Karura to Opal:210```211xtokens -> transfer212213currencyId:214	ForeingAsset215		<TOKEN_ID>216217amount:218		<AMOUNT>219dest:220	V1221	(222		Parents:1,223		X2(Parachain(<KARURA_PARA_ID>), AccountId(Any, <ACCOUNT>)224	)225destWeight:226	<WEIGHT>227```