Skip to content

Conversation

@bmzig
Copy link
Contributor

@bmzig bmzig commented Nov 18, 2024

Summary

We need to have a way to deposit into the spoke pool and perform a swapAndBridge using EIP-2612 and EIP-3009.

This functionality is added with four new functions in the UniversalSwapAndBridge contract: swapAndBridgeWithPermit, depositWithPermit, swapAndBridgeWithAuthorization, and depositWithAuthorization, where *WithPermit indicates usage of an EIP-2612 compliant token, and *WithAuthorization indicates usage of an EIP-3009 compliant token.

Details

EIP-2616 is used solely to give an approval to an address without calling approve first. This allows us to still use transferFrom when using any EIP-2612 token.
On the other hand, EIP-3009 will simply transfer tokens to the designated receiver contract and not raise the contract's allowance, so all usage of these types of functions check whether a sufficient token amount was transferred to the contract before proceeding with the rest of the swap/deposit.

Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
@bmzig bmzig marked this pull request as ready for review November 18, 2024 17:32
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
nicholaspai

This comment was marked as outdated.

Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Copy link
Member

@nicholaspai nicholaspai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more Q on a comment!

Signed-off-by: bennett <bennett@umaproject.org>
@bmzig bmzig requested a review from mrice32 November 19, 2024 18:17
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
@bmzig bmzig requested a review from pxrl November 21, 2024 14:17
@bmzig bmzig requested a review from pxrl November 21, 2024 14:24
Copy link
Contributor

@pxrl pxrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bmzig bmzig merged commit fa67f5e into master Nov 21, 2024
9 checks passed
@bmzig bmzig deleted the bz/swapAndBridgeUpdate branch November 21, 2024 14:43
mrice32 added a commit that referenced this pull request Feb 3, 2025
mrice32 added a commit that referenced this pull request Feb 3, 2025
* Revert "feat: consolidate spoke pool utility functions into a periphery contract (#758)"

This reverts commit 49ecbfb.

* Revert "feat: handle EIP-2612 and EIP-3009 in `SwapAndBridge.sol` (#751)"

This reverts commit fa67f5e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants