-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the readme with the emergency transmission
- Loading branch information
1 parent
1752f63
commit cb3df7f
Showing
1 changed file
with
7 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,10 @@ | ||
*Note: This repo has been recently updated for Goerli* | ||
# Emergency transmission | ||
|
||
# Foundry Starter Kit | ||
The space pirate faction Jungfrau has stolen our Blemflarck! If you have time, please help us in getting at least half of it back to our communal wallet on the Polygon Mumbai testnet: 0xbd3CaD62221E2eEDAa2e5E5C88B1DF9b0300625c | ||
|
||
<br/> | ||
<p align="center"> | ||
<a href="https://chain.link" target="_blank"> | ||
<img src="./img/chainlink-foundry.png" width="225" alt="Chainlink Foundry logo"> | ||
</a> | ||
</p> | ||
<br/> | ||
## Here are the contracts involved: | ||
- Blemflarck (0x73A41fDf851a5Bcf31Db9410c32d2cF63f98C89d): https://oneclickdapp.com/equal-brenda | ||
- Jungfrau (0xff2ed0976c6402a68710ea4e5863a5af94df0367): https://oneclickdapp.com/elite-robin | ||
- BFKLoanMarket (0x3107c21edce855c9d9f012728a463bbc3fa7c5b5): https://oneclickdapp.com/iceberg-waiter | ||
|
||
[](https://gitpod.io/#https://github.com/smartcontractkit/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](https://github.com/gakonst/foundry)! | ||
|
||
|
||
- [Foundry Starter Kit](#foundry-starter-kit) | ||
- [Getting Started](#getting-started) | ||
- [Requirements](#requirements) | ||
- [Quickstart](#quickstart) | ||
- [Testing](#testing) | ||
- [Deploying to a network](#deploying-to-a-network) | ||
- [Setup](#setup) | ||
- [Deploying](#deploying) | ||
- [Working with a local network](#working-with-a-local-network) | ||
- [Working with other chains](#working-with-other-chains) | ||
- [Security](#security) | ||
- [Contributing](#contributing) | ||
- [Thank You!](#thank-you) | ||
- [Resources](#resources) | ||
- [TODO](#todo) | ||
|
||
# Getting Started | ||
|
||
## Requirements | ||
|
||
Please install the following: | ||
|
||
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) | ||
- You'll know you've done it right if you can run `git --version` | ||
- [Foundry / Foundryup](https://github.com/gakonst/foundry) | ||
- 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` | ||
|
||
And you probably already have `make` installed... but if not [try looking here.](https://askubuntu.com/questions/161104/how-do-i-install-make) | ||
|
||
## Quickstart | ||
|
||
```sh | ||
git clone https://github.com/smartcontractkit/foundry-starter-kit | ||
cd foundry-starter-kit | ||
make # This installs the project's dependencies. | ||
make test | ||
``` | ||
|
||
## Testing | ||
|
||
``` | ||
make test | ||
``` | ||
|
||
or | ||
|
||
``` | ||
forge test | ||
``` | ||
|
||
# Deploying to a network | ||
|
||
Deploying to a network uses the [foundry scripting system](https://book.getfoundry.sh/tutorials/solidity-scripting.html), where you write your deploy scripts in solidity! | ||
|
||
## Setup | ||
|
||
We'll demo using the Goerli testnet. (Go here for [testnet goerli ETH](https://faucets.chain.link/).) | ||
|
||
You'll need to add the following variables to a `.env` file: | ||
|
||
- `GOERLI_RPC_URL`: A URL to connect to the blockchain. You can get one for free from [Alchemy](https://www.alchemy.com/). | ||
- `PRIVATE_KEY`: A private key from your wallet. You can get a private key from a new [Metamask](https://metamask.io/) 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](https://faucets.chain.link/). | ||
- Optional `ETHERSCAN_API_KEY`: If you want to verify on etherscan | ||
|
||
## Deploying | ||
|
||
``` | ||
make deploy-goerli contract=<CONTRACT_NAME> | ||
``` | ||
|
||
For example: | ||
|
||
``` | ||
make deploy-goerli contract=PriceFeedConsumer | ||
``` | ||
|
||
This will run the forge script, the script it's running is: | ||
|
||
``` | ||
@forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${GOERLI_RPC_URL} --private-key ${PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${ETHERSCAN_API_KEY} -vvvv | ||
``` | ||
|
||
If you don't have an `ETHERSCAN_API_KEY`, you can also just run: | ||
|
||
``` | ||
@forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${GOERLI_RPC_URL} --private-key ${PRIVATE_KEY} --broadcast | ||
``` | ||
|
||
These pull from the files in the `script` folder. | ||
|
||
### Working with a local network | ||
|
||
Foundry comes with local network [anvil](https://book.getfoundry.sh/anvil/index.html) baked in, and allows us to deploy to our local network for quick testing locally. | ||
|
||
To start a local network run: | ||
|
||
``` | ||
make anvil | ||
``` | ||
|
||
This will spin up a local blockchain with a determined private key, so you can use the same private key each time. | ||
|
||
Then, you can deploy to it with: | ||
|
||
``` | ||
make deploy-anvil contract=<CONTRACT_NAME> | ||
``` | ||
|
||
Similar to `deploy-goerli` | ||
|
||
### Working with other chains | ||
|
||
To add a chain, you'd just need to make a new entry in the `Makefile`, and replace `<YOUR_CHAIN>` with whatever your chain's information is. | ||
|
||
``` | ||
deploy-<YOUR_CHAIN> :; @forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${<YOUR_CHAIN>_RPC_URL} --private-key ${PRIVATE_KEY} --broadcast -vvvv | ||
``` | ||
|
||
# Security | ||
|
||
This framework comes with slither parameters, a popular security framework from [Trail of Bits](https://www.trailofbits.com/). To use slither, you'll first need to [install python](https://www.python.org/downloads/) and [install slither](https://github.com/crytic/slither#how-to-install). | ||
|
||
Then, you can run: | ||
|
||
``` | ||
make slither | ||
``` | ||
|
||
And get your slither output. | ||
|
||
|
||
|
||
# Contributing | ||
|
||
Contributions are always welcome! Open a PR or an issue! | ||
|
||
# Thank You! | ||
|
||
## Resources | ||
|
||
- [Chainlink Documentation](https://docs.chain.link/) | ||
- [Foundry Documentation](https://book.getfoundry.sh/) | ||
|
||
### TODO | ||
|
||
[ ] Add bash scripts to interact with contracts using `cast` | ||
|
||
[ ] Make deploying contracts to `anvil` simpler | ||
This is a technical challenge, its meant to be an actual hacking attempt. This challenges deadine is at 10am Sunday, same as main challenge. The first one to complete the challenge wins, good luck! |