Skip to content

Conversation

@nicholaspai
Copy link
Member

The Optimism token bridge sends ETH (address 0xdeaddead...) to SpokePool, so SpokePool accrues an ETH balance after pool rebalances are executed on L1. We make assumptions that the SpokePool has WETH, not ETH, so we need to wrap WETH before distributing refunds or processing relays.

Originally I wanted to implement the wrapping of ETH in the fallback or receive methods but these are not triggered by ETH deposits over the token bridge because ETH is an ERC20 token on Optimism, so I opted for this approach.

@nicholaspai nicholaspai marked this pull request as draft February 23, 2022 20:50
@nicholaspai nicholaspai marked this pull request as ready for review February 24, 2022 01:55
bytes32[] memory proof
) public nonReentrant {
// This function potentially is expected to transfer WETH to the recipient so we should wrap all ETH.
_depositEthToWeth();
Copy link
Member

Choose a reason for hiding this comment

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

does it make sence to only do this if the destinationToken is WETH?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure done

bytes32[] memory proof
) public nonReentrant {
// This function potentially is expected to transfer WETH to the recipient so we should wrap all ETH.
_depositEthToWeth();
Copy link
Member

Choose a reason for hiding this comment

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

follow on question: does it make sence to put this in the spoke Pool? would it not make more sence to put this in the Optimism spoke pool only seeing this is only relevant on optimism?

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed IRL i'll move to Optimism_SpokePool

@nicholaspai nicholaspai requested a review from mrice32 February 25, 2022 03:12
Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

LGTM!

@nicholaspai nicholaspai merged commit e04572f into master Feb 25, 2022
@nicholaspai nicholaspai deleted the npai/optimism-spokepool branch February 25, 2022 21:49
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