Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
feat: add asset conversion pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
José Molina committed Nov 7, 2023
1 parent e51c1fe commit 30ee9cd
Show file tree
Hide file tree
Showing 14 changed files with 1,289 additions and 1,148 deletions.
1,647 changes: 839 additions & 808 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ trappist-runtime = { path = "runtime/trappist" }
stout-runtime = { path = "runtime/stout" }
jsonrpsee = { version = "0.16.2" }

# External Dependencies
pallet-dex-rpc = { version = "0.0.1", git = "https://github.com/paritytech/substrate-dex.git", default-features = false, branch = "polkadot-v1.1.0" }
pallet-dex = { version = "0.0.1", git = "https://github.com/paritytech/substrate-dex.git", default-features = false, branch = "polkadot-v1.1.0" }
pallet-dex-rpc-runtime-api = { version = "0.0.1", git = "https://github.com/paritytech/substrate-dex.git", default-features = false, branch = "polkadot-v1.1.0" }

# Trappist Pallets
pallet-asset-registry = { default-features = false, path = "pallets/asset-registry" }
trappist-runtime-benchmarks = { default-features = false, path = "pallets/benchmarks" }
Expand Down Expand Up @@ -123,6 +118,7 @@ frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk"
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }

## Substrate Pallet Dependencies
pallet-asset-conversion = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
Expand Down
3 changes: 0 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ trappist-runtime = { workspace = true, optional = true }
stout-runtime = { workspace = true, optional = true }
jsonrpsee = { workspace = true, features = ["server"] }

# External Dependencies
pallet-dex-rpc = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true, features = ["std"] }
frame-benchmarking-cli = { workspace = true }
Expand Down
3 changes: 0 additions & 3 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ where
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BlockBuilder<Block>,
C::Api: pallet_dex_rpc::DexRuntimeApi<Block, AssetId, Balance, Balance>,
P: TransactionPool + Sync + Send + 'static,
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashingFor<Block>>,
{
use frame_rpc_system::{System, SystemApiServer};
use pallet_dex_rpc::{Dex, DexApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};

Expand All @@ -73,7 +71,6 @@ where
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
module.merge(Dex::new(client).into_rpc())?;

Ok(module)
}
4 changes: 0 additions & 4 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ where
+ sp_session::SessionKeys<Block>
+ sp_api::ApiExt<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ pallet_dex_rpc::DexRuntimeApi<Block, AssetId, Balance, Balance>
+ sp_block_builder::BlockBuilder<Block>,
BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi>>,
Expand Down Expand Up @@ -232,7 +231,6 @@ where
+ sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_dex_rpc::DexRuntimeApi<Block, AssetId, Balance, Balance>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>,
BIQ: FnOnce(
Expand Down Expand Up @@ -519,7 +517,6 @@ where
+ cumulus_primitives_core::CollectCollationInfo<Block>
+ sp_consensus_aura::AuraApi<Block, <<AuraId as AppCrypto>::Pair as Pair>::Public>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ pallet_dex_rpc::DexRuntimeApi<Block, AssetId, Balance, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
<<AuraId as AppCrypto>::Pair as Pair>::Signature:
TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec,
Expand Down Expand Up @@ -609,7 +606,6 @@ where
+ sp_api::ApiExt<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block>
+ pallet_dex_rpc::DexRuntimeApi<Block, AssetId, Balance, Balance>
+ sp_consensus_aura::AuraApi<Block, <<AuraId as AppCrypto>::Pair as Pair>::Public>,
<<AuraId as AppCrypto>::Pair as Pair>::Signature:
TryFrom<Vec<u8>> + std::hash::Hash + sp_runtime::traits::Member + Codec,
Expand Down
11 changes: 6 additions & 5 deletions runtime/stout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ frame-system-benchmarking = { workspace = true, optional = true }
frame-system-rpc-runtime-api = { workspace = true }

## Substrate Pallet Dependencies
pallet-asset-conversion = { workspace = true }
pallet-assets = { workspace = true }
pallet-asset-tx-payment = { workspace = true }
pallet-aura = { workspace = true }
Expand All @@ -68,6 +69,7 @@ pallet-uniques = { workspace = true }
pallet-utility = { workspace = true }

# Cumulus dependencies
assets-common = { workspace = true }
cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-dmp-queue = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true }
Expand Down Expand Up @@ -95,8 +97,6 @@ xcm-primitives = { workspace = true }
pallet-xcm-benchmarks = { workspace = true, optional = true }

# External Pallets
pallet-dex = { workspace = true }
pallet-dex-rpc-runtime-api = { workspace = true }
pallet-asset-registry = { workspace = true }

[features]
Expand All @@ -122,6 +122,7 @@ std = [
"frame-support/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"pallet-asset-conversion/std",
"pallet-assets/std",
"pallet-asset-tx-payment/std",
"pallet-aura/std",
Expand All @@ -131,8 +132,6 @@ std = [
"pallet-collective/std",
"pallet-contracts/std",
"pallet-contracts-primitives/std",
"pallet-dex/std",
"pallet-dex-rpc-runtime-api/std",
"pallet-identity/std",
"pallet-multisig/std",
"pallet-insecure-randomness-collective-flip/std",
Expand All @@ -145,6 +144,7 @@ std = [
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"assets-common/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std",
Expand All @@ -170,13 +170,13 @@ runtime-benchmarks = [
"frame-system-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-asset-conversion/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-asset-registry/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-dex/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
Expand All @@ -187,4 +187,5 @@ runtime-benchmarks = [
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"assets-common/runtime-benchmarks",
]
Loading

0 comments on commit 30ee9cd

Please sign in to comment.