Skip to content

Commit

Permalink
doc: Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
oyyblin committed Oct 31, 2024
1 parent f505658 commit eba27f9
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/main/updater/README.md

# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# Drand Oracle
# 🎲 Drand Oracle

A Solidity smart contract and updater service for bringing randomness from the [drand network](https://drand.love) on-chain.

## Overview
## 📄 Contract

This project consists of two main components:
The `DrandOracle` smart contract serves as an on-chain source of randomness by storing values from the drand network.

1. A Solidity smart contract (`DrandOracle.sol`) that stores randomness values along with necessary metadatas and signatures to verify the randomness off chain.
2. A Go updater service that fetches new randomness from drand and updates the contract.
For more information, see the [contract README](contracts/README.md).

## Contract
## 🔄 Updater

The randomness stored in the contract is verifiable off-chain but not on-chain. This is due to BLS signatures used by Drand network are not yet supported on EVM.
The updater service fetches new randomness from drand and updates the `DrandOracle` contract with its managed signer and sender EOA addresses.

For more information, see the [updater README](updater/README.md).

## 📝 License

This project is licensed under the [MIT License](LICENSE).

## 🤝 Contributing

Contributions are welcome! Please feel free to open an issue or submit a Pull Request.
62 changes: 62 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 📄 Drand Oracle Smart Contract

## 🔎 Overview

The `DrandOracle` smart contract serves as an on-chain source of randomness by storing values from the drand network.

## 📚 Core Contracts

### 🎲 DrandOracle.sol

The main contract responsible for storing and managing randomness from the drand network.

#### 🛠️ Usage

- `getRandomnessFromRound(uint64 _round) external view returns (Random memory)`
- Retrieves the complete randomness data for a specific round
- Parameters:
- `_round`: The round number to query
- Returns:
- `Random memory`: The Random struct containing the round's data
- `getRandomnessFromTimestamp(uint64 _timestamp) external view returns (Random memory)`
- Retrieves the complete randomness data for a specific timestamp, or the latest timestamp prior to the given timestamp if no exact match is found
- Parameters:
- `_timestamp`: The timestamp to query
- Returns:
- `Random memory`: The Random struct containing the timestamp's data

### 🔒 Access Control

The contract implements a simple single-updater access control pattern:

- Only the designated updater address can submit new randomness
- Updater address is set during contract deployment
- Updater can be updated by the owner

### ⚠️ Limitations

1. The randomness stored in the contract is verifiable off-chain but not on-chain. This is due to BLS signatures used by Drand network are not yet supported on EVM.
2. Reliance on trusted updater.

### 🧪 Testing

Run tests with:

```bash
forge test
```

### 💻 Run Locally

1. Start local anvil chain

```bash
anvil
```

2. Deploy the contract

```bash
forge build
make deploy-anvil
```
8 changes: 0 additions & 8 deletions updater/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,3 @@ Go to the `updater` directory and run:
```bash
make local-run-anvil
```

## 📄 License

MIT License.

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

0 comments on commit eba27f9

Please sign in to comment.