A demonstration of token swaps in Neon EVM using Solana signature verification, showcasing how users with Solana wallets can interact with EVM smart contracts on Neon EVM.
This demo demonstrates that users with a Solana wallet can, through this SDK, interact with EVM smart contracts on the Neon EVM.
The demo showcases how to perform token swaps in Neon EVM via the Solana signer library, integrating Solana's native tokens and user base with Neon EVM's smart contract environment.
For more information, visit the Solana Native documentation.
The demo implements several key components:
- Smart Contracts: Deploys PancakeSwap exchange contracts on Neon EVM, including a factory and router
- Token Creation: Creates ERC20ForSPL tokens for testing purposes
- Liquidity Pools: Sets up liquidity pools for token pairs
- Frontend Interface: Provides a UI for performing token swaps
- Proxy Server: Handles cross-origin requests and other middleware functionality
The process flow involves:
- Creating scheduled Neon EVM transactions
- Signing them with Solana wallet credentials
- Submitting them to the Neon EVM network via Solana
- Monitoring transaction status
├── frontend
│ └── swap-ui # React-based UI for performing token swaps
├── pancakeswap # Scripts and configuration for PancakeSwap deployment
│ ├── scripts # Deployment and configuration scripts
- Node.js (v16+)
- Yarn package manager
- Solana CLI tools
- A Solana wallet with SOL tokens (for devnet)
- Basic understanding of:
- Solidity and EVM-compatible smart contracts
- Token swaps and liquidity pools
- Solana transaction model
- Clone the repository:
git clone https://github.com/neonlabsorg/neon-solana-native-swap-demo.git
cd neon-solana-native-swap-demo- Configure environment variables:
For the frontend:
cd frontend/swap-ui
cp .env.example .env
# Edit .env with your configurationFor PancakeSwap deployment:
cd pancakeswap
cp .env.example .env
# Edit .env with your configurationKey environment variables:
# Backend & Frontend
VITE_PROXY_ENV: devnet
VITE_SOLANA_URL: https://api.devnet.solana.com
VITE_NEON_CORE_API_RPC_URL: https://devnet.neonevm.org
# Wallet Private Keys (Never commit these to git!)
VITE_SOLANA_WALLET: <your_solana_private_key_in_bs58>
VITE_NEON_WALLET: <your_neon_private_key>
# PancakeSwap Deployment
DEPLOYER_KEY: <your_evm_private_key>
SOLANA_WALLET: <your_solana_private_key_in_bs58>
NEON_EVM_NODE: https://devnet.neonevm.org
NEON_FAUCET: https://api.neonfaucet.org/request_neon
SOLANA_RPC_NODE: https://api.devnet.solana.com
- Install dependencies:
cd pancakeswap
npm install- Run the PancakeSwap setup script for deploying all contracts:
npm run deploy
npm run airdropThis script will:
- Deploy WNEON contract
- Deploy PancakeSwap exchange contracts (Factory and Router)
- Deploy ERC20ForSPL tokens (both v1 and v2 variants)
- Create token pairs and provide initial liquidity
- Save all contract addresses to the artifacts folder
For more PancakeSwap deployment details, see /pancakeswap/README.md.
- Install dependencies:
cd frontend/swap-ui
yarn install- Start development server:
yarn dev- Open the frontend application in your browser (typically at http://localhost:5173)
- Connect your Solana wallet (Phantom or another compatible wallet)
- Request tokens for testing:
cd pancakeswap
npm run airdropThis will mint test tokens and transfer them to your wallet.
- Use the swap interface to exchange tokens
To adapt this demo for your own purposes:
-
Replace token symbols and names in
pancakeswap/scripts/deploy-tokens.js -
Modify the token amounts and liquidity pool configurations in
pancakeswap/scripts/create-liquidity-pools.js -
Update the frontend UI in
frontend/swap-ui/srcto match your branding
When deploying to mainnet:
-
Update network configurations in
.envfiles:- Use mainnet RPC endpoints
- Remove faucet configurations
-
Ensure sufficient SOL and NEON balances in deployment wallets
-
Update hardhat configuration in
pancakeswap/hardhat.config.jsto use mainnet settings -
Implement proper error handling and transaction monitoring for production use
-
Consider security audits for any contract modifications
-
Implement proper key management (never store private keys in code or env files on production)
MIT