Skip to content

Conversation

@bmzig
Copy link
Contributor

@bmzig bmzig commented Nov 21, 2024

This consolidates our SpokePoolVerifier and SwapAndBridge* contracts into a single SpokePoolV3Periphery contract, which can be used to construct more expressive deposit types, like gasless deposits, by using extra, ephemeral input data.

Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
}
}

// This contract supports two variants of swap and bridge, one that allows one token and another that allows the caller to pass them in.
Copy link
Contributor Author

@bmzig bmzig Nov 21, 2024

Choose a reason for hiding this comment

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

The code to these functions was not changed, (although since it is a single contract, their visibility was switched to private for gas savings), but they were moved to the bottom of the contract to follow the Solidity style guide.

* values used in the single call to this function were passed in correctly before enabling the usage of this contract.
*/
constructor(
function initialize(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is new code

depositData,
SWAP_TOKEN,
ACROSS_INPUT_TOKEN
function deposit(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is taken from the spoke pool verifier. The added changes were to remove the spokePool argument, since it should be defined in this contract on initialization, and to add a nonReentrant modifier to the function.

address exclusiveRelayer,
uint32 quoteTimestamp,
uint32 fillDeadline,
uint32 exclusivityDeadline,
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this to exclusivityParameter now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. All instances and comments now refer to it as the exclusivityParameter: daff3b7

* @param _acrossInputAmount Amount of the input token to deposit into the spoke pool.
* @param depositData Specifies the Across deposit params to use.
*/
function _depositV3(
Copy link
Member

Choose a reason for hiding this comment

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

These functions were all copied right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes exactly.

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.

+1 LGTM. This contract is getting pretty big and though its not core spoke pool logic, i think its about time we start adding some simple unit tests that check the correct functions are called, tokens are pulled in expected amounts, allowances are set and reset correctly, etc.

It can be done in a follow up PR!

Signed-off-by: bennett <bennett@umaproject.org>
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.

@bmzig I'm OK with this new functionality but I think that updating SwapAndBridge will potentially cause problems because this contract should be deployed beside an existing SwapAndBridge contract. wdyt about moving it all to a new file, rather than updating the existing one? We'd later deprecate SwapAndBridge once we have the new implementation fully audited.

Signed-off-by: bennett <bennett@umaproject.org>
@bmzig bmzig requested a review from pxrl November 22, 2024 14:04
@bmzig bmzig merged commit 49ecbfb into master Nov 22, 2024
9 checks passed
@bmzig bmzig deleted the bz/swapAndBridgeInit branch November 22, 2024 14:27
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.

4 participants