mirror of
https://github.com/lux-amm/v4-periphery.git
synced 2026-10-30 20:54:39 +00:00
34 lines
1.4 KiB
Solidity
34 lines
1.4 KiB
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {PoolKey} from "@luxamm/v4-core/src/types/PoolKey.sol";
|
|
import {Hooks} from "@luxamm/v4-core/src/libraries/Hooks.sol";
|
|
import {BalanceDelta} from "@luxamm/v4-core/src/types/BalanceDelta.sol";
|
|
import {BaseTestHooks} from "@luxamm/v4-core/src/test/BaseTestHooks.sol";
|
|
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@luxamm/v4-core/src/types/BeforeSwapDelta.sol";
|
|
import {IMsgSender} from "../../src/interfaces/IMsgSender.sol";
|
|
import {SwapParams} from "@luxamm/v4-core/src/types/PoolOperation.sol";
|
|
|
|
contract MockMsgSenderHook is BaseTestHooks {
|
|
event BeforeSwapMsgSender(address msgSender);
|
|
event AfterSwapMsgSender(address msgSender);
|
|
|
|
function beforeSwap(address periphery, PoolKey calldata, 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, SwapParams calldata, BalanceDelta, bytes calldata)
|
|
external
|
|
override
|
|
returns (bytes4, int128)
|
|
{
|
|
emit AfterSwapMsgSender(IMsgSender(periphery).msgSender());
|
|
return (BaseTestHooks.afterSwap.selector, 0);
|
|
}
|
|
}
|