An end-to-end example of a Solidity escrow contract for real-estate fundraising, with a full TypeScript + Viem client, automated Mocha tests, and local Hardhat development. Designed to showcase best practices in smart-contract architecture, testing, and developer ergonomics.
RealEstateEscrow is a Solidity smart contract that simulates a simple fundraising escrow for tokenized real-estate projects.
- Contributors lock ETH into the contract via
invest()before a deadline. - If the funding goal is met by the deadline, the funds are released to the developer via
releaseToDeveloper(). - Otherwise, contributors can reclaim their ETH with
refund().
This repo demonstrates:
- Clean contract design in Solidity 0.8⟂
- Local dev with Hardhat & Ganache-style network
- Type-safe client code in TypeScript using Viem
- Automated end-to-end tests with Mocha + Chai
- CI-ready structure and clear README for prospective employers
- ✔️ Fundraising goal + deadline
- ✔️ Safe refunds with re-entrancy guard
- ✔️ Secure release to developer
- ✔️ Full on-chain state inspection (balances + mapping)
- ✔️ TypeScript + Viem client for scriptable interactions
- ✔️ Automated Mocha tests (invest, refund, release)
- ✔️ Hardhat local node for fast iteration
- Solidity 0.8.x – Smart-contract language
- Hardhat – Local Ethereum environment, compilation, console
- TypeScript – Client & tests
- Viem – Typed Ethereum client (RPC, wallet, contracts)
- Mocha & Chai – Test runner & assertions
- dotenv – Environment-variable management
- Node.js ≥ 18
- npm (comes with Node)
- git
# Clone the repo
git clone https://github.com/<your-username>/realestate-escrow.git
cd realestate-escrow
# Install dependencies
npm install
# Compile Contracts
npm run compile
# deploy contracts
npm run deploy
# Run local hardhat node
npm run dev
# run tests
npm run test:viem