Skip to content

Commit

Permalink
Chainx v5.0.0: Use BTC as chainx-evm gas (#655)
Browse files Browse the repository at this point in the history
* Deprecated assets-bridge

* Breaking: use BTC as chainx-evm gas instead of PCX

* Run `make clippy`

* Update xpallet-assets-bridge

* Run `make format`

* Bump ChainX version to 5.0.0

* Update bitcoin gateway deposit_evm

* Rename BtcLedger to XBtcLedger

* Add assets-bridge transfer_btc_to_evm

* Update btc-ledger rpc

* Update Copyright

* Fix xpallet-btc-ledger tests

* Update seed node

* Update chainx-malan runtime version to 29

* Add metamask config

* Set to the same runtime version

---------

Co-authored-by: icodezjb <[email protected]>
  • Loading branch information
icodezjb and icodezjb authored Jun 1, 2023
1 parent 75099d5 commit 4cb9a98
Show file tree
Hide file tree
Showing 221 changed files with 2,438 additions and 645 deletions.
183 changes: 116 additions & 67 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chainx"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"
description = "Fully Decentralized Interchain Crypto Asset Management on Polkadot"
Expand Down Expand Up @@ -37,6 +37,9 @@ members = [
"xpallets/assets/rpc/runtime-api",
"xpallets/assets-bridge",
"xpallets/assets-registrar",
"xpallets/btc-ledger",
"xpallets/btc-ledger/rpc",
"xpallets/btc-ledger/rpc/runtime-api",
"xpallets/dex/spot",
"xpallets/dex/spot/rpc",
"xpallets/dex/spot/rpc/runtime-api",
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ Please refer to the [docs](https://chainx-org.github.io/documentation) for build

Any kinds of contributions are highly welcome. Feel free to file an issue if you have any question or run into any issues.

## Metamask config for BTC
```
Network name: ChainX
RPC URL: https://mainnet.chainx.org/rpc
Chain ID: 1501
Currency symbol: BTC
Block explorer URL (Optional): https://evm.chainx.org/
```

## License

[GPL v3](LICENSE)
3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chainx-cli"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
description = "Implementation of protocol https://chainx.org in Rust based on the Substrate framework."
edition = "2021"
Expand Down Expand Up @@ -64,6 +64,7 @@ xp-protocol = { path = "../primitives/protocol" }

xpallet-gateway-bitcoin = { path = "../xpallets/gateway/bitcoin" }
xpallet-gateway-common = { path = "../xpallets/gateway/common" }
xpallet-btc-ledger = { path = "../xpallets/btc-ledger" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18" }
Expand Down
2 changes: 1 addition & 1 deletion cli/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

Expand Down
5 changes: 4 additions & 1 deletion cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

#![allow(unused)]
use std::collections::BTreeMap;
Expand Down Expand Up @@ -555,6 +555,7 @@ fn mainnet_genesis(
sp_runtime::Permill::from_parts(125_000),
),
x_assets_bridge: chainx::XAssetsBridgeConfig { admin_key: None },
x_btc_ledger: Default::default(),
}
}

Expand Down Expand Up @@ -809,6 +810,7 @@ fn malan_genesis(
sp_runtime::Permill::from_parts(125_000),
),
x_assets_bridge: malan::XAssetsBridgeConfig { admin_key: None },
x_btc_ledger: Default::default(),
}
}

Expand Down Expand Up @@ -986,5 +988,6 @@ fn build_dev_genesis(
sp_runtime::Permill::from_parts(125_000),
),
x_assets_bridge: dev::XAssetsBridgeConfig { admin_key: None },
x_btc_ledger: Default::default(),
}
}
2 changes: 1 addition & 1 deletion cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use sc_cli::{CliConfiguration, KeySubcommand, SignCmd, VanityCmd, VerifyCmd};

Expand Down
2 changes: 1 addition & 1 deletion cli/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.
#![allow(clippy::borrowed_box)]

use std::net::SocketAddr;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use serde_json::value::Value;
use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/genesis/assets.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.
#![allow(clippy::type_complexity)]

use xp_protocol::{BTC_DECIMALS, PCX, PCX_DECIMALS, X_BTC};
Expand Down
2 changes: 1 addition & 1 deletion cli/src/genesis/bitcoin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use std::convert::TryFrom;

Expand Down
2 changes: 1 addition & 1 deletion cli/src/genesis/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

pub mod assets;
pub mod bitcoin;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! ChainX CLI library.
Expand Down
2 changes: 1 addition & 1 deletion cli/src/logger.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use std::str::FromStr;

Expand Down
2 changes: 1 addition & 1 deletion cli/src/res/chainx_regenesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "chainx",
"chainType": "Live",
"bootNodes": [
"/ip4/52.77.243.26/tcp/23555/ws/p2p/12D3KooWQ6GGfmvmmmsbKRmZqMA3A8rxaHz25HvA7JNBbcZhLXtk",
"/ip4/18.142.230.171/tcp/23555/ws/p2p/12D3KooWQ6GGfmvmmmsbKRmZqMA3A8rxaHz25HvA7JNBbcZhLXtk",
"/ip4/120.26.57.227/tcp/36789/ws/p2p/12D3KooWEAX2BcQCZP79MuxQpqLQUop7P3tZY97eNxxUgc4ZTu3k",
"/ip4/47.114.74.52/tcp/36789/ws/p2p/12D3KooWJPMUkGytfAMt3AMqm4AFn4VToXjbWZoC4Z2NxXNXvTwb"
],
Expand Down
2 changes: 1 addition & 1 deletion cli/src/res/malan.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "chainx-malan",
"chainType": "Live",
"bootNodes": [
"/ip4/120.26.57.227/tcp/26789/ws/p2p/12D3KooWANojjJuis3SnDF5hjFGqEUkFHhf34yPgJJLe9yZcznW6"
"/ip4/18.142.230.171/tcp/26789/ws/p2p/12D3KooWANojjJuis3SnDF5hjFGqEUkFHhf34yPgJJLe9yZcznW6"
],
"telemetryEndpoints": [
[
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contr
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/security/Pausable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/access/Ownable.sol";

import "./AssetsBridgeAdaptor.sol";
import "./deprecated_AssetsBridgeAdaptor.sol";

/**
* @dev Implementation of the {IERC20} interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contr
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/security/Pausable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/access/Ownable.sol";

import "./AssetsBridgeAdaptor.sol";
import "./deprecated_AssetsBridgeAdaptor.sol";

/**
* @dev Implementation of the {IERC20} interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contr
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/security/Pausable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/access/Ownable.sol";

import "./AssetsBridgeAdaptor.sol";
import "./deprecated_AssetsBridgeAdaptor.sol";

/**
* @dev Implementation of the {IERC20} interface.
Expand Down
2 changes: 1 addition & 1 deletion docs/xbtc_in_chainx_evm.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# XBTC in ChainX-EVM
# [deprecated] XBTC in ChainX-EVM

## 1. XBTC
ChainX is the community-run layer2 network of bitcoin, and your portal into the world of Bitcoin ecosysterm.
Expand Down
2 changes: 1 addition & 1 deletion executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chainx-executor"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion executor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

pub use sc_executor::NativeElseWasmExecutor;

Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chainx-primitives"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/assets-registrar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-assets-registrar"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/assets-registrar/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! The asset registrar primitives.
Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-gateway-bitcoin"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/bitcoin/src/detector.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use sp_std::fmt::Debug;

Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/bitcoin/src/extractor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use crate::types::OpReturnAccount;
use frame_support::log::{debug, error};
Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/bitcoin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! Some primitives and utils about ChainX gateway bitcoin.
Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/bitcoin/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use codec::{Decode, Encode};
use scale_info::TypeInfo;
Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/bitcoin/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use frame_support::log::{error, warn};
use sp_std::{cmp::Ordering, prelude::Vec};
Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-gateway-common"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/gateway/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! Common concepts with regard to the ChainX gateway system.
Expand Down
2 changes: 1 addition & 1 deletion primitives/genesis-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-genesis-builder"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/genesis-builder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! The genesis builder primitives.
Expand Down
2 changes: 1 addition & 1 deletion primitives/io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-io"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/io/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
2 changes: 1 addition & 1 deletion primitives/mining/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-mining-common"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/mining/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
2 changes: 1 addition & 1 deletion primitives/mining/staking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-mining-staking"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/mining/staking/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
2 changes: 1 addition & 1 deletion primitives/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-protocol"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/protocol/src/asset.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use chainx_primitives::{AssetId, Decimals};

Expand Down
2 changes: 1 addition & 1 deletion primitives/protocol/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! Some protocol details in the ChainX.
Expand Down
2 changes: 1 addition & 1 deletion primitives/protocol/src/network.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use codec::{Decode, Encode};
use scale_info::TypeInfo;
Expand Down
2 changes: 1 addition & 1 deletion primitives/rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-rpc"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/rpc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

use std::{
fmt::{Debug, Display},
Expand Down
6 changes: 3 additions & 3 deletions primitives/runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xp-runtime"
version = "4.4.0"
version = "5.0.0"
authors = ["The ChainX Authors"]
edition = "2021"

Expand All @@ -15,8 +15,8 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18", default-features = false }

# EVM
fp-rpc = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18", default-features = false }
pallet-ethereum = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18", default-features = false }
fp-rpc = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc", default-features = false }
pallet-ethereum = { git = "https://github.com/chainx-org/frontier", branch = "polkadot-v0.9.18-btc", default-features = false }

[dev-dependencies]
hex = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

//! ChainX Runtime Modules shared primitive types.
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2022 ChainX Project Authors. Licensed under GPL-3.0.
// Copyright 2019-2023 ChainX Project Authors. Licensed under GPL-3.0.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
Loading

0 comments on commit 4cb9a98

Please sign in to comment.