Skip to content

ademolahh/lending-and-borrowing-protocol

Repository files navigation

Lending & Borrowing Protocol

ZToken Protocol is a modular lending and borrowing system built with Foundry. It supports ERC20 and native-asset markets, interest rate modeling, and collateralized lending mechanics.

Overview

Core contracts live in src/ and are composed around a base ZToken implementation with ERC20 and native-asset market variants plus collateral and liquidation management.

Contracts

  • ZToken – Base interest-bearing token
  • ZErc20 / ZNative – ERC20 and native-asset market implementations
  • CollateralManager – Collateral deposits, limits, and liquidation flows
  • LiquidationManger – Liquidation execution logic
  • ZTokenFactory – Market deployment and setup

Repo Layout

  • src/ – Solidity contracts
  • src/interfaces/ – External interfaces
  • src/libraries/ – Math and helpers
  • test/ – Foundry tests
  • script/ – Deployment / utility scripts
  • docs/ – mdBook documentation

Quickstart

# Install dependencies
forge install

# Build contracts
forge build

Make Targets

# Convert bulloak trees for unit tests
make tree

# Generate scaffolds for missing test files
make gen

# Check test trees
make check

# Auto-fix tree check issues
make fix

# Coverage report
make coverage

Documentation

The mdBook source lives in docs/. To build and serve locally:

mdbook build docs
mdbook serve docs -p 3000

Notes

  • Contract docs in docs/src/src/ are generated from the Solidity sources.
  • Use foundry.toml for compiler and remapping configuration.

About

Core contracts for ZToken-based lending markets — includes ERC20/native token wrappers, interest rate math, and collateral management primitives.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors