Skip to content
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

Add SwapAndBridge feature #64

Merged
merged 115 commits into from
Jul 11, 2024
Merged

Add SwapAndBridge feature #64

merged 115 commits into from
Jul 11, 2024

Conversation

ricott1
Copy link
Contributor

@ricott1 ricott1 commented Mar 18, 2024

Closes #191.

Implement swap-and-bridge feature with the SwapAndBridge contract. This contract exposes the swapAndBridgeToWithMinimumAmount public function by which users can swap ETH for a target LST and bridge it directly to an L2 while also specifying the minimum amount of LST to receive. The contract also exposes some convenience functions and a receive fallback allowing the interaction to happen just by sending ETH to the contract.

A new SwapAndBridge contract should be deployed for each LST protocol and target L2. The contract will be created with the L1 LST token, the L1 bridge, and the target L2 token as parameters. In this PR we add integration tests for Lido and Diva LST protocols as examples.

@ricott1 ricott1 requested a review from matjazv March 18, 2024 17:53
@ricott1 ricott1 self-assigned this Mar 18, 2024
.env.example Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
src/L1/SwapAndBridge.sol Outdated Show resolved Hide resolved
src/L1/SwapAndBridge.sol Outdated Show resolved Hide resolved
src/L1/diva/WdivETH.sol Outdated Show resolved Hide resolved
src/L1/lido/WstETH.sol Outdated Show resolved Hide resolved
src/L1/diva/WdivETH.sol Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
foundry.toml Outdated Show resolved Hide resolved
lib/solady Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
script/swap_and_bridge/SwapAndBridge.s.sol Outdated Show resolved Hide resolved
src/L1/SwapAndBridge.sol Outdated Show resolved Hide resolved
@ricott1 ricott1 requested a review from matjazv April 9, 2024 13:50
Copy link
Contributor

@matjazv matjazv left a comment

Choose a reason for hiding this comment

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

Nice work!
Just some minor suggestions.

.env.example Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
foundry.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@matjazv matjazv 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!
Just few small comments left.

script/Utils.sol Outdated Show resolved Hide resolved
script/Utils.sol Outdated Show resolved Hide resolved
script/Utils.sol Outdated Show resolved Hide resolved
script/Utils.sol Outdated Show resolved Hide resolved
@matjazv
Copy link
Contributor

matjazv commented Apr 18, 2024

Two other things to consider:

  • feature/swapAndBridge branch is out-of-date with main branch
  • PR check is currently failing:
Encountered 1 failing test in test/swap_and_bridge/SwapAndBridge.t.sol:TestBridgingScript
[FAIL. Reason: setup failed: environment variable "L2_CROSS_DOMAIN_MESSENGER_ADDR" not found] setUp()

@ricott1 ricott1 requested a review from matjazv July 2, 2024 08:30
Copy link
Contributor

@matjazv matjazv 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 small comment left.

Well done!

script/swap_and_bridge/test/README.md Outdated Show resolved Hide resolved
script/swap_and_bridge/README.md Outdated Show resolved Hide resolved
@shuse2 shuse2 enabled auto-merge (squash) July 3, 2024 13:12
@shuse2 shuse2 merged commit 29838dc into development Jul 11, 2024
4 checks passed
@shuse2 shuse2 deleted the feature/swapAndBridge branch July 11, 2024 11:20
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.

Add swap-and-bridge feature
5 participants