Skip to content

chronicleprotocol/chronicle-foundry-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chronicle Foundry Template

The Chronicle Foundry Template enables users to seamlessly integrate Chronicle oracles in their Foundry-based projects.

Foundry Installation

Note

If you are new to Foundry, you might want to check out the Foundry Installation and Foundry Getting Started docs first.

Set up your environment variables

Based on the env.example file, create or update an .env file in the root directory of your project. Below you can find an explanation of each variable:

SEPOLIA_RPC_URL   - http RPC node endpoint used by Forge.
PRIVATE_KEY       - private key of an account used for deployment and interaction with the smart contracts. When using Anvil, a set of private keys for local usage is provided. Use one of these for local development.
ETHERSCAN_API_KEY - API key for Etherscan, used for contract verification.

Load the environment variables from .env file

$ source .env

Build the projects's smart contracts

$ forge build

Test

Needs to be run on a fork to work as static calls are made

$ forge test --fork-url $SEPOLIA_RPC_URL --fork-block-number 7484876

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

Note that it is recommended to run the following command before each deploy:

$ forge clean

Afterwards, just run:

$ forge create --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY src/OracleReader.sol:OracleReader

You can also deploy using the script/deploy_oracleReader.s.sol script via:

$ forge script --chain sepolia script/deploy_oracleReader.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast  --verify -vvvv

Reading your oracle

$ cast call <your oracle address> 'read()(uint,uint)' --rpc-url $SEPOLIA_RPC_URL

Help

$ forge --help
$ anvil --help
$ cast --help

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published