diff --git a/Cargo.lock b/Cargo.lock index d4696fa6..01b655b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "annuity" version = "1.0.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-benchmarking", "frame-support", @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "bitcoin" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 0.30.2", "bitcoin_hashes 0.7.6", @@ -1340,7 +1340,7 @@ checksum = "bd769563b4ea2953e2825c9e6b7470a5f55f67e0be00030bf3e390a2a6071f64" [[package]] name = "btc-relay" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 1.2.0", "frame-benchmarking", @@ -1360,7 +1360,7 @@ dependencies = [ [[package]] name = "btc-relay-rpc" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "btc-relay-rpc-runtime-api", "jsonrpsee", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "btc-relay-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "parity-scale-codec", @@ -1722,7 +1722,7 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clients-info" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "fixed-hash 0.7.0", "frame-benchmarking", @@ -2207,7 +2207,7 @@ dependencies = [ [[package]] name = "currency" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "frame-system", @@ -2974,7 +2974,7 @@ dependencies = [ [[package]] name = "escrow" version = "1.0.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-benchmarking", "frame-support", @@ -3838,7 +3838,7 @@ dependencies = [ [[package]] name = "fee" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "currency", "frame-benchmarking", @@ -4846,9 +4846,11 @@ dependencies = [ "pallet-insecure-randomness-collective-flip", "pallet-mmr", "pallet-multisig", + "pallet-nfts", "pallet-offences", "pallet-preimage", "pallet-proxy", + "pallet-psp37", "pallet-ranked-collective", "pallet-receipt-registry", "pallet-referenda", @@ -5956,7 +5958,7 @@ dependencies = [ [[package]] name = "interbtc-primitives" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 1.2.0", "bstringify", @@ -6033,7 +6035,7 @@ dependencies = [ [[package]] name = "issue" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 1.2.0", "btc-relay", @@ -6065,7 +6067,7 @@ dependencies = [ [[package]] name = "issue-rpc" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "issue-rpc-runtime-api", "jsonrpsee", @@ -6078,7 +6080,7 @@ dependencies = [ [[package]] name = "issue-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "parity-scale-codec", @@ -7033,7 +7035,7 @@ checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "loans" version = "1.9.3" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "currency", "frame-benchmarking", @@ -7848,7 +7850,7 @@ dependencies = [ [[package]] name = "nomination" version = "0.5.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "currency", "fee", @@ -8192,7 +8194,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "oracle" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "currency", "frame-benchmarking", @@ -8215,7 +8217,7 @@ dependencies = [ [[package]] name = "oracle-rpc" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "jsonrpsee", "oracle-rpc-runtime-api", @@ -8228,7 +8230,7 @@ dependencies = [ [[package]] name = "oracle-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "interbtc-primitives", @@ -9223,6 +9225,24 @@ dependencies = [ "sp-std 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43)", ] +[[package]] +name = "pallet-nfts" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43#5e49f6e44820affccaf517fd22af564f4b495d40" +dependencies = [ + "enumflags2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log 0.4.20", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0", + "sp-io 7.0.0", + "sp-runtime 7.0.0", + "sp-std 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43)", +] + [[package]] name = "pallet-offences" version = "4.0.0-dev" @@ -9272,6 +9292,22 @@ dependencies = [ "sp-std 5.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43)", ] +[[package]] +name = "pallet-psp37" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-nfts", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0", + "sp-runtime 7.0.0", +] + [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" @@ -10912,7 +10948,7 @@ dependencies = [ [[package]] name = "redeem" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 1.2.0", "btc-relay", @@ -10942,7 +10978,7 @@ dependencies = [ [[package]] name = "redeem-rpc" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10955,7 +10991,7 @@ dependencies = [ [[package]] name = "redeem-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "parity-scale-codec", @@ -11083,7 +11119,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "replace" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 1.2.0", "btc-relay", @@ -11113,7 +11149,7 @@ dependencies = [ [[package]] name = "replace-rpc" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11126,7 +11162,7 @@ dependencies = [ [[package]] name = "replace-rpc-runtime-api" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "parity-scale-codec", @@ -11190,7 +11226,7 @@ dependencies = [ [[package]] name = "reward" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-benchmarking", "frame-support", @@ -11210,7 +11246,7 @@ dependencies = [ [[package]] name = "reward-rpc" version = "0.3.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "jsonrpsee", "oracle-rpc-runtime-api", @@ -11224,7 +11260,7 @@ dependencies = [ [[package]] name = "reward-rpc-runtime-api" version = "0.3.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "oracle-rpc-runtime-api", @@ -13257,7 +13293,7 @@ dependencies = [ [[package]] name = "security" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-benchmarking", "frame-support", @@ -15344,7 +15380,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "staking" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-benchmarking", "frame-support", @@ -16859,7 +16895,7 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" [[package]] name = "traits" version = "1.9.3" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "frame-system", @@ -17065,9 +17101,9 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "digest 0.10.7", - "rand 0.5.6", + "rand 0.4.6", "static_assertions", ] @@ -17363,7 +17399,7 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vault-registry" version = "1.2.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "bitcoin 1.2.0", "currency", @@ -17396,7 +17432,7 @@ dependencies = [ [[package]] name = "vault-registry-rpc" version = "0.3.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "jsonrpsee", "oracle-rpc-runtime-api", @@ -17410,7 +17446,7 @@ dependencies = [ [[package]] name = "vault-registry-rpc-runtime-api" version = "0.3.0" -source = "git+https://github.com/ggxchain/interbtc.git?branch=polkadot-v0.9.43#fb0433e19d3f560b248f133c28ee0c0635e30ac0" +source = "git+https://github.com/ggxchain/interbtc.git?rev=1074d1b7#1074d1b70be897a0abb2fd0545064cfc6e96f9c7" dependencies = [ "frame-support", "oracle-rpc-runtime-api", diff --git a/Cargo.toml b/Cargo.toml index 485ac160..d43cfa9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,6 +134,7 @@ pallet-im-online = { version = "4.0.0-dev", git = "https://github.com/paritytech pallet-indices = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } pallet-mmr = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } pallet-multisig = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } +pallet-nfts = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } pallet-offences = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } pallet-preimage = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } pallet-proxy = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } @@ -260,43 +261,44 @@ orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-li orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "28a2e6f0df9540d91db4018c7ecebb8bfc217a2a", default-features = false } # BTC bridge -annuity = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -bitcoin = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -btc-relay = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -clients-info = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -escrow = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -fee = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -interbtc-currency = { package = "currency", git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -issue = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -loans = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -nomination = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -oracle = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -primitives = { package = "interbtc-primitives", git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -redeem = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -replace = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -reward = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -security = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -staking = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -vault-registry = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } +annuity = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +bitcoin = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +btc-relay = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +clients-info = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +escrow = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +fee = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +interbtc-currency = { package = "currency", git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +issue = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +loans = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +nomination = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +oracle = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +primitives = { package = "interbtc-primitives", git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +redeem = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +replace = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +reward = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +security = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +staking = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +vault-registry = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } -btc-relay-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -issue-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -oracle-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -redeem-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -replace-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -reward-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -vault-registry-rpc = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } +btc-relay-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +issue-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +oracle-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +redeem-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +replace-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +reward-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +vault-registry-rpc = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } -btc-relay-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -issue-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -oracle-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -redeem-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -replace-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -reward-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } -vault-registry-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", branch = "polkadot-v0.9.43", default-features = false } +btc-relay-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +issue-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +oracle-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +redeem-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +replace-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +reward-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } +vault-registry-rpc-runtime-api = { git = "https://github.com/ggxchain/interbtc.git", rev = "1074d1b7", default-features = false } # Dex pallet-dex = { path = "pallet/dex", default-features = false } +pallet-psp37 = { path = "pallet/psp37", default-features = false } # Supress warnings from the peerset in logs during syncing # The polkadot did the same in the next release. See: diff --git a/pallet/psp37/Cargo.toml b/pallet/psp37/Cargo.toml new file mode 100644 index 00000000..283e583f --- /dev/null +++ b/pallet/psp37/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "pallet-psp37" +version = "0.1.0" +edition.workspace = true +authors.workspace = true +repository.workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +frame-support.workspace = true +frame-system.workspace = true +pallet-nfts.workspace = true +scale-codec = { package = "parity-scale-codec", workspace = true, features = ["max-encoded-len"] } +scale-info.workspace = true +sp-runtime.workspace = true + +[dev-dependencies] +pallet-assets.workspace = true +pallet-balances.workspace = true +pallet-timestamp.workspace = true +sp-core.workspace = true + +[features] +default = ["std"] +std = [ + "frame-support/std", + "frame-system/std", + "pallet-assets/std", + "pallet-balances/std", + "pallet-nfts/std", + "pallet-timestamp/std", + "scale-codec/std", + "scale-info/std", + "sp-core/std", + "sp-runtime/std", +] + +try-runtime = ["frame-support/try-runtime"] \ No newline at end of file diff --git a/pallet/psp37/src/lib.rs b/pallet/psp37/src/lib.rs new file mode 100644 index 00000000..81cd6266 --- /dev/null +++ b/pallet/psp37/src/lib.rs @@ -0,0 +1,317 @@ +#![cfg_attr(not(feature = "std"), no_std)] +#![recursion_limit = "256"] +#[cfg(test)] +pub mod mock; +#[cfg(test)] +pub mod tests; + +// use cumulus_pallet_xcm::Origin as CumulusOrigin; +pub use frame_support::traits::Currency; +use frame_system::{ + ensure_signed, + pallet_prelude::{BlockNumberFor, OriginFor}, +}; +pub use pallet::*; +use pallet_nfts::{ + CollectionConfig, CollectionSettings, Incrementable, MintSettings, NextCollectionId, +}; + +use scale_info::prelude::{vec, vec::Vec}; +use sp_runtime::traits::One; +pub use sp_runtime::traits::{StaticLookup, Zero}; +type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; +// pub use xcm::prelude::*; +pub type BalanceOf = <>::Currency as Currency< + ::AccountId, +>>::Balance; + +pub type CollectionConfigFor = pallet_nfts::CollectionConfig< + BalanceOf, + BlockNumberFor, + >::CollectionId, +>; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use sp_runtime::DispatchResult; + /// The current storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + + #[pallet::pallet] + #[pallet::without_storage_info] + #[pallet::storage_version(STORAGE_VERSION)] + pub struct Pallet(PhantomData<(T, I)>); + + /// Configure the pallet by specifying the parameters and types on which it depends. + #[pallet::config] + /// The module configuration trait. + pub trait Config: frame_system::Config + pallet_nfts::Config { + /// Because this pallet emits events, it depends on the runtime's definition of an event. + type RuntimeEvent: From> + + IsType<::RuntimeEvent>; + } + + #[pallet::storage] + #[pallet::getter(fn native_asset_id)] + pub type DefaultItemId, I: 'static = ()> = StorageValue<_, T::ItemId, OptionQuery>; + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event, I: 'static = ()> { + /// An `item` of a `id` has been approved by the `owner` for transfer by + /// a `operator`. + Approval { + owner: T::AccountId, + operator: AccountIdLookupOf, + id: T::CollectionId, + value: BalanceOf, + }, + + /// An `item` was transferred. + Transfer { + from: T::AccountId, + to: AccountIdLookupOf, + id: T::CollectionId, + value: BalanceOf, + }, + + /// A `token id` was created. + Created { + id: T::CollectionId, + creator: T::AccountId, + owner: AccountIdLookupOf, + }, + + /// `token value` was issued. + Issued { + id: T::CollectionId, + owner: AccountIdLookupOf, + value: BalanceOf, + }, + + /// New metadata has been set for an item. + MetadataSet { + id: T::CollectionId, + data: BoundedVec, + }, + + /// set default item id + DefaultItemIdSet { id: T::ItemId }, + } + + // Errors inform users that something went wrong. + #[pallet::error] + pub enum Error { + // Default item id not exist + DefaultItemIdNotExist, + // From account Id not equ origin + FromIdNotEquOrigin, + // Default item had init + DefaultItemIdHadInited, + } + + #[pallet::call] + impl, I: 'static> Pallet { + #[pallet::weight({0})] + #[pallet::call_index(0)] + pub fn approve( + origin: OriginFor, + operator: AccountIdLookupOf, + id: T::CollectionId, + value: BalanceOf, + ) -> DispatchResult { + let owner = ensure_signed(origin.clone())?; + + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_some(), Error::::DefaultItemIdNotExist); + + let rt = pallet_nfts::Pallet::::approve_transfer( + origin.clone(), + id, + item_id.unwrap(), + operator.clone(), + None, + )?; + + if rt == () { + Self::deposit_event(Event::Approval { + owner, + operator, + id, + value, + }); + } + + Ok(rt) + } + + #[pallet::weight({0})] + #[pallet::call_index(1)] + pub fn transfer( + origin: OriginFor, + to: AccountIdLookupOf, + id: T::CollectionId, + value: BalanceOf, + _data: Vec, + ) -> DispatchResult { + let from = ensure_signed(origin.clone())?; + + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_some(), Error::::DefaultItemIdNotExist); + + let rt = pallet_nfts::Pallet::::transfer( + origin.clone(), + id, + item_id.unwrap(), + to.clone(), + )?; + + if rt == () { + Self::deposit_event(Event::Transfer { + from, + to, + id, + value, + }); + } + + Ok(rt) + } + + #[pallet::weight({0})] + #[pallet::call_index(2)] + pub fn transfer_from( + origin: OriginFor, + from: T::AccountId, + to: AccountIdLookupOf, + id: T::CollectionId, + value: BalanceOf, + _data: Vec, + ) -> DispatchResult { + let who = ensure_signed(origin.clone())?; + + ensure!(who == from, Error::::FromIdNotEquOrigin); + + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_some(), Error::::DefaultItemIdNotExist); + + let rt = pallet_nfts::Pallet::::transfer( + origin.clone(), + id, + item_id.unwrap(), + to.clone(), + )?; + + if rt == () { + Self::deposit_event(Event::Transfer { + from, + to, + id, + value, + }); + } + + Ok(rt) + } + + #[pallet::weight({0})] + #[pallet::call_index(3)] + pub fn create_id(origin: OriginFor, owner: AccountIdLookupOf) -> DispatchResult { + let creator = ensure_signed(origin.clone())?; + + let id = NextCollectionId::::get().unwrap_or(T::CollectionId::initial_value()); + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_some(), Error::::DefaultItemIdNotExist); + + let rt = pallet_nfts::Pallet::::create( + origin.clone(), + owner.clone(), + CollectionConfig { + settings: CollectionSettings::all_enabled(), + max_supply: None, + mint_settings: MintSettings::default(), + }, + )?; + + if rt == () { + Self::deposit_event(Event::Created { id, creator, owner }); + } + + Ok(rt) + } + + #[pallet::weight({0})] + #[pallet::call_index(4)] + pub fn mint( + origin: OriginFor, + id: T::CollectionId, + mint_to: AccountIdLookupOf, + ) -> DispatchResult { + let _who = ensure_signed(origin.clone())?; + + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_some(), Error::::DefaultItemIdNotExist); + + let rt = pallet_nfts::Pallet::::mint( + origin.clone(), + id, + item_id.unwrap(), + mint_to.clone(), + None, + )?; + + if rt == () { + Self::deposit_event(Event::Issued { + id, + owner: mint_to, + value: One::one(), + }); + } + + Ok(rt) + } + + #[pallet::weight({0})] + #[pallet::call_index(5)] + pub fn set_metadata( + origin: OriginFor, + id: T::CollectionId, + data: BoundedVec>::StringLimit>, + ) -> DispatchResult { + let _who = ensure_signed(origin.clone())?; + + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_some(), Error::::DefaultItemIdNotExist); + + let rt = pallet_nfts::Pallet::::set_metadata( + origin.clone(), + id, + item_id.unwrap(), + data.clone(), + )?; + + if rt == () { + Self::deposit_event(Event::MetadataSet { id, data }); + } + + Ok(rt) + } + + #[pallet::weight({0})] + #[pallet::call_index(6)] + pub fn init_default_item_id(origin: OriginFor, id: T::ItemId) -> DispatchResult { + let _who = ensure_signed(origin.clone())?; + + let item_id = DefaultItemId::::get(); + ensure!(item_id.is_none(), Error::::DefaultItemIdHadInited); + + DefaultItemId::::put(id); + + Self::deposit_event(Event::DefaultItemIdSet { id }); + + Ok(()) + } + } +} diff --git a/pallet/psp37/src/mock.rs b/pallet/psp37/src/mock.rs new file mode 100644 index 00000000..16fbec30 --- /dev/null +++ b/pallet/psp37/src/mock.rs @@ -0,0 +1,205 @@ +use crate as pallet_psp37; + +use frame_support::{ + pallet_prelude::Weight, parameter_types, sp_io, traits::AsEnsureOriginWithArg, + weights::constants::RocksDbWeight, +}; +use frame_system::EnsureSigned; +use pallet_nfts::PalletFeatures; +use sp_core::{ConstU128, ConstU32, ConstU64, H256}; +use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32, MultiSignature}; + +pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); +pub const BOB: AccountId32 = AccountId32::new([1u8; 32]); +pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]); + +pub const INITIAL_BALANCE: u128 = 1_000_000_000; + +pub type AccountId = AccountId32; +pub type Balance = u128; +pub type AssetId = u32; + +pub type Signature = MultiSignature; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system, + Balances: pallet_balances, + Timestamp: pallet_timestamp, + Assets: pallet_assets, + Nfts: pallet_nfts, + Psp37: pallet_psp37, + } +); + +impl pallet_balances::Config for Test { + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ConstU128<1>; + type AccountStore = System; + type WeightInfo = pallet_balances::weights::SubstrateWeight; + type MaxLocks = ConstU32<50>; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type HoldIdentifier = (); + type FreezeIdentifier = (); + type MaxHolds = ConstU32<0>; + type MaxFreezes = ConstU32<0>; +} + +// These parameters dont matter much as this will only be called by root with the forced arguments +// No deposit is substracted with those methods +parameter_types! { + pub const AssetDeposit: Balance = 0; + pub const AssetAccountDeposit: Balance = 0; + pub const ApprovalDeposit: Balance = 0; + pub const AssetsStringLimit: u32 = 50; + pub const MetadataDepositBase: Balance = 0; + pub const MetadataDepositPerByte: Balance = 0; +} + +impl pallet_assets::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type AssetId = AssetId; + type Currency = Balances; + type ForceOrigin = frame_system::EnsureRoot; + type AssetDeposit = AssetDeposit; + type AssetAccountDeposit = AssetAccountDeposit; + type MetadataDepositBase = MetadataDepositBase; + type MetadataDepositPerByte = MetadataDepositPerByte; + type ApprovalDeposit = ApprovalDeposit; + type StringLimit = AssetsStringLimit; + type Freezer = (); + type Extra = (); + type CreateOrigin = AsEnsureOriginWithArg>; + type WeightInfo = pallet_assets::weights::SubstrateWeight; + type RemoveItemsLimit = ConstU32<0>; + type AssetIdParameter = AssetId; + type CallbackHandle = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + +parameter_types! { + pub BlockWeights: frame_system::limits::BlockWeights = + frame_system::limits::BlockWeights::simple_max( + Weight::from_parts(2_000_000_000_000, u64::MAX), + ); +} + +impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = BlockWeights; + type BlockLength = (); + type DbWeight = RocksDbWeight; + type RuntimeOrigin = RuntimeOrigin; + type Index = u64; + type BlockNumber = u64; + type RuntimeCall = RuntimeCall; + type Hash = H256; + type Version = (); + type Hashing = sp_runtime::traits::BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU64<250>; + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +impl pallet_timestamp::Config for Test { + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = ConstU64<2>; + type WeightInfo = (); +} + +parameter_types! { + pub const CollectionDeposit: Balance = 100; + pub const ItemDeposit: Balance = 1 ; + pub const KeyLimit: u32 = 32; + pub const ValueLimit: u32 = 256; + pub const ApprovalsLimit: u32 = 20; + pub const ItemAttributesApprovalsLimit: u32 = 20; + pub const MaxTips: u32 = 10; + + pub Features: PalletFeatures = PalletFeatures::all_enabled(); + pub const MaxAttributesPerCall: u32 = 10; +} + +impl pallet_nfts::Config for Test { + type RuntimeEvent = RuntimeEvent; + type CollectionId = u32; + type ItemId = u32; + type Currency = Balances; + type ForceOrigin = frame_system::EnsureRoot; + type CollectionDeposit = CollectionDeposit; + type ItemDeposit = ItemDeposit; + type MetadataDepositBase = MetadataDepositBase; + type AttributeDepositBase = MetadataDepositBase; + type DepositPerByte = MetadataDepositPerByte; + type StringLimit = AssetsStringLimit; + type KeyLimit = KeyLimit; + type ValueLimit = ValueLimit; + type ApprovalsLimit = ApprovalsLimit; + type ItemAttributesApprovalsLimit = ItemAttributesApprovalsLimit; + type MaxTips = MaxTips; + type MaxDeadlineDuration = (); + type MaxAttributesPerCall = MaxAttributesPerCall; + type Features = Features; + type OffchainSignature = Signature; + type OffchainPublic = ::Signer; + type WeightInfo = (); + type CreateOrigin = AsEnsureOriginWithArg>; + type Locker = (); +} + +impl pallet_psp37::Config for Test { + type RuntimeEvent = RuntimeEvent; +} + +pub struct ExtBuilder; + +impl Default for ExtBuilder { + fn default() -> Self { + ExtBuilder + } +} + +impl ExtBuilder { + pub fn build(self) -> sp_io::TestExternalities { + let mut storage = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE)], + } + .assimilate_storage(&mut storage) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + ExtBuilder::default().build() +} diff --git a/pallet/psp37/src/tests.rs b/pallet/psp37/src/tests.rs new file mode 100644 index 00000000..e380bb56 --- /dev/null +++ b/pallet/psp37/src/tests.rs @@ -0,0 +1,122 @@ +use super::{pallet::Error, *}; +use frame_support::{assert_noop, assert_ok, BoundedVec}; +use mock::*; + +#[test] +fn test_create_id() { + new_test_ext().execute_with(|| { + assert_noop!( + Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE), + Error::::DefaultItemIdNotExist + ); + + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + assert_ok!(Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE)); + }) +} + +#[test] +fn test_mint() { + new_test_ext().execute_with(|| { + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + assert_ok!(Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE)); + assert_ok!(Psp37::mint(RuntimeOrigin::signed(ALICE), 0, ALICE)); + }) +} + +#[test] +fn test_approve() { + new_test_ext().execute_with(|| { + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + assert_ok!(Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE)); + assert_ok!(Psp37::mint(RuntimeOrigin::signed(ALICE), 0, ALICE)); + + assert_noop!( + Psp37::approve(RuntimeOrigin::signed(CHARLIE), BOB, 0, 1), + pallet_nfts::Error::::NoPermission + ); + + assert_ok!(Psp37::approve(RuntimeOrigin::signed(ALICE), BOB, 0, 1)); + }) +} + +#[test] +fn test_transfer() { + new_test_ext().execute_with(|| { + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + assert_ok!(Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE)); + assert_ok!(Psp37::mint(RuntimeOrigin::signed(ALICE), 0, ALICE)); + + assert_ok!(Psp37::transfer( + RuntimeOrigin::signed(ALICE), + BOB, + 0, + 0, + vec![] + )); + }) +} + +#[test] +fn test_transfer_from() { + new_test_ext().execute_with(|| { + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + assert_ok!(Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE)); + assert_ok!(Psp37::mint(RuntimeOrigin::signed(ALICE), 0, ALICE)); + + assert_ok!(Psp37::approve(RuntimeOrigin::signed(ALICE), BOB, 0, 1)); + + assert_noop!( + Psp37::transfer_from(RuntimeOrigin::signed(CHARLIE), ALICE, BOB, 0, 1, vec![]), + Error::::FromIdNotEquOrigin + ); + + assert_noop!( + Psp37::transfer_from(RuntimeOrigin::signed(CHARLIE), CHARLIE, BOB, 0, 1, vec![]), + pallet_nfts::Error::::NoPermission + ); + + assert_ok!(Psp37::transfer_from( + RuntimeOrigin::signed(BOB), + BOB, + CHARLIE, + 0, + 1, + vec![] + )); + }) +} + +#[test] +fn test_set_metadata() { + new_test_ext().execute_with(|| { + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + assert_ok!(Psp37::create_id(RuntimeOrigin::signed(ALICE), ALICE)); + assert_ok!(Psp37::mint(RuntimeOrigin::signed(ALICE), 0, ALICE)); + + let data: BoundedVec = vec![1, 2, 3].try_into().unwrap(); + + assert_ok!(Psp37::set_metadata(RuntimeOrigin::signed(ALICE), 0, data)); + }) +} + +#[test] +fn test_set_default_item_id() { + new_test_ext().execute_with(|| { + assert_ok!(Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0)); + + let item_id = DefaultItemId::::get(); + assert_eq!(item_id, Some(0)); + + assert_noop!( + Psp37::init_default_item_id(RuntimeOrigin::signed(ALICE), 0), + Error::::DefaultItemIdHadInited + ); + }) +} diff --git a/runtime/brooklyn/Cargo.toml b/runtime/brooklyn/Cargo.toml index 886d0e88..e08ceaf1 100644 --- a/runtime/brooklyn/Cargo.toml +++ b/runtime/brooklyn/Cargo.toml @@ -58,6 +58,7 @@ pallet-im-online.workspace = true pallet-indices.workspace = true pallet-mmr.workspace = true pallet-multisig.workspace = true +pallet-nfts.workspace = true pallet-offences.workspace = true pallet-preimage.workspace = true pallet-proxy.workspace = true @@ -154,6 +155,8 @@ vault-registry-rpc-runtime-api.workspace = true # Dex pallet-dex.workspace = true +pallet-psp37.workspace = true + [build-dependencies] substrate-wasm-builder.workspace = true @@ -209,6 +212,7 @@ std = [ "pallet-indices/std", "pallet-mmr/std", "pallet-multisig/std", + "pallet-nfts/std", "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", @@ -288,6 +292,8 @@ std = [ #Dex "pallet-dex/std", + + "pallet-psp37/std", ] aura = [] allowlist = [] diff --git a/runtime/brooklyn/src/lib.rs b/runtime/brooklyn/src/lib.rs index edcd9705..7872d267 100644 --- a/runtime/brooklyn/src/lib.rs +++ b/runtime/brooklyn/src/lib.rs @@ -25,6 +25,7 @@ mod ink; pub mod light_client; pub mod pos; mod prelude; +pub mod psp37; mod version; pub use version::VERSION; @@ -68,6 +69,7 @@ use frame_support::weights::constants::ParityDbWeight as RuntimeDbWeight; use frame_support::weights::constants::RocksDbWeight as RuntimeDbWeight; pub use pallet_grandpa::AuthorityId as GrandpaId; use pallet_grandpa::{fg_primitives, AuthorityList as GrandpaAuthorityList}; +use pallet_nfts::PalletFeatures; use pallet_session::historical::{self as pallet_session_historical}; use pallet_transaction_payment::CurrencyAdapter; use pos::{currency, session_payout}; @@ -569,6 +571,51 @@ impl pallet_utility::Config for Runtime { type WeightInfo = pallet_utility::weights::SubstrateWeight; } +parameter_types! { + pub const CollectionDeposit: Balance = 100 * GGX; + pub const ItemDeposit: Balance = 1 * GGX; + pub const KeyLimit: u32 = 32; + pub const ValueLimit: u32 = 256; + pub const ApprovalsLimit: u32 = 20; + pub const ItemAttributesApprovalsLimit: u32 = 20; + pub const MaxTips: u32 = 10; + pub storage MaxDeadlineDuration: BlockNumber = 12 * 30 * Days::get(); + + pub Features: PalletFeatures = PalletFeatures::all_enabled(); + pub const MaxAttributesPerCall: u32 = 10; + + pub const NftsStringLimit: u32 = 256; +} + +impl pallet_nfts::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CollectionId = u32; + type ItemId = u32; + type Currency = Balances; + type ForceOrigin = frame_system::EnsureRoot; + type CollectionDeposit = CollectionDeposit; + type ItemDeposit = ItemDeposit; + type MetadataDepositBase = MetadataDepositBase; + type AttributeDepositBase = MetadataDepositBase; + type DepositPerByte = MetadataDepositPerByte; + type StringLimit = NftsStringLimit; + type KeyLimit = KeyLimit; + type ValueLimit = ValueLimit; + type ApprovalsLimit = ApprovalsLimit; + type ItemAttributesApprovalsLimit = ItemAttributesApprovalsLimit; + type MaxTips = MaxTips; + type MaxDeadlineDuration = MaxDeadlineDuration; + type MaxAttributesPerCall = MaxAttributesPerCall; + type Features = Features; + type OffchainSignature = Signature; + type OffchainPublic = ::Signer; + type WeightInfo = pallet_nfts::weights::SubstrateWeight; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); + type CreateOrigin = AsEnsureOriginWithArg>; + type Locker = (); +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -603,6 +650,7 @@ construct_runtime!( Historical: pallet_session_historical, RandomnessCollectiveFlip: pallet_randomness_collective_flip, ElectionProviderMultiPhase: pallet_election_provider_multi_phase, + Nfts: pallet_nfts, // Goverment pallets Treasury: pallet_treasury, @@ -670,6 +718,10 @@ construct_runtime!( // Dex Dex: pallet_dex, + + // Psp37 + Psp37: pallet_psp37, + } ); diff --git a/runtime/brooklyn/src/psp37.rs b/runtime/brooklyn/src/psp37.rs new file mode 100644 index 00000000..83e4ffed --- /dev/null +++ b/runtime/brooklyn/src/psp37.rs @@ -0,0 +1,5 @@ +use crate::prelude::*; + +impl pallet_psp37::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/runtime-common/src/weights/btc_relay.rs b/runtime/runtime-common/src/weights/btc_relay.rs index 0958e8c7..ad5bd501 100644 --- a/runtime/runtime-common/src/weights/btc_relay.rs +++ b/runtime/runtime-common/src/weights/btc_relay.rs @@ -94,6 +94,26 @@ impl btc_relay::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } + + fn update_store_utxo_to_spent () -> Weight { + // Proof Size summary in bytes: + // Measured: `874` + // Estimated: `6340` + // Minimum execution time: 88_808_000 picoseconds. + Weight::from_parts(90_482_000, 6340) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + + fn store_monitor_utxo () -> Weight { + // Proof Size summary in bytes: + // Measured: `874` + // Estimated: `6340` + // Minimum execution time: 88_808_000 picoseconds. + Weight::from_parts(90_482_000, 6340) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } /// Storage: BTCRelay ChainCounter (r:1 w:1) /// Proof: BTCRelay ChainCounter (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BTCRelay BlockHeaders (r:2 w:1)