You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal: To perform a swap on L1 Uniswap that is initiated from L2 using assets from L2 where the output assets are bridged back into L2 after execution. Support both private and public variants (public can be extended to support Aztec connect like functionality).
The series of high-level actions required for such a "feat":
Deploy a Dai token portal (similar to TokenPortal), but where the noir part also support an open version of withdraw and deposit, along with a shield and unshield moving funds between private and public domains. Should also support designated caller.
Approve Dai token portal to pull funds using dai::approve
Deposit Dai into the rollup
Claim Dai on L2, in private or public depending on test case.
Initiate a swap of Dai to Weth on L2, this should create a bundle that:
Make a call to withdraws Dai from L2 with the Uniswap portal as the recipient and designated caller. This will emit an L2 -> L1 message from the L2 Dai contract.
Initiate a swap of Dai to Weth on the Uniswap Portal. This will emit an L2 -> L1 message from the Uniswap contract. The message specifies input asset, output asset, minimum amount out, amount in, the Aztec address of the recipient and a secretHash, all provided by the user.
Anyone can on the Uniswap portal execute swap with sufficient arguments to:
call InputAssetPortal::withdraw to consume the first message, and receive InputAsset (Dai)
consume the second message from the outbox
execute a swap on Uniswap using the content of the second message
call weth::approve to approve the Weth to the Weth portal
take the output from the trade, and call OutputAssetPortal::deposit using values from the content of the second message, such that Weth is pulled into the portal and it emits an L1 -> L2 message
The user can claim Weth on L2, in private or public depending on test case.
If 9 is public, shield the funds, if 9 is private unshield the funds.
Visualization:
This covers a single individual trading on Uniswap from within L2. If building both public and private flows we should cover the following features:
Private functions consuming L1 -> L2 messages for moving funds into the rollup
Private functions emitting L2 -> L1 messages for moving funds into the rollup
Public functions consuming L1 -> L2 messages for moving funds into the rollup
Public functions emitting L2 -> L1 messages for moving funds into the rollup
Public functions calling private functions (shielding)
Private functions calling public functions (unshielding)
Private functions calling private functions (swapping from private)
Public functions calling public functions (swapping from public)
The tasks at the top of my head:
For the private execution:
The content you are editing has changed. Please copy your edits and refresh the page.
Goal: To perform a swap on L1 Uniswap that is initiated from L2 using assets from L2 where the output assets are bridged back into L2 after execution. Support both private and public variants (public can be extended to support Aztec connect like functionality).
The series of high-level actions required for such a "feat":
open
version of withdraw and deposit, along with ashield
andunshield
moving funds between private and public domains. Should also support designated caller.dai::approve
swap
with sufficient arguments to:InputAssetPortal::withdraw
to consume the first message, and receive InputAsset (Dai)weth::approve
to approve the Weth to the Weth portalOutputAssetPortal::deposit
using values from the content of the second message, such that Weth is pulled into the portal and it emits an L1 -> L2 messageVisualization:
This covers a single individual trading on Uniswap from within L2. If building both public and private flows we should cover the following features:
The tasks at the top of my head:
For the private execution:
Private Flow
Public Flow
Syntax Improvements
The text was updated successfully, but these errors were encountered: