Step 1: Compile and Install the Application
First, we need to compile and install the application. Please ensure you are in thetutorials/oracle/base
directory. Run the following command in your terminal:
Step 2: Initialise the Application
Next, we need to initialise the application. Run the following command in your terminal:tutorials/oracle/base/scripts/init.sh
, which sets up the necessary configuration for your application to run. This includes creating the app.toml
configuration file and initialising the blockchain with a genesis block.
Step 3: Start the Application
Now, we can start the application. Run the following command in your terminal:Step 4: Query the Oracle Prices
Finally, we can query the current prices from the Oracle module. Run the following command in your terminal:Understanding Vote Extensions in Oracle
In the Oracle module, theExtendVoteHandler
function is responsible for creating the vote extensions. This function fetches the current prices from the provider, creates a OracleVoteExtension
struct with these prices, and then marshals this struct into bytes. These bytes are then set as the vote extension.
In the context of testing, the Oracle module uses a mock provider to simulate the behavior of a real price provider. This mock provider is defined in the mockprovider package and is used to return predefined prices for specific currency pairs.