Là một dự án mã nguồn mở, smartcontractkit/foundry-starter-kit đã đạt 363 sao trên GitHub, ngôn ngữ Solidity.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
[!IMPORTANT]
This repository has recently been updated for use with Chainlink contracts v1.5.0. See the dependency installation section for instructions on how to set up v1.5.0 within your own project using forge install.
Foundry Starter Kit
Foundry Starter Kit is a repo that shows developers how to quickly build, test, and deploy smart contracts with one of the fastest frameworks out there, foundry!
Foundry Starter Kit
Getting Started
Requirements
Quickstart
Dependencies
Testing
Deploying to a network
Setup
Deploying
Working with a local network
Working with other chains
Security
Contributing
Thank You!
Resources
TODO
Getting Started
Requirements
Please install the following:
Git
You'll know you've done it right if you can run git --version
Foundry / Foundryup
This will install forge, cast, and anvil
You can test you've installed them right by running forge --version and get an output like: forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
To get the latest of each, just run foundryup
Quickstart
git clone https://github.com/smartcontractkit/foundry-starter-kit
cd foundry-starter-kit
Install dependencies as follows:
Run forge install to install dependencies. Foundry uses git submodules as its dependency management system.
⚠️ when running forge install, you may see an error message if you have uncommitted changes in your repo. Read the message carefully - it may inform you that you can add the --no-commit flag to each of these install commands if your workspace has uncommitted changes.
You can update dependencies by running forge update
Installing Chainlink contracts:
forge install
[!IMPORTANT]
For this starter kit, the packages have already been included and can be installed using the above forge install command. This package includes Chainlink contracts v1.5.0.
To add Chainlink contracts to an existing project:
v1.5.0 and above
Step 1: Install >= v1.5.0 and required dependencies
To check that everything is compiling and working as intended after cloning and installing dependencies, run
forge test
All tests should pass.
Chainlink Foundry Starter Kit
Implementation of the following 4 Chainlink services using the [Foundry] (https://book.getfoundry.sh/) smart contract development tooling:
Chainlink Price Feeds
Chainlink VRF V2
Chainlink Automation
For Chainlink Functions please go to these starter kits: Hardhat | Foundry (coming soon)
For Chainlink CCIP (Cross Chain Interoperability Protocol) please go to these starter kits: Hardhat | Foundry
Deploying to a network
Deploying to a network uses the foundry scripting system, where you write your deploy scripts in solidity!
Setup
We'll demo using the Sepolia testnet. (Go here for testnet sepolia ETH.)
You'll need to add the following variables to a .env file:
SEPOLIA_RPC_URL: A URL to connect to the blockchain. You can get one for free from Infura account
PRIVATE_KEY: A private key from your wallet. You can get a private key from a new MetaMask account
Additionally, if you want to deploy to a testnet, you'll need test ETH and/or LINK. You can get them from faucets.chain.link.
Optional ETHERSCAN_API_KEY: If you want to verify on etherscan
When you've added your environment variables to the .env file, run source .env in your terminal (and for each new terminal session) to load the environment variables into your terminal.
Deploying
Deploy scripts are in ./script. The relevant Chainlink Service can be determined from the name of the Contract script. HelperConfig is not meant to be deployed.
To deploy one of the Chainlink Service consumer contracts run the script as follows:
If you don't have an ETHERSCAN_API_KEY, you can omit --verify --etherscan-api-key $ETHERSCAN_API_KEY
Working with Anvil local development network
Foundry comes with local network anvil baked in, and allows us to deploy to our local network for quick testing locally.
To start a local network run the following in a new terminal window or tab:
anvil
This will spin up a local blockchain on http://localhost:8545 : (see console output for the mnemonic used, and 10 private keys and their associated wallet address), so you can use the same private key each time.
Then, you can deploy to it with one of those private keys; in this example we use the first one:
This framework comes with slither parameters, a popular security framework from Trail of Bits. To use slither, you'll first need to install python and install slither.
Then, you can run:
make slither
And get your slither output.
Contributing
Contributions are always welcome! Open a PR or an issue!
If you do contribute please add solidity.formatter": "forge to your VSCode Settings, or run forge fmt before you commit and push.
Thank You!
Resources
Chainlink Documentation
Foundry Documentation
TODO
[ ] Add bash scripts to interact with contracts using cast
[ ] Make deploying contracts to anvil simpler
Disclaimer: Please note, this repo contains community examples only — these are not Chainlink products or services and are not supported or maintained by Chainlink. This code represents an example of using a Chainlink product or service, and is intended for demonstration and educational purposes only. It is provided “AS IS” and “AS AVAILABLE” without warranties of any kind, may not have been audited, and may omit checks or error handling. Each party intending to use this example code does so entirely at their own risk and must perform its own audits, security and code review, key management, and testing before any production deployment and ensure the operation and performance of such code matches expectations. Neither Chainlink Labs nor the Chainlink Foundation deploys, operates, monitors, maintains or endorses any deployment of this code. Note that this is not a Chainlink product, feature or service, and there are no commitments made with respect to the code, including compatibility with future Chainlink releases. You should not rely on this code without first conducting your own technical, engineering, and security review. This code is also outside the scope of any Chainlink bug bounty programs. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for outcomes due to errors in this example or how it is deployed or operated, or liable for any resulting claims or damages. Use of the Chainlink Network is subject to the Chainlink Foundation Terms of Service, which provides important information and disclosures. By using this code, you acknowledge and agree to these terms.
smartcontractkit/foundry-starter-kit có bao nhiêu sao?
smartcontractkit/foundry-starter-kit có 363 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/smartcontractkit/foundry-starter-kit. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
smartcontractkit/foundry-starter-kit có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho smartcontractkit/foundry-starter-kit. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
smartcontractkit/foundry-starter-kit còn đang phát triển không?
Commit gần nhất trên smartcontractkit/foundry-starter-kit là 1 tháng trước (theo timestamp GitHub). Repo có 107 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
smartcontractkit/foundry-starter-kit là gì?
smartcontractkit/foundry-starter-kit (smartcontractkit/foundry-starter-kit) là dự án Solidity TopGit theo dõi. Tính tới lần đồng bộ gần nhất, repo có 363 sao.
smartcontractkit/foundry-starter-kit viết bằng ngôn ngữ gì?
smartcontractkit/foundry-starter-kit chủ yếu viết bằng Solidity. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
foundry-starter-kit có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về foundry-starter-kit.