Skip to content

Commit 3c643f6

Browse files
authored
Merge pull request #189 from hashed-io/feature/proxy-migration
Feature/proxy migration
2 parents 232473a + 668bfd7 commit 3c643f6

File tree

14 files changed

+2742
-6
lines changed

14 files changed

+2742
-6
lines changed

Cargo.lock

Lines changed: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pallets/gated-marketplace/src/functions.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl<T: Config> Pallet<T> {
2727
let _appraiser_role_id = T::Rbac::create_and_set_roles(pallet_id.clone(), [MarketplaceRole::Appraiser.to_vec()].to_vec())?;
2828
// redemption specialist role and permissions
2929
let _redemption_role_id = T::Rbac::create_and_set_roles(pallet_id, [MarketplaceRole::RedemptionSpecialist.to_vec()].to_vec())?;
30+
31+
Self::deposit_event(Event::MarketplaceSetupCompleted);
3032
Ok(())
3133
}
3234

@@ -36,7 +38,7 @@ impl<T: Config> Pallet<T> {
3638
// ensure the generated id is unique
3739
ensure!(!<Marketplaces<T>>::contains_key(marketplace_id), Error::<T>::MarketplaceAlreadyExists);
3840
//Insert on marketplaces and marketplaces by auth
39-
T::Rbac::create_scope(Self::pallet_id(),marketplace_id)?;
41+
T::Rbac::create_scope(Self::pallet_id(), marketplace_id)?;
4042
Self::insert_in_auth_market_lists(owner.clone(), MarketplaceRole::Owner, marketplace_id)?;
4143
Self::insert_in_auth_market_lists(admin.clone(), MarketplaceRole::Admin, marketplace_id)?;
4244
<Marketplaces<T>>::insert(marketplace_id, marketplace);

pallets/gated-marketplace/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ pub mod pallet {
201201
OfferDuplicated([u8;32], [u8;32]),
202202
/// Offer was removed. [offer_id], [marketplace_id]
203203
OfferRemoved([u8;32], [u8;32]),
204+
/// Initial palllet setup
205+
MarketplaceSetupCompleted,
204206
}
205207

206208
// Errors inform users that something went wrong.

pallets/gated-marketplace/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub type CustodianFields<T> = ( AccountIdOf<T>, Cids<<T as Config>::MaxFiles>);
1616
#[scale_info(skip_type_params(T))]
1717
#[codec(mel_bound())]
1818
pub struct Marketplace<T: Config>{
19-
pub label: BoundedVec<u8,T::LabelMaxLen>,
19+
pub label: BoundedVec<u8, T::LabelMaxLen>,
2020
}
2121

2222
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, TypeInfo,)]

pallets/proxy/Cargo.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[package]
2+
name = "pallet-proxy"
3+
version = "4.0.0-dev"
4+
description = "Proxy migration pallet"
5+
authors = ["Hashed <https://github.com/hashed-io"]
6+
homepage = "https://hashed.io"
7+
edition = "2021"
8+
license = "Unlicense"
9+
publish = false
10+
repository = "https://github.com/hashed-io/hashed-substrate"
11+
12+
[package.metadata.docs.rs]
13+
targets = ["x86_64-unknown-linux-gnu"]
14+
15+
[dependencies]
16+
log = "0.4"
17+
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
18+
"derive",
19+
] }
20+
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
21+
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27"}
22+
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" }
23+
frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27", optional = true }
24+
sp-runtime = { default-features = false, version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" }
25+
26+
pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" }
27+
pallet-rbac = { default-features = false, version = "4.0.0-dev", path="../rbac/"}
28+
29+
[dev-dependencies]
30+
sp-core = { default-features = false, version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" }
31+
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" }
32+
33+
[features]
34+
default = ["std"]
35+
std = [
36+
"codec/std",
37+
"scale-info/std",
38+
"frame-support/std",
39+
"frame-system/std",
40+
"frame-benchmarking/std",
41+
"pallet-timestamp/std",
42+
"pallet-rbac/std"
43+
]
44+
45+
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
46+
try-runtime = ["frame-support/try-runtime"]

pallets/proxy/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Proxy
2+
Proxy pallet it was designed to migrate Proxy project to Substrate.
3+
4+
- [Proxy](#proxy)
5+
- [Overview](#overview)
6+
- [Terminology](#terminology)
7+
- [Interface](#interface)
8+
- [Helper functions](#helper-functions)
9+
- [Getters](#getters)
10+
- [Constants](#constants)
11+
- [Usage](#usage)
12+
- [Querying with Polkadot-js CLI](#querying-with-polkadot-js-cli)
13+
- [Errors](#errors)
14+
- [Events](#events)
15+
16+
17+
## Overview
18+
19+
## Terminology
20+
21+
## Interface
22+
23+
### Helper functions
24+
25+
### Getters
26+
27+
### Constants
28+
29+
## Usage
30+
31+
### Querying with Polkadot-js CLI
32+
33+
## Errors
34+
35+
## Events

pallets/proxy/src/benchmarking.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! Benchmarking setup for pallet-template
2+
3+
use super::*;
4+
5+
#[allow(unused)]
6+
use crate::Pallet as Template;
7+
use frame_benchmarking::{benchmarks, whitelisted_caller};
8+
use frame_system::RawOrigin;
9+
10+
benchmarks! {
11+
do_something {
12+
let s in 0 .. 100;
13+
let caller: T::AccountId = whitelisted_caller();
14+
}: _(RawOrigin::Signed(caller), s)
15+
verify {
16+
assert_eq!(Something::<T>::get(), Some(s));
17+
}
18+
19+
impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test);
20+
}

0 commit comments

Comments
 (0)