Closed jalextowle closed 1 month ago
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
contracts/src/libraries/UniV3Path.sol | 2 | 4 | 50.0% | ||
contracts/src/zaps/UniV3Zap.sol | 148 | 164 | 90.24% | ||
<!-- | Total: | 150 | 168 | 89.29% | --> |
Totals | |
---|---|
Change from base Build 11261243207: | 0.02% |
Covered Lines: | 2639 |
Relevant Lines: | 2969 |
Benchmark suite | Current: 6777136ba8076c68f5186f0d4ba4f152d5b74a54 | Previous: 540732a98e843ec15a453bbeb63a80676580b11c | Deviation | Status |
---|---|---|---|---|
addLiquidity: min |
33812 gas |
33812 gas |
0% |
π° |
addLiquidity: avg |
193051 gas |
193001 gas |
0.0259% |
π¨ |
addLiquidity: max |
474677 gas |
474677 gas |
0% |
π° |
checkpoint: min |
40338 gas |
40338 gas |
0% |
π° |
checkpoint: avg |
147682 gas |
147705 gas |
-0.0156% |
β |
checkpoint: max |
259386 gas |
259386 gas |
0% |
π° |
closeLong: min |
31390 gas |
31390 gas |
0% |
π° |
closeLong: avg |
129896 gas |
130031 gas |
-0.1038% |
β |
closeLong: max |
2539405 gas |
2539405 gas |
0% |
π° |
closeShort: min |
31378 gas |
31378 gas |
0% |
π° |
closeShort: avg |
124783 gas |
124916 gas |
-0.1065% |
β |
closeShort: max |
277335 gas |
277335 gas |
0% |
π° |
initialize: min |
31356 gas |
31356 gas |
0% |
π° |
initialize: avg |
355841 gas |
355865 gas |
-0.0067% |
β |
initialize: max |
424801 gas |
424801 gas |
0% |
π° |
openLong: min |
33370 gas |
33370 gas |
0% |
π° |
openLong: avg |
173786 gas |
173869 gas |
-0.0477% |
β |
openLong: max |
339778 gas |
339778 gas |
0% |
π° |
openShort: min |
33936 gas |
33936 gas |
0% |
π° |
openShort: avg |
172587 gas |
172411 gas |
0.1021% |
π¨ |
openShort: max |
414941 gas |
414861 gas |
0.0193% |
π¨ |
redeemWithdrawalShares: min |
31240 gas |
31240 gas |
0% |
π° |
redeemWithdrawalShares: avg |
74247 gas |
74244 gas |
0.0040% |
π¨ |
redeemWithdrawalShares: max |
311225 gas |
311225 gas |
0% |
π° |
removeLiquidity: min |
31246 gas |
31246 gas |
0% |
π° |
removeLiquidity: avg |
216956 gas |
217006 gas |
-0.0230% |
β |
removeLiquidity: max |
403402 gas |
403671 gas |
-0.0666% |
β |
This comment was automatically generated by workflow using github-action-benchmark.
Description
This PR adds a zap contract that supports generalized swapping between assets using Uniswap V3. Each Hyperdrive trading or LP function has a direct anologue in the zap contract that exposes all of the parameters as well as a few extra parameters for things like the Uniswap swap object (
ISwapRouter.ExactInputParams
) and special-case parameters to handle different edge-cases in the zap.Extensive tests were added that should test the different paths through these functions. Special care was taken to verify that ETH, WETH, and rebasing tokens are properly handled by the zap contract. Since Uniswap v3 doesn't really support ETH as a first-class citizen in all situations, there are several flows within the zap contract where ETH will be converted to WETH or vice-versa. For the most part, this is unopinionated and will support all use-cases, but in the case of zapping funds out of the zap, WETH will always be unwrapped into ETH before sending it to the user.
Some notable things to watch out for are:
openShortZap
's lack of precision compared to the other flows. This is unavoidable because of the way that Hyperdrive'sopenShort
logic functions.