Skip to content

Commit

Permalink
refactor: primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
Daanvdplas committed Jul 25, 2024
1 parent 4a476b0 commit f3cc83a
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 27 deletions.
21 changes: 10 additions & 11 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pallet-api = { path = "pallets/api", default-features = false }
pop-runtime-devnet = { path = "runtime/devnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-common = { path = "runtime/common", default-features = false }
primitives = { path = "./primitives", default-features = false }
pop-primitives = { path = "./primitives", default-features = false }

# Substrate
sc-basic-authorship = "0.35.0"
Expand Down
2 changes: 0 additions & 2 deletions pallets/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ frame-benchmarking.workspace = true
frame-support.workspace = true
frame-system.workspace = true
pallet-assets.workspace = true
primitives.workspace = true
sp-runtime.workspace = true
sp-std.workspace = true

Expand All @@ -43,7 +42,6 @@ std = [
"frame-system/std",
"pallet-assets/std",
"pallet-balances/std",
"primitives/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
Expand Down
4 changes: 2 additions & 2 deletions pop-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enumflags2 = { version = "0.7.7" }
ink = { version = "5.0.0", default-features = false }
sp-io = { version = "31.0.0", default-features = false, features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }

primitives = { path = "../primitives", default-features = false }
pop-primitives = { path = "../primitives", default-features = false }

[lib]
name = "pop_api"
Expand All @@ -22,7 +22,7 @@ default = ["std"]
std = [
"enumflags2/std",
"ink/std",
"primitives/std",
"pop-primitives/std",
"sp-io/std",
]
assets = []
Expand Down
4 changes: 2 additions & 2 deletions pop-api/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ frame-system = { version = "29.0.0", default-features = false }
pallet-balances = { version = "29.0.2", default-features = false }
pallet-assets = { version = "30.0.0", default-features = false }
pallet-contracts = { version = "28.0.0", default-features = false }
primitives = { path = "../../primitives", default-features = false }
pop-primitives = { path = "../../primitives", default-features = false }
pop-runtime-devnet = { path = "../../runtime/devnet", default-features = false }
sp-io = { version = "31.0.0", default-features = false }
sp-runtime = { version = "32.0.0", default-features = false }
Expand All @@ -25,7 +25,7 @@ std = [
"pallet-balances/std",
"pallet-assets/std",
"pallet-contracts/std",
"primitives/std",
"pop-primitives/std",
"pop-runtime-devnet/std",
"scale/std",
"sp-io/std",
Expand Down
2 changes: 1 addition & 1 deletion pop-api/integration-tests/src/local_fungibles.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use primitives::error::{
use pop_primitives::error::{
ArithmeticError::*,
Error::{self, *},
TokenError::*,
Expand Down
2 changes: 1 addition & 1 deletion pop-api/src/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ink::env::{DefaultEnvironment, Environment};
pub use primitives::*;
pub use pop_primitives::*;

pub(crate) type AccountId = <DefaultEnvironment as Environment>::AccountId;
pub(crate) type Balance = <DefaultEnvironment as Environment>::Balance;
3 changes: 2 additions & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
name = "primitives"
name = "pop-primitives"
description = "Primitives crate for Pop"
license = "GPL-3.0-only"
version = "0.0.0"
edition = "2021"
Expand Down
1 change: 1 addition & 0 deletions primitives/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reserved crate for pop-primitives.
4 changes: 2 additions & 2 deletions runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ scale-info.workspace = true
smallvec.workspace = true

# Local
primitives.workspace = true
pop-primitives.workspace = true
pop-runtime-common.workspace = true
pallet-api.workspace = true

Expand Down Expand Up @@ -140,7 +140,7 @@ std = [
"parachains-common/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"primitives/std",
"pop-primitives/std",
"scale-info/std",
"sp-api/std",
"sp-io/std",
Expand Down
4 changes: 2 additions & 2 deletions runtime/devnet/src/extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use frame_support::{
use pallet_contracts::chain_extension::{
BufInBufOutState, ChainExtension, Environment, Ext, InitState, RetVal,
};
use primitives::AssetId;
use pop_primitives::AssetId;
use sp_core::crypto::UncheckedFrom;
use sp_runtime::{traits::Dispatchable, DispatchError};
use sp_std::vec::Vec;
Expand Down Expand Up @@ -208,7 +208,7 @@ enum VersionedDispatch {
// Converts a `DispatchError` to a `u32` status code based on the version of the API the contract uses.
// The contract calling the chain extension can convert the status code to the descriptive `Error`.
//
// For `Error` see `primitives::<version>::error::Error`.
// For `Error` see `pop_primitives::<version>::error::Error`.
//
// The error encoding can vary per version, allowing for flexible and backward-compatible error handling.
// As a result, contracts maintain compatibility across different versions of the runtime.
Expand Down
4 changes: 2 additions & 2 deletions runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ scale-info.workspace = true
smallvec.workspace = true

# Local
primitives.workspace = true
pop-primitives.workspace = true
pop-runtime-common.workspace = true

# Substrate
Expand Down Expand Up @@ -137,7 +137,7 @@ std = [
"parachains-common/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"primitives/std",
"pop-primitives/std",
"scale-info/std",
"sp-api/std",
"sp-io/std",
Expand Down

0 comments on commit f3cc83a

Please sign in to comment.