Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
use DefaultConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopgalvao committed Jul 16, 2023
1 parent 27364b1 commit 4f4e456
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frame/examples/offchain-worker-ping-pong/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ pub mod pallet {
use frame_system::pallet_prelude::*;

/// This pallet's configuration trait
#[pallet::config]
#[pallet::config(with_default)]
pub trait Config: CreateSignedTransaction<Call<Self>> + frame_system::Config {
/// The identifier type for an offchain worker.
#[pallet::no_default]
type AuthorityId: AppCrypto<Self::Public, Self::Signature>;

/// The overarching event type.
#[pallet::no_default]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

// Configuration parameters
Expand All @@ -172,6 +174,7 @@ pub mod pallet {
///
/// This ensures that we only accept unsigned transactions once, every `UnsignedInterval`
/// blocks.
#[pallet::no_default]
#[pallet::constant]
type UnsignedInterval: Get<Self::BlockNumber>;

Expand Down
5 changes: 4 additions & 1 deletion frame/examples/offchain-worker-price-oracle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,22 @@ pub mod pallet {
use frame_system::pallet_prelude::*;

/// This pallet's configuration trait
#[pallet::config]
#[pallet::config(with_default)]
pub trait Config: CreateSignedTransaction<Call<Self>> + frame_system::Config {
/// The identifier type for an offchain worker.
#[pallet::no_default]
type AuthorityId: AppCrypto<Self::Public, Self::Signature>;

/// The overarching event type.
#[pallet::no_default]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// A grace period after we send transaction.
///
/// To avoid sending too many transactions, we only attempt to send one
/// every `GRACE_PERIOD` blocks. We use Local Storage to coordinate
/// sending between distinct runs of this offchain worker.
#[pallet::no_default]
#[pallet::constant]
type GracePeriod: Get<Self::BlockNumber>;

Expand Down

0 comments on commit 4f4e456

Please sign in to comment.