Questions tagged [frame]
Questions about Substrate's framework for developing custom runtime logic.
114
questions
6
votes
2
answers
283
views
How do treasury accounts compare to end user accounts in FRAME?
I would like to understand how treasury accounts are created and used under the hood. How do they compare to end user accounts? Are they also just an AccountId to AccountInfo map in storage?
2
votes
1
answer
53
views
What is a runtime as a data structure?
After a runtime is complete and all the macros are expanded, what kind of data structure is the runtime?
e.g.
Is the Runtime a struct? If so, what are some of the fields? I want to be able to build a ...
7
votes
1
answer
61
views
How can I check whether a specific storage item was already accessed in the current block?
Inside a FRAME runtime I want to check whether a specific storage item was already read in the current block. Reason is to determine the impact of storage accesses across the extrinsics of a block ...
3
votes
1
answer
94
views
Storage definition syntax
#[pallet::storage]
pub(super) type ProofMapping<T: Config> = StorageMap<_, Blake2_128Concat, Vec<u8>, (T::AccountId, T::BlockNumber), ValueQuery >;
What does the syntax used to ...
4
votes
2
answers
117
views
What means `PhantomData<T>` in a pallet?
I see that some pallets wrap phantom data:
pub struct Pallet<T>(PhantomData<T>);
and others not:
pub struct Pallet<T>(_);
Why is it there?
Do I need this in my pallet as well?
5
votes
1
answer
87
views
Difference between ReservableCurrency and NamedReservableCurrency?
The docs on the traits ReservableCurrency and NamedReservableCurrency currency are the same, although they clearly have subtle differences between them. When should someone use ReservableCurrency vs ...
6
votes
2
answers
68
views
How are Events aggregated
I noticed that every pallet (that i've checked) that has any events uses the following line in the pallets config trait:
type Event: From<Event<Self, I>> + IsType<<Self as ...
5
votes
1
answer
59
views
Which data to put in a Pallet Event?
In other blockchains I practiced extreme frugality with event data, since it is expensive.
For example only putting an ID into an event which can then be looked up with lookup(ID) -> ...
2
votes
1
answer
36
views
pallet module in frame_support_procedural crate
Im looking into some of the procedural macros used, namely the #[pallet] attribute to declare a pallet that is recognised by construct_runtime!. However, I cannot find the source code for the pallet ...
4
votes
2
answers
101
views
When should I use `ConstU32` to declare a constant value for my pallet?
There seems to be different approaches to declaring constants for a pallet's runtime implementation.
A common approach for example is:
// In pallet/example/src/lib.rs
#[pallet::config]
pub trait ...
6
votes
2
answers
105
views
Is it possible to use format! in Substrate runtime?
From the link, It seems format! can work in Substrate runtime.
let hello_world = sp_std::fmt::format!("Hello,{}","world");
I want to have a variable hello_world and use it for ...
10
votes
2
answers
104
views
How does the AccountData type work in FRAME runtimes?
The FRAME system for runtime development defines an AccountData type, which is coupled with data from the Balances Pallet in the Polkadot runtime.
What other types of data could be tracked using this ...
6
votes
1
answer
172
views
How do I use storage and functions from one custom pallet in another?
Is there a way for one custom pallet to access the storage or functions from another custom pallet?
For Example:
Pallet 1
#[pallet::storage]
pub(super) type MyValue<T: Config> = StorageValue<...
22
votes
3
answers
695
views
When should I build a Substrate FRAME Pallet versus a Smart Contract?
What are the differences between developing a Substrate FRAME Pallet and a Substrate Smart Contract (for example with the ink! language)?
What are some examples of applications which are best written ...