/MP_2022

Primary LanguageTypeScript

Get started

  1. Clone the repo.
  2. Install deps with yarn yarn or npm npm install
  3. Start hardhat npx hardhat node --watch
It runs a Hardhat node, compiles contracts, generates typescript interfaces, creates React context and instantiates your contract instances and factories with frontend provider.
  1. Open up a new terminal

  2. cd frontend

  3. Install deps with yarn yarn or npm npm install

  4. Ensure Metamask RPC is set to http://localhost:8545 and chainID 31337.

  5. Start React app with yarn yarn start or npm npm start. The frontend should start up at http://localhost:3000/.

Because of this default hardhat.config.ts it will first try to connect with an injected provider like Metamask (web3modal package does this).

If nothing found it will try to connect with your hardhat node. On localhost and hardhat nodes it will inject your mnemonic into the frontend so you have a "browser wallet" that can both call and send transactions. NB! Dont ever put a mnemonic with actual value here.

In hardhat.config.ts there is example on how to instruct your hardhat-network to use mnemonic or privatekey.

const config: HardhatUserConfig = {
  react: {
    providerPriority: ["web3modal", "hardhat"],
  },
};

Ensure you are using RPC to http://localhost:8545.

You may also need to set the chainID to 31337 if you are using Hardhat blockchain development node.

Common error: Invalid nonce.

eth_sendRawTransaction
  Invalid nonce. Expected X but got X.

Solution: Reset your account in Metamask.

Develop

Develop

Make the changes that are required to get the app working smoothly, and any improvements you would like to add. Use any tools/packages you are comfortable with. Feel free to show off your skill set!

Done?

  1. zip up your work:
git archive --format=zip --output project.zip HEAD
  1. Email it to your contact at Yield.