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.
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.
ZToken– Base interest-bearing tokenZErc20/ZNative– ERC20 and native-asset market implementationsCollateralManager– Collateral deposits, limits, and liquidation flowsLiquidationManger– Liquidation execution logicZTokenFactory– Market deployment and setup
src/– Solidity contractssrc/interfaces/– External interfacessrc/libraries/– Math and helperstest/– Foundry testsscript/– Deployment / utility scriptsdocs/– mdBook documentation
# Install dependencies
forge install
# Build contracts
forge build# 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 coverageThe mdBook source lives in docs/. To build and serve locally:
mdbook build docs
mdbook serve docs -p 3000- Contract docs in
docs/src/src/are generated from the Solidity sources. - Use
foundry.tomlfor compiler and remapping configuration.