Skip to content

SethuRamanOmanakuttan/chainlink-feeds-with-foundry

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Labs

Chainstack is the leading suite of services connecting developers with Web3 infrastructure

         

Supported protocolsChainstack blogChainstack docsBlockchain API referenceStart for free

Using Chainlink data feeds with Foundry

This project shows how to use Foundry to compile and deploy Smart contracts.

See the full tutorial on the Chainstack blog:

Project details

Foundry is one of the latest smart contract development tools currently in the market, and it allows users to compile contracts, write tests, deploy contracts, and much more through its command line interface. This project is already set up for you to deploy smart contracts and interact with Chainlink’s data feeds.

Learn more about Foundry: Foundry: A fast Solidity smart contract development toolkit

Quick start

Clone this repository.

Install Foundry

curl -L https://foundry.paradigm.xyz | bash

Then:

foundryup

Compile smart contracts

forge build

Create a .env file

In the root directory:

touch .env

This will create a new .env file, paste and edit the following in it:

GOERLI_RPC_URL=CHAINSTACK_GOERLI_NODE_URL
PRIVATE_KEY=YOU_PRIVATE_KEY
ETHERSCAN_KEY=ETHERSCAN_API_KEY(to verify the smart contract)

Deploy the smart contract

Run the following command:

forge script script/priceFeedsScript.s.sol:ChainlinkScript --rpc-url $GOERLI_RPC_URL  --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv

Prerequisites

  • Linux or MacOS
  • A Goerli Chainstack endpoint

Deploy a Goerli node:

  1. Sign up with Chainstack.
  2. Deploy a node.
  3. View node access and credentials.

Install

Clone this repository.

Install Foundry

curl -L https://foundry.paradigm.xyz | bash

Then:

foundryup

Example

Here is a link to a verified smart contract deployed to the Goerli testnet, and then verified using Foundry's command line.

About

A tutorial on using Chainlink data feeds with Foundry.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 100.0%