Note: This is now the old version of this template. Please see the new one here
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!
This repo is based on the femplate
You can also check out the similar dapptools-starter-kit
Installation
Requirements
- Git (version 2.36.1 or above)
- Foundry / Foundryup
- Nix
And you probably already have make
installed... but if not try looking here.
Getting Started / Quickstart
git clone https://github.com/smartcontractkit/foundry-starter-kit.git
cd foundry-starter-kit
make # This installs the project's dependencies.
make test
Testing
make test
or
forge test
Deploying to a network
Deploying is done by a prompt system rather than a flexible single command to run at this time. If you'd like to contribute by writing some scripts to make deploying easier, please do!
Setup
You'll need the following:
RPC URL
: A URL to connect to the blockchain. You can get one for free from Alchemy.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.
Constructor Arguments
: These are the arguments that you pass to your smart contract on deployment. If you look at theconstructor
function in each contract, those are the values that they need. If you want some examples, we've provided some in ourscripts/helper-config.sh
file.Contract
: The name of the contract you want to deploy, iePriceFeedConsumer
.
Deploying
bash scripts/deploy_<NETWORK>.sh
You'll be prompted for the following:
Enter Your Rinkeby RPC URL:
Example: https://eth-mainnet.alchemyapi.io/v2/XXXXXXXXXX
Which contract do you want to deploy (eg Greeter)?
Enter constructor arguments separated by spaces (eg 1 2 3):
compiling...
success.
Insert private key:
0x<PRIVATE_KEY_HERE>
Full Example:
bash scripts/deploy_rinkeby.sh
Enter Your Rinkeby RPC URL:
https://eth-rinkeby.alchemyapi.io/v2/XXXXXX
Which contract do you want to deploy (eg Greeter)?
PriceFeedConsumer
Enter constructor arguments separated by spaces (eg 1 2 3):
0x8A753747A1Fa494EC906cE90E9f37563A8AF630e
Insert private key:
0xXXXXXXX
Deployer: 0x643315c9be056cdea171f4e7b2222a4ddab9f88d
Deployed to: 0xec8af3f6c8725cc60e6ecc0009ad9e756e9723e0
Contributing
Contributions are always welcome! Open a PR or an issue!
Thank You!
Resources
TODO
[ ] Make deployment more modular like in dapptools-starter-kit
[ ] Enable network & contract choice from the command line
[ ] Add scripts that interact with deployed contracts
[ ] Add documentation for running on a local network with hardhat & a forked network