git.delta.rocks / unique-network / refs/commits / a4cc0ef96159

difftreelog

source

README.md5.0 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-2022-11-15 and make it default:5657```bash58rustup toolchain install nightly-2022-11-1559rustup default nightly-2022-11-1560```61624. Add wasm target for nightly toolchain:6364```bash65rustup target add wasm32-unknown-unknown --toolchain nightly-2022-11-1566```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### Polkadot launch utility8889```90git clone https://github.com/UniqueNetwork/polkadot-launch.git91git checkout unique-network92```9394### Build relay9596```97git clone https://github.com/paritytech/polkadot.git98cd polkadot99git checkout release-v0.9.43100cargo build --release101```102103### Build Unique parachain104105Run in the root of this project:106```107cargo build --release108```109110### Build Acala parachain (optional, full config only)111112```113git clone https://github.com/AcalaNetwork/Acala114cd Acala115git checkout 54db3acd409a0b787f116f20e163a3b24101ce38116make build-release117```118119## Running as Parachain locally120121```122./launch-testnet.sh123```124125Optional, full setup with Acala and Statemint126```127./launch-testnet-full.sh128```129130## Run Integration Tests1311321. Install all needed dependecies133```134cd tests135yarn install136```1371382. Run tests139```140yarn test141```142143144## Code Formatting145146### Apply formatting and clippy fixes147```bash148cargo clippy149cargo fmt150```151152### Format tests153```bash154pushd tests && yarn fix ; popd155```156157### Check code style in tests158```bash159cd tests && yarn eslint --ext .ts,.js src/160```161162163## Karura token transfer164165To get started, you need to open inbound and outbound hrmp channels.166167### Next, we need to register our asset at Karura.168```169assetRegistry -> registerForeignAsset(location, metadata)170location:171	V0(X2(Parent, Parachain(PARA_ID)))172metadata:173	name         QTZ174	symbol       QTZ175	decimals     18176minimalBalance	 1177```178179### Next, we can send tokens from Quartz to Karura:180```181polkadotXcm -> reserveTransferAssets182dest:183	V0(X2(Parent, Parachain(<KARURA_PARA_ID>)))184beneficiary:185	X1(AccountId(Any, <ACCOUNT>))186assets:187	V1(Concrete(0,Here), Fungible(<AMOUNT>))188feeAssetItem:189	0190weightLimit:191	<LIMIT>192```193194The result will be displayed in ChainState195tokens -> accounts196197### To send tokens from Karura to Quartz:198```199xtokens -> transfer200201currencyId:202	ForeignAsset203		<TOKEN_ID>204205amount:206		<AMOUNT>207dest:208	V1209	(210		Parents:1,211		X2(Parachain(<KARURA_PARA_ID>), AccountId(Any, <ACCOUNT>)212	)213destWeight:214	<WEIGHT>215```