Skip to content

KXAND/5568-Backend

Repository files navigation

DeFi Project Backend

Backend repository for our DeFi lending protocol project on Ethereum.

Before You Start

Please read GIT_RULES.md first and follow it during development. Frontend integration guide: FRONTEND_API.md

Targets

Basic:

  • A lending pool where users can supply, withdraw, borrow, and repay
  • Over-collateralization logic
  • Interest rate model (kinked)
    • Dynamic interest rate model based on utilization rate
    • Accrue interest per block (lenders and borrowers)
  • Oracle (simple fixed-price)

Bonus:

  • Liquidation mechanism:
    • Allow a third party to liquidate a position when health factor < 1
    • Liquidation Spread/Bonus
  • Flash Loan
  • Real Oracle
  • Advanced tokenomics: issue a governance token (like COMP or AAVE) as a reward for lenders/borrowers (liquidity mining)
  • Analytics & UX

Development Setup

  • Use Remix (recommended)
  • Use VS Code + Hardhat3 when needed

Repository Layout

  • contracts/: Solidity contracts
  • test/: automated tests
  • scripts/: manual interaction scripts
  • ignition/: deployment modules
  • .vscode/: shared debug/task configs

VS Code + Hardhat Commands

Please use pnpm as your package manager. You can install it by:

npm install -g pnpm@latest-10

Install dependencies:

pnpm install

Compile contracts:

pnpm exec hardhat compile

Run Test

Start a local node:

pnpm exec hardhat node

Then run all test:

pnpm exec hardhat test --network localhost

Or only use TypeScript test:

pnpm exec hardhat test nodejs --network localhost

Or only use Solidity test:

pnpm exec hardhat test solidity --network localhost

Run a Script on a Fresh EVM

For example, to run scripts/deploy.ts:

pnpm exec hardhat run scripts/deploy.ts --network hardhatMainnet

Run a Script on Localhost

Start a local node:

pnpm exec hardhat node

Then run a TypeScript script on localhost. For example:

pnpm exec hardhat run scripts/play.ts --network localhost

Or connect Remix to your local node:

  1. Open Remix or launch your Remix Desktop
  2. Open Deploy & Run Transactions
  3. Select Dev - Hardhat Provider
  4. If needed, set the URL to http://127.0.0.1:8545

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors