A simple dApp for interacting with Arrakis Finance liquidity pools. Deposit WETH and RETH to earn fees.
# Install dependencies
yarn
# Run development server
yarn dev
# Run tests
yarn test
Used a single ContractContext
to manage all blockchain interactions. This keeps state management simple and avoids prop drilling. All contract calls, state, and error handling live in one place. Easier for you to review and test.
Built small, focused components that do one thing well:
Input.tsx
- Handles numeric input with validationPrimaryButton.tsx
- Consistent button styling with loading statesDepositForm.tsx
- Combines components for the deposit flow and submits transaction
This makes testing easier and components more reusable.
Optimized contract interactions to minimize gas costs:
- Approvals happen inside try/catch blocks to maintain normal gas fees
- Only calculate values once to avoid duplicate blockchain calls
- Proper error detection for user rejections vs actual errors
- Clear success/failure indicators to avoid unnecessary transactions
Built tests before implementing components to ensure proper behavior:
- Context tests verify contract interactions work correctly
- Component tests ensure UI behaves as expected
- Edge case tests for scientific notation, zero values, etc.
This approach caught several bugs early and made development faster.
- Users have MetaMask or another web3 wallet installed
- Users have WETH and RETH in their wallet
- The Arrakis vault contract is already deployed and working
- 5% slippage is acceptable for most users
- No mobile wallet support (WalletConnect, etc.)
- Limited error handling for complex contract failures
- No transaction history or position management
- Only supports one pool (WETH/RETH)
- Only supports slippage of 5%
- Add support for multiple pools
- Improve mobile support
- Add more comprehensive error handling
- Implement better loading states
- Implement multiple hooks for the contract calls if the context gets too large
# Install dependencies
yarn
# Run development server
yarn dev
# Run tests
yarn test
# Run specific test files
yarn test components
yarn test contexts
# Build for production
yarn build
All contract addresses are in lib/constants.ts
.
Simple utilities handle:
- Number formatting for display
- User input validation (prevents non-numeric input)
- Blockchain error message formatting
These keep the UI clean and user-friendly without unnecessary complexity.