-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from InvArch/gabriel-v0.9.43
Upgrade to v0.9.43
- Loading branch information
Showing
49 changed files
with
4,670 additions
and
3,538 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
modified-construct-runtime/src/construct_runtime/expand/call.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
modified-construct-runtime/src/construct_runtime/expand/config.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
modified-construct-runtime/src/construct_runtime/expand/event.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
modified-construct-runtime/src/construct_runtime/expand/freeze_reason.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License | ||
|
||
use crate::construct_runtime::{parse::PalletPath, Pallet}; | ||
use proc_macro2::{Ident, TokenStream}; | ||
use quote::quote; | ||
|
||
pub fn expand_outer_freeze_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream { | ||
let mut conversion_fns = Vec::new(); | ||
let mut freeze_reason_variants = Vec::new(); | ||
for decl in pallet_decls { | ||
if let Some(_) = decl.find_part("FreezeReason") { | ||
let variant_name = &decl.name; | ||
let path = &decl.path; | ||
let index = decl.index; | ||
|
||
conversion_fns.push(expand_conversion_fn(path, variant_name)); | ||
|
||
freeze_reason_variants.push(expand_variant(index, path, variant_name)); | ||
} | ||
} | ||
|
||
quote! { | ||
/// A reason for placing a freeze on funds. | ||
#[derive( | ||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, | ||
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen, | ||
#scrate::scale_info::TypeInfo, | ||
#scrate::RuntimeDebug, | ||
)] | ||
pub enum RuntimeFreezeReason { | ||
#( #freeze_reason_variants )* | ||
} | ||
|
||
#( #conversion_fns )* | ||
} | ||
} | ||
|
||
fn expand_conversion_fn(path: &PalletPath, variant_name: &Ident) -> TokenStream { | ||
quote! { | ||
impl From<#path::FreezeReason> for RuntimeFreezeReason { | ||
fn from(hr: #path::FreezeReason) -> Self { | ||
RuntimeFreezeReason::#variant_name(hr) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn expand_variant(index: u8, path: &PalletPath, variant_name: &Ident) -> TokenStream { | ||
quote! { | ||
#[codec(index = #index)] | ||
#variant_name(#path::FreezeReason), | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
modified-construct-runtime/src/construct_runtime/expand/hold_reason.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License | ||
|
||
use crate::construct_runtime::{parse::PalletPath, Pallet}; | ||
use proc_macro2::{Ident, TokenStream}; | ||
use quote::quote; | ||
|
||
pub fn expand_outer_hold_reason(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream { | ||
let mut conversion_fns = Vec::new(); | ||
let mut hold_reason_variants = Vec::new(); | ||
for decl in pallet_decls { | ||
if let Some(_) = decl.find_part("HoldReason") { | ||
let variant_name = &decl.name; | ||
let path = &decl.path; | ||
let index = decl.index; | ||
|
||
conversion_fns.push(expand_conversion_fn(path, variant_name)); | ||
|
||
hold_reason_variants.push(expand_variant(index, path, variant_name)); | ||
} | ||
} | ||
|
||
quote! { | ||
/// A reason for placing a hold on funds. | ||
#[derive( | ||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, | ||
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen, | ||
#scrate::scale_info::TypeInfo, | ||
#scrate::RuntimeDebug, | ||
)] | ||
pub enum RuntimeHoldReason { | ||
#( #hold_reason_variants )* | ||
} | ||
|
||
#( #conversion_fns )* | ||
} | ||
} | ||
|
||
fn expand_conversion_fn(path: &PalletPath, variant_name: &Ident) -> TokenStream { | ||
quote! { | ||
impl From<#path::HoldReason> for RuntimeHoldReason { | ||
fn from(hr: #path::HoldReason) -> Self { | ||
RuntimeHoldReason::#variant_name(hr) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn expand_variant(index: u8, path: &PalletPath, variant_name: &Ident) -> TokenStream { | ||
quote! { | ||
#[codec(index = #index)] | ||
#variant_name(#path::HoldReason), | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
modified-construct-runtime/src/construct_runtime/expand/inherent.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
modified-construct-runtime/src/construct_runtime/expand/lock_id.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License | ||
|
||
use crate::construct_runtime::{parse::PalletPath, Pallet}; | ||
use proc_macro2::{Ident, TokenStream}; | ||
use quote::quote; | ||
|
||
pub fn expand_outer_lock_id(pallet_decls: &[Pallet], scrate: &TokenStream) -> TokenStream { | ||
let mut conversion_fns = Vec::new(); | ||
let mut lock_id_variants = Vec::new(); | ||
for decl in pallet_decls { | ||
if let Some(_) = decl.find_part("LockId") { | ||
let variant_name = &decl.name; | ||
let path = &decl.path; | ||
let index = decl.index; | ||
|
||
conversion_fns.push(expand_conversion_fn(path, variant_name)); | ||
|
||
lock_id_variants.push(expand_variant(index, path, variant_name)); | ||
} | ||
} | ||
|
||
quote! { | ||
/// An identifier for each lock placed on funds. | ||
#[derive( | ||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, | ||
#scrate::codec::Encode, #scrate::codec::Decode, #scrate::codec::MaxEncodedLen, | ||
#scrate::scale_info::TypeInfo, | ||
#scrate::RuntimeDebug, | ||
)] | ||
pub enum RuntimeLockId { | ||
#( #lock_id_variants )* | ||
} | ||
|
||
#( #conversion_fns )* | ||
} | ||
} | ||
|
||
fn expand_conversion_fn(path: &PalletPath, variant_name: &Ident) -> TokenStream { | ||
quote! { | ||
impl From<#path::LockId> for RuntimeLockId { | ||
fn from(hr: #path::LockId) -> Self { | ||
RuntimeLockId::#variant_name(hr) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn expand_variant(index: u8, path: &PalletPath, variant_name: &Ident) -> TokenStream { | ||
quote! { | ||
#[codec(index = #index)] | ||
#variant_name(#path::LockId), | ||
} | ||
} |
Oops, something went wrong.