Skip to content

Starter kit for contract development with SEDA Oracle Programs using Hardhat.

License

Notifications You must be signed in to change notification settings

sedaprotocol/seda-hardhat-starter-kit

Repository files navigation

seda-protocol

SEDA Hardhat Starter Kit

This starter kit is built on a minimal Hardhat boilerplate, focusing on simplicity to showcase how to interact with the SEDA network. It features a sample consumer contract (PriceFeed) that interacts with the SEDA protocol through a Prover Contract, demonstrating how to create and retrieve data requests on the network.

Getting Started

Clone the repository and install the dependencies:

git clone git@github.com:sedaprotocol/seda-hardhat-starter-kit.git
cd seda-hardhat-starter-kit
npm install

Project Structure

This project follows the structure of a typical Hardhat project:

  • contracts/: Contains the Solidity contracts including PriceFeed.
  • ignition/: Ignition deployment modules for deploying contracts.
  • tasks/: Hardhat tasks for interacting with the PriceFeed contract.
  • test/: Test files for the contracts.

Compiling and Testing the Contracts

Compile your contracts and run tests to ensure everything works correctly:

npx hardhat compile
npx hardhat test

Deploying the Contracts

Deploy the PriceFeed contract using Hardhat Ignition with a specific SEDA configuration:

npx hardhat ignition deploy ./ignition/modules/PriceFeed.ts --network baseSepolia --verify

Note

The project includes a seda.config.ts file that includes SEDA-specific configurations. This file allows you to define and modify configurations such as the addresses of Prover Contracts on different networks.

Interacting with Deployed Contracts

Use Hardhat tasks specifically designed for interacting with the PriceFeed contract.

Transmit a Data Request: Calls the transmit function on PriceFeed to trigger a data request post on the SEDA network.

npx hardhat pricefeed transmit --network <network_name>

Fetch Latest Answer: Calls the latestAnswer function on PriceFeed to get the result of the data request.

npx hardhat pricefeed latest-answer --network <network_name>

Environment Variables

Configure the .env file with the necessary variables. Here is an example .env file:

ORACLE_PROGRAM_ID=YOUR_ORACLE_PROGRAM_ID
EVM_PRIVATE_KEY=YOUR_EVM_PRIVATE_KEY
BASE_SEPOLIA_ETHERSCAN_API_KEY=YOUR_BASESCAN_API_KEY

Additional Resources

License

Contents of this repository are open source under MIT License.

About

Starter kit for contract development with SEDA Oracle Programs using Hardhat.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published