MotoZap enables users to add liquidity to a MotoSwap pool using a single token instead of the required pair. No manual swaps. No complex steps. Just one click to convert idle balances into yield-earning liquidity while minimizing transaction costs and friction.
Built on OP_NET (a Bitcoin Layer-1 smart contract platform).
Target pool: MOTO/PILL on OP_NET testnet.
The project provides:
- Smart contract (ZapIn) — Implements the zap-in flow. It computes the optimal portion of the provided token to swap, performs the swap against the MotoSwap pool, and then adds liquidity using the remaining tokens plus the swap output.
- Frontend — A React application with OP_NET wallet connection and a simple UI for browsing pools, inspecting pool details, and executing zap-in operations.
MotoZap simplifies the process of adding liquidity using a single token.
The interaction flow between the user, frontend, and smart contract is:
- User connects a wallet using WalletConnect (OP_NET testnet).
- User selects a pool, the input token, and the amount of tokens to use.
- If required, the frontend submits an approval transaction allowing the ZapIn contract to spend the user's tokens.
- The frontend prepares a transaction calling the zapIn function.
- The user signs the transaction using their wallet.
- The frontend submits the transaction to the network.
- The ZapIn smart contract:
- calculates the optimal portion of the input token to swap
- performs the swap against the MotoSwap pool
- adds liquidity using the remaining tokens and the swap output
- The user receives MotoSwap liquidity tokens representing their share of the pool.
| Package | Description |
|---|---|
frontend |
React + Vite application. Includes pool listing, pool detail pages, and the zap-in flow. Uses OP_NET WalletConnect and shared types/addresses. |
sc |
Zap-in smart contract written in AssemblyScript. |
common |
Shared types, pool client utilities, and contract addresses. |
The repository is structured as an npm workspaces monorepo.
The primary deliverables are frontend and sc.
Prerequisites: Node.js.
npm install
# Build shared library (required by the frontend)
npm run build -w common
# Start frontend in development mode
npm run dev -w frontend
The web application allows users to:
- connect a wallet (OP_NET testnet)
- view the MOTO/PILL pool (reserves and token metadata)
- add liquidity using a single-token zap-in
- increase token allowance when required
Routes include:
- home
- pools list
- pool detail page with the zap-in form
The frontend is built with React + Vite.
The only contract in this repository is ZapIn, which enables single-token (zap-in) liquidity provisioning for a MotoSwap pool.
Deployed on OP_NET testnet:
0x605dc19e8395d4420479454a3713e1e51629bb77a1500e5cd2a7e2ca2df36b5c
- Single entry point:
zapIn(poolAddress, amountIn, minLiquidity, direction_0to1, to, deadline)
The contract performs the following steps:
- Reads pool reserves and token ordering using
PoolHelper. - Computes the optimal swap amount so that the remaining input plus the swap output match the pool ratio.
- Transfers the swap portion from the user to the pool and calls the pool’s
swap(...). - Transfers the remaining input from the user and sends the swap output to the pool, then calls the pool’s
mint(to).
The contract enforces:
deadline(block number)minLiquidity
Finally, it emits the event:
ZapInExecuted(swapAmountIn, amountOut, liquidity)