fp_dynamic_fee/
lib.rs

1// This file is part of Frontier.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Core types and inherents for dynamic fee.
19
20#![cfg_attr(not(feature = "std"), no_std)]
21#![warn(unused_crate_dependencies)]
22
23use sp_core::U256;
24use sp_inherents::InherentIdentifier;
25#[cfg(feature = "std")]
26use sp_inherents::{Error, InherentData};
27
28pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"dynfee0_";
29
30pub type InherentType = U256;
31
32#[cfg(feature = "std")]
33pub struct InherentDataProvider(pub InherentType);
34
35#[cfg(feature = "std")]
36#[async_trait::async_trait]
37impl sp_inherents::InherentDataProvider for InherentDataProvider {
38	async fn provide_inherent_data(&self, inherent_data: &mut InherentData) -> Result<(), Error> {
39		inherent_data.put_data(INHERENT_IDENTIFIER, &self.0)
40	}
41
42	async fn try_handle_error(
43		&self,
44		_identifier: &InherentIdentifier,
45		_error: &[u8],
46	) -> Option<Result<(), Error>> {
47		None
48	}
49}