NolaSwap is a decentralized exchange (DEX) built on Uniswap v4, focusing on regulatory compliance while maintaining decentralization and privacy. This implementation includes advanced features for KYC/AML, automated tax collection, and MEV protection.
-
KYCContract.sol
- Manages KYC verification and volume restrictions
- Implements tiered trading limits based on KYC level
- Uses Chainlink price feeds for volume calculations
- Features:
- Volume-based KYC requirements
- Token and user restriction capabilities
- Configurable trading limits for swaps and liquidity operations
-
MainHook.sol
- Core hook implementation for Uniswap v4
- Handles swap validation and liquidity management
- Integrates with KYC and Tax contracts
- Key features:
- Pre-swap validation
- Liquidity position management
- MEV protection mechanisms
-
TaxContract.sol
- Manages automated tax collection
- Configurable tax rates and whitelisting
- Transparent on-chain tax storage
- Features:
- Automated 0.1% tax collection
- Whitelist management
- Tax withdrawal mechanisms
- Support for both ERC20 and native currency
-
MEVArbitrage.sol
- Implements MEV protection mechanisms
- Features:
- Price commitment mechanism
- Liquidity rebalancing
- Arbitrage control
- Protection against sandwich attacks
- SoulBound Token (SBT) based identity verification
- Three-tier KYC system with different trading limits
- Privacy-preserving verification mechanism
function isPermitKYCSwap(uint256 amount, address token) public view returns (bool)
function isPermitKYCModifyLiquidity(uint256 amount0, address token0, uint256 amount1, address token1) public view returns (bool)
- Volume-based trading restrictions
- Smart anti-money laundering checks
- Real-time price feed integration
function calculateTax(uint256 amount) external view returns (uint256)
function withdrawERC20(address token, uint256 amount) external
- Automated tax collection system
- Transparent tax storage
- Configurable tax rates
- Support for multiple tokens
function openPool(uint160 _newSqrtPriceX96) external
function depositHedgeCommitment(uint256 amount0, uint256 amount1) external payable
- Price commitment mechanism
- Liquidity provider protection
- Anti-sandwich attack measures
- Fair ordering system
- Solidity ^0.8.24
- Uniswap v4 Core
- OpenZeppelin Contracts
- Chainlink Price Feeds
- Clone the repository
git clone https://github.com/your-repo/nolaswap.git
- Install dependencies
forge install
- Compile contracts
forge build
- Run tests
forge test
-
Access Control
- Ownable pattern for administrative functions
- Role-based access control for sensitive operations
- Whitelisting mechanism for privileged operations
-
Price Oracle Security
- Chainlink price feed integration
- Fallback mechanisms for oracle failures
- Price manipulation protection
-
Smart Contract Safety
- Reentrancy protection
- Integer overflow protection (Solidity ^0.8.x)
- Emergency pause functionality
MIT License
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
[Pending - Security audits will be conducted before mainnet deployment]