A smart contract that enables single-sided liquidity provision for the OYL AMM protocol. Users can provide any single token and the zap contract will automatically:
- Find optimal swap routes to the target LP pair tokens
- Split the input token optimally between the two target tokens
- Execute the swaps
- Provide liquidity to the target pool
- Return LP tokens to the user
- Single-Sided Entry: Deposit any token to get LP tokens for any pair
- Optimal Routing: Finds the best swap paths with minimal price impact
- Smart Splitting: Calculates optimal token allocation for balanced LP provision
- Slippage Protection: Configurable minimum LP token output
- Gas Optimized: Efficient execution with minimal transaction overhead
Input Token → [Route Discovery] → [Optimal Split] → [Dual Swaps] → [LP Provision] → LP Tokens
// Zap USDC into ETH/BTC LP
ZapIntoLP {
input_token: USDC_ID,
input_amount: 1000_000000, // 1000 USDC
target_token_a: ETH_ID,
target_token_b: BTC_ID,
min_lp_tokens: 950_000000, // 95% slippage tolerance
deadline: block_time + 300, // 5 minute deadline
}alkanes/oyl-zap/: Core zap contract implementationsrc/lib.rs: Main contract interfacesrc/tests/: Comprehensive test suite
The zap contract integrates with existing OYL protocol contracts:
- Uses OYL Factory for pool discovery and liquidity provision
- Leverages OYL Pool contracts for swapping
- Utilizes OYL Library for AMM calculations