|
| 1 | +# ChatterPay Contracts Details |
| 2 | + |
| 3 | +## 1. [**ChatterPay.sol**](../../src/ChatterPay.sol) |
| 4 | + |
| 5 | +### **High-Level Overview**: |
| 6 | +The `ChatterPay` contract serves as the core of the ChatterPay ecosystem, acting as a smart wallet implementation that supports ERC-4337 account abstraction. It facilitates token transfers, fee management, Uniswap-based token swaps, and integration with price oracles for real-time token valuation. |
| 7 | + |
| 8 | +### **Key Features**: |
| 9 | +- **ERC-4337 Account Abstraction**: Supports user operations via the EntryPoint contract, enabling decentralized transaction validation. |
| 10 | +- **Fee Management**: Implements a fee structure in USD cents, with customizable pool fees and slippage for token swaps. |
| 11 | +- **Uniswap V3 Integration**: Executes token swaps with single-hop or multi-hop routes and customizable price tolerances. |
| 12 | +- **Token Whitelisting and Price Feeds**: Allows only whitelisted tokens to be used, with price feeds from Chainlink oracles. |
| 13 | +- **Batch Transfers**: Supports multiple token transfers in a single transaction. |
| 14 | +- **Upgradeable**: Built using `UUPSUpgradeable` for future enhancements. |
| 15 | + |
| 16 | +### **Relations with Other ChatterPay Contracts**: |
| 17 | +- **ChatterPayPaymaster**: Works alongside the Paymaster to manage fees and user operations. |
| 18 | +- **ChatterPayVault**: Can interact with the vault for secure asset storage and retrieval. |
| 19 | +- **ChatterPayWalletFactory**: Deployed wallets are created and managed by the factory contract. |
| 20 | + |
| 21 | +### **External Contract Interactions**: |
| 22 | +- **Uniswap V3 Router**: Interacts with the swap router for token exchanges. |
| 23 | +- **Chainlink Oracles**: Retrieves token prices to calculate fees and ensure transaction accuracy. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## 2. [**ChatterPayNFT.sol**](../../src/ChatterPayNFT.sol) |
| 28 | + |
| 29 | +### **High-Level Overview**: |
| 30 | +The `ChatterPayNFT` contract enables the minting and management of both original NFTs and their limited copies. It incorporates robust features for URI management, copy limits, and upgradeability. |
| 31 | + |
| 32 | +### **Key Features**: |
| 33 | +- **ERC721 NFTs**: Implements the ERC721 standard for unique digital assets. |
| 34 | +- **Original and Copy NFTs**: Allows the creation of original NFTs and associated copies with defined limits. |
| 35 | +- **Base URI Management**: Supports dynamic updates to the base URI by the contract owner. |
| 36 | +- **Upgradeable**: Built using `UUPSUpgradeable` for seamless updates. |
| 37 | + |
| 38 | +### **Relations with Other ChatterPay Contracts**: |
| 39 | +- **ChatterPay**: NFTs can be linked to wallet activities for rewards or asset tracking. |
| 40 | +- **ChatterPayVault**: Original and copy NFTs may serve as collateral or proof of ownership within the vault. |
| 41 | + |
| 42 | +### **External Contract Interactions**: |
| 43 | +- **ERC721URIStorage**: Provides extended functionality for metadata management. |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## 3. [**ChatterPayPaymaster.sol**](../../src/ChatterPayPaymaster.sol) |
| 48 | + |
| 49 | +### **High-Level Overview**: |
| 50 | +The `ChatterPayPaymaster` contract validates and manages user operations in collaboration with the EntryPoint contract. It uses signature-based authentication to ensure secure and authorized transactions. |
| 51 | + |
| 52 | +### **Key Features**: |
| 53 | +- **Paymaster Role**: Acts as a trusted intermediary to sponsor transaction costs for users. |
| 54 | +- **Signature Validation**: Ensures operations are authorized via backend-signed messages. |
| 55 | +- **Fee Management**: Integrates seamlessly with the `ChatterPay` wallet for fee processing. |
| 56 | +- **Upgradeable**: Can be enhanced with new functionalities over time. |
| 57 | + |
| 58 | +### **Relations with Other ChatterPay Contracts**: |
| 59 | +- **ChatterPay**: Handles operation validation and fee sponsorship for the wallet contract. |
| 60 | + |
| 61 | +### **External Contract Interactions**: |
| 62 | +- **EntryPoint**: Collaborates with the EntryPoint contract for operation validation. |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 4. [**ChatterPayVault.sol**](../../src/ChatterPayVault.sol) |
| 67 | + |
| 68 | +### **High-Level Overview**: |
| 69 | +The `ChatterPayVault` contract serves as a secure storage mechanism for password-protected commitments. It supports the reservation, redemption, and cancellation of payments. |
| 70 | + |
| 71 | +### **Key Features**: |
| 72 | +- **Password-Protected Payments**: Uses hashed passwords for added security in transactions. |
| 73 | +- **Commitment Expiration**: Ensures timely redemption or cancellation of commitments. |
| 74 | +- **ERC20 Integration**: Handles token-based payments securely. |
| 75 | + |
| 76 | +### **Relations with Other ChatterPay Contracts**: |
| 77 | +- **ChatterPay**: Interacts with the main wallet for secure payment and asset management. |
| 78 | +- **ChatterPayNFT**: Supports NFTs as collateral or proof of ownership. |
| 79 | + |
| 80 | +### **External Contract Interactions**: |
| 81 | +- **ERC20**: Facilitates secure token transfers within the vault. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## 5. [**ChatterPayWalletFactory.sol**](../../src/ChatterPayWalletFactory.sol) |
| 86 | + |
| 87 | +### **High-Level Overview**: |
| 88 | +The `ChatterPayWalletFactory` contract is responsible for deploying and managing wallet proxies for users. It leverages deterministic address computation for predictable wallet creation. |
| 89 | + |
| 90 | +### **Key Features**: |
| 91 | +- **Wallet Proxy Creation**: Deploys upgradeable wallet proxies using the ERC1967 standard. |
| 92 | +- **Proxy Tracking**: Maintains a record of all deployed wallet proxies. |
| 93 | +- **Upgradeable**: Built to support future enhancements. |
| 94 | + |
| 95 | +### **Relations with Other ChatterPay Contracts**: |
| 96 | +- **ChatterPayWalletProxy**: Deploys and manages proxies for the core wallet. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 6. [**ChatterPayWalletProxy.sol**](../../src/ChatterPayWalletProxy.sol) |
| 101 | + |
| 102 | +### **High-Level Overview**: |
| 103 | +The `ChatterPayWalletProxy` contract provides upgradeable functionality for wallets using the ERC1967 Proxy standard. It ensures that wallets can be updated without changing their addresses. |
| 104 | + |
| 105 | +### **Key Features**: |
| 106 | +- **Upgradeable Wallets**: Supports upgrades to wallet implementations while preserving state. |
| 107 | +- **ERC1967 Standard**: Provides a reliable mechanism for proxy upgrades. |
| 108 | + |
| 109 | +### **Relations with Other ChatterPay Contracts**: |
| 110 | +- **ChatterPayWalletFactory**: Proxies are deployed and managed by the factory. |
| 111 | +- **ChatterPay**: Proxies delegate calls to the main wallet implementation. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 7. [**AggregatorV3Interface.sol**](../../src/interfaces/AggregatorV3Interface.sol) |
| 116 | + |
| 117 | +### **High-Level Overview**: |
| 118 | +The `AggregatorV3Interface` defines the interface for Chainlink price feeds. It enables the retrieval of real-time token prices and metadata. |
| 119 | + |
| 120 | +### **Key Features**: |
| 121 | +- **Price Feeds**: Provides real-time token prices from decentralized oracles. |
| 122 | +- **Metadata Access**: Retrieves additional information like price feed descriptions and versions. |
| 123 | + |
| 124 | +### **Relations with Other ChatterPay Contracts**: |
| 125 | +- **ChatterPay**: Utilizes price feeds to calculate transaction fees and validate swaps. |
| 126 | + |
| 127 | +### **External Contract Interactions**: |
| 128 | +- **Chainlink Oracles**: Fetches price data for supported tokens. |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## 8. [**ISwapRouter.sol**](../../src/interfaces/ISwapRouter.sol) |
| 133 | + |
| 134 | +### **High-Level Overview**: |
| 135 | +The `ISwapRouter` interface facilitates token swaps using the Uniswap V3 protocol. It supports both single-hop and multi-hop swaps with fine-grained control over slippage and fees. |
| 136 | + |
| 137 | +### **Key Features**: |
| 138 | +- **Token Swapping**: Enables efficient token exchanges within the ecosystem. |
| 139 | +- **Customizable Parameters**: Supports exact input/output swaps with defined slippage tolerances. |
| 140 | + |
| 141 | +### **Relations with Other ChatterPay Contracts**: |
| 142 | +- **ChatterPay**: Executes swaps for supported tokens using the router. |
| 143 | + |
| 144 | +### **External Contract Interactions**: |
| 145 | +- **Uniswap V3**: Provides the infrastructure for token swaps. |
| 146 | + |
0 commit comments