How to Setup Environment


In order to set your environment up in preparation for following the Runbook to test a BIP, follow these steps:

  1. Clone the Beanstalk GitHub repository and change directories into the new folder.
  2. Suggestion: name the repository based on which BIP you are verifying. BIP-X will be the name of the directory on your computer after cloning the repository.

    git clone git@github.com:BeanstalkFarms/Beanstalk.git BIP-X
    cd BIP-X/
  3. Checkout the branch in the GitHub pull request linked in the BIP runbook.
  4. git checkout example-branch
  5. Change directories into the protocol folder.
  6. cd protocol/
  7. Rename the .env-sample file to .env and set the FORKING_RPC, BLOCK_NUMBER and MAINNET_RPC environment variables.
  8. mv .env-sample .env

    FORKING_RPC and MAINNET_RPC should be set to the same RPC URL; we recommend getting an API key on Alchemy (this will be provided to BCM Signers). Choose a BLOCK_NUMBER after the facets being added/changed have already been deployed and before they are added to Beanstalk. This means if you are testing a BIP during the Voting Period, you can go to Etherscan and pick any recent block number. The following is an example .env file:

  9. Install all packages.
  10. yarn install
  11. Compile the Solidity code.
  12. npx hardhat compile
  13. Fork mainnet locally.
  14. npx hardhat node
  15. Open another terminal window in order to run commands against your mainnet fork. At this point you are ready to follow the Runbook for the given BIP.