Skip to content

Commit 312f5d5

Browse files
committed
Add GPL-v3 license
1 parent e79a227 commit 312f5d5

6 files changed

Lines changed: 109 additions & 0 deletions

File tree

zenlink-protocol/rpc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "zenlink-protocol-rpc"
33
version = "0.4.0"
44
authors = ["Zenlink Developers"]
55
edition = "2018"
6+
license = "GPL-3.0-only"
67

78
[package.metadata.docs.rs]
89
targets = ['x86_64-unknown-linux-gnu']

zenlink-protocol/rpc/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,3 +541,7 @@
541541
}
542542
}
543543
```
544+
545+
## License
546+
547+
[GPL-v3](LICENSE)

zenlink-protocol/rpc/runtime-api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "zenlink-protocol-runtime-api"
33
version = "0.4.0"
44
authors = ["Zenlink Developers"]
55
edition = "2018"
6+
license = "GPL-3.0-only"
67

78
[dependencies]
89
# alias "parity-scale-code" to "codec"

zenlink-protocol/src/README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
## Zenlink Protocol v0.4.0 Overview
2+
![zenlink protocol](./docs/zenlink-protocol-v0.4.0.png)
3+
4+
`Zenlink Protocol` mainly consists of two parts: assets and asset operations,
5+
namely `Zenlink Assets` and `Zenlink Actions`.
6+
Through the `UAI`(unified asset identifier) and `MultiAssetsHandler` interfaces,
7+
`Zenlink` can perform `Swap` and `Transfer By XCM` any asset on the chain.
8+
9+
## Zenlink Protocol v0.4.0 Features
10+
- Based on the `newest` XCM design
11+
- Based on `FRAMEv2`
12+
- Swap exchange fee `configurable`
13+
- `Compatible` Polkadot XCMP cross-chain asset processing
14+
- Zenlink Protocol registration whitelist-XCM `trust collection management`
15+
- Through Transfer-By-XCM, `assets can flow freely` between parachains
16+
- ZenlinkMultiAssets adapter comes with `LIQUIDITY` and `Foreign` asset processing, which can `adapt to various native assets such as NATIVE/LOCAL/RESERVE`
17+
- Provide LocalAssetHandler, OtherAssetHandler and other traits to `support locally defined assets such as LOCAL and RESERVE`
18+
- Under the control of MultiAssetsHandler, `assets can swap freely`
19+
20+
## UAI v0.1.0
21+
22+
- UAI v0.1.0 definition
23+
24+
```rust
25+
pub struct AssetId {
26+
pub chain_id: u32, // ParaId
27+
pub asset_type: u8, // Asset types supported by Zenlink Assets
28+
pub asset_index: u32, // the index number of the asset
29+
}
30+
```
31+
32+
- UAI v0.1.0 asset type
33+
34+
`asset_type` currently only supports the following values:
35+
36+
```rust
37+
/// Native currency, the most basic asset on each parachain
38+
pub const NATIVE: u8 = 0;
39+
/// Swap module asset, LP token generated by Zenlink DEX
40+
pub const LIQUIDITY: u8 = 1;
41+
/// Other asset type on this chain, other asset modules on this chain
42+
pub const LOCAL: u8 = 2;
43+
/// Reserved for future, reserved asset type
44+
pub const RESERVED: u8 = 3;
45+
```
46+
47+
In the current version of UAI, `Zenlink Assets` supports up to four locally defined assets of `Native/LIQUIDITY/LOCAL/RESERVED`.
48+
When these four assets are transferred across chains, a cross-chain mapping asset category `Foreign` will be generated inside `ZenlinkProtocol`.
49+
50+
- `Before and after the cross-chain asset transfer, the UAI of the asset has not changed`.
51+
52+
## MultiAssetsHandler
53+
54+
The trait is defined as follows
55+
```rust
56+
pub trait MultiAssetsHandler<AccountId> {
57+
fn balance_of(asset_id: AssetId, who: &AccountId) -> AssetBalance;
58+
fn total_supply(asset_id: AssetId) -> AssetBalance;
59+
fn is_exists(asset_id: AssetId) -> bool;
60+
fn transfer(
61+
asset_id: AssetId,
62+
origin: &AccountId,
63+
target: &AccountId,
64+
amount: AssetBalance,
65+
) -> DispatchResult {
66+
let withdrawn = Self::withdraw(asset_id, origin, amount)?;
67+
let _ = Self::deposit(asset_id, target, withdrawn)?;
68+
Ok(())
69+
}
70+
fn deposit(
71+
asset_id: AssetId,
72+
target: &AccountId,
73+
amount: AssetBalance,
74+
) -> Result<AssetBalance, DispatchError>;
75+
76+
fn withdraw(
77+
asset_id: AssetId,
78+
origin: &AccountId,
79+
amount: AssetBalance,
80+
) -> Result<AssetBalance, DispatchError>;
81+
}
82+
83+
```
84+
85+
- `is_exists` is a unified access interface for `Zenlink Actions`
86+
- `balance_of`, `total_supply`, `transfer` are `Zenlink Swap Action` access interface
87+
- `deposit`, `withdraw` are `Zenlink Transfer-By-XCM Action` access interface
88+
- `MultiAssetsHandler` can operate in addition to the four native defined assets identified by `UAI`,
89+
as well as the `cross-chain mapping asset Foreign` inside `ZenlinkProtocol`.
90+
91+
92+
## Swap and Transfer-By-XCM
93+
- Four native defined assets (`NATIVE/LIQUIDITY/LOCAL/RESERVED`) and cross-chain mapping assets (`Foreign`) can be exchanged through `MultiAssetsHandler`.
94+
- Four native defined assets (`NATIVE/LIQUIDITY/LOCAL/RESERVED`) Cross-chain asset transfer through `Transfer-By-XCM`, and a mapped asset `Foreign` is generated
95+
on the target parachain, Also through the `Transfer-By-XCM` cross-chain transfer back to the original definition chain of the asset.
96+
97+
98+
## License
99+
100+
[GPL-v3](LICENSE)
33.1 KB
Loading

zenlink-protocol/src/transfer/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright 2020-2021 Zenlink
2+
// Licensed under GPL-3.0.
3+
14
use super::*;
25

36
impl<T: Config> Pallet<T> {

0 commit comments

Comments
 (0)