Skip to content

Commit 0dbb569

Browse files
authored
0.3.0 (#28)
1 parent dabb6a2 commit 0dbb569

8 files changed

Lines changed: 20 additions & 20 deletions

File tree

content/docs/how-it-works.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Submission logic defines what is done with the result of a service component aft
6161

6262
After the execution of a service component in the WAVS runtime, the results are passed to this contract, which can contain validation and submission logic for the service. Developers can use this contract to define their own logic for results and implement different rules depending on the specific needs of their service.
6363

64-
You can view an example service handler contract in the template tutorial. This service handler contract [calls the `Service Manager` contract](https://github.com/Lay3rLabs/wavs-foundry-template/blob/v0.3.0-rc1/src/contracts/WavsSubmit.sol) to validate operator signatures before executing the business logic (storing BTC price onchain in this case). This contract contains a basic example of verifying submission data, however, a submission contract can theoretically contain any business logic that a service may need.
64+
You can view an example service handler contract in the template tutorial. This service handler contract [calls the `Service Manager` contract](https://github.com/Lay3rLabs/wavs-foundry-template/blob/v0.3.0/src/contracts/WavsSubmit.sol) to validate operator signatures before executing the business logic (storing BTC price onchain in this case). This contract contains a basic example of verifying submission data, however, a submission contract can theoretically contain any business logic that a service may need.
6565

6666
## WAVS Runtime
6767

content/docs/tutorial/1-overview.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ In this guide, you will build a simple oracle service that fetches Bitcoin price
1313

1414
The price oracle service example has three basic parts:
1515

16-
1. [A trigger](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/src/contracts/WavsTrigger.sol): A trigger can be any on-chain event emitted from a contract. This event **triggers** a service to run. In the WAVS Foundry Template, there is a simple trigger contract that stores trigger requests, assigns them unique IDs, and emits an event when a new trigger is added. In this example, the trigger event will pass data pertaining to the ID of an asset for the CoinMarketCap price feed.
16+
1. [A trigger](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src/contracts/WavsTrigger.sol): A trigger can be any on-chain event emitted from a contract. This event **triggers** a service to run. In the WAVS Foundry Template, there is a simple trigger contract that stores trigger requests, assigns them unique IDs, and emits an event when a new trigger is added. In this example, the trigger event will pass data pertaining to the ID of an asset for the CoinMarketCap price feed.
1717

18-
2. [A service component](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/lib.rs): The service component contains the business logic of a service. It is written in Rust (support for more languages is coming soon), compiled to WASM, and run by operators in the WAVS runtime. In this example, operators will listen for a new trigger event to be emitted and then run the service component off-chain, using the asset ID data from the trigger event as input. The component contains logic to fetch the price of the asset from the CoinMarketCap price feed API, which is then processed and encoded before being sent back on-chain.
18+
2. [A service component](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/lib.rs): The service component contains the business logic of a service. It is written in Rust (support for more languages is coming soon), compiled to WASM, and run by operators in the WAVS runtime. In this example, operators will listen for a new trigger event to be emitted and then run the service component off-chain, using the asset ID data from the trigger event as input. The component contains logic to fetch the price of the asset from the CoinMarketCap price feed API, which is then processed and encoded before being sent back on-chain.
1919

20-
3. [A submission contract](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/src/contracts/WavsSubmit.sol): Also known as the “service handler,” this contract contains the on-chain submission logic for the service. It validates and stores the processed data returned by the WAVS component. When an operator submits a response, the contract verifies the data’s integrity by checking the operator’s signature and then associates it with the original trigger ID, bringing the queried price on-chain.
20+
3. [A submission contract](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src/contracts/WavsSubmit.sol): Also known as the “service handler,” this contract contains the on-chain submission logic for the service. It validates and stores the processed data returned by the WAVS component. When an operator submits a response, the contract verifies the data’s integrity by checking the operator’s signature and then associates it with the original trigger ID, bringing the queried price on-chain.
2121

2222
These three parts come together to create a basic oracle service using WAVS. To learn more about services and how they work, visit the [How it works page](../how-it-works).
2323

content/docs/tutorial/3-project.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ code .
2626

2727
This template repo contains all the files you'll need to build, run, and test WAVS services locally.
2828

29-
The template already contains the necessary files for the oracle example to run. For example, the trigger ([`WavsTrigger.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/src/contracts/WavsTrigger.sol)) and submission ([`WavsSubmit.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/src/contracts/WavsSubmit.sol)) contracts can be found in the [`/my-wavs/src/contracts`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/6fb281c9382ceefdc8538b7a8e29916c509aafc9/src) folder.
29+
The template already contains the necessary files for the oracle example to run. For example, the trigger ([`WavsTrigger.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src/contracts/WavsTrigger.sol)) and submission ([`WavsSubmit.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src/contracts/WavsSubmit.sol)) contracts can be found in the [`/my-wavs/src/contracts`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src) folder.
3030

31-
In [`/eth-price-oracle/src/lib.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/lib.rs) you'll find the oracle service component.
31+
In [`/eth-price-oracle/src/lib.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/lib.rs) you'll find the oracle service component.
3232

33-
This template uses a [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/Makefile) and environment variables to help with your developer experience. If you are ever curious about one of the `Make` commands in the following sections, you can always look at the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/Makefile) to learn more.
33+
This template uses a [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/Makefile) and environment variables to help with your developer experience. If you are ever curious about one of the `Make` commands in the following sections, you can always look at the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/Makefile) to learn more.
3434

3535
<Callout title="Info" type="info">
3636

content/docs/tutorial/4-component.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { Callout } from 'fumadocs-ui/components/callout';
66
import { Scrollycoding } from "@/components/scrollycoding";
77
import { link } from "@/components/link.tsx";
88

9-
The core logic of the price oracle in this example is located in the [`/eth-price-oracle/src/lib.rs` file](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/lib.rs). Scroll down to follow a walkthrough of the code for the oracle component.
9+
The core logic of the price oracle in this example is located in the [`/eth-price-oracle/src/lib.rs` file](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/lib.rs). Scroll down to follow a walkthrough of the code for the oracle component.
1010

1111

1212
<HoverContainer>
1313
<Scrollycoding>
1414

1515
## !!steps trigger.rs
1616

17-
The [trigger.rs](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/trigger.rs) file handles the decoding of incoming trigger data and preparing it for processing within the WAVS component. The `encode_trigger_output` function ensures that processed data is formatted correctly before being sent back. Update the code if you require different trigger types (e.g. Cosmos events) or if you are building a [custom trigger](./5-build#custom-triggers).
17+
The [trigger.rs](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/trigger.rs) file handles the decoding of incoming trigger data and preparing it for processing within the WAVS component. The `encode_trigger_output` function ensures that processed data is formatted correctly before being sent back. Update the code if you require different trigger types (e.g. Cosmos events) or if you are building a [custom trigger](./5-build#custom-triggers).
1818

1919

2020
```rust ! trigger.rs
@@ -56,7 +56,7 @@ mod solidity {
5656

5757
## !!steps Oracle component definitions
5858

59-
The [`lib.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/lib.rs) file contains the main component logic for the oracle. The first section of the code imports the required modules for requests, serialization, and bindings, defines the component struct, and exports the component for execution within the WAVS runtime.
59+
The [`lib.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/lib.rs) file contains the main component logic for the oracle. The first section of the code imports the required modules for requests, serialization, and bindings, defines the component struct, and exports the component for execution within the WAVS runtime.
6060

6161
```rust ! lib.rs
6262
// !focus(1:13)

content/docs/tutorial/5-build.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ The maximum fuel allocation can be adjusted in the `Makefile` to accommodate dif
8282
8383
When developing a custom trigger, you will need to update the template code in a few places:
8484
85-
1. The trigger contract itself in [`src/WavsTrigger.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/src/contracts/WavsTrigger.sol), which defines how triggers are created and emitted on-chain.
86-
2. The `wasi-exec` command in the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/Makefile#L36-L40), which passes input data when testing WAVS components via `--input cast format-bytes32-string $(COIN_MARKET_CAP_ID)`. This simulates an Ethereum event during local execution.
87-
3. The `decode_trigger_event` function in [`/components/eth-price-oracle/src/trigger.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/trigger.rs#L11-L21), which processes the trigger data and extracts relevant fields like `trigger_id` and `data`.
88-
4. The `run` function in [`/components/eth-price-oracle/src/lib.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/components/eth-price-oracle/src/lib.rs#L13), which calls decode_trigger_event, processes the extracted trigger data, and determines how to handle it.
89-
5. The trigger script in [`/script/Trigger.s.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/script/Trigger.s.sol#L15), which calls the `addTrigger` function with the `coinMarketCapID`, used in this template for the oracle example.
85+
1. The trigger contract itself in [`src/WavsTrigger.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src/contracts/WavsTrigger.sol), which defines how triggers are created and emitted on-chain.
86+
2. The `wasi-exec` command in the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/Makefile#L39-L43), which passes input data when testing WAVS components via `--input cast format-bytes32-string $(COIN_MARKET_CAP_ID)`. This simulates an Ethereum event during local execution.
87+
3. The `decode_trigger_event` function in [`/components/eth-price-oracle/src/trigger.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/trigger.rs#L11-L21), which processes the trigger data and extracts relevant fields like `trigger_id` and `data`.
88+
4. The `run` function in [`/components/eth-price-oracle/src/lib.rs`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/components/eth-price-oracle/src/lib.rs#L13), which calls decode_trigger_event, processes the extracted trigger data, and determines how to handle it.
89+
5. The trigger script in [`/script/Trigger.s.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/script/Trigger.s.sol#L15), which calls the `addTrigger` function with the `coinMarketCapID`, used in this template for the oracle example.
9090
9191
## Contract interfaces
9292

content/docs/tutorial/6-run-service.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ The following command will deploy your WASI component and service information to
4646
make deploy-service
4747
```
4848

49-
This command specifies the event emitted from your trigger contract as the on-chain event that will trigger your service. In the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/Makefile#L95-L102), you can also see that it specifies the submission contract as the `submit-address`, as well as the filename of your component.
49+
This command specifies the event emitted from your trigger contract as the on-chain event that will trigger your service. In the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/Makefile#L95-L102), you can also see that it specifies the submission contract as the `submit-address`, as well as the filename of your component.
5050

5151
<Callout title="Customize variables" type="info">
5252

53-
Open the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/Makefile#L9-L22) to view the different variables that you can customize, including the trigger event, the component filename, and the service config.
53+
Open the [`Makefile`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/Makefile#L9-L22) to view the different variables that you can customize, including the trigger event, the component filename, and the service config.
5454

5555
You can also modify variables by specifying them before running the `make` command:
5656

@@ -65,7 +65,7 @@ TRIGGER_EVENT="NewTrigger(bytes)" make deploy-service
6565

6666
Next, use your deployed trigger contract to trigger the oracle to be run. In the following command, you'll specify the `COIN_MARKET_CAP_ID` as `1`, which corresponds to the ID of Bitcoin.
6767

68-
Running this command will execute [`/script/Trigger.s.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/script/Trigger.s.sol) and pass the ID to the trigger contract, starting the following chain of events:
68+
Running this command will execute [`/script/Trigger.s.sol`](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/script/Trigger.s.sol) and pass the ID to the trigger contract, starting the following chain of events:
6969

7070
1. The trigger contract will emit an event with the specified ID as its data.
7171
2. Operators listening for the event will receive the data and run it in the oracle component off-chain.

content/docs/tutorial/7-prediction.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ These contracts handle the creation of markets and conditional tokens.
3030

3131
In this demo, the oracle that resolves the market is triggered by the [`PredictionMarketOracleController.sol`](https://github.com/Lay3rLabs/wavs-demos/blob/d13fd90b1407cdb876340e2f399769bb31b1dc52/src/PredictionMarketOracleController.sol) contract.
3232

33-
This contract contains modifications to the `WavsTrigger.sol` contract from the [WAVS Foundry Template repo](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0-rc1/src/contracts/WavsTrigger.sol). Similar to the simple trigger contract, it passes data to the oracle AVS via the `NewTrigger` event.
33+
This contract contains modifications to the `WavsTrigger.sol` contract from the [WAVS Foundry Template repo](https://github.com/Lay3rLabs/wavs-foundry-template/tree/v0.3.0/src/contracts/WavsTrigger.sol). Similar to the simple trigger contract, it passes data to the oracle AVS via the `NewTrigger` event.
3434

3535
```rust
3636
struct TriggerInputData {

last_commit_sync.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
72321ee1eccd426988c8250fe9289a2567eb9ffd
1+
2e88997580af9441a8107816962fedadceecab23

0 commit comments

Comments
 (0)