Zap is a smart contract that facilitates stablecoin "zapping" and Synthetix native collateral unwinding by integrating flash loans from Aave and Odos swaps.
ONLY USDC is supported
USDC <--(spot market)--> sUSDC <--(spot market)--> USDx
- Request Flash Loans (Aave): Borrow USDC to access liquidity without posting collateral.
 - Zap into USDx (Synthetix Spot Market): Use the borrowed funds to zap into USDx.
 - Burn USDx & Repay Debt (Synthetix Core): Repay Synthetix debt by burning USDx.
 - Withdraw and Unwrap Collateral (Synthetix Spot Market): Withdraw margin (e.g., sETH) and convert it back to underlying assets (e.g., WETH).
 - Swap (Odos): Exchange collateral assets (like WETH) for USDC to repay the flash loan.
 - Flash Loan Repayment (Aave): The USDC loan, including the premium, is repaid to Aave.
 - Send Remaining Collateral (Synthetix): Any surplus collateral is returned to the user.
 
- Zap via Synthetix
 - Wrap & Unwrap Collateral via Synthetix
 - Buy & Sell via Synthetix
 - Unwind Collateral via Synthetix, Aave, and Odos
 - Burn Debt via Synthetix
 - Withdraw Perp Collateral via Synthetix
 - Swap via Odos
 
- 
Build the project
forge build - 
Run tests
forge test - 
Report Test Coverage
make coverage - 
Report Gas Snapshot
make snapshot 
- See the 
deployments/folder for Base deployments. 
How to Deploy:
- 
Create a
.envfile using.env-exampleas a reference - 
Deploy to Base
make deploy_base 
- See the 
audits/folder for Audit reports.