A non-custodial collateralized lending protocol deployed on Ethereum Sepolia. Users deposit ETH as collateral to borrow ERC20 tokens, with on-chain liquidation logic and a React/TypeScript frontend.
The project demonstrates the core building blocks of decentralized lending, including collateral management, borrowing, repayment, interest accrual, and liquidation within a transparent on-chain protocol.
Decentralized lending protocols enable users to access liquidity without relying on centralized financial institutions.
Nexus Lend demonstrates the core mechanics of collateralized on-chain lending, including collateral management, borrowing limits, interest accrual, repayment, and liquidation, while emphasizing secure smart contract design and transparent protocol logic.
The protocol is built around a single NexusLendingPool contract implementing a 150% collateralization ratio with automatic liquidation at 120%. Interest accrual is tracked per-position using block timestamps.
Smart Contract: Solidity 0.8.24 · Foundry · OpenZeppelin
Frontend: React · TypeScript · wagmi · viem · Vite
Network: Ethereum Sepolia Testnet
- User deposits ETH as collateral.
- The protocol records the collateral position.
- The user borrows ERC20 tokens within the allowed collateral ratio.
- Interest accrues over time.
- The borrower repays the loan and withdraws the collateral.
- Undercollateralized positions can be liquidated by third parties.
- ETH collateral deposits with per-address position tracking
- ERC20 borrowing with 150% collateralization
- Automatic liquidation below 120% collateral ratio
- SafeERC20 token transfers
- ReentrancyGuard protection
- Custom Solidity errors for gas-efficient execution
| Contract | Network | Address |
|---|---|---|
| NexusLendingPool | Sepolia | 0x1e96DE8C083FE1C74d2e50a50fB696941F5d9b20 |
Verified on Etherscan (Exact Match)
6 tests · 0 failures · includes fuzz testing with 256 runs per invariant
forge test -v| Test | Type | Status |
|---|---|---|
| test_DepositCollateral | Unit | PASS |
| test_Borrow | Unit | PASS |
| test_Repay | Unit | PASS |
| test_RevertWhen_BorrowExceedsLimit | Unit | PASS |
| testFuzz_DepositCollateral | Fuzz (256 runs) | PASS |
| testFuzz_BorrowNeverExceedsMax | Fuzz (256 runs) | PASS |
git clone https://github.com/BlockchainInes/nexus-lend
cd nexus-lend
forge install
forge build
forge testDeploy:
cp .env.example .env
# Add PRIVATE_KEY, SEPOLIA_RPC_URL, ETHERSCAN_API_KEY, BORROW_TOKEN
forge script script/Counter.s.sol:DeployNexusLendingPool \
--rpc-url $SEPOLIA_RPC_URL \
--broadcast \
--verifyLive demo: Coming soon: nexus-lend-ui.vercel.app
cd nexus-lend-ui
npm install
npm run dev- Reentrancy protection on all external calls
- Pull-over-push pattern for ETH transfers
- Collateral locked until debt is fully repaid
- Current version uses a simplified collateral model. A production deployment would integrate Chainlink Data Feeds for decentralized price discovery.
MIT

