Crate serp_example_ocw[−][src]
In this example we are going to build a very simplistic, naive and definitely NOT
production-ready oracle forJUSD/USD price.
The DAI here represents JUSD since JUSD is not yet listed in the market.
Offchain Worker (OCW) will be triggered after every block, fetch the current price
and prepare either signed or unsigned transaction to feed the result back on chain.
The on-chain logic will simply aggregate the results and store last 64
values to compute
the average price.
Additional logic in OCW is put in place to prevent spamming the network with both signed
and unsigned transactions, and custom UnsignedValidator
makes sure that there is only
one unsigned transaction floating in the network.
Modules
crypto | Based on the above |
Structs
Module | A public part of the pallet. |
PricePayload | Payload used by this example crate to hold price data required to submit a transaction. |
Enums
Call | Dispatchable calls. |
RawEvent | Events for this module. |
Constants
KEY_TYPE | Defines application identifier for crypto keys of this module. |
Traits
Trait | This pallet’s configuration trait |
Type Definitions
Event |