Coder Social home page Coder Social logo

aavedaiescrow's Introduction

AAVE DAI Escrow

This is an AAVE DAI Escrow Dapp built with Hardhat.

Project Layout

There are three top-level folders:

  1. /app - contains the front-end application
  2. /contracts - contains the solidity contract
  3. /tests - contains tests for the solidity contract

Setup

There are a few steps to get setup here:

  • Install install Node.js
  • Download this repository locally
  • Open the command line and navigate to your local copy of this repository
  • Run npm install to download all the dependencies

Contracts

You can use hardhat commands to test and compile the contracts, among other things.

To learn more about these commands run npx hardhat help.

Front-End

To run the front-end application:

  1. Compile the contracts with npx hardhat compile (this will make the artifacts accessible to /app)
  2. Move into the app folder and run npx parcel index.html

You can learn more about Parcel here.

Using the Dapp

To use the Dapp, first install Metamask to your browser of choice.

Once you have metamask installed, you should see a connection notice at the top of the Dapp. The Dapp is currently setup to work only on Kovan. You can switch to Kovan by clicking on the metamask browser extension.

Once you have switched to Kovan, you will need some Kovan ether to perform any transactions. At the time of writing this kovan faucet works when you sign in with Github.

When you have your Kovan Ether, the next step is to get some Kovan DAI. After all, this is a DAI Escrow! One way to do this would be to borrow some from AAVE. If you deposit some Kovan ether you can borrow DAI. Then you can use this DAI to create and fund the Escrow contract!

Fill in the New Contract fields and then click Approve DAI & Deploy. This will have you approve the Escrow to spend your DAI, and then deploy the contract once that transaction has been completed (this may take a moment).

Tests

The tests are setup to point at already deployed AAVE contracts. We'll need to fork mainnet to do this in our test blockchain.

Forking Mainnet

In order to fork mainnet, we'll be pointing this repository at an Alchemy API endpoint. To do this, you'll need to sign up for Alchemy, create a mainnet project and get your HTTP endpoint.

Once you've done this we'll use dotenv to store the endpoint in a local .env file that won't accidentally get committed! Since this package is already in your dependencies all you'll need to do is create a new .env file at the top level of the repository and add the following entry into it:

FORKING_URL=https://eth-mainnet.alchemyapi.io/v2/<YOUR_API_KEY>

Replacing <YOUR_API_KEY> with the API key from Alchemy.

Running Tests

The hardhat.config.js is already set up to fork mainnet at a recent block.

All we'll need to do to run the tests is run npx hardhat test.

aavedaiescrow's People

Contributors

dan-nolan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.