git.delta.rocks / unique-network / refs/commits / 430b0201ea83

difftreelog

source

README.md5.7 KiBsourcehistory
1# Unique Parachain23## Project Description45The Unique Pallet is the core of NFT functionality. Like ERC-721 standard in Ethereum ecosystem, this pallet provides the6basement for creating collections of unique non-divisible things, also called Non Fungible Tokens (NFTs), minting NFT of7a given Collection, and managing their ownership.89The pallet also enables storing NFT properties. Though (according to ERC-721) NFT properties belong to logic of a10concrete application that operates a Collection, so purposefully the NFT Tracking Module does not have any knowledge11about properties except their byte size leaving application logic out to be controlled by Smart Contracts.1213The Unique Chain also provides:1415-   Smart Contracts Pallet and example smart contract that interacts with Unique Runtime16-   ERC-1155 Functionality (currently PoC as Re-Fungible tokens, i.e. items that are still unique, but that can be split17    between multiple users)18-   Variety of economic options for dapp producers to choose from to create freemium games and other ways to attract19    users. As a step one, we implemented an economic model when a collection sponsor can be set to pay for collection20    Transfer transactions.2122Wider Unique Ecosystem (most of it was developed during Hackusama):2324-   [SubstraPunks Game hosted on IPFS](https://github.com/UniqueNetwork/substrapunks)25-   [Unique Wallet and UI](https://wallet.unique.network)26-   [NFT Asset for Unity Framework](https://github.com/usetech-llc/nft_unity)2728Please see our [walk-through instructions](doc/hackusama_walk_through.md) to try everything out!2930## Application Development3132If you are building an application that operates NFT tokens, use [this document](doc/application_development.md).333435## Building3637Building Unique chain requires special versions of Rust and toolchain. We don't use the most recent versions of everything38so that we can keep the builds stable.3940*Windows note: We do not provide support for Windows systems and don't test the Unique chain on them.41Nonetheless, the Unique chain node might work on Windows. To build it on Windows, you need to enable symlink support in Git:*42```43git config --global core.symlinks true44```45461. Install Rust:4748```bash49sudo apt-get install git curl libssl-dev llvm pkg-config libclang-dev clang make cmake protobuf-compiler50curl https://sh.rustup.rs -sSf | sh51```52532. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.54553. Install toolchain nightly-2023-05-22 and make it default:5657```bash58rustup toolchain install nightly-2023-05-2259rustup default nightly-2023-05-2260```61624. Add wasm target for nightly toolchain:6364```bash65rustup target add wasm32-unknown-unknown --toolchain nightly-2023-05-2266```67685. Build:6970Opal71```bash72cargo build --release73```74Quartz75```bash76cargo build --features=quartz-runtime --release77```78Unique79```bash80cargo build --features=unique-runtime --release81```8283## Building as Parachain locally8485Note: checkout this project and all related projects (see below) in the sibling folders (both under the same folder)8687### Build relay8889```90git clone https://github.com/paritytech/polkadot.git91cd polkadot92git checkout release-v0.9.4393cargo build --release94```9596### Build Unique parachain9798Run in the root of this project:99```100cargo build --release101```102103### Build Acala parachain (optional, full config only)104105```106git clone https://github.com/AcalaNetwork/Acala107cd Acala108git checkout 54db3acd409a0b787f116f20e163a3b24101ce38109make build-release110```111112## Running as Parachain locally113114### Dev mode115116You can launch the node in the dev mode where blocks are sealed automatically each 500 ms or on each new transaction.117118* Opal Runtime: `cargo run --release -- --dev`119* Quartz Runtime: `cargo run --release --features quartz-runtime -- --dev`120* Unique Runtime: `cargo run --release --features unique-runtime -- --dev`121122 You can tweak the dev mode with the following CLI options:123 * --idle-autoseal-interval <IDLE_AUTOSEAL_INTERVAL>124          When running the node in the `--dev` mode, an empty block will be sealed automatically after the `<IDLE_AUTOSEAL_INTERVAL>` milliseconds.125 * --disable-autoseal-on-tx126          Disable auto-sealing blocks on new transactions in the `--dev` mode127 * --autoseal-finalization-delay <AUTOSEAL_FINALIZATION_DELAY>128          Finalization delay (in seconds) of auto-sealed blocks in the `--dev` mode.129          Disabled by default.130131## Run Integration Tests1321331. Install all needed dependencies134```135cd tests136yarn install137```1381392. Run tests140```141yarn test142```143144145## Code Formatting146147### Apply formatting and clippy fixes148```bash149cargo clippy150cargo fmt151```152153### Format tests154```bash155pushd tests && yarn fix ; popd156```157158### Check code style in tests159```bash160cd tests && yarn eslint --ext .ts,.js src/161```162163### Enable checking of code style on commits164```bash165make git-hooks166```167168169## Karura token transfer170171To get started, you need to open inbound and outbound hrmp channels.172173### Next, we need to register our asset at Karura.174```175assetRegistry -> registerForeignAsset(location, metadata)176location:177	V0(X2(Parent, Parachain(PARA_ID)))178metadata:179	name         QTZ180	symbol       QTZ181	decimals     18182minimalBalance	 1183```184185### Next, we can send tokens from Quartz to Karura:186```187polkadotXcm -> reserveTransferAssets188dest:189	V0(X2(Parent, Parachain(<KARURA_PARA_ID>)))190beneficiary:191	X1(AccountId(Any, <ACCOUNT>))192assets:193	V1(Concrete(0,Here), Fungible(<AMOUNT>))194feeAssetItem:195	0196weightLimit:197	<LIMIT>198```199200The result will be displayed in ChainState201tokens -> accounts202203### To send tokens from Karura to Quartz:204```205xtokens -> transfer206207currencyId:208	ForeignAsset209		<TOKEN_ID>210211amount:212		<AMOUNT>213dest:214	V1215	(216		Parents:1,217		X2(Parachain(<KARURA_PARA_ID>), AccountId(Any, <ACCOUNT>)218	)219destWeight:220	<WEIGHT>221```