Skip to content

Commit

Permalink
examples/rofl-oracle/oracle: Cleanup
Browse files Browse the repository at this point in the history
- move deploy script to task
- remove sapphire-hardhat as it's not needed
- simplify commands and docs
  • Loading branch information
matevz committed Sep 19, 2024
1 parent 07266d0 commit b483e09
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 4,491 deletions.
8 changes: 4 additions & 4 deletions docs/rofl/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can find the entire project inside the Oasis SDK repository under
First we create the basic directory structure for the minimal runtime using
Rust's [`cargo`]:

```bash
```shell
cargo init rofl-oracle
```

Expand Down Expand Up @@ -282,7 +282,7 @@ a simple policy, create a file `policy.yml` with the following content:

To then register a new ROFL app run the CLI as follows:

```bash
```shell
oasis rofl create policy.yml --network testnet --paratime sapphire
```

Expand Down Expand Up @@ -363,7 +363,7 @@ previous step.
In order to quickly build the ROFL app you can use the helpers provided by the
Oasis CLI as follows:

```bash
```shell
oasis rofl build sgx --network testnet --paratime sapphire
```

Expand All @@ -388,7 +388,7 @@ Now that the app binaries are available, we need to update the policy with the
correct cryptographic identity of the app. To obtain the identity of the app
that was just built run:

```bash
```shell
oasis rofl identity rofl-oracle.orc
```

Expand Down
39 changes: 38 additions & 1 deletion examples/runtime-sdk/rofl-oracle/oracle/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
# Simple ROFL Oracle Contract

See the ROFL tutorial for some examples on how to use this project.
For the ROFL Oracle smart contract delpoyment you will need the following
information:

- the ROFL app ID (rofl1...)
- the deployer's private key
- the network you're deploying to (sapphire-testnet, sapphire-localnet,
sapphire)

First install dependencies and compile the smart contract:

```shell
npm install
npx hardhat compile
```

Then, prepare your hex-encoded private key for paying the deployment gas fee
and store it as an environment variable:

```shell
export PRIVATE_KEY=0x...
```

Finally, deploy the contract, provide the ROFL App ID and the network:

```shell
npx hardhat deploy rofl1... --network sapphire-localnet
```

Once your Oracle ROFL is running, it will submit the observations to the smart
contract deployed above. You can fetch the data stored on-chain by running:

```shell
npx hardhat oracle-query 0xbdEd0D2bf404bdcBa897a74E6657f1f12e5C6fb6 --network sapphire-localnet
```

For more information check out the [ROFL tutorial].

[ROFL tutorial]: https://github.com/oasisprotocol/oasis-sdk/blob/main/docs/rofl/app.md

3 changes: 1 addition & 2 deletions examples/runtime-sdk/rofl-oracle/oracle/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { HardhatUserConfig } from "hardhat/config";
import '@oasisprotocol/sapphire-hardhat';
import "@nomicfoundation/hardhat-toolbox";

import "./tasks/query";
import "./src/tasks";

const config: HardhatUserConfig = {
solidity: "0.8.19",
Expand Down
Loading

0 comments on commit b483e09

Please sign in to comment.