Welcome to Aboki Finance — a decentralized P2P crypto swap and liquidity platform.
This documentation is crafted for everyone: users, developers, and contributors.
- Overview
- For Users
- For Developers
- Smart Contract API
- Security
- Deployment & Environment
- Order Lifecycle & Error Handling
- Contributing
- FAQ
- License & Acknowledgements
Aboki Finance is a trustless dApp for swapping crypto and providing liquidity, featuring:
- Modern frontend: React, Vite, TypeScript, Tailwind CSS.
- Web3 Integration: Wagmi, Viem, Privy, Ethers.js.
- EVM Contracts: Secure, audited, and upgradable.
- User-focused: Simple, secure, and open-source.
- Swap crypto: Instantly exchange supported tokens.
- Provide liquidity: Earn rewards by supplying to pools.
- Track activity: See your swap and liquidity history.
- Stay secure: Your wallet, your keys.
-
Access the App
- Visit the live site or run locally (see Developer section).
-
Connect Your Wallet
- Click “Connect Wallet”.
- Use MetaMask, WalletConnect, or Privy.
-
Swap Tokens
- Go to "Swap".
- Select input/output tokens and amount.
- Click "Swap" and confirm in your wallet.
-
Add Liquidity
- Go to "Add Liquidity".
- Select tokens and amounts.
- Approve and confirm via your wallet.
-
Track Activity
- Visit "Activity" or "Liquidity Dashboard" to see your history.
-
Disconnect
- Disconnect your wallet for extra safety after use.
- Frontend: React, Vite, TypeScript, Tailwind CSS
- Web3: Wagmi, Viem, Ethers.js, Privy
- Contracts: Solidity, OpenZeppelin, Uniswap V2
- Testing/Deploy: Hardhat, Node.js
src/
├── App.tsx # Main routes
├── main.tsx # App root, providers
├── assets/ # Images, logos
├── components/ # UI (Navbar, Modals, Swap, Liquidity, etc)
├── context/ # React Contexts (liquidity, swap)
├── contracts/ # ABIs, contract hooks
├── hooks/ # Custom hooks
├── pages/ # Route-level pages (Landing, Swap, Activity, etc)
-
Clone the Repo
git clone https://github.com/Aboki-finance/FrontEnd.git cd FrontEnd -
Install Dependencies
npm install # or yarn install -
Set Up Environment Variables
- Copy
.env.exampleto.envand fill in the required fields (see Deployment & Environment).
- Copy
-
Run the Dev Server
npm run dev # or yarn dev- Visit
http://localhost:5173in your browser.
- Visit
-
Lint, Format, and Test
npm run lint npm run format npm run test
Main Functions
createOrderWithSwap(address[] path, uint256 amountIn, uint256 minOut)estimateSwapOutput(address[] path, uint256 amountIn)setTokenSupport(address token, bool ok)(Admin only)setProtocolFeePercent(uint256 feeBp)(Admin only)
Events
OrderCreated(orderId, user, amountIn, minOut)SwapExecuted(orderId, amountOut)
Example (wagmi)
import { useContractWrite } from 'wagmi';
const { write } = useContractWrite({
address: GATEWAY_ADDRESS,
abi: SimpleGatewayABI,
functionName: 'createOrderWithSwap',
});
write({ args: [path, amountIn, minOut] });- ReentrancyGuard: Prevents reentrancy attacks.
- Ownable: Restricts admin functions.
- Token Whitelist: Only approved tokens can be swapped.
- Slippage Protection: Users set
minOut. - Audited: SecureChain Labs, 2024.
Set required ENV vars (.env):
| Key | Description | Example |
|---|---|---|
| VITE_APP_PRIVY_KEY | Privy client ID | pk_live_abc123 |
| VITE_UNISWAP_ROUTER | UniswapV2 router address | 0x7a250d5630b4cf539739df2c5dacb4c659f2488d |
| GATEWAY_ADDRESS | SimpleGateway contract address | 0xAb0...c1b |
| NODE_RPC_URL | RPC endpoint | https://mainnet.infura.io/v3/YOUR_KEY |
| PROTOCOL_FEE_BASIS | Protocol fee (basis points) | 200 |
Build for Production:
npm run build
# or
yarn buildDeploy:
Upload dist/ folder to your static host (Vercel, Netlify, etc).
Deploy with Hardhat:
npx hardhat deploy --network mainnet --tags SimpleGatewayOrder Status
- PENDING: Swap submitted, waiting for execution.
- EXECUTED: Swap successful.
- FAILED: Swap failed (slippage, gas, etc).
- CANCELLED: User cancelled (frontend only).
Common Errors
| Error | Meaning | Fix |
|---|---|---|
| Token not supported | Not whitelisted | Admin: use setTokenSupport() |
| Invalid amount | Zero or negative | Use a positive value |
| INSUFFICIENT_OUTPUT_AMOUNT | Slippage too strict | Use higher slippage tolerance |
| Gas-related failures | Network/gas issues | Retry with more gas, check network |
- Fork & Clone the repo.
- Create a Feature Branch:
git checkout -b feat/your-feature
- Code, Lint, Test:
npm run lint && npm run test
- Open a Pull Request on
mainwith a clear description.
Q: What wallets are supported?
A: All EVM wallets (MetaMask, WalletConnect, Privy, etc).
Q: Can I use the frontend without deployed contracts?
A: You can view the UI, but swaps/liquidity require your wallet and live contracts.
Q: Is my data private?
A: Yes. You control your keys and sign all transactions yourself.
Q: Where do I get help or report bugs?
A: Open an issue at Aboki-finance/FrontEnd Issues.
- MIT License (see LICENSE)
- Built with: React, Vite, Tailwind, Wagmi, Viem, Privy, Ethers.js, Uniswap, OpenZeppelin
- Audited by SecureChain Labs (2024)
For more, see the source code, contract ABIs, or contact the maintainers at Aboki-finance/FrontEnd.