Backend repository for our DeFi lending protocol project on Ethereum.
Please read GIT_RULES.md first and follow it during development. Frontend integration guide: FRONTEND_API.md
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
- Use Remix (recommended)
- Use VS Code + Hardhat3 when needed
contracts/: Solidity contractstest/: automated testsscripts/: manual interaction scriptsignition/: deployment modules.vscode/: shared debug/task configs
Please use pnpm as your package manager. You can install it by:
npm install -g pnpm@latest-10Install dependencies:
pnpm installCompile contracts:
pnpm exec hardhat compileStart a local node:
pnpm exec hardhat nodeThen run all test:
pnpm exec hardhat test --network localhostOr only use TypeScript test:
pnpm exec hardhat test nodejs --network localhostOr only use Solidity test:
pnpm exec hardhat test solidity --network localhostFor example, to run scripts/deploy.ts:
pnpm exec hardhat run scripts/deploy.ts --network hardhatMainnetStart a local node:
pnpm exec hardhat nodeThen run a TypeScript script on localhost. For example:
pnpm exec hardhat run scripts/play.ts --network localhostOr connect Remix to your local node:
- Open Remix or launch your Remix Desktop
- Open
Deploy & Run Transactions - Select
Dev - Hardhat Provider - If needed, set the URL to
http://127.0.0.1:8545