-
Notifications
You must be signed in to change notification settings - Fork 569
Add msgSender()
to V4Quoter
#458
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"Quoter_exactInputSingle_oneForZero_multiplePositions": "145902", | ||
"Quoter_exactInputSingle_zeroForOne_multiplePositions": "152117", | ||
"Quoter_exactOutputSingle_oneForZero": "79267", | ||
"Quoter_exactOutputSingle_zeroForOne": "84512", | ||
"Quoter_quoteExactInput_oneHop_1TickLoaded": "122728", | ||
"Quoter_quoteExactInput_oneHop_initializedAfter": "147363", | ||
"Quoter_quoteExactInput_oneHop_startingInitialized": "80638", | ||
"Quoter_quoteExactInput_twoHops": "204942", | ||
"Quoter_quoteExactOutput_oneHop_1TickLoaded": "122224", | ||
"Quoter_quoteExactOutput_oneHop_2TicksLoaded": "152879", | ||
"Quoter_quoteExactOutput_oneHop_initializedAfter": "122251", | ||
"Quoter_quoteExactOutput_oneHop_startingInitialized": "98545", | ||
"Quoter_quoteExactOutput_twoHops": "204670" | ||
"Quoter_exactInputSingle_oneForZero_multiplePositions": "146134", | ||
"Quoter_exactInputSingle_zeroForOne_multiplePositions": "152349", | ||
"Quoter_exactOutputSingle_oneForZero": "79477", | ||
"Quoter_exactOutputSingle_zeroForOne": "84722", | ||
"Quoter_quoteExactInput_oneHop_1TickLoaded": "122938", | ||
"Quoter_quoteExactInput_oneHop_initializedAfter": "147573", | ||
"Quoter_quoteExactInput_oneHop_startingInitialized": "80848", | ||
"Quoter_quoteExactInput_twoHops": "205152", | ||
"Quoter_quoteExactOutput_oneHop_1TickLoaded": "122434", | ||
"Quoter_quoteExactOutput_oneHop_2TicksLoaded": "153089", | ||
"Quoter_quoteExactOutput_oneHop_initializedAfter": "122461", | ||
"Quoter_quoteExactOutput_oneHop_startingInitialized": "98755", | ||
"Quoter_quoteExactOutput_twoHops": "204880" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
/// @title IMsgSender | ||
/// @notice Interface for contracts that expose the original caller | ||
interface IMsgSender { | ||
/// @notice Returns the address of the original caller (msg.sender) | ||
/// @dev Uniswap v4 periphery contracts implement a callback pattern which lose | ||
/// the original msg.sender caller context. This view function provides a way for | ||
/// integrating contracts (e.g. hooks) to access the original caller address. | ||
/// @return The address of the original caller | ||
function msgSender() external view returns (address); | ||
hensha256 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.20; | ||
|
||
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; | ||
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; | ||
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol"; | ||
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; | ||
import {BaseTestHooks} from "@uniswap/v4-core/src/test/BaseTestHooks.sol"; | ||
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@uniswap/v4-core/src/types/BeforeSwapDelta.sol"; | ||
import {IMsgSender} from "../../src/interfaces/IMsgSender.sol"; | ||
|
||
contract MockMsgSenderHook is BaseTestHooks { | ||
event BeforeSwapMsgSender(address msgSender); | ||
event AfterSwapMsgSender(address msgSender); | ||
|
||
function beforeSwap(address periphery, PoolKey calldata, IPoolManager.SwapParams calldata, bytes calldata) | ||
external | ||
override | ||
returns (bytes4, BeforeSwapDelta, uint24) | ||
{ | ||
emit BeforeSwapMsgSender(IMsgSender(periphery).msgSender()); | ||
return (BaseTestHooks.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, 0); | ||
} | ||
|
||
function afterSwap( | ||
address periphery, | ||
PoolKey calldata, | ||
IPoolManager.SwapParams calldata, | ||
BalanceDelta, | ||
bytes calldata | ||
) external override returns (bytes4, int128) { | ||
emit AfterSwapMsgSender(IMsgSender(periphery).msgSender()); | ||
return (BaseTestHooks.afterSwap.selector, 0); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.