Skip to content

vacuumlabs/moto-zap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MotoZap

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.

Overview

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.

Workflow

MotoZap simplifies the process of adding liquidity using a single token.
The interaction flow between the user, frontend, and smart contract is:

  1. User connects a wallet using WalletConnect (OP_NET testnet).
  2. User selects a pool, the input token, and the amount of tokens to use.
  3. If required, the frontend submits an approval transaction allowing the ZapIn contract to spend the user's tokens.
  4. The frontend prepares a transaction calling the zapIn function.
  5. The user signs the transaction using their wallet.
  6. The frontend submits the transaction to the network.
  7. 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
  8. The user receives MotoSwap liquidity tokens representing their share of the pool.

Project structure

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.

Quick start

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

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.

Contract: ZapIn

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

What it does

  • Single entry point:
    zapIn(poolAddress, amountIn, minLiquidity, direction_0to1, to, deadline)

The contract performs the following steps:

  1. Reads pool reserves and token ordering using PoolHelper.
  2. Computes the optimal swap amount so that the remaining input plus the swap output match the pool ratio.
  3. Transfers the swap portion from the user to the pool and calls the pool’s swap(...).
  4. 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)

About

MotoZap enables users to add liquidity to a MotoSwap pool using a single token instead of the required pair.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors