A novel extension for 1inch Cross-chain Swap (Fusion+) that enables seamless token swaps between Ethereum and Aptos blockchains using atomic swap protocols with hashlock and timelock mechanisms with WebSocket relayer for seamless order matching.
- Bidirectional Swaps: Swap tokens from Ethereum to Aptos and vice versa
- Atomic Swap Protocol: Secure cross-chain transfers using hashlock and timelock
- Non-EVM Compatibility: Full implementation for Aptos (Move language) alongside Ethereum (Solidity)
- Testnet Ready: Deployed and tested on Ethereum Sepolia and Aptos Testnet
- User-Friendly UI: Intuitive interface for initiating and monitoring cross-chain swaps
- 1inch Integration: Built as an extension to leverage 1inch's existing infrastructure
Ethereum User (Alice) Aptos User (Bob)
| |
| 1. Initiate swap with hashlock |
| and timelock |
|----------------------------------------|
| |
| 2. Verify and lock tokens
| with same hash
| |
| 3. Reveal secret to claim |
| Bob's tokens |
|<---------------------------------------|
| |
| 4. Use revealed secret
| to claim Alice's tokens
- No trusted intermediaries required
- Funds are never at risk of being stolen
- Automatic refund mechanism for failed swaps
- Cryptographically secure secret generation
- Node.js >= 16.0.0
- Yarn or npm
- MetaMask wallet (for Ethereum)
- Petra wallet (for Aptos)
- Git
# Clone the repository
git clone https://github.com/ankit875/fusionplus-aptos.git
cd fusionplus-aptos
# Install dependencies
yarn install
# Copy environment variables
cp .env.example .env
# Configure your environment variables
nano .env# Ethereum Configuration
ETHEREUM_RPC_URL=https://sepolia.infura.io/v3/YOUR_PROJECT_ID
ETHEREUM_PRIVATE_KEY=your_private_key_here
ETHEREUM_CONTRACT_ADDRESS=0x...
# Aptos Configuration
APTOS_RPC_URL=https://fullnode.testnet.aptoslabs.com/v1
APTOS_PRIVATE_KEY=your_private_key_here
APTOS_CONTRACT_ADDRESS=0x...
# 1inch API
ONEINCH_API_KEY=your_api_key_here# Start the frontend
cd ui
bun install
bun start-
Connect Wallets
- Connect MetaMask for Ethereum
- Connect Petra for Aptos
-
Configure Swap
- Select source token (Ethereum)
- Select destination token (Aptos)
- Enter swap amount
-
Initiate Transaction
- Generate secret hash
- Lock tokens on Ethereum with hashlock and timelock
- Share hash with counterparty
-
Complete Swap
- Counterparty locks tokens on Aptos
- Reveal secret to claim Aptos tokens
- Counterparty uses secret to claim Ethereum tokens
- Real-time Status: Track swap progress in the UI
- Transaction History: View all past swaps
- Refund Options: Automatic refund after timelock expiration
- Ethereum: Sepolia Testnet
- Aptos: Aptos Testnet
- Faucets:
-
ETH → APT Swap
- Swap 0.1 ETH for 10 APT tokens
- Demonstrate hashlock/timelock functionality
- Show successful atomic swap completion
-
APT → ETH Swap
- Reverse swap: 10 APT for 0.1 ETH
- Showcase bidirectional capability
- Verify non-EVM implementation
-
Failed Swap Recovery
- Initiate swap but don't complete
- Demonstrate automatic refund after timelock
# Run Ethereum contract tests
yarn test:ethereum
# Run Aptos contract tests
yarn test:aptos
# Run integration tests
yarn test:integration
# Run end-to-end tests
yarn test:e2eswap_initiated- New swap createdswap_completed- Swap successfully finishedswap_refunded- Swap refunded due to timeoutblock_update- New block information
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discord: Community Chat
- Email: support@yourproject.com
- 1inch Network for the Fusion+ infrastructure
- Aptos Labs for Move language support
- Ethereum Foundation for EVM compatibility
- Mainnet deployment
- Additional token support
- Mobile app development
- Advanced routing algorithms
- Integration with more DEXs
- Layer 2 support (Polygon, Arbitrum)