Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset registry #516

Merged
merged 870 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
870 commits
Select commit Hold shift + click to select a range
dac393d
Refactor primitives (#171)
ark930 Jul 7, 2021
5afda45
update chain spec (#172)
ark930 Jul 7, 2021
46f8c6b
remove unused pallets (#173)
ark930 Jul 8, 2021
c3cbb46
vsbond-auction-fix (#174)
AllenPocketGamer Jul 9, 2021
6512a3e
Improve image build (#175)
yrong Jul 9, 2021
93d9ab2
Remove bifrost asset (#176)
yrong Jul 9, 2021
3a54bbc
Refactor docs (#177)
ark930 Jul 9, 2021
a4f7660
Fix build image (#180)
yrong Jul 10, 2021
211080b
companion for polkadot-v0.9.8 (#178)
ark930 Jul 10, 2021
b9b4ec1
Benchmarks runtime integration (#181)
yrong Jul 12, 2021
bcab94a
Xcm test framework (#182)
yrong Jul 13, 2021
e9442dc
Herry optimize (#183)
herryho Jul 13, 2021
2f4878c
Fix build image from ci (#184)
yrong Jul 13, 2021
c0b30cc
rename charge-transaction-fee module to flexible-fee (#185)
herryho Jul 14, 2021
63393b2
Refactor salp (#179)
AllenPocketGamer Jul 15, 2021
46d3234
vsbond-auction - support decimal price (#186)
AllenPocketGamer Jul 16, 2021
09a4fba
Fix token types (#187)
ark930 Jul 19, 2021
1dade32
Update rustfmt (#189)
AllenPocketGamer Jul 22, 2021
350ff07
feat: 🎸 add a macro to convert between currencyid and assetid (#188)
yooml Jul 22, 2021
d600485
Modify bancor (#190)
herryho Jul 24, 2021
ac814e8
Salp Revamp companion for dmp transfer (#191)
yrong Jul 26, 2021
fea1d46
fix: 🐛 add bootnode to bifrost.json (#192)
yooml Jul 27, 2021
7c310f8
Readme improvement (#193)
yrong Aug 2, 2021
f7c9180
Fix benchmarking&CI integration (#194)
yrong Aug 2, 2021
76d638b
No longer exposed unit_price to front-end (#195)
AllenPocketGamer Aug 2, 2021
7bda6fe
Ksm fee (#197)
herryho Aug 2, 2021
a109f2e
Alert monitoring (#198)
yrong Aug 2, 2021
ee0c867
Add development runtime (#200)
yrong Aug 3, 2021
ca9b244
remove pallet bridge (#201)
ark930 Aug 3, 2021
0cee15f
Add rules for parachain (#202)
yrong Aug 3, 2021
077b14e
add bancor benchmarking file (#203)
herryho Aug 3, 2021
deb3c70
modify flexible-fee module to charge KSM only in the situation of ins…
herryho Aug 3, 2021
0a9b363
- fix bancor missing 2 rpc interfaces (#207)
herryho Aug 5, 2021
98d2a95
Add manual-sealing consensus for dev runtime (#208)
yrong Aug 5, 2021
5d18085
Build wasm script (#209)
yrong Aug 6, 2021
14b98b3
Add script for pm2 deployment (#206)
yrong Aug 6, 2021
c359118
Local docker deployment (#205)
yrong Aug 6, 2021
e463617
Fix build image[skip ci] (#210)
yrong Aug 7, 2021
90eb4da
update readme intro (#212)
wodlj1314 Aug 7, 2021
408abc8
fix bug in minter reward module (#214)
herryho Aug 10, 2021
a335005
docs: ✏️ Run full node with docker (#216)
yooml Aug 11, 2021
c5d8082
More benchmarking (#217)
herryho Aug 11, 2021
df822e0
Bifrost v0.8.1 (#220)
ark930 Aug 12, 2021
d2f15ef
Try-runtime integration (#221)
yrong Aug 13, 2021
e108cb1
Add tokens and currencies (#211)
herryho Aug 14, 2021
72239e0
vsbond-acution benchmarking (#222)
herryho Aug 14, 2021
d1fdad7
Xcm revamp about buy weight for transact (#223)
yrong Aug 16, 2021
10db427
feat: 🎸 add Treasury and Bounties at bifrost runtime (#224)
yooml Aug 16, 2021
a1ad776
change ausd to kusd (#225)
herryho Aug 17, 2021
ff307b4
Force set vested (#228)
ark930 Aug 17, 2021
62572c5
feat: 🎸 add bifrost.weights (#226)
yooml Aug 17, 2021
6cc5b8c
Update orml dependencies (#230)
ark930 Aug 17, 2021
28db436
Bifrost v0.8.2 (#231)
ark930 Aug 18, 2021
c0e8c3d
Enable dmp transfer (#232)
yrong Aug 18, 2021
8b2e14c
add orml-xtokens (#233)
herryho Aug 18, 2021
d84e09a
Add kar (#234)
herryho Aug 18, 2021
55b0b6d
Develop Liquidity-mining pallet (#199)
AllenPocketGamer Aug 18, 2021
429c999
Salp revamp with multisig account to confirm (#227)
yrong Aug 18, 2021
8ad10bc
:bug: ($PALLET) Fix liquidity-mining mock error (#237)
AllenPocketGamer Aug 19, 2021
315384a
Revamp salp xcm weight (#236)
yrong Aug 19, 2021
8a01236
fixes for xcm conversion of KAR and KUSD (#238)
herryho Aug 19, 2021
0d8a5aa
Merge branch 'develop' into weights (#235)
yooml Aug 19, 2021
711e6a1
Enable democracy (#239)
yrong Aug 19, 2021
c5b56ce
Fix fee (#240)
yrong Aug 20, 2021
ffbcf20
Fee charge ksm directly (#241)
herryho Aug 20, 2021
f08b540
Adjust gov params (#244)
ark930 Aug 20, 2021
a8f10da
adjust treasury stuff (#245)
ark930 Aug 20, 2021
a639e80
add flexible-fee module to Bifrost runtime (#247)
herryho Aug 21, 2021
d62d88e
add FeeMultiplierUpdate (#249)
herryho Aug 23, 2021
9f92dbf
Revamp salp origin (#242)
yrong Aug 23, 2021
ae5fe7f
Opt flexible fee (#251)
herryho Aug 24, 2021
75c568c
Opti liquidity-mining (#243)
AllenPocketGamer Aug 24, 2021
aec2fe8
Bifrost V0.8.3 (#246)
ark930 Aug 24, 2021
91ac920
Salp with derivate (#250)
yrong Aug 24, 2021
ae43d29
Bump dependencies of Cumulus to polkadot-v0.9.9 (#253)
ark930 Aug 27, 2021
8a2f683
merge from v0.8.3 into develop (#256)
ark930 Aug 30, 2021
e7bbdbe
disable treasury burn (#257)
ark930 Aug 30, 2021
4e01a7d
fix bad mandatory error (#258)
ark930 Aug 31, 2021
e35322f
Salp with rpc (#252)
yrong Aug 31, 2021
eb5b87b
feat: 🎸 add pallet_multisig (#261)
yooml Sep 1, 2021
3790aac
Add xtokens to Bifrost runtime (#260)
herryho Sep 1, 2021
a23fd9b
SALP optimization (#262)
ark930 Sep 1, 2021
2445428
Refact collator (#263)
yrong Sep 2, 2021
88d3128
:pencil: ($PALLET) Add docs to vsbond-auction (#264)
AllenPocketGamer Sep 2, 2021
71a0444
fix KAR\KUSD existential deposit (#265)
herryho Sep 3, 2021
53a7628
Fix salp rpc (#270)
yrong Sep 6, 2021
26bb343
add multiple fee traders (#271)
herryho Sep 7, 2021
724afb5
fix BNC as xcmp fee currency (#274)
herryho Sep 7, 2021
7388a8a
fix Bancor rpc for returning value as NumberOrHex (#275)
herryho Sep 7, 2021
1b37e2d
Fix break benchmark&Update weight (#273)
yrong Sep 7, 2021
0f44138
:ambulance: ($RUNTIME) Change Salp::MinContribution to 0.1KSM at Bifr…
AllenPocketGamer Sep 8, 2021
13d8cf4
Revamp salp fee (#279)
yrong Sep 9, 2021
6a6c989
add-orml-xcm (#280)
herryho Sep 9, 2021
c448a6a
Revamp salp origin (#283)
yrong Sep 11, 2021
9076bfe
add-endowment-in-bifrost-test-chainspec (#284)
herryho Sep 11, 2021
028ff49
fix KUSD type to CurrencyId::Stable (#286)
ark930 Sep 11, 2021
36b2017
fix KUSD in develop branch (#288)
herryho Sep 11, 2021
759fe0f
Charge salp transaction fee (#289)
herryho Sep 13, 2021
883c1a2
Revamp salp rpc (#290)
yrong Sep 13, 2021
ea39c89
Change SALP multisig account (#291)
ark930 Sep 13, 2021
3c4c9d1
fix compact error (#292)
ark930 Sep 13, 2021
d62595f
fix () implementation for trait BancorHandler (#293)
herryho Sep 13, 2021
eae2902
delete bancor for bifrost runtime (#294)
herryho Sep 13, 2021
3c7d7e7
Bump v0.9.0 (#295)
ark930 Sep 13, 2021
cd49e91
Revamp salp with fund edit (#296)
yrong Sep 14, 2021
918191c
Revamp&Fix in salp (#298)
yrong Sep 15, 2021
b612cae
add alice to council and tech committee (#301)
herryho Sep 17, 2021
b8eb722
Refactor vsbond auction (#300)
AllenPocketGamer Sep 17, 2021
40081bb
Revamp ci&image flow (#304)
yrong Sep 18, 2021
a45fd47
Refactor liquidity mining (#302)
AllenPocketGamer Sep 18, 2021
16379d8
add ZLK (#303)
herryho Sep 18, 2021
bd858fe
Modify lm reviewed (#307)
AllenPocketGamer Sep 19, 2021
aa1c8aa
opt bifrost_local chainspec (#306)
herryho Sep 19, 2021
b9fa09f
Salp improve (#305)
yrong Sep 22, 2021
5bc6047
Integration test (#282)
yrong Sep 22, 2021
bb89fb6
Add benchmarking to lm (#309)
AllenPocketGamer Sep 23, 2021
2183207
allow vsksm and vsbond transferring (#310)
herryho Sep 23, 2021
7e2295b
Add lm weights to bifrost runtime (#311)
AllenPocketGamer Sep 23, 2021
1fd3e9a
benchmark for liquidity mining (#313)
ark930 Sep 24, 2021
363c71d
Modify lm redeem (#314)
AllenPocketGamer Sep 25, 2021
8c5c74d
Fix lm bug (#315)
AllenPocketGamer Sep 26, 2021
1c033d9
Liquidity mining benchmark (#316)
ark930 Sep 26, 2021
e65e492
Benchmark for salp (#317)
ark930 Sep 26, 2021
2104d92
Add rpc for lm (#318)
AllenPocketGamer Sep 27, 2021
8f571fe
:bug: ($PROJ) Upgrade Cargo.lock (#319)
AllenPocketGamer Sep 27, 2021
0b0a642
Fix dust white list (#320)
AllenPocketGamer Sep 28, 2021
a412aa6
vsksm crosschain support (#312)
herryho Sep 28, 2021
e0efbef
Refactor Asgard runtime (#322)
ark930 Sep 28, 2021
2c0665f
Token issuer (#321)
herryho Sep 29, 2021
5948e6b
bump zenlink (#323)
herryho Sep 29, 2021
bcb4238
bump zenlink (#324)
herryho Sep 29, 2021
7503c1b
zenlink lptoken (#325)
herryho Sep 29, 2021
cc1c260
fix: 🐛 modify ControlOrigin of liquidity_mining (#329)
yooml Oct 8, 2021
652fa04
feat: 🎸 add zenlink to bifrost (#330)
yooml Oct 8, 2021
b254b50
Update deps to polkadot-v0.9.10 (#328)
ark930 Oct 9, 2021
4c59cf7
Add token issuer benchmarking (#331)
herryho Oct 9, 2021
26fc8b4
Fix integration test (#332)
yrong Oct 9, 2021
02ed96b
add zenlink rpc (#333)
herryho Oct 9, 2021
34e755f
update rust toolchain to nightly-2021-09-12 (#334)
ark930 Oct 9, 2021
557283a
Bump version to v0.9.2 (#336)
ark930 Oct 9, 2021
d8e02b6
Fix lm reward settlement (#335)
AllenPocketGamer Oct 9, 2021
84c7f2d
Fix lm force retire (#337)
AllenPocketGamer Oct 9, 2021
7e6cd6f
unit tests done (#327)
herryho Oct 10, 2021
c4926c6
minor fix (#339)
ark930 Oct 11, 2021
fc77a81
delete multiweighttraders (#340)
herryho Oct 11, 2021
353c4f1
Allow token transfer except BNC and ZLK (#341)
ark930 Oct 11, 2021
b14aaf2
:ambulance: ($PALLET) Discard remain reward be less than ed (#344)
AllenPocketGamer Oct 12, 2021
61222d3
Allow BNC transfer and enable vesting (#343)
ark930 Oct 13, 2021
0868653
Handle bnc vsbond with speical method (#338)
AllenPocketGamer Oct 13, 2021
dea8040
Xcm refact (#345)
yrong Oct 13, 2021
815e9db
More docs to lm (#346)
AllenPocketGamer Oct 13, 2021
3cf691b
Delete useless code (#342)
AllenPocketGamer Oct 13, 2021
669124a
add-lightening-redeem-to-bifrost (#347)
herryho Oct 14, 2021
cc842f5
Support system api (#350)
ark930 Oct 14, 2021
0e8f7b9
V0.9.3 (#353)
ark930 Oct 15, 2021
3d4b476
Add system api (#351)
ark930 Oct 15, 2021
bd36a59
Add README to lm (#349)
AllenPocketGamer Oct 15, 2021
5986aa5
:bug: ($NODE) Fix interrupt when launch asgard-genesis (#356)
AllenPocketGamer Oct 15, 2021
2e7db6c
Clear runtime upgrade codes (#348)
ark930 Oct 17, 2021
2e35155
Update deps to polkadot-v0.9.11 (#362)
ark930 Oct 19, 2021
abe630d
bump version to 0.9.6 (#364)
ark930 Oct 19, 2021
e2a745b
Add salp-lite pallet (#359)
yrong Oct 19, 2021
163426d
add-vsdot-vsbond (#361)
herryho Oct 19, 2021
3ab158f
Revamp xcm for v2 (#366)
yrong Oct 20, 2021
ed9c42d
Fix dev executor (#367)
yrong Oct 20, 2021
dac357f
Revamp fund migration (#368)
yrong Oct 20, 2021
82f860d
Add release script for ci[skip ci] (#369)
yrong Oct 21, 2021
0d62593
Revamp message id (#371)
yrong Oct 21, 2021
177e549
Fix VersionWrapper (#372)
yrong Oct 22, 2021
85ea0d0
minor fix (#374)
ark930 Oct 22, 2021
69fa2d8
fix support of token dot (#384)
herryho Nov 1, 2021
3274e84
Update for xcm v2 (#385)
yrong Nov 2, 2021
4ad39cc
feat: 🎸 add pallet_identity (#375)
yooml Nov 2, 2021
9c6bac9
Add call switchgear & combine benchmark fixes from Allen and Ron (#386)
herryho Nov 2, 2021
09caa32
Generate WeightInfo Automatically (#380)
AllenPocketGamer Nov 2, 2021
4f96f75
Fix try runtime migration (#389)
yrong Nov 3, 2021
ac2e667
:fire: ($CI) Annote bench (#390)
AllenPocketGamer Nov 3, 2021
74f829e
Sync dev chain (#391)
yrong Nov 4, 2021
21890ce
fix-callswitchgear-in-dev (#392)
herryho Nov 4, 2021
e608071
Update deps to polkadot-v0.9.12 (#394)
ark930 Nov 9, 2021
fdf1f2c
:bug: ($PALLET) Fix the encode-method is called by lm::rpc (#395)
AllenPocketGamer Nov 9, 2021
d845a25
Rich benchmarkings (#396)
herryho Nov 9, 2021
c41aeff
ban ZLK transfer and PhragmenElection in bifrost rutnime (#398)
herryho Nov 10, 2021
083a366
Refact client & dev chain (#393)
yrong Nov 10, 2021
2fb28fb
change dot ed value and the order of zlk banned call (#399)
herryho Nov 10, 2021
89fc2f6
change-flexible-fee-format (#401)
herryho Nov 10, 2021
29e296a
:bug: ($PALLET) Fix a potential bug about ChargedPoolIds (#403)
AllenPocketGamer Nov 11, 2021
0ae37fe
Bifrost v0.9.8 (#388)
ark930 Nov 13, 2021
cf924ec
remove zenlink transfer control (#418)
herryho Nov 26, 2021
e49cb4a
Upgrade components and introduce srtool into ci flow (#419)
yrong Nov 29, 2021
25bd5d4
Bump version to `v0.9.10` (#416)
AllenPocketGamer Nov 29, 2021
b352905
Bifrost v0.9.10 (#424)
ark930 Dec 1, 2021
facf04a
Fix ci & Upgrade toolchain (#422)
yrong Dec 2, 2021
362205d
Currency unit (#413)
yrong Dec 2, 2021
bafca47
Fix benchmark & Add to ci (#428)
yrong Dec 5, 2021
8a37016
remove zenlink data migration code (#429)
herryho Dec 6, 2021
a3c72c6
hot fix for currency (#431)
yrong Dec 7, 2021
c1a7e9b
Bifrost v0.9.12 (#425)
ark930 Dec 9, 2021
b58f9ab
Fix integration tests & Optimize binary (#432)
yrong Dec 9, 2021
c658476
Bifrost polkadot runtime (#430)
herryho Dec 10, 2021
f0decb0
:ambulance: ($PALLET) Quick fix for vsbond-auction (#435)
AllenPocketGamer Dec 10, 2021
b0fe30d
:ambulance: ($RUNTIME) Imprv max deposit in liquidity pool (#438)
AllenPocketGamer Dec 11, 2021
c44aaf0
Add token pha & more (#427)
herryho Dec 13, 2021
032b9c5
Update deps to polkadot-v0.9.13 and move rust edition to 2021 (#439)
ark930 Dec 13, 2021
8684f2b
Revamp redeem flow in salp-lite (#440)
yrong Dec 15, 2021
99f7082
fix wasm build script (#445)
ark930 Dec 16, 2021
02a128c
feat: 🎸 add build-bifrost-wasm-jenkins for Makefile (#446)
yooml Dec 22, 2021
ac3b28a
Update zenlink to rely on Polkadot-0.9.13 dependencies (#452)
herryho Dec 24, 2021
e449e20
add transactional macro to callables (#451)
herryho Dec 24, 2021
c42bd08
[skip ci] fix benchmark name (#454)
ark930 Dec 24, 2021
5f964a1
Revamp salp(lite) with configurable multisig account (#444)
yrong Dec 24, 2021
1fe2659
add a overall control toggle (#449)
herryho Dec 24, 2021
63ac67f
Add edit fund interface & Some fix (#457)
yrong Dec 27, 2021
29b108d
[skip ci] add named-profiles features (#459)
yooml Dec 28, 2021
ce93385
add-modify-vestingInfo-function to the vesting pallet (#450)
herryho Dec 28, 2021
4243ebd
Revamp vsbond auction (#448)
herryho Dec 28, 2021
ee7cd81
Bifrost v0.9.16 (#458)
ark930 Jan 1, 2022
59e87b0
[skip ci] remove parachain-id (#464)
ark930 Jan 4, 2022
5b0d8b6
move bifrost runtime to bifrost-kusama (#463)
ark930 Jan 4, 2022
71abbe4
remove VsbondAuctionOnRuntimeUpgrade (#465)
ark930 Jan 4, 2022
fce934c
Bifrost V0.9.18 (#471)
ark930 Jan 13, 2022
1d4f0aa
[skip ci] update srtool to 1.57.0 (#474)
ark930 Jan 13, 2022
06550ea
Support statemine asset transfer (#420)
yrong Jan 13, 2022
a3ab560
Bifrost v0.9.20 (#475)
ark930 Jan 16, 2022
a355423
Bifrost v0.9.22 (#476)
AllenPocketGamer Jan 19, 2022
a54e1d4
update merkle-distributor (#479)
yooml Jan 24, 2022
535924c
Revamp salp with fund continue flow (#480)
yrong Jan 24, 2022
caf9749
add bifrost stage chain spec (#467)
ark930 Jan 26, 2022
304656b
V0.9.23 (#482)
yrong Jan 27, 2022
2ca13f5
Bifrost v0.9.24 (#485)
herryho Jan 29, 2022
666a1ca
Happy new year 2022 (#486)
ark930 Feb 5, 2022
8e070c2
[skip ci] Optimize release (#487)
ark930 Feb 5, 2022
c6f6913
[skip ci] Remove cargo-features = ["named-profiles"] (#488)
ark930 Feb 5, 2022
77eb5ca
[skip ci] Remove `resolver = "2"` since it's default settings in edit…
ark930 Feb 5, 2022
6643f80
[skip ci] Update bootnodes for bifrost-kusama runtime (#493)
ark930 Feb 7, 2022
a81293e
Bifrost v0.9.25 (#492)
yooml Feb 9, 2022
b44d28b
[skip ci] Fix bootnodes (#495)
ark930 Feb 9, 2022
5f14d93
Bifrost v0.9.26 (#494)
yrong Feb 14, 2022
be3f819
add dependabot.yml (#468)
ark930 Feb 14, 2022
ec09e5d
Bump serde_json from 1.0.78 to 1.0.79 (#496)
dependabot[bot] Feb 15, 2022
5eff85f
Refact xcm interface and fee charge (#503)
yrong Feb 24, 2022
f2608de
Add ForeignAsset type into CurrencyId
ark930 Mar 13, 2022
0c1e428
Add pallet asset-registry
ark930 Mar 13, 2022
8c333b6
test case for CurrencyId::ForeignAsset
ark930 Mar 15, 2022
3cd0c52
Merge from develop
ark930 Mar 18, 2022
877e583
Merge from develop
ark930 Mar 22, 2022
c6f7af2
fix asset-registry
ark930 Mar 23, 2022
236a278
support foreign asset conversion
ark930 Mar 23, 2022
8e82243
Merge from develop
ark930 Mar 24, 2022
0352f30
Support Moonriver Native token
ark930 Mar 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 106 additions & 92 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"node/primitives",
"node/rpc",
"node/service",
"pallets/asset-registry",
"pallets/flexible-fee",
"pallets/lightening-redeem",
"pallets/liquidity-mining",
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ build-bifrost-polkadot-wasm:

.PHONY: build-bifrost-rococo-fast-wasm
build-bifrost-rococo-fast-wasm:
.maintain/build-wasm.sh bifrost-kusama fast
.maintain/build-wasm.sh bifrost-kusama fast

.PHONY: check-try-runtime
check-try-runtime:
Expand All @@ -124,7 +124,7 @@ insert-session-key:

.PHONY: generate-node-key
generate-node-key:
subkey generate-node-key --file ./resources/node-key
subkey generate-node-key --file ./resources/node-key

.PHONY: view-key
view-key:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cd -
```bash
git clone -n https://github.com/paritytech/polkadot.git /tmp/polkadot
cd /tmp/polkadot
git checkout release-v0.9.16
git checkout release-v0.9.17
cargo build --release
cd -
```
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ fn parachain_subaccounts_are_unique() {
hex_literal::hex!["70617261d1070000000000000000000000000000000000000000000000000000"]
.into()
);

assert_eq!(RelaychainSovereignSubAccount::get(), create_x2_multilocation(0));
});
}

Expand Down
1 change: 1 addition & 0 deletions integration-tests/src/statemine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use xcm_emulator::TestExt;
use crate::{integration_tests::*, kusama_test_net::*};
#[test]
fn statemine() {
env_logger::init();
Statemine::execute_with(|| {
use frame_support::traits::Currency;
use westmint_runtime::*;
Expand Down
71 changes: 44 additions & 27 deletions node/primitives/src/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ macro_rules! create_currency_id {
| Self::Stable(ts)
| Self::VSToken(ts)
| Self::VSBond(ts, ..) => ts as u8,
Self::ForeignAsset(..) => 0u8,
Self::LPToken(..) => 0u8
} as u64;

Expand Down Expand Up @@ -188,52 +189,56 @@ macro_rules! create_currency_id {
Self::LPToken(token_symbol_1, token_type_1, token_symbol_2, token_type_2) => {
(((*token_symbol_1 as u64) << 16) & 0x0000_0000_00ff_0000) + (((*token_type_1 as u64) << 24) & 0x0000_0000_ff00_0000) +
(((*token_symbol_2 as u64) << 32) & 0x0000_00ff_0000_0000) + (((*token_type_2 as u64) << 40) & 0x0000_ff00_0000_0000) + discr
},
Self::ForeignAsset(asset_token_id) => {
(((*asset_token_id as u64) << 16) & 0x0000_ffff_ffff_0000) + discr
}
}
}

fn name(&self) -> &str {
fn name(&self) -> Option<&str> {
match self {
$(CurrencyId::Native(TokenSymbol::$symbol) => $name,)*
$(CurrencyId::Stable(TokenSymbol::$symbol) => $name,)*
$(CurrencyId::Token(TokenSymbol::$symbol) => $name,)*
$(CurrencyId::VToken(TokenSymbol::$symbol) => $name,)*
$(CurrencyId::VSToken(TokenSymbol::$symbol) => $name,)*
$(CurrencyId::VSBond(TokenSymbol::$symbol, ..) => $name,)*
$(CurrencyId::Native(TokenSymbol::$symbol) => Some($name),)*
$(CurrencyId::Stable(TokenSymbol::$symbol) => Some($name),)*
$(CurrencyId::Token(TokenSymbol::$symbol) => Some($name),)*
$(CurrencyId::VToken(TokenSymbol::$symbol) => Some($name),)*
$(CurrencyId::VSToken(TokenSymbol::$symbol) => Some($name),)*
$(CurrencyId::VSBond(TokenSymbol::$symbol, ..) => Some($name),)*
CurrencyId::LPToken(ts1, type1, ts2, type2) => {
let c1_u64: u64 = (((*type1 as u64) << 8) & 0x0000_0000_0000_ff00) + ((*ts1 as u64) & 0x0000_0000_0000_00ff);
let c2_u64: u64 = (((*type2 as u64) << 8) & 0x0000_0000_0000_ff00) + ((*ts2 as u64) & 0x0000_0000_0000_00ff);

let _c1: CurrencyId = c1_u64.try_into().unwrap_or_default();
let _c2: CurrencyId = c2_u64.try_into().unwrap_or_default();
stringify!(_c1.name(), ",", _c2.name())
}
Some(stringify!(_c1.name(), ",", _c2.name()))
},
_ => None
}
}

fn symbol(&self) -> &str {
fn symbol(&self) -> Option<&str> {
match self {
$(CurrencyId::Native(TokenSymbol::$symbol) => stringify!($symbol),)*
$(CurrencyId::Stable(TokenSymbol::$symbol) => stringify!($symbol),)*
$(CurrencyId::Token(TokenSymbol::$symbol) => stringify!($symbol),)*
$(CurrencyId::VToken(TokenSymbol::$symbol) => stringify!($symbol),)*
$(CurrencyId::VSToken(TokenSymbol::$symbol) => stringify!($symbol),)*
$(CurrencyId::VSBond(TokenSymbol::$symbol, ..) => stringify!($symbol),)*
CurrencyId::LPToken(_ts1, _, _ts2, _) => {
stringify!(_ts1, ",", _ts2)
}
$(CurrencyId::Native(TokenSymbol::$symbol) => Some(stringify!($symbol)),)*
$(CurrencyId::Stable(TokenSymbol::$symbol) => Some(stringify!($symbol)),)*
$(CurrencyId::Token(TokenSymbol::$symbol) => Some(stringify!($symbol)),)*
$(CurrencyId::VToken(TokenSymbol::$symbol) => Some(stringify!($symbol)),)*
$(CurrencyId::VSToken(TokenSymbol::$symbol) => Some(stringify!($symbol)),)*
$(CurrencyId::VSBond(TokenSymbol::$symbol, ..) => Some(stringify!($symbol)),)*
CurrencyId::LPToken(_ts1, _, _ts2, _) => Some(stringify!(_ts1, ",", _ts2)),
_ => None
}
}

fn decimals(&self) -> u8 {
fn decimals(&self) -> Option<u8> {
match self {
$(CurrencyId::Native(TokenSymbol::$symbol) => $deci,)*
$(CurrencyId::Stable(TokenSymbol::$symbol) => $deci,)*
$(CurrencyId::Token(TokenSymbol::$symbol) => $deci,)*
$(CurrencyId::VToken(TokenSymbol::$symbol) => $deci,)*
$(CurrencyId::VSToken(TokenSymbol::$symbol) => $deci,)*
$(CurrencyId::VSBond(TokenSymbol::$symbol, ..) => $deci,)*
CurrencyId::LPToken(..) => 1u8
$(CurrencyId::Native(TokenSymbol::$symbol) => Some($deci),)*
$(CurrencyId::Stable(TokenSymbol::$symbol) => Some($deci),)*
$(CurrencyId::Token(TokenSymbol::$symbol) => Some($deci),)*
$(CurrencyId::VToken(TokenSymbol::$symbol) => Some($deci),)*
$(CurrencyId::VSToken(TokenSymbol::$symbol) => Some($deci),)*
$(CurrencyId::VSBond(TokenSymbol::$symbol, ..) => Some($deci),)*
CurrencyId::LPToken(..) => Some(1u8),
_ => None
}
}
}
Expand Down Expand Up @@ -280,6 +285,8 @@ impl Default for TokenSymbol {
}
}

pub type ForeignAssetId = u32;

/// Currency ID, it might be extended with more variants in the future.
#[derive(
Encode,
Expand All @@ -305,6 +312,7 @@ pub enum CurrencyId {
VSBond(TokenSymbol, ParaId, LeasePeriod, LeasePeriod),
// [currency1 Tokensymbol, currency1 TokenType, currency2 TokenSymbol, currency2 TokenType]
LPToken(TokenSymbol, u8, TokenSymbol, u8),
ForeignAsset(ForeignAssetId),
}

impl Default for CurrencyId {
Expand Down Expand Up @@ -368,6 +376,7 @@ impl CurrencyId {
Self::VSToken(..) => 4,
Self::VSBond(..) => 5,
Self::LPToken(..) => 6,
Self::ForeignAsset(..) => 7,
}
}
}
Expand Down Expand Up @@ -403,6 +412,10 @@ impl CurrencyIdExt for CurrencyId {
matches!(self, CurrencyId::LPToken(..))
}

fn is_foreign_asset(&self) -> bool {
matches!(self, CurrencyId::ForeignAsset(..))
}

fn into(symbol: Self::TokenSymbol) -> Self {
CurrencyId::Token(symbol)
}
Expand Down Expand Up @@ -440,6 +453,10 @@ impl TryFrom<u64> for CurrencyId {

Ok(Self::LPToken(token_symbol_1, token_type_1, token_symbol_2, token_type_2))
},
7 => {
let foreign_asset_id = ((id & 0x0000_ffff_ffff_0000) >> 16) as ForeignAssetId;
Ok(Self::ForeignAsset(foreign_asset_id))
},
_ => Err(()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mod tests;

pub use crate::{
bridge::*,
currency::{CurrencyId, TokenSymbol},
currency::{CurrencyId, ForeignAssetId, TokenSymbol},
traits::*,
};

Expand Down
24 changes: 24 additions & 0 deletions node/primitives/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ fn currency_id_to_u64_should_work() {
assert_eq!(0x0000_0103_0002_0600, e61.currency_id());
assert_eq!(0x0000_0205_0104_0600, e62.currency_id());
assert_eq!(0x0000_0406_0300_0600, e63.currency_id());

let e70 = CurrencyId::ForeignAsset(0);
let e71 = CurrencyId::ForeignAsset(1);
let e72 = CurrencyId::ForeignAsset(255);
let e73 = CurrencyId::ForeignAsset(256);
let e74 = CurrencyId::ForeignAsset(ForeignAssetId::MAX);

assert_eq!(0x0000_0000_0000_0700, e70.currency_id());
assert_eq!(0x0000_0000_0001_0700, e71.currency_id());
assert_eq!(0x0000_0000_00ff_0700, e72.currency_id());
assert_eq!(0x0000_0000_0100_0700, e73.currency_id());
assert_eq!(0x0000_ffff_ffff_0700, e74.currency_id());
}

#[test]
Expand Down Expand Up @@ -245,4 +257,16 @@ fn u64_to_currency_id_should_work() {
assert_eq!(e61, CurrencyId::try_from(0x0000_0103_0002_0600).unwrap());
assert_eq!(e62, CurrencyId::try_from(0x0000_0205_0104_0600).unwrap());
assert_eq!(e63, CurrencyId::try_from(0x0000_0406_0300_0600).unwrap());

let e70 = CurrencyId::ForeignAsset(0);
let e71 = CurrencyId::ForeignAsset(1);
let e72 = CurrencyId::ForeignAsset(255);
let e73 = CurrencyId::ForeignAsset(256);
let e74 = CurrencyId::ForeignAsset(ForeignAssetId::MAX);

assert_eq!(e70, CurrencyId::try_from(0x0000_0000_0000_0700).unwrap());
assert_eq!(e71, CurrencyId::try_from(0x0000_0000_0001_0700).unwrap());
assert_eq!(e72, CurrencyId::try_from(0x0000_0000_00ff_0700).unwrap());
assert_eq!(e73, CurrencyId::try_from(0x0000_0000_0100_0700).unwrap());
assert_eq!(e74, CurrencyId::try_from(0x0000_ffff_ffff_0700).unwrap());
}
19 changes: 15 additions & 4 deletions node/primitives/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ use sp_runtime::{
};
use sp_std::{fmt::Debug, vec::Vec};

use crate::BridgeAssetBalance;
use crate::{BridgeAssetBalance, CurrencyId};

pub trait TokenInfo {
fn currency_id(&self) -> u64;
fn name(&self) -> &str;
fn symbol(&self) -> &str;
fn decimals(&self) -> u8;
fn name(&self) -> Option<&str>;
fn symbol(&self) -> Option<&str>;
fn decimals(&self) -> Option<u8>;
}

/// Extension trait for CurrencyId
Expand All @@ -50,6 +50,7 @@ pub trait CurrencyIdExt {
fn is_native(&self) -> bool;
fn is_stable(&self) -> bool;
fn is_lptoken(&self) -> bool;
fn is_foreign_asset(&self) -> bool;
fn into(symbol: Self::TokenSymbol) -> Self;
}

Expand Down Expand Up @@ -195,3 +196,13 @@ where
}
}
}

/// A mapping between AssetId and AssetMetadata.
pub trait AssetIdMapping<ForeignAssetId, MultiLocation, AssetMetadata> {
/// Returns the AssetMetadata associated with a given ForeignAssetId.
fn get_foreign_asset_metadata(foreign_asset_id: ForeignAssetId) -> Option<AssetMetadata>;
/// Returns the MultiLocation associated with a given ForeignAssetId.
fn get_multi_location(foreign_asset_id: ForeignAssetId) -> Option<MultiLocation>;
/// Returns the CurrencyId associated with a given MultiLocation.
fn get_currency_id(multi_location: MultiLocation) -> Option<CurrencyId>;
}
4 changes: 2 additions & 2 deletions node/service/src/chain_spec/bifrost_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ fn bifrost_kusama_properties() -> Properties {
]
.iter()
.for_each(|token| {
token_symbol.push(token.symbol().to_string());
token_decimals.push(token.decimals() as u32);
token_symbol.push(token.symbol().expect("Token symbol expected").to_string());
token_decimals.push(token.decimals().expect("Token decimals expected") as u32);
});

properties.insert("tokenSymbol".into(), token_symbol.into());
Expand Down
4 changes: 2 additions & 2 deletions node/service/src/chain_spec/bifrost_polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fn bifrost_polkadot_properties() -> Properties {
]
.iter()
.for_each(|token| {
token_symbol.push(token.symbol().to_string());
token_decimals.push(token.decimals() as u32);
token_symbol.push(token.symbol().expect("Token symbol expected").to_string());
token_decimals.push(token.decimals().expect("Token decimals expected") as u32);
});

properties.insert("tokenSymbol".into(), token_symbol.into());
Expand Down
42 changes: 42 additions & 0 deletions pallets/asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
name = "bifrost-asset-registry"
version = "0.8.0"
authors = ["Edwin Wang <lark930@gmail.com>"]
edition = "2021"

[dependencies]
log = { version = "0.4.14", default-features = false }
serde = { version = "1.0.124", optional = true }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.3.1", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17", default-features = false }
primitives = { package = "node-primitives", path = "../../node/primitives", default-features = false }

xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.17", default-features = false }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.17" }

[features]
default = ["std"]
std = [
"serde",
"log/std",
"codec/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
"frame-support/std",
"frame-system/std",
"primitives/std",
"xcm/std",
"xcm-builder/std",
"xcm-executor/std",
]
try-runtime = ["frame-support/try-runtime"]
Loading