From 6416e0079b9389e74d86e9dc7335b61cbefa88c2 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 6 Dec 2023 09:53:48 -0500 Subject: [PATCH] Add ABI crate Call and Event are both from the pallets, which are AGPL licensed. Accordingly, they make serai-client AGPL licensed when serai-client must end up MIT licensed. This creates a MIT-licensed variant of Calls and Events such that they can be used by serai-client, enabling transitioning it to MIT. Relevant to https://github.com/serai-dex/serai/issues/337. --- Cargo.lock | 243 +++++++++++++++------------ Cargo.toml | 2 + substrate/abi/Cargo.toml | 38 +++++ substrate/abi/LICENSE | 21 +++ substrate/abi/src/babe.rs | 15 ++ substrate/abi/src/coins.rs | 23 +++ substrate/abi/src/dex.rs | 77 +++++++++ substrate/abi/src/grandpa.rs | 24 +++ substrate/abi/src/in_instructions.rs | 20 +++ substrate/abi/src/lib.rs | 42 +++++ substrate/abi/src/signals.rs | 57 +++++++ substrate/abi/src/system.rs | 8 + substrate/abi/src/timestamp.rs | 6 + substrate/abi/src/validator_sets.rs | 68 ++++++++ 14 files changed, 539 insertions(+), 105 deletions(-) create mode 100644 substrate/abi/Cargo.toml create mode 100644 substrate/abi/LICENSE create mode 100644 substrate/abi/src/babe.rs create mode 100644 substrate/abi/src/coins.rs create mode 100644 substrate/abi/src/dex.rs create mode 100644 substrate/abi/src/grandpa.rs create mode 100644 substrate/abi/src/in_instructions.rs create mode 100644 substrate/abi/src/lib.rs create mode 100644 substrate/abi/src/signals.rs create mode 100644 substrate/abi/src/system.rs create mode 100644 substrate/abi/src/timestamp.rs create mode 100644 substrate/abi/src/validator_sets.rs diff --git a/Cargo.lock b/Cargo.lock index 047d54be..13febec8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2219,7 +2219,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", ] @@ -2242,7 +2242,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support", "frame-support-procedural", @@ -2267,7 +2267,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support", "frame-system", @@ -2296,7 +2296,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "bitflags 1.3.2", "environmental", @@ -2329,7 +2329,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "Inflector", "cfg-expr", @@ -2347,7 +2347,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.3.1", @@ -2359,7 +2359,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "proc-macro2", "quote", @@ -2369,7 +2369,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "cfg-if", "frame-support", @@ -2388,7 +2388,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "sp-api", @@ -2397,7 +2397,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support", "parity-scale-codec", @@ -4831,7 +4831,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support", "frame-system", @@ -4845,7 +4845,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-benchmarking", "frame-support", @@ -4869,7 +4869,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-benchmarking", "frame-support", @@ -4892,7 +4892,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support", "frame-system", @@ -4913,7 +4913,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-benchmarking", "frame-support", @@ -4931,7 +4931,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-support", "frame-system", @@ -4947,7 +4947,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -4963,7 +4963,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6116,7 +6116,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "log", "sp-core", @@ -6127,7 +6127,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "futures", @@ -6155,7 +6155,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "futures", "futures-timer", @@ -6178,7 +6178,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6193,7 +6193,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -6212,7 +6212,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -6223,7 +6223,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "chrono", @@ -6262,7 +6262,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "fnv", "futures", @@ -6287,7 +6287,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "hash-db", "kvdb", @@ -6313,7 +6313,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "futures", @@ -6338,7 +6338,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "fork-tree", @@ -6374,7 +6374,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6387,7 +6387,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "ahash", "array-bytes", @@ -6428,7 +6428,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "futures", @@ -6451,7 +6451,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -6473,7 +6473,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -6485,7 +6485,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "anyhow", "cfg-if", @@ -6502,7 +6502,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "anstyle", "futures", @@ -6518,7 +6518,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "parking_lot 0.12.1", @@ -6532,7 +6532,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "async-channel", @@ -6574,7 +6574,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-channel", "cid", @@ -6594,7 +6594,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -6611,7 +6611,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "ahash", "futures", @@ -6630,7 +6630,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "async-channel", @@ -6651,7 +6651,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "async-channel", @@ -6685,7 +6685,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "futures", @@ -6703,7 +6703,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "bytes", "fnv", @@ -6735,7 +6735,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6744,7 +6744,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "futures", "jsonrpsee", @@ -6774,7 +6774,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -6793,7 +6793,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "http", "jsonrpsee", @@ -6808,7 +6808,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "futures", @@ -6834,7 +6834,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "directories", @@ -6897,7 +6897,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "log", "parity-scale-codec", @@ -6908,7 +6908,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "futures", "libc", @@ -6927,7 +6927,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "chrono", "futures", @@ -6946,7 +6946,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "anstyle", "chrono", @@ -6974,7 +6974,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -6985,7 +6985,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "futures", @@ -7011,7 +7011,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "futures", @@ -7027,7 +7027,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-channel", "futures", @@ -7249,6 +7249,26 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" +[[package]] +name = "serai-abi" +version = "0.1.0" +dependencies = [ + "borsh", + "frame-support", + "parity-scale-codec", + "serai-coins-primitives", + "serai-in-instructions-primitives", + "serai-primitives", + "serai-signals-primitives", + "serai-validator-sets-primitives", + "serde", + "sp-application-crypto", + "sp-consensus-babe", + "sp-consensus-grandpa", + "sp-core", + "sp-runtime", +] + [[package]] name = "serai-client" version = "0.1.0" @@ -7690,11 +7710,24 @@ dependencies = [ "scale-info", "serai-in-instructions-pallet", "serai-primitives", + "serai-signals-primitives", "serai-validator-sets-pallet", "sp-core", "sp-io", ] +[[package]] +name = "serai-signals-primitives" +version = "0.1.0" +dependencies = [ + "borsh", + "parity-scale-codec", + "scale-info", + "serai-primitives", + "serde", + "zeroize", +] + [[package]] name = "serai-validator-sets-pallet" version = "0.1.0" @@ -8025,7 +8058,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "hash-db", "log", @@ -8046,7 +8079,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "Inflector", "blake2", @@ -8060,7 +8093,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "scale-info", @@ -8073,7 +8106,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "integer-sqrt", "num-traits", @@ -8087,7 +8120,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "scale-info", @@ -8099,7 +8132,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "sp-api", "sp-inherents", @@ -8110,7 +8143,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "futures", "log", @@ -8128,7 +8161,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "futures", @@ -8142,7 +8175,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "parity-scale-codec", @@ -8161,7 +8194,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "finality-grandpa", "log", @@ -8179,7 +8212,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "scale-info", @@ -8191,7 +8224,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "array-bytes", "bitflags 1.3.2", @@ -8234,7 +8267,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "blake2b_simd", "byteorder", @@ -8246,7 +8279,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "quote", "sp-core-hashing", @@ -8256,7 +8289,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8265,7 +8298,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "proc-macro2", "quote", @@ -8275,7 +8308,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "environmental", "parity-scale-codec", @@ -8286,7 +8319,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8300,7 +8333,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "bytes", "ed25519", @@ -8322,7 +8355,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "lazy_static", "sp-core", @@ -8333,7 +8366,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -8345,7 +8378,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "thiserror", "zstd 0.12.4", @@ -8354,7 +8387,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -8365,7 +8398,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "sp-api", "sp-core", @@ -8375,7 +8408,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "backtrace", "lazy_static", @@ -8385,7 +8418,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "rustc-hash", "serde", @@ -8395,7 +8428,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "either", "hash256-std-hasher", @@ -8417,7 +8450,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8435,7 +8468,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "Inflector", "proc-macro-crate 1.3.1", @@ -8447,7 +8480,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "scale-info", @@ -8462,7 +8495,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8476,7 +8509,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "hash-db", "log", @@ -8497,12 +8530,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8515,7 +8548,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "async-trait", "parity-scale-codec", @@ -8528,7 +8561,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "sp-std", @@ -8540,7 +8573,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "sp-api", "sp-runtime", @@ -8549,7 +8582,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "ahash", "hash-db", @@ -8572,7 +8605,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8589,7 +8622,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8600,7 +8633,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -8613,7 +8646,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "parity-scale-codec", "scale-info", @@ -8791,12 +8824,12 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8815,7 +8848,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "hyper", "log", @@ -8827,7 +8860,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" +source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" dependencies = [ "anstyle", "build-helper", diff --git a/Cargo.toml b/Cargo.toml index 45950950..a63b7461 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,8 @@ members = [ "substrate/signals/primitives", "substrate/signals/pallet", + "substrate/abi", + "substrate/runtime", "substrate/node", diff --git a/substrate/abi/Cargo.toml b/substrate/abi/Cargo.toml new file mode 100644 index 00000000..8de000f2 --- /dev/null +++ b/substrate/abi/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "serai-abi" +version = "0.1.0" +description = "ABI for the Serai runtime" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/abi" +authors = ["Luke Parker "] +edition = "2021" +rust-version = "1.69" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[dependencies] +scale = { package = "parity-scale-codec", version = "3", features = ["derive"] } + +borsh = { version = "1", features = ["derive", "de_strict_order"], optional = true } +serde = { version = "1", features = ["derive", "alloc"], optional = true } + +sp-application-crypto = { git = "https://github.com/serai-dex/substrate" } +sp-core = { git = "https://github.com/serai-dex/substrate" } +sp-runtime = { git = "https://github.com/serai-dex/substrate" } + +sp-consensus-babe = { git = "https://github.com/serai-dex/substrate" } +sp-consensus-grandpa = { git = "https://github.com/serai-dex/substrate" } + +serai-primitives = { path = "../primitives", version = "0.1" } +serai-coins-primitives = { path = "../coins/primitives", version = "0.1" } +serai-validator-sets-primitives = { path = "../validator-sets/primitives", version = "0.1" } +serai-in-instructions-primitives = { path = "../in-instructions/primitives", version = "0.1" } +serai-signals-primitives = { path = "../signals/primitives", version = "0.1" } + +frame-support = { git = "https://github.com/serai-dex/substrate" } + +[features] +borsh = ["dep:borsh"] +serde = ["dep:serde"] diff --git a/substrate/abi/LICENSE b/substrate/abi/LICENSE new file mode 100644 index 00000000..e6bff13c --- /dev/null +++ b/substrate/abi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Luke Parker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/substrate/abi/src/babe.rs b/substrate/abi/src/babe.rs new file mode 100644 index 00000000..24602757 --- /dev/null +++ b/substrate/abi/src/babe.rs @@ -0,0 +1,15 @@ +use sp_consensus_babe::EquivocationProof; + +use serai_primitives::Header; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +pub struct ReportEquivocation { + pub equivocation_proof: Box>, + pub key_owner_proof: (), +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +pub enum Call { + report_equivocation(ReportEquivocation), + report_equivocation_unsigned(ReportEquivocation), +} diff --git a/substrate/abi/src/coins.rs b/substrate/abi/src/coins.rs new file mode 100644 index 00000000..0b32b36b --- /dev/null +++ b/substrate/abi/src/coins.rs @@ -0,0 +1,23 @@ +use serai_primitives::{Balance, SeraiAddress}; + +pub use serai_coins_primitives as primitives; +use primitives::OutInstructionWithBalance; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Call { + transfer { to: SeraiAddress, balance: Balance }, + burn { balance: Balance }, + burn_with_instruction { instruction: OutInstructionWithBalance }, +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + Mint { to: SeraiAddress, balance: Balance }, + Burn { from: SeraiAddress, balance: Balance }, + BurnWithInstruction { from: SeraiAddress, instruction: OutInstructionWithBalance }, + Transfer { from: SeraiAddress, to: SeraiAddress, balance: Balance }, +} diff --git a/substrate/abi/src/dex.rs b/substrate/abi/src/dex.rs new file mode 100644 index 00000000..65d3c3eb --- /dev/null +++ b/substrate/abi/src/dex.rs @@ -0,0 +1,77 @@ +use sp_runtime::BoundedVec; + +use serai_primitives::*; + +type PoolId = Coin; +type PoolCoinId = Coin; +type MaxSwapPathLength = sp_core::ConstU32<3>; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Call { + add_liquidity { + coin: Coin, + coin_desired: SubstrateAmount, + sri_desired: SubstrateAmount, + coin_min: SubstrateAmount, + sri_min: SubstrateAmount, + mint_to: SeraiAddress, + }, + remove_liquidity { + coin: Coin, + lp_token_burn: SubstrateAmount, + coin_min_receive: SubstrateAmount, + sri_min_receive: SubstrateAmount, + withdraw_to: SeraiAddress, + }, + swap_exact_tokens_for_tokens { + path: BoundedVec, + amount_in: SubstrateAmount, + amount_out_min: SubstrateAmount, + send_to: SeraiAddress, + }, + swap_tokens_for_exact_tokens { + path: BoundedVec, + amount_out: SubstrateAmount, + amount_in_max: SubstrateAmount, + send_to: SeraiAddress, + }, +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + PoolCreated { + pool_id: PoolId, + pool_account: SeraiAddress, + lp_token: PoolCoinId, + }, + + LiquidityAdded { + who: SeraiAddress, + mint_to: SeraiAddress, + pool_id: PoolId, + coin_amount: SubstrateAmount, + sri_amount: SubstrateAmount, + lp_token: PoolCoinId, + lp_token_minted: SubstrateAmount, + }, + + LiquidityRemoved { + who: SeraiAddress, + withdraw_to: SeraiAddress, + pool_id: PoolId, + coin_amount: SubstrateAmount, + sri_amount: SubstrateAmount, + lp_token: PoolCoinId, + lp_token_burned: SubstrateAmount, + }, + + SwapExecuted { + who: SeraiAddress, + send_to: SeraiAddress, + path: BoundedVec, + amount_in: SubstrateAmount, + amount_out: SubstrateAmount, + }, +} diff --git a/substrate/abi/src/grandpa.rs b/substrate/abi/src/grandpa.rs new file mode 100644 index 00000000..2990630e --- /dev/null +++ b/substrate/abi/src/grandpa.rs @@ -0,0 +1,24 @@ +use sp_consensus_grandpa::EquivocationProof; + +use serai_primitives::{BlockNumber, SeraiAddress}; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +pub struct ReportEquivocation { + pub equivocation_proof: Box>, + pub key_owner_proof: (), +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +pub enum Call { + report_equivocation(ReportEquivocation), + report_equivocation_unsigned(ReportEquivocation), +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + NewAuthorities { authority_set: Vec<(SeraiAddress, u64)> }, + Paused, + Resumed, +} diff --git a/substrate/abi/src/in_instructions.rs b/substrate/abi/src/in_instructions.rs new file mode 100644 index 00000000..e66e1e90 --- /dev/null +++ b/substrate/abi/src/in_instructions.rs @@ -0,0 +1,20 @@ +use serai_primitives::*; + +pub use serai_in_instructions_primitives as primitives; +use primitives::SignedBatch; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Call { + execute_batch { batch: SignedBatch }, +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + Batch { network: NetworkId, id: u32, block: BlockHash, instructions_hash: [u8; 32] }, + InstructionFailure { network: NetworkId, id: u32, index: u32 }, + Halt { network: NetworkId }, +} diff --git a/substrate/abi/src/lib.rs b/substrate/abi/src/lib.rs new file mode 100644 index 00000000..ecfb3ce6 --- /dev/null +++ b/substrate/abi/src/lib.rs @@ -0,0 +1,42 @@ +#![allow(non_camel_case_types)] + +pub mod system; + +pub mod timestamp; + +pub mod coins; +pub mod dex; + +pub mod validator_sets; +pub mod in_instructions; +pub mod signals; + +pub mod babe; +pub mod grandpa; + +pub use serai_primitives as primitives; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +pub enum Call { + Timestamp(timestamp::Call), + Coins(coins::Call), + LiquidityTokens(coins::Call), + Dex(dex::Call), + ValidatorSets(validator_sets::Call), + InInstructions(in_instructions::Call), + Signals(signals::Call), + Babe(babe::Call), + Grandpa(grandpa::Call), +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +pub enum Event { + System(system::Event), + Coins(coins::Event), + LiquidityTokens(coins::Event), + Dex(dex::Event), + ValidatorSets(validator_sets::Event), + InInstructions(in_instructions::Event), + Signals(signals::Event), + Grandpa(grandpa::Event), +} diff --git a/substrate/abi/src/signals.rs b/substrate/abi/src/signals.rs new file mode 100644 index 00000000..91956374 --- /dev/null +++ b/substrate/abi/src/signals.rs @@ -0,0 +1,57 @@ +use serai_primitives::{NetworkId, SeraiAddress}; + +use serai_validator_sets_primitives::ValidatorSet; + +pub use serai_signals_primitives as primitives; +use primitives::SignalId; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Call { + register_retirement_signal { in_favor_of: [u8; 32] }, + revoke_retirement_signal { retirement_signal_id: [u8; 32] }, + favor { signal_id: SignalId, for_network: NetworkId }, + revoke_favor { signal_id: SignalId, for_network: NetworkId }, + stand_against { signal_id: SignalId, for_network: NetworkId }, +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + RetirementSignalRegistered { + signal_id: [u8; 32], + in_favor_of: [u8; 32], + registrant: SeraiAddress, + }, + RetirementSignalRevoked { + signal_id: [u8; 32], + }, + SignalFavored { + signal_id: SignalId, + by: SeraiAddress, + for_network: NetworkId, + }, + SetInFavor { + signal_id: SignalId, + set: ValidatorSet, + }, + RetirementSignalLockedIn { + signal_id: [u8; 32], + }, + SetNoLongerInFavor { + signal_id: SignalId, + set: ValidatorSet, + }, + FavorRevoked { + signal_id: SignalId, + by: SeraiAddress, + for_network: NetworkId, + }, + AgainstSignal { + signal_id: SignalId, + who: SeraiAddress, + for_network: NetworkId, + }, +} diff --git a/substrate/abi/src/system.rs b/substrate/abi/src/system.rs new file mode 100644 index 00000000..afbc78f1 --- /dev/null +++ b/substrate/abi/src/system.rs @@ -0,0 +1,8 @@ +use frame_support::dispatch::{DispatchInfo, DispatchError}; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + ExtrinsicSuccess { dispatch_info: DispatchInfo }, + ExtrinsicFailed { dispatch_error: DispatchError, dispatch_info: DispatchInfo }, +} diff --git a/substrate/abi/src/timestamp.rs b/substrate/abi/src/timestamp.rs new file mode 100644 index 00000000..7c36b052 --- /dev/null +++ b/substrate/abi/src/timestamp.rs @@ -0,0 +1,6 @@ +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Call { + set { now: u64 }, +} diff --git a/substrate/abi/src/validator_sets.rs b/substrate/abi/src/validator_sets.rs new file mode 100644 index 00000000..346ca6d1 --- /dev/null +++ b/substrate/abi/src/validator_sets.rs @@ -0,0 +1,68 @@ +pub use serai_validator_sets_primitives as primitives; + +use serai_primitives::*; +use serai_validator_sets_primitives::*; + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Call { + set_keys { + network: NetworkId, + key_pair: KeyPair, + signature: Signature, + }, + remove_participant { + network: NetworkId, + to_remove: SeraiAddress, + signers: Vec, + signature: Signature, + }, + allocate { + network: NetworkId, + amount: Amount, + }, + deallocate { + network: NetworkId, + amount: Amount, + }, + claim_deallocation { + network: NetworkId, + session: Session, + }, +} + +#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] +#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum Event { + NewSet { + set: ValidatorSet, + }, + ParticipantRemoved { + set: ValidatorSet, + removed: SeraiAddress, + }, + KeyGen { + set: ValidatorSet, + key_pair: KeyPair, + }, + AllocationIncreased { + validator: SeraiAddress, + network: NetworkId, + amount: Amount, + }, + AllocationDecreased { + validator: SeraiAddress, + network: NetworkId, + amount: Amount, + delayed_until: Option, + }, + DeallocationClaimed { + validator: SeraiAddress, + network: NetworkId, + session: Session, + }, + SetRetired { + set: ValidatorSet, + }, +}