Skip to content

Conversation

@chrismaree
Copy link
Member

No description provided.

chrismaree and others added 8 commits February 14, 2022 10:51
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
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.

Looks good left some questions.

// TODO: Should relay message to L2 for destinationChainId and call setEnableRoute(originToken, destinationChainId, true)
// Note that this method makes no L1->L1 call to whitelist the route. The assumption is that the origin chain's
// SpokePool Owner will call setEnableRoute to enable the route. This removes the need for an L1->L2 call.
whitelistedRoutes[originToken][destinationChainId] = destinationToken;
Copy link
Member

Choose a reason for hiding this comment

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

This comment no longer applies as my outstanding PR #33 will make the L1-->L2 call

Copy link
Member Author

Choose a reason for hiding this comment

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

yup. I saw that :)

Copy link
Member

Choose a reason for hiding this comment

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

Can remove this comment

contract Optimism_SpokePool is CrossDomainEnabled, SpokePoolInterface, SpokePool, Ownable {
// "l1Gas" parameter used in call to bridge tokens from this contract back to L1 via `IL2ERC20Bridge`.
uint32 l1Gas = 6_000_000;
uint32 public l1Gas = 1_900_000;
Copy link
Member

Choose a reason for hiding this comment

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

This is L1 gas. Are you sure this should be set to 1.9mil? I thought only the L2 gas param in the Optimism Adapter (which calls L1--> L2 txns) should use this value

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not exactly sure. tbh I'm not exactly sure how it works going from L2->L1, only really know what the costing is from L1->L2.

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm i believe this value is unused as per the comments but let's double check

Copy link
Member

Choose a reason for hiding this comment

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

I think you can leave this at 6mil, but +1 on making it public

if (distributionLeaf.l2TokenAddress == address(weth)) {
WETH9(l2Token).withdraw(distributionLeaf.amountToReturn); // Unwrap ETH.
l2Token = l2Eth; // Set the bridged token to the Optimism ETH address.
l1Destination = l1EthWrapper; // Set the destination to the L1 ETH wrapper.
Copy link
Member

Choose a reason for hiding this comment

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

Why is the destination the l1 eth wrapper, how does thhis wrapper contract know who the end recipient is?

Copy link
Member Author

Choose a reason for hiding this comment

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

this will be this contract: https://github.com/across-protocol/across-smart-contracts/blob/master/contracts/insured-bridge/ovm/Optimism_Wrapper.sol which simply receives eth, wraps it and sends it to the hupPool (the destination). I'll add this contract to this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a modified version of this contract to this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@nicholaspai I've pretty drastically refactored this.

Copy link
Member

Choose a reason for hiding this comment

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

ah i see

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
* and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol.
*/
contract Lockable {
bool internal _notEntered;
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to copy this to change it to be internal so the HubPool can read from it.

Copy link
Member

Choose a reason for hiding this comment

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

was it private before?

Signed-off-by: chrismaree <christopher.maree@gmail.com>
// contract. In this case, deposit the ETH into WETH. If true then this was set as a result of unwinding LP tokens,
// with the intention of sending ETH to the LP. In this case, do nothing as we intend on sending the ETH to the LP.
function depositEthToWeth() public payable {
if (_notEntered) weth.deposit{ value: address(this).balance }();
Copy link
Member

Choose a reason for hiding this comment

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

As discussed IRL, let's expose _notEntered via a descriptive public function and call that here

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree merged commit 7602413 into master Feb 16, 2022
@chrismaree chrismaree deleted the chrismaree/todo branch February 16, 2022 18:12
pxrl added a commit that referenced this pull request Feb 20, 2024
Originally authored by Nick & Matt.

Signed-off-by: nicholaspai npai.nyc@gmail.com
Signed-off-by: Matt Rice matthewcrice32@gmail.com
Co-authored-by: Matt Rice matthewcrice32@gmail.com
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.

3 participants