Zap swaps along the registry route, deposits into USDGPool, and returns leftovers.
Addresses: Addresses. ABI: Zap.json. Confirm the USDC route with RiskRegistry.zapRoute(usdc) before you send.
1
Check the route
zapRoute(token).allowed must be true. route[0] == token and route[last] == USDG. Slippage is maxSlippageBps from the registry, not from the caller.2
Approve and zapSupply
3
ETH path
Send
msg.value. _resolveIn wraps that ETH to WETH and ignores the token argument. Passing token = address(0) with no value reverts ZeroAddress. Outbound borrowTo / zapWithdraw accept address(0) or the WETH address to pay ETH.Related calls
What can go wrong
InvalidRouteif the asset is not allowlisted or the path does not end in USDG.- Slippage revert inside
SwapLibwhen the pool moves more thanmaxSlippageBps. - Decimal mixup: testnet faucet USDG is 18. Mainnet USDG is 6. USDC is usually 6. Read
decimals(). zapSupplydoes not bypass pause on USDG withdraw, but depositing is live.borrowTostill needs LIVE and an operator grant.- The Zap must hold nothing after the call. If a sweep ETH transfer fails, the tx reverts
ZeroAmount.
RiskRegistry.zapRoute(usdc).allowed before you send.
Slippage is maxSlippageBps from the registry, not from the caller. That is intentional. A frontend cannot widen slippage past governance.
ETH in: send msg.value. _resolveIn wraps to WETH and ignores the token argument. Passing token = address(0) with no value reverts ZeroAddress. ETH out: borrowTo and zapWithdraw accept address(0) or WETH.
Functions
Next: Repay and withdraw, Reserve and fees.