HemDealer is a decentralized application (DApp) designed for buying, selling, and managing cars in a cross-chain environment. Built using Solidity, it leverages the Ethereum blockchain, ERC721 standards, and the Across Protocol to facilitate seamless transactions across different blockchain networks.
- NFT Car Listings: Tokenize vehicles as ERC721 NFTs with comprehensive metadata
- Cross-Chain Transfers: Seamless vehicle transfers between different blockchain networks using Across Protocol
- Native Token Payments: Support for ETH and network native tokens
- Secure Ownership: ERC721-based ownership management with cross-chain verification
- Advanced Search: Filter cars by make, model, year, and other attributes
- Event Tracking: Comprehensive event logging for all marketplace activities
- Detailed Car Profiles: Comprehensive vehicle information including:
- Basic details (make, model, year, VIN)
- Technical specifications
- Multiple image support
- Condition assessment
- Price history
- Listing Management: Create, update, and delete car listings
- Ownership History: Track all previous owners and sales
- ReentrancyGuard Protection: Prevent reentrancy attacks
- Cross-Chain Verification: Secure message verification via Across Protocol
- Slippage Protection: Maximum 0.5% slippage tolerance
- Transfer Timeout: 24-hour safety window for cross-chain transfers
- Access Controls: Role-based permissions system
- Payment Validation: Automatic payment verification and processing
- Seller Profiles: Detailed seller information and history
- Multiple Listings: Manage multiple car listings
- Sales Analytics: Track listing performance and sales history
- Cross-Chain Management: List cars on multiple chains
- Secure Payments: Protected native token transactions
- Cross-Chain Shopping: Browse and buy cars across different networks
- Purchase History: Track all vehicle purchases
- Transfer Tracking: Real-time cross-chain transfer status
- Gas Optimization: Efficient contract design for lower transaction costs
- Event Logging: Comprehensive event emission for frontend tracking
- Upgradeable Design: Modular contract architecture
- Bridge Integration: Seamless Across Protocol integration
- Batch Operations: Support for multiple car operations
- Emergency Controls: Admin functions for emergency situations
-
Smart Contracts
HemDealer.sol
: Main marketplace contract (ERC721)HemDealerCrossChain.sol
: Cross-chain transfer handler- Across Protocol integration for secure cross-chain messaging
-
Frontend Integration
- Web3 provider integration (ethers.js)
- MetaMask and Rainbow Wallet support
- Real-time transaction tracking
- Responsive UI for car listings
Primary marketplace contract handling:
- Car listings and sales
- Ownership management (ERC721)
- Payment processing
- Cross-chain coordination
Manages cross-chain operations:
- Transfer initiation and completion
- Message verification via Across Protocol
- Payment bridging
- Timeout handling (24-hour safety)
- Clone the repository:
git clone https://github.com/MujeebSulayman/Car-dealership-dapp.git
cd Car-dealership-dapp
- Install dependencies:
npm install
- Configure environment variables:
cp .env.example .env
- Update
.env
with your configuration:
# RPC and API Keys
NEXT_PUBLIC_RPC_URL=your_sepolia_rpc_url
NEXT_PUBLIC_ALCHEMY_ID=your_alchemy_id
PRIVATE_KEY=your_private_key
# Across Protocol Addresses (Sepolia)
ACROSS_ROUTER_ADDRESS=0xC499a572640B64eA1C8c194c43Bc3E19940719dC
ACROSS_SPOKE_POOL_ADDRESS=0x7376B2F28E58a7E7103d4185daC1e2c0E272C8A9
- Deploy to Sepolia testnet:
npx hardhat run scripts/deploy.js --network sepolia
- Verify contracts:
npx hardhat verify --network sepolia <CONTRACT_ADDRESS> "HemDealer" "HEMD"
const listCar = async (car: CarParams) => {
const contract = await getEthereumContract()
await contract.listCar(
car.basicDetails,
car.technicalDetails,
car.additionalInfo,
car.sellerDetails,
car.destinationChainId,
car.paymentToken
)
}
const transfer = async (carId: number, destinationChain: number) => {
// Get quote from Across Protocol
const quote = await getAcrossQuote(amount, destinationChain)
const contract = await getCrossChainContract()
await contract.initiateCrossChainTransfer(
carId,
destinationChain,
quote.relayerFeePct,
quote.quoteTimestamp
)
}
Run the test suite:
npx hardhat test
Generate coverage report:
npx hardhat coverage
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- ReentrancyGuard implementation
- Ownership validation
- Cross-chain message verification
- Slippage protection (0.5% max)
- Transfer timeout (24 hours)
- Comprehensive access controls
MIT License - see LICENSE.md for details