The Chronicle Foundry Template enables users to seamlessly integrate Chronicle oracles in their Foundry-based projects.
Note
If you are new to Foundry, you might want to check out the Foundry Installation and Foundry Getting Started docs first.
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.
$ source .env
$ forge build
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
$ forge fmt
$ forge snapshot
$ anvil
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
$ cast call <your oracle address> 'read()(uint,uint)' --rpc-url $SEPOLIA_RPC_URL
$ forge --help
$ anvil --help
$ cast --help