ShibaSwap v1 is the original version of the protocol, offering classic AMM functionality with simple liquidity provision and fixed 0.3% trading fees.
How ShibaSwap v1 Works
ShibaSwap v1 is an automated liquidity protocol powered by a constant product formula and implemented in non-upgradeable smart contracts on the Ethereum blockchain. It prioritizes decentralization, censorship resistance, and security by removing the need for trusted intermediaries.Core Components
Liquidity Pools
Pools containing pairs of ERC-20 tokens that enable trading.
Automated Market Maker
Smart contracts that automatically execute trades using mathematical formulas.
Liquidity Providers
Users who provide tokens to pools and earn trading fees.
Constant Product Formula
The protocol uses the constant product formula:x * y = k
Where:
x
= Reserve of token Ay
= Reserve of token Bk
= Constant product (invariant)
This formula ensures that the pool always has liquidity, but larger trades will experience more price impact.
The constant product formula means that as you trade more of one token, you get exponentially less of the other token due to price impact.
Protocol Architecture
Smart Contract Structure
ShibaSwap v1 consists of several key smart contracts:Factory Contract
Factory Contract
Creates and manages all trading pairs. Each pair is a separate smart contract that handles the liquidity pool for two specific tokens.
Pair Contracts
Pair Contracts
Individual contracts for each token pair that manage liquidity, execute swaps, and track reserves.
Router Contract
Router Contract
Handles the logic for token swaps, including price calculations and optimal routing.
LP Token Contracts
LP Token Contracts
ERC-20 tokens that represent liquidity provider shares in each pool.
Liquidity Pool Mechanics
When you provide liquidity to a ShibaSwap v1 pool:- Equal Value Deposit: You deposit equal dollar values of both tokens
- LP Tokens: You receive LP (Liquidity Provider) tokens representing your share
- Fee Earnings: You earn a portion of all trading fees (0.3% per trade)
- Impermanent Loss: Token price changes can affect your position value
LP tokens can be staked for additional BONE rewards on the Woof page (Ethereum only).
Trading Process
How Swaps Work
1
User Initiates Swap
A user wants to trade Token A for Token B.
2
Price Calculation
The smart contract calculates the output amount using the constant product formula.
3
Fee Deduction
A 0.3% fee is deducted from the input amount and distributed to liquidity providers.
4
Token Transfer
Tokens are transferred between the user and the liquidity pool.
5
Reserve Update
The pool reserves are updated to maintain the constant product formula.
Price Impact
Price impact increases with trade size relative to pool liquidity:- Small trades: Minimal price impact
- Large trades: Significant price impact
- Very large trades: May fail due to slippage protection
Always check the price impact before executing large trades. Consider splitting large trades into smaller ones to minimize impact.
Key Features
Decentralized Trading
- No intermediaries or centralized exchanges
- Direct peer-to-peer token swaps
- Censorship-resistant trading
Automated Liquidity
- Smart contracts manage all trading logic
- No need for order books or market makers
- Continuous liquidity provision
Fixed Fee Structure
- 0.3% fee on all trades
- Fees distributed to liquidity providers
- Predictable cost structure
LP Token Rewards
- Earn trading fees proportional to your share
- Additional BONE rewards through staking
- Compound earnings over time
Token Standards
ERC-20 Tokens
ShibaSwap v1 supports all standard ERC-20 tokens on Ethereum:Standard Compliance
All tokens must follow the ERC-20 standard for compatibility.
Wrapped Tokens
Native ETH is automatically wrapped to WETH for trading.
LP Tokens
When you provide liquidity, you receive LP tokens:- Representation: LP tokens represent your share of the pool
- Transferable: Can be transferred or traded
- Redeemable: Can be burned to withdraw underlying tokens
- Stakable: Can be staked for additional rewards
Security Features
Non-Upgradeable Contracts
- Smart contracts cannot be modified after deployment
- Immutable protocol logic
- Reduced risk of malicious updates
Audited Code
- Multiple security audits
- Open-source codebase
- Community-reviewed contracts
Slippage Protection
- Users can set maximum slippage tolerance
- Failed trades if price moves too much
- Protection against front-running
Comparison: v1 vs v2
Feature | ShibaSwap v1 | ShibaSwap v2 |
---|---|---|
AMM Type | Classic AMM | Concentrated Liquidity |
Fee Structure | Fixed 0.3% | Multiple tiers (0.05%, 0.3%, 1%) |
Liquidity | Full price range | Custom price ranges |
Position Type | LP tokens | NFT positions |
Capital Efficiency | Standard | Higher with concentration |
Complexity | Simple | Advanced |
Gas Costs | Lower | Higher for complex operations |
Developer Resources
Smart Contract Repositories
- shibaswap-v1-core: Core protocol contracts
- shibaswap-v1-periphery: Router and helper contracts
SDK and Tools
- shibaswap-sdk: JavaScript SDK for integration
- Documentation: Complete API reference
- Examples: Code samples and tutorials
Contract Addresses
- Factory:
0x115934131916C8b277DD010Ee302de153C0f07DE
- Router:
0x03f7724180AA6b939894B5Ca4314783B0b36b329
- WETH:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Best Practices
1
Start Small
Begin with small trades to understand how the protocol works.
2
Check Liquidity
Ensure sufficient liquidity exists for your desired trade.
3
Monitor Slippage
Set appropriate slippage tolerance based on market conditions.
4
Understand Impermanent Loss
Learn about impermanent loss before providing significant liquidity.
5
Diversify Positions
Consider providing liquidity to multiple pools to spread risk.
Common Use Cases
Token Swapping
- Trade between any supported ERC-20 tokens
- No registration or KYC required
- Instant settlement on Ethereum
Liquidity Provision
- Earn trading fees by providing liquidity
- Support the ecosystem while earning rewards
- Compound earnings over time
Yield Farming
- Stake LP tokens for additional BONE rewards
- Maximize returns through multiple reward streams
- Participate in ecosystem governance
Troubleshooting
Transaction Failed
- Check gas fees
- Verify slippage settings
- Ensure sufficient token balance
- Check for sufficient liquidity
High Price Impact
- Try smaller trade amounts
- Check pool liquidity
- Consider different token pairs
- Split large trades
LP Token Issues
- Verify LP token balance
- Check pool contract address
- Ensure correct token pair
- Contact support if needed
Reward Claims
- Check Woof page for available rewards
- Ensure wallet is connected
- Verify staking position
- Check network connection
Related Resources
Getting Started
Complete beginner’s guide to ShibaSwap.
Liquidity Pools
Learn about providing liquidity on v1.
Swap Tokens
How to swap tokens on ShibaSwap.
v2 Overview
Learn about ShibaSwap v2 features.
ShibaSwap v1 provides a solid foundation for decentralized trading with its proven AMM model. While v2 offers advanced features, v1 remains a reliable choice for simple trading and liquidity provision.