Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cf99ad4
refactor(mainnet): include assets
al3mart Feb 5, 2025
726b377
test(assets): add nfts config unit tests
al3mart Feb 11, 2025
e614927
refactor(proxy): Add assets & smart contract proxy type
al3mart Feb 11, 2025
f8fdeea
refactor(assets): implement nfts runtime api
al3mart Feb 11, 2025
6b4b505
fix(pallet-nfts-api): workspace linters are not defined
al3mart Feb 11, 2025
5c75dc7
docs(assets): clarify deposits
al3mart Feb 11, 2025
e94a545
chore(proxy): improve usage of references
al3mart Feb 11, 2025
13a2392
docs(assets): update src reference
al3mart Feb 11, 2025
47b3c92
chore(assets): update MetadataDepositBase
al3mart Feb 11, 2025
e5f4212
docs(assets): remove TODOs
al3mart Feb 11, 2025
6a7fb18
refactor(proxy): revert SmartContract ProxyType
al3mart Feb 12, 2025
88f5eab
revert: e614927728f48ae8b176f86ee4207083c062c71a
al3mart Feb 13, 2025
fb92342
style(Cargo): revert format changes on dep comments
al3mart Feb 13, 2025
84188ad
chore(assets): apply feedback to tests
al3mart Feb 13, 2025
b813b52
chore(assets): removed unused type
al3mart Feb 13, 2025
5263090
revert: fb9234215336ce342c3edb6c15fff56ec2130c98
al3mart Feb 13, 2025
8708e32
docs(assets): better comments
al3mart Feb 13, 2025
976a845
chore(assets): lower nfts deposit costs
al3mart Feb 13, 2025
84790c1
chore(assets): reduced deposit cost for AssetAccountDeposit
al3mart Feb 13, 2025
b332ba1
chore(assets): use SDK's pallet_nfts
al3mart Feb 13, 2025
759e51a
chore(assets): better deposits & fmt Cargo
al3mart Feb 13, 2025
f10ccd8
chore(assets): better comments
al3mart Feb 13, 2025
645fb3d
chore(assets): more explicit comments for deposits
al3mart Feb 14, 2025
08b3369
chore(assets): provide src for NftsCollectionDeposit deposit
al3mart Feb 14, 2025
098a035
chore(assets): apply feedback
al3mart Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", bra
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-nft-fractionalization = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-nfts-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-nfts-sdk = { package = "pallet-nfts", git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
pallet-revive = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false }
Expand Down
3 changes: 0 additions & 3 deletions pallets/nfts/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ readme = "README.md"
repository.workspace = true
version = "23.0.0"

[lints]
workspace = true

[package.metadata.docs.rs]
targets = [ "x86_64-unknown-linux-gnu" ]

Expand Down
1 change: 1 addition & 0 deletions pallets/nfts/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
extern crate alloc;

use alloc::vec::Vec;

use codec::{Decode, Encode};

sp_api::decl_runtime_apis! {
Expand Down
10 changes: 10 additions & 0 deletions runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ frame-system.workspace = true
frame-system-benchmarking.workspace = true
frame-system-rpc-runtime-api.workspace = true
frame-try-runtime.workspace = true
pallet-assets.workspace = true
pallet-aura.workspace = true
pallet-authorship.workspace = true
pallet-balances.workspace = true
pallet-message-queue.workspace = true
pallet-multisig.workspace = true
pallet-nfts-runtime-api.workspace = true
pallet-nfts-sdk.workspace = true
pallet-preimage.workspace = true
pallet-proxy.workspace = true
pallet-revive.workspace = true
Expand Down Expand Up @@ -114,12 +117,15 @@ std = [
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime/std",
"pallet-assets/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-message-queue/std",
"pallet-multisig/std",
"pallet-nfts-runtime-api/std",
"pallet-nfts-sdk/std",
"pallet-preimage/std",
"pallet-proxy/std",
"pallet-revive/std",
Expand Down Expand Up @@ -166,10 +172,12 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nfts-sdk/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-revive/runtime-benchmarks",
Expand Down Expand Up @@ -199,12 +207,14 @@ try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nfts-sdk/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
"pallet-revive/try-runtime",
Expand Down
55 changes: 51 additions & 4 deletions runtime/mainnet/src/apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
use codec::Encode;
use frame_support::{
genesis_builder_helper::{build_state, get_preset},
traits::tokens::{Fortitude::Polite, Preservation::Preserve},
traits::{
nonfungibles_v2::Inspect,
tokens::{Fortitude::Polite, Preservation::Preserve},
},
weights::{Weight, WeightToFee as _},
};
use pallet_revive::AddressMapper;
Expand All @@ -30,9 +33,9 @@
use super::{
config::{monetary::fee::WeightToFee, system::RuntimeBlockWeights, xcm as xcm_config},
AccountId, Balance, Balances, Block, BlockNumber, BlockWeights, EventRecord, Executive,
ExtrinsicInclusionMode, InherentDataExt, Nonce, OriginCaller, ParachainSystem, PolkadotXcm,
Revive, Runtime, RuntimeCall, RuntimeEvent, RuntimeGenesisConfig, RuntimeOrigin, SessionKeys,
System, TransactionPayment, UncheckedExtrinsic, VERSION,
ExtrinsicInclusionMode, InherentDataExt, Nfts, Nonce, OriginCaller, ParachainSystem,
PolkadotXcm, Revive, Runtime, RuntimeCall, RuntimeEvent, RuntimeGenesisConfig, RuntimeOrigin,
SessionKeys, System, TransactionPayment, UncheckedExtrinsic, VERSION,
};

impl_runtime_apis! {
Expand Down Expand Up @@ -189,6 +192,50 @@
}
}

impl pallet_nfts_runtime_api::NftsApi<Block, AccountId, u32, u32> for Runtime {
fn owner(collection: u32, item: u32) -> Option<AccountId> {
<Nfts as Inspect<AccountId>>::owner(&collection, &item)
}

fn collection_owner(collection: u32) -> Option<AccountId> {
<Nfts as Inspect<AccountId>>::collection_owner(&collection)
}

fn attribute(
collection: u32,
item: u32,
key: Vec<u8>,
) -> Option<Vec<u8>> {
<Nfts as Inspect<AccountId>>::attribute(&collection, &item, &key)
}

fn custom_attribute(
account: AccountId,
collection: u32,
item: u32,
key: Vec<u8>,
) -> Option<Vec<u8>> {
<Nfts as Inspect<AccountId>>::custom_attribute(
&account,
&collection,
&item,
&key,
)
}

fn system_attribute(
collection: u32,
item: Option<u32>,
key: Vec<u8>,
) -> Option<Vec<u8>> {
<Nfts as Inspect<AccountId>>::system_attribute(&collection, item.as_ref(), &key)
}

fn collection_attribute(collection: u32, key: Vec<u8>) -> Option<Vec<u8>> {
<Nfts as Inspect<AccountId>>::collection_attribute(&collection, &key)
}
}

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
Expand Down Expand Up @@ -236,7 +283,7 @@

use frame_system_benchmarking::Pallet as SystemBench;

impl frame_system_benchmarking::Config for Runtime {

Check warning on line 286 in runtime/mainnet/src/apis.rs

View workflow job for this annotation

GitHub Actions / clippy

non-local `impl` definition, `impl` blocks should be written at the same level as their item

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> runtime/mainnet/src/apis.rs:286:4 | 278 | / fn dispatch_benchmark( 279 | | config: frame_benchmarking::BenchmarkConfig 280 | | ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> { | |___________________________________________________________________________________- move the `impl` block outside of this associated function `dispatch_benchmark` ... 286 | impl frame_system_benchmarking::Config for Runtime { | ^^^^^---------------------------------^^^^^------- | | | | | `Runtime` is not local | `Config` is not local | = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl` = note: `#[warn(non_local_definitions)]` on by default
fn setup_set_code_requirements(code: &Vec<u8>) -> Result<(), BenchmarkError> {
ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
Ok(())
Expand All @@ -248,7 +295,7 @@
}

use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

Check warning on line 298 in runtime/mainnet/src/apis.rs

View workflow job for this annotation

GitHub Actions / clippy

non-local `impl` definition, `impl` blocks should be written at the same level as their item

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> runtime/mainnet/src/apis.rs:298:4 | 278 | / fn dispatch_benchmark( 279 | | config: frame_benchmarking::BenchmarkConfig 280 | | ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> { | |___________________________________________________________________________________- move the `impl` block outside of this associated function `dispatch_benchmark` ... 298 | impl cumulus_pallet_session_benchmarking::Config for Runtime {} | ^^^^^-------------------------------------------^^^^^------- | | | | | `Runtime` is not local | `Config` is not local | = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`

use frame_support::traits::WhitelistedStorageKeys;
let whitelist = AllPalletsWithSystem::whitelisted_storage_keys();
Expand Down
Loading
Loading