Skip to content

Complete DeFi ecosystem on Arc testnet MVP: collateralized lending, constant product AMMs. Built with Solidity + Foundry. 20/20 tests passing.

License

Notifications You must be signed in to change notification settings

dharmanan/ARC-Testnet-Lend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ARC Testnet Lending Protocol 🏦

Complete DeFi ecosystem on Arc blockchain: lending pools, AMMs, and scheduled payouts. Built with Solidity + Foundry, React + Vite. 20/20 tests passing.

Tests License

⚠️ Testnet & MVP Notice

This is a testnet MVP (Minimum Viable Product) not production ready.

  • πŸ§ͺ Testnet Only: Deployed on Arc Testnet only
  • πŸ’° Test Funds Only: Use testnet funds exclusively (no real assets)
  • πŸš€ MVP Status: Core features complete but requires security audit before mainnet
  • πŸ“‹ For Development & Testing: Learning DeFi mechanics, protocol testing, and demos

Do NOT use with mainnet tokens or real funds.


Overview

Complete DeFi ecosystem on Arc blockchain: lending pools, AMMs, and scheduled payouts. Built with Solidity + Foundry, React + Vite. 20/20 tests passing.

  • Lending Pool: Collateralized borrowing with health factor management
  • AMM Pairs: Three constant product pairs (ETH/WBTC, ETH/ARC, WBTC/ARC) with 0.3% fees
  • Scheduled Payouts: Time locked fund releases
  • Frontend Demo: React UI for protocol interaction
  • All contracts verified and audited on Arc Testnet

πŸš€ Live Demo

Frontend Application: https://arclending.vercel.app/

Connect your Arc Testnet wallet and start interacting with the protocol!

Application Screenshots

Dashboard

Dashboard

Market

Market

History (Transactions)

History

Quick Links

Quick Start

Requirements: Node.js 16+, Foundry, Git

git clone https://github.com/dharmanan/ARC-Testnet-Lend.git
cd ARC-Testnet-Lend

# Install frontend
cd frontend && npm install && cd ..

# Create local .env file
cp .env.example .env

# Run tests
forge test -v

# Start frontend UI
cd frontend && npm run dev
# Open http://localhost:3000, connect MetaMask to Arc Testnet (Chain ID: 5042002)

⚠️ Important: Edit .env and add your PRIVATE_KEY and ARC_TESTNET_RPC_URL. Never commit .env to git it contains secrets.

Setting Up a Testnet Wallet

Create a new testnet wallet using Foundry's cast command:

cast wallet new

Output example:

Successfully created new keypair.
Address:     0xB815A0c4bC23930119324d4359dB65e27A846A2d
Private key: 0xcc1b30a6af68ea9a9917f1ddβ€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’97c5

⚠️ Important:

  • Keep your private key secure never share it or commit it to source control
  • Add the private key to .env:
PRIVATE_KEY="0xcc1b30a6af68ea9a9917f1ddβ€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’97c5"

Then reload your environment:

source .env

Get testnet funds:

  • Request faucet tokens from Circle Faucet
  • Use only testnet addresses and funds for testing
  • Use only testnet addresses and funds for testing

Smart Contracts

Contract Address
LendingPool 0x9dD7314B876fF9dFFB4F9aC4d4c8540156cf10b9
AMM (ETH/WBTC) 0xF4638B258905C6a2F7Aa71E05aAC887dB697c338
AMM (ETH/ARC) 0x677df5298Fd0a80672b1E6B4a61BEB75534a83A1
AMM (WBTC/ARC) 0x27e14cfEF1a029A32F574263dce67371bce32d24

Token addresses: CONTRACTS_REPORT.md

Project Structure

ARC-Testnet-Lend/
β”œβ”€β”€ src/                # Solidity contracts
β”‚   β”œβ”€β”€ LendingPool.sol
β”‚   β”œβ”€β”€ GenericAMMPair.sol
β”‚   β”œβ”€β”€ ScheduledPayoutManager.sol
β”‚   └── ...
β”œβ”€β”€ test/               # Foundry tests
β”‚   └── Contracts.t.sol
β”œβ”€β”€ script/             # Deployment & helper scripts
β”‚   β”œβ”€β”€ Deploy.s.sol
β”‚   β”œβ”€β”€ AddLiquidity.s.sol
β”‚   └── ...
β”œβ”€β”€ frontend/           # React + Vite frontend
β”‚   β”œβ”€β”€ App.tsx, index.tsx, ...
β”‚   β”œβ”€β”€ components/
β”‚   └── assets/
β”œβ”€β”€ docs/               # Guides, user & dev docs
β”‚   β”œβ”€β”€ LENDING_POOL_GUIDE.md
β”‚   β”œβ”€β”€ dev-notes/
β”‚   └── images/
β”œβ”€β”€ ROADMAP.md          # Project roadmap
β”œβ”€β”€ DEPLOYMENT_VERIFICATION.md
β”œβ”€β”€ DOCUMENTATION_INDEX.md
β”œβ”€β”€ LICENSE             # MIT License
β”œβ”€β”€ README.md           # This file
└── ...

Roadmap

See ROADMAP.md for planned features, phases, and known limitations.

Documentation

Development

Build and test the protocol locally:

# Build contracts
forge build

# Run all tests (20 tests)
forge test -v

# Run specific test file
forge test --match-path test/Contracts.t.sol -v

Refer to DOCUMENTATION_INDEX.md for more development workflows and debugging steps.

Tech Stack

  • Smart Contracts: Solidity 0.8.20 + OpenZeppelin Contracts
  • Testing: Foundry + Solc 0.8.20
  • Frontend: React + TypeScript + Vite
  • Styling: Tailwind CSS
  • Blockchain: Arc Testnet
  • RPC Integration: ethers.js

Security

  • ⚠️ Testnet only do not use with real funds or mainnet tokens
  • Use only testnet wallet (create new wallet for testing)
  • Never commit .env or private keys use testnet secrets only
  • Reentrancy guards & access controls (OpenZeppelin)
  • See SMART_CONTRACT_AUDIT.md for security details

Recent Updates

Fixed Issues βœ…

  • RPC Provider Caching - Wallet balances now display accurate values from blockchain

    • Arc official RPC (https://rpc.testnet.arc.network) is now primary provider
    • Blockdaemon moved to fallback due to state sync lag
    • Impact: Wallet balance displays correct values in real-time
  • Mock Data Reset - Initial wallet balance state no longer masks blockchain data

    • User balances now load correctly from blockchain
    • See CHANGELOG.md for details

Troubleshooting & Known Issues

Contributing

Open issues or PRs. For protocol changes, discuss in an issue first.

git checkout -b feature/my-change
forge test
git push origin feature/my-change

License

MIT β€” LICENSE


For detailed guides, UI screenshots, and implementation details, see docs/.

About

Complete DeFi ecosystem on Arc testnet MVP: collateralized lending, constant product AMMs. Built with Solidity + Foundry. 20/20 tests passing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published