Skip to content

Commit

Permalink
Develop (#885)
Browse files Browse the repository at this point in the history
## Describe your changes

v5.4.0 runtime release 
spec_version: 312

## Checklist before requesting a review
- [x] I have performed a self-review of my code.
- [x] If it is a core feature, I have added thorough tests.
- [x] I removed all Clippy and Formatting Warnings. 
- [x] I added required Copyrights.
  • Loading branch information
Gauthamastro authored Dec 6, 2023
2 parents 192cfdf + 5974f72 commit f140059
Show file tree
Hide file tree
Showing 27 changed files with 784 additions and 327 deletions.
16 changes: 11 additions & 5 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion check-all-ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ cargo build --features runtime-benchmarks || exit
./target/debug/polkadex-node benchmark pallet --pallet "*" --extrinsic "*" --steps 2 --repeat 1 || exit
cargo clippy -- -D warnings || exit
cargo test || exit
RUSTFLAGS="-D warnings" cargo build -p thea-message-handler || exit
2 changes: 1 addition & 1 deletion nodes/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadex-node"
version = "5.4.0"
version = "5.4.1"
authors = ["Polkadex OÜ <https://polkadex.trade>"]
description = "Polkadex main blockchain"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion pallets/ocex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-ocex-lmp"
version = "5.3.0"
version = "5.4.1"
authors = ["Gautham J <gautham@polkadex.trade>"]
edition = "2021"
license = "GNU GPL v3"
Expand Down
5 changes: 4 additions & 1 deletion pallets/ocex/rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-ocex-rpc"
version = "0.1.0"
version = "5.4.1"
edition = "2021"

[dependencies]
Expand All @@ -19,8 +19,11 @@ serde_json = { workspace = true, default-features = true }
polkadex-primitives = { workspace = true }
sc-rpc-api = { workspace = true, default-features = true }
sc-rpc = { workspace = true, default-features = true }
sp-std = { workspace = true, default-features = false }
sp-offchain = { workspace = true, default-features = true }
parking_lot = { workspace = true }
hash-db = { workspace = true }
trie-db = { workspace = true }
sp-trie = { workspace = true }
rust_decimal = { workspace = true, features = ["scale-codec"], default-features = false }
pallet-ocex-lmp = { path = "../../ocex" }
14 changes: 5 additions & 9 deletions pallets/ocex/rpc/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,16 @@

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

use orderbook_primitives::ObCheckpointRaw;
use parity_scale_codec::Codec;
use parity_scale_codec::{Codec, Decode};
use polkadex_primitives::AssetId;
use rust_decimal::Decimal;
use sp_std::{collections::btree_map::BTreeMap, vec::Vec};

sp_api::decl_runtime_apis! {
pub trait PolkadexOcexRuntimeApi<AccountId, Hash> where AccountId: Codec, Hash : Codec {
fn get_ob_recover_state() -> Result<Vec<u8>, sp_runtime::DispatchError>;
// gets balance from given account of given asset
fn get_balance(from: AccountId, of: AssetId) -> Result<Decimal, sp_runtime::DispatchError>;
// gets the latest checkpoint from the offchain State
fn fetch_checkpoint() -> Result<ObCheckpointRaw, sp_runtime::DispatchError>;
pub trait PolkadexOcexRuntimeApi<AccountId, Hash> where AccountId: Codec, Hash : Codec, BTreeMap<AccountId,Vec<AccountId>>: Decode {
// Returns all on-chain registered main accounts and it's proxies
fn get_main_accounts() -> BTreeMap<AccountId,Vec<AccountId>>;
// Returns the asset inventory deviation in the offchain State
fn calculate_inventory_deviation() -> Result<BTreeMap<AssetId,Decimal>, sp_runtime::DispatchError>;
fn calculate_inventory_deviation(offchain_inventory: BTreeMap<AssetId,Decimal>, last_processed_block: u32) -> Result<BTreeMap<AssetId,Decimal>, sp_runtime::DispatchError>;
}
}
Loading

0 comments on commit f140059

Please sign in to comment.