-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
👷 Odos integration #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odosSwap return value design needs to be updated for unwind process - separate PR incoming with the fix
src/Zap.sol
Outdated
@@ -510,7 +505,7 @@ contract Zap is Reentrancy, Errors, Flush(msg.sender) { | |||
// whatever collateral amount is remaining is returned to the caller | |||
unwound -= _collateral == USDC | |||
? _flashloan | |||
: _swapFor(_collateral, _path, _flashloan, _swapMaxAmountIn); | |||
: odosSwap(_collateral, _swapAmountIn, _path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odosSwap
returns USDC amount out, when in this case we need the collateral amount spent in the swap (in this case _swapAmountIn
), otherwise this incorrectly subtracts from unwound balance the USDC amount instead of spent collateral amount
* 👷 fix: odos unwind swap return * fix * ✨ fmt --------- Co-authored-by: Moss <[email protected]>
* 👷 refund logic * ✅ unwind test
* 📚 first round of fixes * 👷 fix 2
* 👷 fix leftovers * fmt --------- Co-authored-by: Moss <[email protected]>
* 👷 zapOut when unwinding USDC * fix make deploy_base * 👷 adjust minAmountOut to match usdc 6 decimal precision when unwinding udsc
changed swap logic from Uniswap to Odos