@lenddao/lend-core

0.1.1 • Public • Published

Build pass codecov

#                            ######     #    ####### 
#       ###### #    # #####  #     #   # #   #     # 
#       #      ##   # #    # #     #  #   #  #     # 
#       #####  # #  # #    # #     # #     # #     # 
#       #      #  # # #    # #     # ####### #     # 
#       #      #   ## #    # #     # #     # #     # 
####### ###### #    # #####  ######  #     # ####### 

LendDAO Protocol

This repository contains the smart contracts source code and markets configuration for LendDAO Protocol. The repository uses Docker Compose and Hardhat as development environment for compilation, testing and deployment tasks.

What is LendDAO?

LendDAO is a decentralized non-custodial liquidity markets protocol where users can participate as suppliers or borrowers. Suppliers provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an overcollateralized (perpetually) or undercollateralized (one-block liquidity) fashion.

Documentation

See the link to the technical paper or visit the LendDAO Developer docs.

Audits

You can find all audit reports under the audits folder.

Connect with the community

You can join the Discord channel or the Governance Forum to ask questions about the protocol or talk about LendDAO with other peers.

Getting Started

You can install @lenddao/lend-core as an NPM package in your Hardhat or Truffle project to import the contracts and interfaces:

npm install @lenddao/lend-core

Import at Solidity files:

import {IPool} from "@lenddao/lend-core/contracts/interfaces/IPool.sol";

contract Misc {

  function supply(address pool, address token, address user, uint256 amount) public {
    IPool(pool).supply(token, amount, user, 0);
    {...}
  }
}

The JSON artifacts with the ABI and Bytecode are also included in the bundled NPM package at artifacts/ directory.

Import JSON file via Node JS require:

const PoolArtifact = require('@lenddao/lend-core/artifacts/contracts/protocol/pool/Pool.sol/Pool.json');

// Log the ABI into console
console.log(PoolArtifact.abi)

Setup

The repository uses Docker Compose to manage sensitive keys and load the configuration. Prior to any action like test or deploy, you must run docker-compose up to start the contracts-env container, and then connect to the container console via docker-compose exec contracts-env bash.

Follow the next steps to setup the repository:

  • Install docker and docker-compose
  • Create an environment file named .env and fill the next environment variables
# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
ALCHEMY_KEY=""
INFURA_KEY=""


# Optional, if you plan to use Tenderly scripts
TENDERLY_PROJECT=""
TENDERLY_USERNAME=""

Test

You can run the full test suite with the following commands:

# In one terminal
docker-compose up

# Open another tab or terminal
docker-compose exec contracts-env bash

# A new Bash terminal is prompted, connected to the container
npm run test

Package Sidebar

Install

npm i @lenddao/lend-core

Weekly Downloads

0

Version

0.1.1

License

AGPLv3

Unpacked Size

44.7 MB

Total Files

1581

Last publish

Collaborators

  • r2d2seldon