Decentralized Auction System
A professional, secure, and transparent decentralized auction system built with Solidity and Hardhat.
Overview
This project implements a simple yet robust auction mechanism on the Ethereum blockchain. Users can place bids during a predefined period, and the highest bidder wins the auction. Outbid participants can safely withdraw their funds.
Features
- Secure Bidding: Uses a pull-over-push pattern for refunds to prevent reentrancy and DOS attacks.
- Transparent Logic: All auction rules are encoded in the smart contract.
- Automated Settlement: Finalizes auctions and transfers funds to the beneficiary securely.
- Comprehensive Testing: Full test suite covering edge cases and security scenarios.
- Ignition Deployment: Modern deployment workflow using Hardhat Ignition.
Tech Stack
- Solidity: ^0.8.24
- Hardhat: Development environment
- Ethers.js: Ethereum library for testing and interaction
- Mocha/Chai: Testing framework
Getting Started
Prerequisites
- Node.js (v18+ recommended)
- npm
Installation
- Clone the repository
- Install dependencies:
npm install --legacy-peer-deps
Usage
Compilation
Compile the smart contracts:
npm run compile
Testing
Run the test suite:
npm test
Deployment
Deploy to a network (configured in hardhat.config.cjs):
npm run deploy -- --network <network-name>
Smart Contract Details
Auction.sol
constructor(uint _biddingTime, address payable _beneficiary): Initializes the auction.
bid(): Allows users to place a bid.
withdraw(): Allows outbid users to reclaim their funds.
auctionEnd(): Finalizes the auction (can only be called after the bidding period).
License
This project is licensed under the ISC License.