A production-ready decentralized exchange (DEX) built on Flow using Cadence smart contracts and React frontend.
This project is built on the Flow blockchain and utilizes:
- Cadence smart contracts for on-chain logic
- Flow Client Library (FCL) for blockchain interaction
- Flow testnet for deployment and testing
- Flow-compatible wallets for user authentication
Contract | Address | Description |
---|---|---|
FlowDEX | 0x18f0d1d9cfa52c6d |
Main DEX contract with AMM functionality |
TestToken | 0x18f0d1d9cfa52c6d |
Test token (FLOW demo) |
TestToken2 | 0x0ea4b4ea56a1260c |
Test token (USDC demo) |
FungibleToken | 0x9a0766d93b6608b7 |
Flow standard fungible token interface |
π View on Flowscan:
- Automated Market Maker (AMM): Constant product formula for price discovery
- Liquidity Pools: Add and remove liquidity from trading pairs
- Token Swaps: Swap between different tokens with slippage protection
- Modern UI: Beautiful, responsive interface with animations
- Flow Integration: Built with Flow Client Library (FCL)
FlowDEX.cdc
: Main DEX contract with liquidity and swap functionalityTestToken.cdc
: Test fungible token for developmentTestToken2.cdc
: Second test token for trading pairs
- Modern React application with TypeScript
- Flow Client Library (FCL) for blockchain interaction
- Tailwind CSS for styling
- Framer Motion for animations
- Zustand for state management
βββ cadence/
β βββ contracts/ # Smart contracts
β βββ transactions/ # Transaction templates
β βββ scripts/ # Query scripts
βββ web/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ hooks/ # Custom hooks
β β βββ transactions.ts # FCL transaction functions
β β βββ fclConfig.ts # Flow configuration
β βββ package.json
βββ flow.json # Flow project configuration
βββ deploy.sh # Deployment script
- Node.js 16+
- Flow CLI
- Git
- Clone the repository:
git clone https://github.com/panditdhamdhere/FlowSwap.git
cd FlowSwap
- Install frontend dependencies:
cd web
npm install
- Start the development server:
npm run dev
The contracts are already deployed to Flow testnet! You can interact with them using the addresses above.
- Update
flow.json
with mainnet addresses - Ensure your account has sufficient FLOW tokens
- Deploy:
flow project deploy --network mainnet
To deploy contracts manually to testnet:
# Deploy TestToken
flow accounts add-contract --network testnet --signer <account> ./cadence/contracts/TestToken.cdc
# Deploy TestToken2
flow accounts add-contract --network testnet --signer <account> ./cadence/contracts/TestToken2.cdc
# Deploy FlowDEX
flow accounts add-contract --network testnet --signer <account> ./cadence/contracts/FlowDEX.cdc
- Contract addresses and aliases
- Network endpoints (emulator, testnet, mainnet)
- Account configurations
- Deployment settings
- Network selection (emulator/testnet/mainnet)
- Access node endpoints
- Wallet discovery settings
All contracts are deployed on Flow testnet and can be verified using the links above. The contracts implement the Flow blockchain standards and are fully compatible with the Flow ecosystem.
- addLiquidity: Add liquidity to the pool
- getReserveA/getReserveB: Get current reserves
- getQuoteAtoB/getQuoteBtoA: On-chain quote helpers with 0.3% fee
- swapAForB/swapBForA: On-chain swaps adjusting reserves (demo, no token vault ops)
- Events: LiquidityAdded, Swap
- Input validation with pre-conditions
- Slippage protection
- Reentrancy protection
- Access control
- Connect with Flow-compatible wallets
- Account management
- Transaction signing
- Add/remove liquidity
- Token swaps
- Real-time price updates
- Balance display
- Responsive design
- Dark/light theme support
- Smooth animations
- Error handling and notifications
- Start Flow emulator:
flow emulator --contracts --persist
- Deploy contracts to emulator:
flow project deploy --network emulator
- Start frontend:
cd web && npm run dev
- Smart contract testing with Flow CLI
- Frontend testing with Jest/React Testing Library
- Integration testing with testnet
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
For questions or issues:
- Create an issue on GitHub
- Join the Flow Discord community
- Check Flow documentation at https://developers.flow.com
- Multi-token support
- Advanced trading features
- Governance token
- Mobile app
- Analytics dashboard
- Cross-chain bridges