This repository contains the smart contracts for a QR payment processing system designed for ChatterPay, a WhatsApp wallet that handles ERC20 token payments with order tracking capabilities.
- Create payment orders with specific ERC20 tokens and amounts
- Process payments from users to fulfill orders
- Track payment status and payer information
- Built with security in mind using OpenZeppelin contracts
- Comprehensive test coverage
- Deployment scripts for local and testnet environments
- PaymentProcessor.sol: Main contract handling payment orders and processing
- USDC.sol: Mock USDC token for testing purposes
bun installCreate a .env file in the root directory with the following variables:
SEPOLIA_RPC_URL=your_sepolia_rpc_url
PRIVATE_KEY=your_wallet_private_key
ETHERSCAN_API_KEY=your_etherscan_api_keybun run compilebun run testbun run coverageLocally deploy:
bun run deploy:localDeploy on Ethereum Sepolia (testnet):
bun run deploy:sepoliacontracts/: Smart contract source filesscripts/: Deployment and testing scriptstest/: Test filesdeployments/: Deployment artifacts and addressestypechain-types/: Generated TypeScript types for contracts
The test suite includes comprehensive tests for:
- Contract deployment
- Payment order creation
- Order payment processing
- Access control
- Error handling
- Edge cases
- Uses OpenZeppelin's battle-tested contracts
- Implements reentrancy protection
- Access control via Ownable pattern
- Comprehensive error handling
MIT