-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7833dd6
commit 9f9136d
Showing
1 changed file
with
38 additions
and
6 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,20 +1,52 @@ | ||
foundry installed | ||
# Crowdstaking | ||
|
||
``` | ||
# install dependencies | ||
With foundry, nodejs etc installed | ||
|
||
### Install dependencies | ||
|
||
Node modules and foundry dependencies for compiling the smart contracts. | ||
|
||
```sh | ||
$ pnpm install | ||
$ forge install | ||
``` | ||
|
||
# start chain | ||
### Start local node | ||
|
||
Anvil starts a local fork from the most recent block based on the rpc url provided. The chain id is used to identify the anvil network in the app config. | ||
|
||
```sh | ||
$ anvil --fork-url https://rpc.gnosis.gateway.fm --chain-id 31337 --block-time 5 | ||
``` | ||
|
||
### Setup wallet | ||
|
||
We also need a wallet for working locally. To set this up take the private key for the first wallet in the list displayed when you start anvil and add this account to metamask. This is the `DEV_ACCOUNT` address in the setup script. | ||
|
||
Because of how the distributor contract works the developer wallet needs to hold some bread before we deploy the contracts for us to be able to vote. The setup script takes care of this as well as funding the wallet with LP tokens which is needed for the LP locking feature. | ||
|
||
```sh | ||
# setup dev wallet | ||
$ pnpm run chain:setup | ||
``` | ||
|
||
### Deploy contracts | ||
|
||
We have the bread smart contracts in this repo as a submodule so we can compile and deploy any version we like to our anvil node. | ||
|
||
This will run the solidity script in contracts/script/DeployLocal.s.sol to deploy both the yield distributor contract (voting) and the buttered bread contract (lp token locking). Dont' worry about the bread contract itself as it rarely changes. | ||
|
||
# deploy contracts | ||
_todo: write deployed contract addresses to JSON file to import in app config._ | ||
|
||
```sh | ||
$ cd contracts | ||
$ forge script script/DeployLocal.s.sol:Deploy --broadcast --rpc-url http://localhost:8545 --private-key 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 --legacy | ||
``` | ||
|
||
### What else? | ||
|
||
Dont forget to start the dev server | ||
|
||
# start dev server | ||
```sh | ||
$ pnpm run dev | ||
``` |