Skip to content

Commit

Permalink
Update readme, separate readme for e2e deployment setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanpeterson1 committed Jun 5, 2024
1 parent 17c474c commit c60090a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 35 deletions.
39 changes: 4 additions & 35 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ npx hardhat deploy --network [network (galadriel or localhost)] --contract [cont
npx hardhat deploy --network galadriel --contract ChatGpt --oracleaddress [oracle_address] ""
# Dall-e example
npx hardhat deploy --network galadriel --contract DalleNft --oracleaddress [oracle_address] "system prompt"
# Groq localhost example
# Groq localhost example (requires running a local node)
npx hardhat deploy --network localhost --contract GroqChatGpt --oracleaddress [oracle_address]
```

Expand All @@ -55,41 +55,10 @@ npm run deployQuickstart
npm run deployAll:galadriel
```

### Local
### Running e2e

**Run local network**

```
npm run node
```

This runs a chain on: http://localhost:8545
Chain ID: 1337

Take some private key from local node and add to .env `PRIVATE_KEY_LOCALHOST`

**Deploy the oracle contract and all examples to local network**

```
npm run deployAll:localhost
```

**Run the oracle backend**

Please see the [`oracles` directory](/oracles) to run the oracle backend. If you don't run the oracle back-end, the
oracle contracts on your localnet will not produce any results (and will not make any callbacks).

## Whitelisting a Wallet in the Oracle Contract

To whitelist an address in the Oracle contract, allowing it to write responses on-chain, you can use the `whitelist`
Hardhat task.

Run the following command, replacing `[oracle_address]` with the Oracle contract's address and `[wallet_address]` with
the address you want to whitelist:

```bash
npx hardhat whitelist --oracle-address [oracle_address] --whitelist-address [wallet_address] --network galadriel
```
To run the whole flow e2e either locally or on Galadriel devnet check out
[e2e deployment readme](/contracts/contracts/README_e2e.md).

### Generating standard Solidity input JSON

Expand Down
47 changes: 47 additions & 0 deletions contracts/README_e2e.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Deploying contracts to run the setup e2e

This document explains how to deploy the contracts, if you want to run
the setup e2e including running the oracle. This is generally not necessary,
unless you wish to make any changes to the oracle, or run it locally for testing.

## Deployment


**Run local network if running locally**

```
npm run node
```

This runs a chain on: http://localhost:8545
Chain ID: 1337

Take some private key from local node and add to .env `PRIVATE_KEY_LOCALHOST`

## Deploy the oracle contract and all examples

This adds the deployed oracle contract to all the other contracts

```
# Localhost
npm run deployAll:localhost
# Galadriel
npm run deployAll:galadriel
```

**Run the oracle backend and look at the next section to whitelist an address**

Please see the [`oracles` directory](/oracles) to run the oracle backend. If you don't run the oracle back-end, the
oracle contracts will not produce any results (and will not make any callbacks).

## Whitelisting a Wallet in the Oracle Contract

To whitelist an address in the Oracle contract, allowing it to write responses on-chain, you can use the `whitelist`
Hardhat task.

Run the following command, replacing `[oracle_address]` with the Oracle contract's address, `[wallet_address]` with
the address you want to whitelist and `[network]` with either `localhost` or `galadriel`:

```bash
npx hardhat whitelist --oracle-address [oracle_address] --whitelist-address [wallet_address] --network [network]
```

0 comments on commit c60090a

Please sign in to comment.