-
Notifications
You must be signed in to change notification settings - Fork 75
feat: consolidate spoke pool utility functions into a periphery contract #758
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
Conversation
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. |
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.
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( |
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.
This is new code
| depositData, | ||
| SWAP_TOKEN, | ||
| ACROSS_INPUT_TOKEN | ||
| function deposit( |
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.
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.
contracts/SpokePoolV3Periphery.sol
Outdated
| address exclusiveRelayer, | ||
| uint32 quoteTimestamp, | ||
| uint32 fillDeadline, | ||
| uint32 exclusivityDeadline, |
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.
Can we rename this to exclusivityParameter now?
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.
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( |
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.
These functions were all copied right?
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.
Yes exactly.
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.
+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>
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.
@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>
This consolidates our
SpokePoolVerifierandSwapAndBridge*contracts into a singleSpokePoolV3Peripherycontract, which can be used to construct more expressive deposit types, like gasless deposits, by using extra, ephemeral input data.