diff --git a/Cargo.lock b/Cargo.lock
index a7e18ef2d..564db9f5e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -861,6 +861,67 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+[[package]]
+name = "bb-bnc"
+version = "0.8.0"
+dependencies = [
+ "bifrost-asset-registry",
+ "bifrost-currencies",
+ "bifrost-primitives",
+ "bifrost-runtime-common",
+ "bifrost-slp",
+ "bifrost-vtoken-minting",
+ "cumulus-primitives-core",
+ "env_logger",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.4.1",
+ "log",
+ "orml-tokens",
+ "orml-traits",
+ "orml-xtokens",
+ "pallet-balances",
+ "pallet-collective",
+ "pallet-xcm",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
+ "staging-xcm",
+ "staging-xcm-builder",
+ "staging-xcm-executor",
+]
+
+[[package]]
+name = "bb-bnc-rpc"
+version = "0.8.0"
+dependencies = [
+ "bb-bnc-rpc-runtime-api",
+ "bifrost-primitives",
+ "jsonrpsee",
+ "parity-scale-codec",
+ "serde",
+ "sp-api",
+ "sp-blockchain",
+ "sp-core",
+ "sp-rpc",
+ "sp-runtime",
+]
+
+[[package]]
+name = "bb-bnc-rpc-runtime-api"
+version = "0.8.0"
+dependencies = [
+ "bifrost-primitives",
+ "parity-scale-codec",
+ "sp-api",
+ "sp-core",
+ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
+]
+
[[package]]
name = "beef"
version = "0.5.2"
@@ -895,11 +956,12 @@ dependencies = [
name = "bifrost-buy-back"
version = "0.8.0"
dependencies = [
+ "bb-bnc",
"bifrost-asset-registry",
"bifrost-currencies",
"bifrost-primitives",
+ "bifrost-runtime-common",
"bifrost-slp",
- "bifrost-ve-minting",
"bifrost-vtoken-minting",
"cumulus-primitives-core",
"env_logger",
@@ -926,25 +988,6 @@ dependencies = [
"zenlink-protocol",
]
-[[package]]
-name = "bifrost-call-switchgear"
-version = "0.8.0"
-dependencies = [
- "bifrost-primitives",
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "orml-tokens",
- "orml-traits",
- "pallet-balances",
- "parity-scale-codec",
- "scale-info",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
-]
-
[[package]]
name = "bifrost-channel-commission"
version = "0.8.0"
@@ -968,7 +1011,7 @@ dependencies = [
[[package]]
name = "bifrost-cli"
-version = "0.12.1"
+version = "0.13.0"
dependencies = [
"bifrost-primitives",
"bifrost-service",
@@ -1002,10 +1045,10 @@ dependencies = [
name = "bifrost-clouds-convert"
version = "0.8.0"
dependencies = [
+ "bb-bnc",
"bifrost-asset-registry",
"bifrost-currencies",
"bifrost-primitives",
- "bifrost-ve-minting",
"frame-benchmarking",
"frame-support",
"frame-system",
@@ -1065,11 +1108,11 @@ dependencies = [
name = "bifrost-farming"
version = "0.8.0"
dependencies = [
+ "bb-bnc",
"bifrost-asset-registry",
"bifrost-currencies",
"bifrost-primitives",
"bifrost-runtime-common",
- "bifrost-ve-minting",
"env_logger",
"frame-benchmarking",
"frame-support",
@@ -1128,15 +1171,19 @@ dependencies = [
"bifrost-slp",
"bifrost-vtoken-minting",
"cumulus-primitives-core",
+ "env_logger",
"frame-benchmarking",
"frame-support",
"frame-system",
"hex-literal 0.4.1",
"log",
+ "orml-oracle",
"orml-tokens",
"orml-traits",
"orml-xtokens",
"pallet-balances",
+ "pallet-prices",
+ "pallet-traits",
"pallet-xcm",
"parity-scale-codec",
"scale-info",
@@ -1286,6 +1333,7 @@ dependencies = [
"bifrost-system-maker",
"bifrost-system-staking",
"bifrost-token-issuer",
+ "bifrost-vbnc-convert",
"bifrost-vesting",
"bifrost-vsbond-auction",
"bifrost-vstoken-conversion",
@@ -1342,6 +1390,7 @@ dependencies = [
"pallet-referenda",
"pallet-scheduler",
"pallet-session",
+ "pallet-staking",
"pallet-timestamp",
"pallet-tips",
"pallet-transaction-payment",
@@ -1417,6 +1466,8 @@ dependencies = [
name = "bifrost-polkadot-runtime"
version = "0.8.0"
dependencies = [
+ "bb-bnc",
+ "bb-bnc-rpc-runtime-api",
"bifrost-asset-registry",
"bifrost-buy-back",
"bifrost-channel-commission",
@@ -1433,14 +1484,13 @@ dependencies = [
"bifrost-salp",
"bifrost-salp-rpc-runtime-api",
"bifrost-slp",
+ "bifrost-slp-v2",
"bifrost-slpx",
"bifrost-stable-asset",
"bifrost-stable-pool",
"bifrost-stable-pool-rpc-runtime-api",
"bifrost-system-maker",
"bifrost-system-staking",
- "bifrost-ve-minting",
- "bifrost-ve-minting-rpc-runtime-api",
"bifrost-vesting",
"bifrost-vstoken-conversion",
"bifrost-vtoken-minting",
@@ -1518,6 +1568,7 @@ dependencies = [
"pallet-referenda",
"pallet-scheduler",
"pallet-session",
+ "pallet-staking",
"pallet-timestamp",
"pallet-tips",
"pallet-traits",
@@ -1572,6 +1623,7 @@ dependencies = [
"bstringify",
"frame-support",
"orml-oracle",
+ "orml-traits",
"parity-scale-codec",
"scale-info",
"serde",
@@ -1587,6 +1639,8 @@ dependencies = [
name = "bifrost-rpc"
version = "0.8.0"
dependencies = [
+ "bb-bnc-rpc",
+ "bb-bnc-rpc-runtime-api",
"bifrost-farming-rpc",
"bifrost-farming-rpc-runtime-api",
"bifrost-flexible-fee-rpc",
@@ -1598,8 +1652,6 @@ dependencies = [
"bifrost-salp-rpc-runtime-api",
"bifrost-stable-pool-rpc",
"bifrost-stable-pool-rpc-runtime-api",
- "bifrost-ve-minting-rpc",
- "bifrost-ve-minting-rpc-runtime-api",
"bifrost-vtoken-minting-rpc",
"bifrost-vtoken-minting-rpc-runtime-api",
"cumulus-primitives-core",
@@ -1768,6 +1820,7 @@ name = "bifrost-service"
version = "0.8.0"
dependencies = [
"async-trait",
+ "bb-bnc-rpc-runtime-api",
"bifrost-farming-rpc-runtime-api",
"bifrost-flexible-fee-rpc-runtime-api",
"bifrost-kusama-runtime",
@@ -1777,7 +1830,6 @@ dependencies = [
"bifrost-rpc",
"bifrost-runtime-common",
"bifrost-salp-rpc-runtime-api",
- "bifrost-ve-minting-rpc-runtime-api",
"clap",
"cumulus-client-cli",
"cumulus-client-collator",
@@ -1904,6 +1956,36 @@ dependencies = [
"staging-xcm-executor",
]
+[[package]]
+name = "bifrost-slp-v2"
+version = "0.0.0"
+dependencies = [
+ "bifrost-asset-registry",
+ "bifrost-currencies",
+ "bifrost-primitives",
+ "bifrost-vtoken-minting",
+ "cumulus-primitives-core",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.4.1",
+ "orml-tokens",
+ "orml-traits",
+ "pallet-balances",
+ "pallet-utility",
+ "pallet-xcm",
+ "parity-scale-codec",
+ "polkadot-parachain-primitives",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
+ "staging-xcm",
+ "staging-xcm-builder",
+ "staging-xcm-executor",
+]
+
[[package]]
name = "bifrost-slpx"
version = "0.8.0"
@@ -2118,64 +2200,25 @@ dependencies = [
]
[[package]]
-name = "bifrost-ve-minting"
+name = "bifrost-vbnc-convert"
version = "0.8.0"
dependencies = [
"bifrost-asset-registry",
"bifrost-currencies",
"bifrost-primitives",
- "bifrost-runtime-common",
- "bifrost-slp",
- "bifrost-vtoken-minting",
- "cumulus-primitives-core",
- "env_logger",
"frame-benchmarking",
"frame-support",
"frame-system",
- "hex-literal 0.4.1",
- "log",
"orml-tokens",
"orml-traits",
- "orml-xtokens",
"pallet-balances",
- "pallet-collective",
- "pallet-xcm",
"parity-scale-codec",
"scale-info",
"sp-core",
"sp-io",
"sp-runtime",
"sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
- "staging-xcm",
"staging-xcm-builder",
- "staging-xcm-executor",
-]
-
-[[package]]
-name = "bifrost-ve-minting-rpc"
-version = "0.8.0"
-dependencies = [
- "bifrost-primitives",
- "bifrost-ve-minting-rpc-runtime-api",
- "jsonrpsee",
- "parity-scale-codec",
- "serde",
- "sp-api",
- "sp-blockchain",
- "sp-core",
- "sp-rpc",
- "sp-runtime",
-]
-
-[[package]]
-name = "bifrost-ve-minting-rpc-runtime-api"
-version = "0.8.0"
-dependencies = [
- "bifrost-primitives",
- "parity-scale-codec",
- "sp-api",
- "sp-core",
- "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
]
[[package]]
@@ -2243,12 +2286,12 @@ dependencies = [
name = "bifrost-vtoken-minting"
version = "0.8.0"
dependencies = [
+ "bb-bnc",
"bifrost-asset-registry",
"bifrost-currencies",
"bifrost-primitives",
"bifrost-runtime-common",
"bifrost-slp",
- "bifrost-ve-minting",
"cumulus-primitives-core",
"env_logger",
"frame-benchmarking",
@@ -9049,6 +9092,7 @@ dependencies = [
"scale-info",
"sp-core",
"sp-io",
+ "sp-runtime",
"sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)",
]
@@ -11934,9 +11978,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.36"
+version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
@@ -14192,9 +14236,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
-version = "1.0.205"
+version = "1.0.210"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150"
+checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
dependencies = [
"serde_derive",
]
@@ -14210,9 +14254,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.205"
+version = "1.0.210"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1"
+checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
@@ -14221,12 +14265,11 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.122"
+version = "1.0.120"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
+checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
dependencies = [
"itoa",
- "memchr",
"ryu",
"serde",
]
@@ -14901,7 +14944,7 @@ dependencies = [
[[package]]
name = "sp-crypto-ec-utils"
version = "0.10.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"ark-bls12-377",
"ark-bls12-377-ext",
@@ -14963,7 +15006,7 @@ dependencies = [
[[package]]
name = "sp-debug-derive"
version = "14.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"proc-macro2",
"quote",
@@ -14983,7 +15026,7 @@ dependencies = [
[[package]]
name = "sp-externalities"
version = "0.25.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"environmental",
"parity-scale-codec",
@@ -15199,7 +15242,7 @@ dependencies = [
[[package]]
name = "sp-runtime-interface"
version = "24.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"bytes",
"impl-trait-for-tuples",
@@ -15231,7 +15274,7 @@ dependencies = [
[[package]]
name = "sp-runtime-interface-proc-macro"
version = "17.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"Inflector",
"expander",
@@ -15320,7 +15363,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot
[[package]]
name = "sp-std"
version = "14.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
[[package]]
name = "sp-storage"
@@ -15337,7 +15380,7 @@ dependencies = [
[[package]]
name = "sp-storage"
version = "19.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"impl-serde",
"parity-scale-codec",
@@ -15372,7 +15415,7 @@ dependencies = [
[[package]]
name = "sp-tracing"
version = "16.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
"parity-scale-codec",
"tracing",
@@ -15469,8 +15512,9 @@ dependencies = [
[[package]]
name = "sp-wasm-interface"
version = "20.0.0"
-source = "git+https://github.com/paritytech/polkadot-sdk#604f56f03db847a90aa4fdb13be6b80482a4dcd6"
+source = "git+https://github.com/paritytech/polkadot-sdk#016421ac71574333da92a56ef7bcbef8621ccc14"
dependencies = [
+ "anyhow",
"impl-trait-for-tuples",
"log",
"parity-scale-codec",
@@ -16579,6 +16623,7 @@ dependencies = [
"sharded-slab",
"smallvec",
"thread_local",
+ "time",
"tracing",
"tracing-core",
"tracing-log",
diff --git a/Cargo.toml b/Cargo.toml
index 9615cbc61..e2b412274 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,11 +15,11 @@ members = [
"pallets/token-issuer",
"pallets/vesting",
"pallets/vsbond-auction",
- "pallets/call-switchgear",
"pallets/cross-in-out",
"pallets/evm-accounts",
"pallets/xcm-interface",
"pallets/slp",
+ "pallets/slp-v2",
"pallets/vstoken-conversion",
"pallets/vtoken-minting",
"pallets/vtoken-voting",
@@ -27,13 +27,14 @@ members = [
"pallets/system-maker",
"pallets/fee-share",
"pallets/parachain-staking",
- "pallets/ve-minting",
+ "pallets/bb-bnc",
"pallets/stable-pool",
"pallets/lend-market",
"pallets/prices",
"pallets/leverage-staking",
"pallets/channel-commission",
"pallets/clouds-convert",
+ "pallets/vbnc-convert",
"runtime/bifrost-kusama",
"runtime/bifrost-polkadot/src/evm/evm-utility/macro",
@@ -52,7 +53,7 @@ bifrost-flexible-fee-rpc = { path = "pallets/flexible-fee/rpc" }
bifrost-rpc = { path = "node/rpc" }
bifrost-salp-rpc = { path = "pallets/salp/rpc" }
bifrost-stable-pool-rpc = { path = "pallets/stable-pool/rpc" }
-bifrost-ve-minting-rpc = { path = "pallets/ve-minting/rpc" }
+bb-bnc-rpc = { path = "pallets/bb-bnc/rpc" }
lend-market-rpc = { path = "pallets/lend-market/rpc" }
bifrost-vtoken-minting-rpc = { path = "pallets/vtoken-minting/rpc" }
@@ -79,6 +80,7 @@ bifrost-salp = { path = "pallets/salp", default-featur
bifrost-salp-rpc-runtime-api = { path = "pallets/salp/rpc/runtime-api", default-features = false }
bifrost-service = { path = "node/service", default-features = false }
bifrost-slp = { path = "pallets/slp", default-features = false }
+bifrost-slp-v2 = { path = "pallets/slp-v2", default-features = false }
bifrost-slpx = { path = "pallets/slpx", default-features = false }
bifrost-stable-asset = { path = "pallets/stable-asset", default-features = false }
bifrost-stable-pool = { path = "pallets/stable-pool", default-features = false }
@@ -86,8 +88,9 @@ bifrost-stable-pool-rpc-runtime-api = { path = "pallets/stable-pool/rpc/runti
bifrost-system-maker = { path = "pallets/system-maker", default-features = false }
bifrost-system-staking = { path = "pallets/system-staking", default-features = false }
bifrost-token-issuer = { path = "pallets/token-issuer", default-features = false }
-bifrost-ve-minting = { path = "pallets/ve-minting", default-features = false }
-bifrost-ve-minting-rpc-runtime-api = { path = "pallets/ve-minting/rpc/runtime-api", default-features = false }
+bifrost-vbnc-convert = { path = "pallets/vbnc-convert", default-features = false }
+bb-bnc = { path = "pallets/bb-bnc", default-features = false }
+bb-bnc-rpc-runtime-api = { path = "pallets/bb-bnc/rpc/runtime-api", default-features = false }
bifrost-vesting = { path = "pallets/vesting", default-features = false }
bifrost-vsbond-auction = { path = "pallets/vsbond-auction", default-features = false }
bifrost-vstoken-conversion = { path = "pallets/vstoken-conversion", default-features = false }
@@ -330,7 +333,7 @@ proc-macro2 = { version = "1.0.40" }
quote = { version = "1.0.20" }
scale-info = { version = "2.11.3", default-features = false }
serde = { version = "1.0.205", default-features = false }
-serde_json = { version = "1.0.122", default-features = false }
+serde_json = { version = "1.0.120", default-features = false }
sha3 = { version = "0.10.6", default-features = false }
similar-asserts = { version = "1.1.0" }
smallvec = { version = "1.13.1" }
diff --git a/Makefile b/Makefile
index 85bae2f33..121749f9c 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ format-check:
.PHONY: clippy # cargo clippy
clippy: format-check
- SKIP_WASM_BUILD= cargo clippy --all --all-targets --features=with-all-runtime -- -D warnings
+ cargo clippy --all --all-targets --features "with-all-runtime,runtime-benchmarks,try-runtime" -- -D warnings
.PHONY: benchmarking-staking # benchmarking staking pallet
benchmarking-staking:
diff --git a/docs/res/readme/bifrost-banner.svg b/docs/res/readme/bifrost-banner.svg
new file mode 100644
index 000000000..34325bff2
--- /dev/null
+++ b/docs/res/readme/bifrost-banner.svg
@@ -0,0 +1,29 @@
+
diff --git a/docs/res/readme/bifrost-black-logo.svg b/docs/res/readme/bifrost-black-logo.svg
new file mode 100644
index 000000000..b70dfd53e
--- /dev/null
+++ b/docs/res/readme/bifrost-black-logo.svg
@@ -0,0 +1,4 @@
+
diff --git a/docs/res/readme/substrate-builder.svg b/docs/res/readme/substrate-builder.svg
new file mode 100644
index 000000000..1eead6316
--- /dev/null
+++ b/docs/res/readme/substrate-builder.svg
@@ -0,0 +1,13 @@
+
diff --git a/docs/res/readme/web3-bootcamp.svg b/docs/res/readme/web3-bootcamp.svg
new file mode 100644
index 000000000..7fb3bb0c8
--- /dev/null
+++ b/docs/res/readme/web3-bootcamp.svg
@@ -0,0 +1,16 @@
+
diff --git a/docs/res/readme/web3-foundation-grant.svg b/docs/res/readme/web3-foundation-grant.svg
new file mode 100644
index 000000000..1b8d7ffc7
--- /dev/null
+++ b/docs/res/readme/web3-foundation-grant.svg
@@ -0,0 +1,48 @@
+
diff --git a/integration-tests/src/mock/bifrost.rs b/integration-tests/src/mock/bifrost.rs
index 5a116eba1..915cb879b 100644
--- a/integration-tests/src/mock/bifrost.rs
+++ b/integration-tests/src/mock/bifrost.rs
@@ -29,15 +29,14 @@ use sp_std::prelude::*;
use crate::mock::{mock_message_queue, Amount};
use bifrost_asset_registry::AssetIdMaps;
use bifrost_polkadot_runtime::{
- xcm_config::{
- BaseXcmWeight, BifrostAccountIdToLocation, BifrostAssetTransactor, MaxAssetsForTransfer,
- ParachainMinFee, SelfRelativeLocation, UniversalLocation,
- },
- BifrostCurrencyIdConvert, BifrostTreasuryAccount, MaxLengthLimit, MaxRefundPerBlock,
- MaxTypeEntryPerBlock, NativeCurrencyId, SelfParaChainId, SubAccountIndexMultiLocationConvertor,
- VtokenMinting, XcmInterface,
+ xcm_config::{BaseXcmWeight, BifrostAssetTransactor, MaxAssetsForTransfer, ParachainMinFee},
+ BifrostTreasuryAccount, MaxLengthLimit, MaxRefundPerBlock, MaxTypeEntryPerBlock,
+ NativeCurrencyId, SubAccountIndexMultiLocationConvertor, VtokenMinting, XcmInterface,
};
-use bifrost_primitives::CurrencyId;
+use bifrost_primitives::{
+ AccountIdToLocation, CurrencyId, PolkadotUniversalLocation, SelfLocation,
+};
+use bifrost_runtime_common::currency_converter::CurrencyIdConvert;
use bifrost_slp::QueryResponseManager;
use pallet_xcm::{QueryStatus, XcmPassthrough};
use polkadot_parachain_primitives::primitives::Sibling;
@@ -118,15 +117,15 @@ impl orml_xtokens::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type CurrencyId = CurrencyId;
- type CurrencyIdConvert = BifrostCurrencyIdConvert;
- type AccountIdToLocation = BifrostAccountIdToLocation;
- type SelfLocation = SelfRelativeLocation;
+ type CurrencyIdConvert = CurrencyIdConvert;
+ type AccountIdToLocation = AccountIdToLocation;
+ type SelfLocation = SelfLocation;
type LocationsFilter = Everything;
type MinXcmFee = ParachainMinFee;
type XcmExecutor = XcmExecutor;
type Weigher = FixedWeightBounds;
type BaseXcmWeight = BaseXcmWeight;
- type UniversalLocation = UniversalLocation;
+ type UniversalLocation = PolkadotUniversalLocation;
type MaxAssetsForTransfer = MaxAssetsForTransfer;
type ReserveProvider = RelativeReserveProvider;
type RateLimiter = ();
@@ -173,7 +172,7 @@ impl Config for XcmConfig {
type OriginConverter = XcmOriginToCallOrigin;
type IsReserve = NativeAsset;
type IsTeleporter = ();
- type UniversalLocation = UniversalLocation;
+ type UniversalLocation = PolkadotUniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds;
type Trader = FixedRateOfFungible;
@@ -215,7 +214,7 @@ impl pallet_xcm::Config for Runtime {
type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds;
- type UniversalLocation = UniversalLocation;
+ type UniversalLocation = PolkadotUniversalLocation;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
@@ -298,7 +297,7 @@ impl bifrost_slp::Config for Runtime {
type WeightInfo = ();
type VtokenMinting = VtokenMinting;
type AccountConverter = SubAccountIndexMultiLocationConvertor;
- type ParachainId = SelfParaChainId;
+ type ParachainId = ParachainInfo;
type SubstrateResponseManager = SubstrateResponseManager;
type MaxTypeEntryPerBlock = MaxTypeEntryPerBlock;
type MaxRefundPerBlock = MaxRefundPerBlock;
diff --git a/integration-tests/src/mock/mod.rs b/integration-tests/src/mock/mod.rs
index d7423adf0..52aa34ef9 100644
--- a/integration-tests/src/mock/mod.rs
+++ b/integration-tests/src/mock/mod.rs
@@ -62,6 +62,7 @@ decl_test_network! {
pub type BifrostTokens = orml_tokens::Pallet;
pub type BifrostXTokens = orml_xtokens::Pallet;
pub type BifrostSlp = bifrost_slp::Pallet;
+pub type BifrostAssetRegistry = bifrost_asset_registry::Pallet;
pub type RelayBalances = pallet_balances::Pallet;
pub type RelaySystem = frame_system::Pallet;
@@ -72,6 +73,15 @@ pub fn para_ext(para_id: u32) -> TestExternalities {
let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap();
+ bifrost_asset_registry::GenesisConfig:: {
+ currency: vec![(CurrencyId::Token2(0), 1_000_000, None)],
+ vcurrency: vec![],
+ vsbond: vec![],
+ phantom: Default::default(),
+ }
+ .assimilate_storage(&mut t)
+ .unwrap();
+
orml_tokens::GenesisConfig:: {
balances: vec![(ALICE, CurrencyId::Token2(0), 100_000_000_000)],
}
diff --git a/integration-tests/src/mock/relaychain.rs b/integration-tests/src/mock/relaychain.rs
index 7ae78ad3f..57bc0358c 100644
--- a/integration-tests/src/mock/relaychain.rs
+++ b/integration-tests/src/mock/relaychain.rs
@@ -17,7 +17,7 @@
// along with this program. If not, see .
use bifrost_polkadot_runtime::{
- xcm_config, BlockHashCount, Hash, Nonce, ReservedDmpWeight, ReservedXcmpWeight,
+ BlockHashCount, Hash, Nonce, RelayOrigin, ReservedDmpWeight, ReservedXcmpWeight,
RuntimeBlockLength, RuntimeBlockWeights, SS58Prefix, Version, XcmpQueue,
};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
@@ -71,7 +71,7 @@ impl frame_system::Config for Runtime {
impl cumulus_pallet_parachain_system::Config for Runtime {
type DmpQueue = frame_support::traits::EnqueueWithOrigin<
bifrost_polkadot_runtime::MessageQueue,
- xcm_config::RelayOrigin,
+ RelayOrigin,
>;
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
diff --git a/integration-tests/src/tests/send_relay_chain_asset.rs b/integration-tests/src/tests/send_relay_chain_asset.rs
index 86e14aaf3..61b621bf5 100644
--- a/integration-tests/src/tests/send_relay_chain_asset.rs
+++ b/integration-tests/src/tests/send_relay_chain_asset.rs
@@ -17,7 +17,8 @@
// along with this program. If not, see .
use crate::mock::{
- Bifrost, BifrostTokens, BifrostXTokens, Relay, RelayBalances, RelaySystem, TestNet, ALICE, BOB,
+ Bifrost, BifrostAssetRegistry, BifrostTokens, BifrostXTokens, Relay, RelayBalances,
+ RelaySystem, TestNet, ALICE, BOB,
};
use bifrost_primitives::CurrencyId;
use cumulus_primitives_core::ParaId;
@@ -39,6 +40,10 @@ fn send_relay_chain_asset_to_relay_chain() {
});
Bifrost::execute_with(|| {
+ assert_ok!(BifrostAssetRegistry::do_register_location(
+ CurrencyId::Token2(0),
+ &Location::parent()
+ ));
assert_ok!(BifrostXTokens::transfer(
Some(ALICE).into(),
CurrencyId::Token2(0),
diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml
index c30589326..1adb0e8fb 100644
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "bifrost-cli"
-version = "0.12.1"
+version = "0.13.0"
authors = ["Liebi Technologies "]
description = "Bifrost Parachain Node"
build = "build.rs"
diff --git a/node/rpc/Cargo.toml b/node/rpc/Cargo.toml
index 1254c4fdd..8ada17b5b 100644
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -44,8 +44,8 @@ bifrost-salp-rpc = { workspace = true }
bifrost-salp-rpc-runtime-api = { workspace = true }
bifrost-farming-rpc = { workspace = true }
bifrost-farming-rpc-runtime-api = { workspace = true }
-bifrost-ve-minting-rpc = { workspace = true }
-bifrost-ve-minting-rpc-runtime-api = { workspace = true }
+bb-bnc-rpc = { workspace = true }
+bb-bnc-rpc-runtime-api = { workspace = true }
bifrost-stable-pool-rpc = { workspace = true }
bifrost-stable-pool-rpc-runtime-api = { workspace = true }
lend-market-rpc = { workspace = true }
diff --git a/node/rpc/src/lib.rs b/node/rpc/src/lib.rs
index 41dc9059b..1bfb4d3cd 100644
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -33,6 +33,8 @@
use std::sync::Arc;
+use bb_bnc_rpc::{BbBNCRpc, BbBNCRpcApiServer};
+use bb_bnc_rpc_runtime_api::BbBNCRuntimeApi;
use bifrost_farming_rpc::{FarmingRpc, FarmingRpcApiServer};
use bifrost_farming_rpc_runtime_api::FarmingRuntimeApi;
use bifrost_flexible_fee_rpc::{FeeRpcApiServer, FlexibleFeeRpc};
@@ -43,8 +45,6 @@ use bifrost_salp_rpc::{SalpRpc, SalpRpcApiServer};
use bifrost_salp_rpc_runtime_api::SalpRuntimeApi;
use bifrost_stable_pool_rpc::{StablePoolRpc, StablePoolRpcApiServer};
use bifrost_stable_pool_rpc_runtime_api::StablePoolRuntimeApi;
-use bifrost_ve_minting_rpc::{VeMintingRpc, VeMintingRpcApiServer};
-use bifrost_ve_minting_rpc_runtime_api::VeMintingRuntimeApi;
use bifrost_vtoken_minting_rpc::{VtokenMintingRpc, VtokenMintingRpcApiServer};
use bifrost_vtoken_minting_rpc_runtime_api::VtokenMintingRuntimeApi;
use futures::channel::mpsc;
@@ -152,7 +152,7 @@ where
C::Api: FarmingRuntimeApi,
C::Api: FeeRuntimeApi,
C::Api: SalpRuntimeApi,
- C::Api: VeMintingRuntimeApi,
+ C::Api: BbBNCRuntimeApi,
C::Api: LendMarketApi,
C::Api: VtokenMintingRuntimeApi,
C::Api: ZenlinkProtocolRuntimeApi,
@@ -169,7 +169,7 @@ where
module.merge(FarmingRpc::new(client.clone()).into_rpc())?;
module.merge(FlexibleFeeRpc::new(client.clone()).into_rpc())?;
module.merge(SalpRpc::new(client.clone()).into_rpc())?;
- module.merge(VeMintingRpc::new(client.clone()).into_rpc())?;
+ module.merge(BbBNCRpc::new(client.clone()).into_rpc())?;
module.merge(ZenlinkProtocol::new(client.clone()).into_rpc())?;
module.merge(StablePoolRpc::new(client.clone()).into_rpc())?;
module.merge(LendMarket::new(client.clone()).into_rpc())?;
diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml
index 74e8f9ac3..64b512682 100644
--- a/node/service/Cargo.toml
+++ b/node/service/Cargo.toml
@@ -124,7 +124,7 @@ fp-rpc = { workspace = true, features = ["default"] }
bifrost-flexible-fee-rpc-runtime-api = { workspace = true }
bifrost-salp-rpc-runtime-api = { workspace = true }
bifrost-farming-rpc-runtime-api = { workspace = true }
-bifrost-ve-minting-rpc-runtime-api = { workspace = true }
+bb-bnc-rpc-runtime-api = { workspace = true }
[features]
default = [ "std" ]
diff --git a/node/service/src/chain_spec/bifrost_kusama.rs b/node/service/src/chain_spec/bifrost_kusama.rs
index bd7c17202..ba38b8ab7 100644
--- a/node/service/src/chain_spec/bifrost_kusama.rs
+++ b/node/service/src/chain_spec/bifrost_kusama.rs
@@ -16,11 +16,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+use crate::chain_spec::{get_account_id_from_seed, get_from_seed, RelayExtensions};
use bifrost_kusama_runtime::{
constants::currency::DOLLARS, AccountId, Balance, BalancesConfig, BlockNumber,
DefaultBlocksPerRound, InflationInfo, Range, SS58Prefix, VestingConfig,
};
-use bifrost_primitives::{CurrencyId, CurrencyId::*, TokenInfo, TokenSymbol::*};
+use bifrost_primitives::{
+ BifrostKusamaChainId, CurrencyId, CurrencyId::*, TokenInfo, TokenSymbol::*,
+};
use bifrost_runtime_common::AuraId;
use cumulus_primitives_core::ParaId;
use frame_benchmarking::{account, whitelisted_caller};
@@ -37,8 +40,6 @@ use std::{
path::PathBuf,
};
-use crate::chain_spec::{get_account_id_from_seed, get_from_seed, RelayExtensions};
-
const DEFAULT_PROTOCOL_ID: &str = "bifrost";
/// Specialized `ChainSpec` for the bifrost runtime.
@@ -49,8 +50,6 @@ pub fn ENDOWMENT() -> u128 {
1_000_000 * DOLLARS
}
-pub const PARA_ID: u32 = 2001;
-
pub fn inflation_config() -> InflationInfo {
fn to_round_inflation(annual: Range) -> Range {
use bifrost_parachain_staking::inflation::{
@@ -219,7 +218,11 @@ pub fn local_testnet_config() -> ChainSpec {
ChainSpec::builder(
bifrost_kusama_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
- RelayExtensions { relay_chain: "kusama-local".into(), para_id: PARA_ID, evm_since: 1 },
+ RelayExtensions {
+ relay_chain: "kusama-local".into(),
+ para_id: BifrostKusamaChainId::get(),
+ evm_since: 1,
+ },
)
.with_name("Bifrost Local Testnet")
.with_id("bifrost_local_testnet")
@@ -240,7 +243,7 @@ pub fn local_testnet_config() -> ChainSpec {
vec![],
balances,
vestings,
- PARA_ID.into(),
+ BifrostKusamaChainId::get().into(),
council_membership,
technical_committee_membership,
salp_multisig,
@@ -325,7 +328,11 @@ pub fn chainspec_config() -> ChainSpec {
ChainSpec::builder(
bifrost_kusama_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
- RelayExtensions { relay_chain: "kusama".into(), para_id: PARA_ID, evm_since: 1 },
+ RelayExtensions {
+ relay_chain: "kusama".into(),
+ para_id: BifrostKusamaChainId::get(),
+ evm_since: 1,
+ },
)
.with_name("Bifrost")
.with_id("bifrost")
@@ -335,7 +342,7 @@ pub fn chainspec_config() -> ChainSpec {
vec![],
balances,
vesting_configs.into_iter().flat_map(|vc| vc.vesting).collect(),
- PARA_ID.into(),
+ BifrostKusamaChainId::get().into(),
vec![], // council membership
vec![], // technical committee membership
salp_multisig,
diff --git a/node/service/src/chain_spec/bifrost_polkadot.rs b/node/service/src/chain_spec/bifrost_polkadot.rs
index ee486a4f3..b52070fe5 100644
--- a/node/service/src/chain_spec/bifrost_polkadot.rs
+++ b/node/service/src/chain_spec/bifrost_polkadot.rs
@@ -22,7 +22,7 @@ use bifrost_polkadot_runtime::{
};
use bifrost_primitives::{
currency::{BNCS, DED, IBTC, INTR, PEN, PINK, USDC, WETH},
- CurrencyId,
+ BifrostPolkadotChainId, CurrencyId,
CurrencyId::*,
TokenInfo, TokenSymbol, ASTR, BNC, DOT, DOT_TOKEN_ID, DOT_U, FIL, GLMR, MANTA,
};
@@ -47,8 +47,6 @@ pub fn ENDOWMENT() -> u128 {
1_000_000 * DOLLARS
}
-pub const PARA_ID: u32 = 2030;
-
fn bifrost_polkadot_properties() -> Properties {
let mut properties = sc_chain_spec::Properties::new();
let mut token_symbol: Vec = vec![];
@@ -227,7 +225,11 @@ pub fn local_testnet_config() -> ChainSpec {
ChainSpec::builder(
bifrost_polkadot_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
- RelayExtensions { relay_chain: "polkadot-local".into(), para_id: PARA_ID, evm_since: 1 },
+ RelayExtensions {
+ relay_chain: "polkadot-local".into(),
+ para_id: BifrostPolkadotChainId::get(),
+ evm_since: 1,
+ },
)
.with_name("Bifrost Polkadot Local Testnet")
.with_id("bifrost_polkadot_local_testnet")
@@ -242,7 +244,7 @@ pub fn local_testnet_config() -> ChainSpec {
],
balances,
vec![],
- PARA_ID.into(),
+ BifrostPolkadotChainId::get().into(),
tokens,
council_membership,
technical_committee_membership,
@@ -336,7 +338,11 @@ pub fn dev_config() -> ChainSpec {
ChainSpec::builder(
bifrost_polkadot_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
- RelayExtensions { relay_chain: "polkadot".into(), para_id: PARA_ID, evm_since: 1 },
+ RelayExtensions {
+ relay_chain: "polkadot".into(),
+ para_id: BifrostPolkadotChainId::get(),
+ evm_since: 1,
+ },
)
.with_name("Bifrost Polkadot Dev Testnet")
.with_id("dev")
@@ -351,7 +357,7 @@ pub fn dev_config() -> ChainSpec {
],
balances,
vec![],
- PARA_ID.into(),
+ BifrostPolkadotChainId::get().into(),
tokens,
council_membership,
technical_committee_membership,
@@ -425,7 +431,11 @@ pub fn paseo_config() -> ChainSpec {
ChainSpec::builder(
bifrost_polkadot_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
- RelayExtensions { relay_chain: "paseo".into(), para_id: PARA_ID, evm_since: 1 },
+ RelayExtensions {
+ relay_chain: "paseo".into(),
+ para_id: BifrostPolkadotChainId::get(),
+ evm_since: 1,
+ },
)
.with_name("Bifrost Paseo")
.with_id("bifrost_paseo")
@@ -434,7 +444,7 @@ pub fn paseo_config() -> ChainSpec {
invulnerables,
balances,
vec![],
- PARA_ID.into(),
+ BifrostPolkadotChainId::get().into(),
vec![],
council_membership,
technical_committee_membership,
@@ -480,7 +490,11 @@ pub fn chainspec_config() -> ChainSpec {
ChainSpec::builder(
bifrost_polkadot_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
- RelayExtensions { relay_chain: "polkadot".into(), para_id: PARA_ID, evm_since: 1 },
+ RelayExtensions {
+ relay_chain: "polkadot".into(),
+ para_id: BifrostPolkadotChainId::get(),
+ evm_since: 1,
+ },
)
.with_name("Bifrost Polkadot")
.with_id("bifrost_polkadot")
@@ -489,7 +503,7 @@ pub fn chainspec_config() -> ChainSpec {
invulnerables,
vec![],
vec![],
- PARA_ID.into(),
+ BifrostPolkadotChainId::get().into(),
vec![],
vec![],
vec![],
diff --git a/pallets/asset-registry/src/benchmarking.rs b/pallets/asset-registry/src/benchmarking.rs
index 309065886..bb7b63b13 100644
--- a/pallets/asset-registry/src/benchmarking.rs
+++ b/pallets/asset-registry/src/benchmarking.rs
@@ -232,12 +232,12 @@ benchmarks! {
}: {call.dispatch_bypass_filter(origin)?}
verify {
assert_eq!(
- LocationToCurrencyIds::::get(location.clone()),
+ LocationToCurrencyIds::::get(location),
Some(Token2(0))
);
assert_eq!(
CurrencyIdToLocations::::get(Token2(0)),
- Some(location.clone())
+ Some(location)
);
assert_eq!(CurrencyIdToWeights::::get(Token2(0)), Some(Weight::from_parts(2000_000_000, u64::MAX)));
}
diff --git a/pallets/ve-minting/Cargo.toml b/pallets/bb-bnc/Cargo.toml
similarity index 98%
rename from pallets/ve-minting/Cargo.toml
rename to pallets/bb-bnc/Cargo.toml
index 122c7a7fa..2b9f27443 100644
--- a/pallets/ve-minting/Cargo.toml
+++ b/pallets/bb-bnc/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "bifrost-ve-minting"
+name = "bb-bnc"
version = "0.8.0"
authors = ["Kadokura "]
edition = "2021"
diff --git a/pallets/ve-minting/rpc/Cargo.toml b/pallets/bb-bnc/rpc/Cargo.toml
similarity index 84%
rename from pallets/ve-minting/rpc/Cargo.toml
rename to pallets/bb-bnc/rpc/Cargo.toml
index aa9fcb7ba..578fd700f 100644
--- a/pallets/ve-minting/rpc/Cargo.toml
+++ b/pallets/bb-bnc/rpc/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "bifrost-ve-minting-rpc"
+name = "bb-bnc-rpc"
version = "0.8.0"
authors = ["Kadokura "]
edition = "2021"
@@ -14,4 +14,4 @@ sp-blockchain = { workspace = true }
sp-core = { workspace = true }
sp-rpc = { workspace = true }
bifrost-primitives = { workspace = true }
-bifrost-ve-minting-rpc-runtime-api = { workspace = true }
+bb-bnc-rpc-runtime-api = { workspace = true }
diff --git a/pallets/ve-minting/rpc/runtime-api/Cargo.toml b/pallets/bb-bnc/rpc/runtime-api/Cargo.toml
similarity index 90%
rename from pallets/ve-minting/rpc/runtime-api/Cargo.toml
rename to pallets/bb-bnc/rpc/runtime-api/Cargo.toml
index afd1c5015..4ec16fe07 100644
--- a/pallets/ve-minting/rpc/runtime-api/Cargo.toml
+++ b/pallets/bb-bnc/rpc/runtime-api/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "bifrost-ve-minting-rpc-runtime-api"
+name = "bb-bnc-rpc-runtime-api"
version = "0.8.0"
authors = ["Kadokura "]
edition = "2021"
diff --git a/pallets/ve-minting/rpc/runtime-api/src/lib.rs b/pallets/bb-bnc/rpc/runtime-api/src/lib.rs
similarity index 96%
rename from pallets/ve-minting/rpc/runtime-api/src/lib.rs
rename to pallets/bb-bnc/rpc/runtime-api/src/lib.rs
index 153b3543b..b1309f318 100644
--- a/pallets/ve-minting/rpc/runtime-api/src/lib.rs
+++ b/pallets/bb-bnc/rpc/runtime-api/src/lib.rs
@@ -24,7 +24,7 @@ use sp_api::decl_runtime_apis;
use sp_core::U256;
decl_runtime_apis! {
- pub trait VeMintingRuntimeApi where
+ pub trait BbBNCRuntimeApi where
AccountId: Codec,
BlockNumber: Codec,
{
diff --git a/pallets/ve-minting/rpc/src/lib.rs b/pallets/bb-bnc/rpc/src/lib.rs
similarity index 90%
rename from pallets/ve-minting/rpc/src/lib.rs
rename to pallets/bb-bnc/rpc/src/lib.rs
index 944d53838..f1483120d 100644
--- a/pallets/ve-minting/rpc/src/lib.rs
+++ b/pallets/bb-bnc/rpc/src/lib.rs
@@ -18,8 +18,8 @@
use std::{marker::PhantomData, sync::Arc};
+pub use bb_bnc_rpc_runtime_api::{self as runtime_api, BbBNCRuntimeApi};
use bifrost_primitives::Balance;
-pub use bifrost_ve_minting_rpc_runtime_api::{self as runtime_api, VeMintingRuntimeApi};
use jsonrpsee::{
core::{async_trait, RpcResult},
proc_macros::rpc,
@@ -37,27 +37,27 @@ use sp_runtime::{
};
#[rpc(client, server)]
-pub trait VeMintingRpcApi {
+pub trait BbBNCRpcApi {
/// rpc method for getting user balance
- #[method(name = "ve_minting_balanceOf")]
+ #[method(name = "bb_bnc_balanceOf")]
fn balance_of(&self, who: AccountId, at: Option) -> RpcResult;
/// RPC method to get total supply
- #[method(name = "ve_minting_totalSupply")]
+ #[method(name = "bb_bnc_totalSupply")]
fn total_supply(&self, at: Option) -> RpcResult;
/// RPC method to find block epoch
- #[method(name = "ve_minting_findBlockEpoch")]
+ #[method(name = "bb_bnc_findBlockEpoch")]
fn find_block_epoch(&self, max_epoch: U256, at: Option) -> RpcResult;
}
#[derive(Clone, Debug)]
-pub struct VeMintingRpc {
+pub struct BbBNCRpc {
client: Arc,
_marker: PhantomData,
}
-impl VeMintingRpc
+impl BbBNCRpc
where
Block: BlockT,
C: BlockIdTo,
@@ -68,12 +68,12 @@ where
}
#[async_trait]
-impl VeMintingRpcApiServer<::Hash, AccountId>
- for VeMintingRpc
+impl BbBNCRpcApiServer<::Hash, AccountId>
+ for BbBNCRpc
where
Block: BlockT,
C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend + BlockIdTo,
- C::Api: VeMintingRuntimeApi,
+ C::Api: BbBNCRuntimeApi,
AccountId: Codec,
// CallError: From<>::Error>,
{
diff --git a/pallets/ve-minting/src/benchmarking.rs b/pallets/bb-bnc/src/benchmarking.rs
similarity index 84%
rename from pallets/ve-minting/src/benchmarking.rs
rename to pallets/bb-bnc/src/benchmarking.rs
index 93822ced8..26dcebcfe 100644
--- a/pallets/ve-minting/src/benchmarking.rs
+++ b/pallets/bb-bnc/src/benchmarking.rs
@@ -27,7 +27,7 @@ use frame_system::RawOrigin;
use sp_runtime::traits::UniqueSaturatedFrom;
use sp_std::vec;
-use crate::{BalanceOf, Call, Config, Pallet as VeMinting, Pallet};
+use crate::{BalanceOf, Call, Config, Pallet as BbBNC, Pallet};
use orml_traits::MultiCurrency;
benchmarks! {
@@ -38,7 +38,7 @@ benchmarks! {
create_lock {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -46,7 +46,7 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
@@ -56,7 +56,7 @@ benchmarks! {
increase_amount {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -64,13 +64,13 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
@@ -80,7 +80,7 @@ benchmarks! {
increase_unlock_time {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -88,13 +88,13 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
@@ -104,7 +104,7 @@ benchmarks! {
withdraw {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -112,13 +112,13 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
@@ -130,7 +130,7 @@ benchmarks! {
get_rewards {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -138,13 +138,13 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
@@ -155,7 +155,7 @@ benchmarks! {
}: _(RawOrigin::Signed(test_account))
notify_rewards {
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -165,7 +165,7 @@ benchmarks! {
}: _(RawOrigin::Root,account("seed",1,1),Some((7 * 86400 / 12u32).into()),rewards)
set_markup_coefficient {
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -175,7 +175,7 @@ benchmarks! {
deposit_markup {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -183,18 +183,18 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
));
- assert_ok!(VeMinting::::set_markup_coefficient(
+ assert_ok!(BbBNC::::set_markup_coefficient(
RawOrigin::Root.into(),
CurrencyId::VToken(TokenSymbol::BNC),
1_000.into(),
@@ -206,7 +206,7 @@ benchmarks! {
withdraw_markup {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -214,31 +214,31 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
));
- assert_ok!(VeMinting::::set_markup_coefficient(
+ assert_ok!(BbBNC::::set_markup_coefficient(
RawOrigin::Root.into(),
CurrencyId::VToken(TokenSymbol::BNC),
1_000.into(),
10_000_000_000_000.into()
));
- assert_ok!(VeMinting::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)));
+ assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)));
>::set_block_number((2 * 365 * 86400 / 12u32).into());
}: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC))
redeem_unlock {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -246,31 +246,31 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
));
- assert_ok!(VeMinting::::set_markup_coefficient(
+ assert_ok!(BbBNC::::set_markup_coefficient(
RawOrigin::Root.into(),
CurrencyId::VToken(TokenSymbol::BNC),
1_000.into(),
10_000_000_000_000.into()
));
- assert_ok!(VeMinting::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)));
+ assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)));
>::set_block_number((2 * 86400 / 12u32).into());
}: _(RawOrigin::Signed(test_account), 0)
refresh {
let test_account: T::AccountId = account("seed",1,1);
- assert_ok!(VeMinting::::set_config(
+ assert_ok!(BbBNC::::set_config(
RawOrigin::Root.into(),
Some((4 * 365 * 86400 / 12u32).into()),
Some((7 * 86400 / 12u32).into())
@@ -278,27 +278,27 @@ benchmarks! {
T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?;
let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))];
- assert_ok!(VeMinting::::notify_rewards(
+ assert_ok!(BbBNC::::notify_rewards(
T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?,
account("seed",1,1),
Some((7 * 86400 / 12u32).into()),rewards
));
- assert_ok!(VeMinting::::create_lock(
+ assert_ok!(BbBNC::::create_lock(
RawOrigin::Signed(test_account.clone()).into(),
BalanceOf::::unique_saturated_from(10_000_000_000_000u128),
(365 * 86400 / 12u32).into()
));
- assert_ok!(VeMinting::::set_markup_coefficient(
+ assert_ok!(BbBNC::::set_markup_coefficient(
RawOrigin::Root.into(),
CurrencyId::VToken(TokenSymbol::BNC),
1_000.into(),
10_000_000_000_000.into()
));
- assert_ok!(VeMinting::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)));
+ assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)));
>::set_block_number((2 * 86400 / 12u32).into());
}: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC))
- impl_benchmark_test_suite!(VeMinting,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime);
+ impl_benchmark_test_suite!(BbBNC,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime);
}
diff --git a/pallets/ve-minting/src/incentive.rs b/pallets/bb-bnc/src/incentive.rs
similarity index 89%
rename from pallets/ve-minting/src/incentive.rs
rename to pallets/bb-bnc/src/incentive.rs
index cbbbb7a77..4edfcb1eb 100644
--- a/pallets/ve-minting/src/incentive.rs
+++ b/pallets/bb-bnc/src/incentive.rs
@@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use crate::{traits::VeMintingInterface, *};
+use crate::{traits::BbBNCInterface, *};
use bifrost_primitives::PoolId;
pub use pallet::*;
use sp_std::collections::btree_map::BTreeMap;
@@ -56,10 +56,10 @@ impl Pallet {
/// Check if the current block number is within the end time of the reward pool
pub fn last_time_reward_applicable(pool_id: PoolId) -> BlockNumberFor {
let current_block_number: BlockNumberFor = frame_system::Pallet::::block_number();
- if current_block_number < Self::incentive_configs(pool_id).period_finish {
+ if current_block_number < IncentiveConfigs::::get(pool_id).period_finish {
current_block_number
} else {
- Self::incentive_configs(pool_id).period_finish
+ IncentiveConfigs::::get(pool_id).period_finish
}
}
@@ -67,7 +67,7 @@ impl Pallet {
pub fn reward_per_token(
pool_id: PoolId,
) -> Result, BalanceOf>, DispatchError> {
- let mut conf = Self::incentive_configs(pool_id);
+ let mut conf = IncentiveConfigs::::get(pool_id);
let current_block_number: BlockNumberFor = frame_system::Pallet::::block_number();
let total_supply = Self::total_supply(current_block_number)?;
if total_supply == BalanceOf::::zero() {
@@ -108,7 +108,7 @@ impl Pallet {
) -> Result, BalanceOf>, DispatchError> {
let reward_per_token = Self::reward_per_token(pool_id)?;
let vetoken_balance = Self::balance_of_current_block(addr)?;
- let mut rewards = if let Some(rewards) = Self::rewards(addr) {
+ let mut rewards = if let Some(rewards) = Rewards::::get(addr) {
rewards
} else {
BTreeMap::, BalanceOf>::default()
@@ -118,7 +118,7 @@ impl Pallet {
.checked_mul(U256::from(
reward
.saturating_sub(
- *Self::user_reward_per_token_paid(addr)
+ *UserRewardPerTokenPaid::::get(addr)
.get(currency)
.unwrap_or(&BalanceOf::::zero()),
)
@@ -136,6 +136,15 @@ impl Pallet {
// and total share.
match share_info {
Some((share, total_share)) => {
+ let mut pools = UserFarmingPool::::get(addr);
+ if share.is_zero() {
+ if let Some(pos) = pools.iter().position(|&x| x == pool_id) {
+ pools.remove(pos);
+ }
+ } else {
+ pools.try_push(pool_id).map_err(|_| Error::::UserFarmingPoolOverflow)?;
+ }
+ UserFarmingPool::::insert(addr, pools);
let reward = increment
.checked_mul(U256::from(share.saturated_into::()))
.ok_or(ArithmeticError::Overflow)?
@@ -195,9 +204,13 @@ impl Pallet {
}
/// Update reward for all pools
- pub fn update_reward_all(addr: Option<&AccountIdOf>) -> DispatchResult {
- // TODO: pool_id
- Self::update_reward(0, addr, None)?;
+ pub fn update_reward_all(addr: &AccountIdOf) -> DispatchResult {
+ UserFarmingPool::::get(addr)
+ .iter()
+ .try_for_each(|&pool_id| -> DispatchResult {
+ Self::update_reward(pool_id, Some(addr), None)
+ })?;
+ Self::update_reward(VE_MINTING_SYSTEM_POOL_ID, Some(addr), None)?;
Ok(())
}
@@ -211,7 +224,7 @@ impl Pallet {
if Self::balance_of_current_block(addr)? == BalanceOf::::zero() {
return Ok(());
} // Excit earlier if balance of token is zero
- if let Some(rewards) = Self::rewards(addr) {
+ if let Some(rewards) = Rewards::::get(addr) {
rewards.iter().try_for_each(|(currency, &reward)| -> DispatchResult {
T::MultiCurrency::transfer(
*currency,
@@ -225,8 +238,6 @@ impl Pallet {
addr: addr.to_owned(),
rewards: rewards.into_iter().collect(),
});
- } else {
- return Err(Error::::NoRewards.into());
}
Ok(())
}
@@ -242,7 +253,7 @@ impl Pallet {
None => return Err(Error::::NoController.into()),
};
Self::update_reward(pool_id, None, None)?;
- let mut conf = Self::incentive_configs(pool_id);
+ let mut conf = IncentiveConfigs::::get(pool_id);
let current_block_number: BlockNumberFor = frame_system::Pallet::::block_number();
if current_block_number >= conf.period_finish {
diff --git a/pallets/ve-minting/src/lib.rs b/pallets/bb-bnc/src/lib.rs
similarity index 91%
rename from pallets/ve-minting/src/lib.rs
rename to pallets/bb-bnc/src/lib.rs
index 03ce9a825..3e0728af3 100644
--- a/pallets/ve-minting/src/lib.rs
+++ b/pallets/bb-bnc/src/lib.rs
@@ -49,9 +49,7 @@ pub use incentive::*;
use orml_traits::{LockIdentifier, MultiCurrency, MultiLockableCurrency};
use sp_core::{U256, U512};
use sp_std::{borrow::ToOwned, cmp::Ordering, collections::btree_map::BTreeMap, vec, vec::Vec};
-pub use traits::{
- LockedToken, MarkupCoefficientInfo, MarkupInfo, UserMarkupInfo, VeMintingInterface,
-};
+pub use traits::{BbBNCInterface, LockedToken, MarkupCoefficientInfo, MarkupInfo, UserMarkupInfo};
pub use weights::WeightInfo;
type BalanceOf = <::MultiCurrency as MultiCurrency>>::Balance;
@@ -64,7 +62,7 @@ pub type CurrencyIdOf = <::MultiCurrency as MultiCurrency<
const VE_LOCK_ID: LockIdentifier = *b"vebnclck";
const MARKUP_LOCK_ID: LockIdentifier = *b"vebncmkp";
-
+const VE_MINTING_SYSTEM_POOL_ID: PoolId = u32::MAX;
#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, Default)]
pub struct VeConfig {
amount: Balance,
@@ -109,10 +107,10 @@ pub mod pallet {
type TokenType: Get;
#[pallet::constant]
- type VeMintingPalletId: Get;
+ type IncentivePalletId: Get;
#[pallet::constant]
- type IncentivePalletId: Get;
+ type BuyBackAccount: Get;
/// Convert the block number into a balance.
type BlockNumberToBalance: Convert, BalanceOf>;
@@ -188,6 +186,9 @@ pub mod pallet {
PartiallyRefreshed {
asset_id: CurrencyIdOf,
},
+ NotifyRewardFailed {
+ rewards: Vec<(CurrencyIdOf, BalanceOf)>,
+ },
}
#[pallet::error]
@@ -197,27 +198,23 @@ pub mod pallet {
BelowMinimumMint,
LockNotExist,
LockExist,
- NoRewards,
ArgumentsError,
ExceedsMaxPositions,
NoController,
+ UserFarmingPoolOverflow,
}
#[pallet::storage]
- #[pallet::getter(fn supply)]
pub type Supply = StorageValue<_, BalanceOf, ValueQuery>;
#[pallet::storage]
- #[pallet::getter(fn ve_configs)]
pub type VeConfigs =
StorageValue<_, VeConfig, BlockNumberFor>, ValueQuery>;
#[pallet::storage]
- #[pallet::getter(fn epoch)]
pub type Epoch = StorageValue<_, U256, ValueQuery>;
#[pallet::storage]
- #[pallet::getter(fn locked)]
pub type Locked = StorageMap<
_,
Blake2_128Concat,
@@ -227,18 +224,15 @@ pub mod pallet {
>;
#[pallet::storage]
- #[pallet::getter(fn user_locked)]
pub type UserLocked