Skip to content

Commit

Permalink
Add assets component (#69)
Browse files Browse the repository at this point in the history
* Add asset pallet

* Add asset precompile

* Add precompile interface

* Impl all asset precompile interfaces

* Self review

* Code clean

* Add mock file

* Fix test compile

* Add test 1

* Add test 2

* Add test 3

* Add test 4

* Finish test

* Add another type

* Update asset origin

* Fix CI

* Move out from Others

* Add asset to other runtimes
  • Loading branch information
boundless-forest authored Nov 29, 2022
1 parent e5be305 commit fc0ea38
Show file tree
Hide file tree
Showing 23 changed files with 1,920 additions and 10 deletions.
43 changes: 42 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions node/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub fn config() -> ChainSpec {
parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: 2105.into() },

// Monetary stuff.
assets: Default::default(),
balances: Default::default(),
transaction_payment: Default::default(),

Expand Down Expand Up @@ -249,6 +250,7 @@ fn testnet_genesis(
parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: id },

// Monetary stuff.
assets: Default::default(),
balances: crab_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(),
},
Expand Down
2 changes: 2 additions & 0 deletions node/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub fn config() -> ChainSpec {
parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() },

// Monetary stuff.
assets: Default::default(),
balances: Default::default(),
transaction_payment: Default::default(),

Expand Down Expand Up @@ -251,6 +252,7 @@ fn testnet_genesis(
parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id },

// Monetary stuff.
assets: Default::default(),
balances: darwinia_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(),
},
Expand Down
2 changes: 2 additions & 0 deletions node/src/chain_spec/pangolin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub fn config() -> ChainSpec {
parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: 2105.into() },

// Monetary stuff.
assets: Default::default(),
balances: Default::default(),
transaction_payment: Default::default(),

Expand Down Expand Up @@ -251,6 +252,7 @@ fn testnet_genesis(
parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: id },

// Monetary stuff.
assets: Default::default(),
balances: pangolin_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(),
},
Expand Down
59 changes: 59 additions & 0 deletions precompiles/assets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[package]
authors = ["Darwinia Network <[email protected]>"]
description = "Assets precompiles for EVM pallet."
edition = "2021"
homepage = "https://darwinia.network"
license = "GPL-3.0"
name = "darwinia-precompile-assets"
readme = "README.md"
repository = "https://github.com/darwinia-network/darwinia"
version = "6.0.0"

[dependencies]
# frontier
fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }
pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" }

# moonbeam
precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" }

# paritytech
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
[dev-dependencies]
# crates.io
codec = { package = "parity-scale-codec", version = "3.2" }
scale-info = { version = "2.3", features = ["derive"] }
sha3 = { version = "0.8" }

# moonbeam
precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] }

# paritytech
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

[features]
default = ["std"]
std = [
# frontier
"fp-evm/std",
"pallet-evm/std",

# moonbeam
"precompile-utils/std",

# paritytech
"frame-support/std",
"frame-system/std",
"pallet-assets/std",
"sp-std/std",
"sp-core/std",
]
Loading

0 comments on commit fc0ea38

Please sign in to comment.