From 0b6cbc76ea5fbddd838b51516c8480054f07d1a3 Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Tue, 6 Feb 2024 15:14:00 -0700 Subject: [PATCH] chore: organize --- src/Bases/Hooks/BaseHooks.sol | 50 +--------------------------------- src/Bases/Hooks/Hooks.sol | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 src/Bases/Hooks/Hooks.sol diff --git a/src/Bases/Hooks/BaseHooks.sol b/src/Bases/Hooks/BaseHooks.sol index c6e0864..6c90ab1 100644 --- a/src/Bases/Hooks/BaseHooks.sol +++ b/src/Bases/Hooks/BaseHooks.sol @@ -1,57 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.18; +import {Hooks} from "./Hooks.sol"; import {BaseHealthCheck, ERC20} from "../HealthCheck/BaseHealthCheck.sol"; -contract DepositHooks { - function _preDepositHook( - uint256 assets, - uint256 shares, - address receiver - ) internal virtual {} - - function _postDepositHook( - uint256 assets, - uint256 shares, - address receiver - ) internal virtual {} -} - -contract WithdrawHooks { - function _preWithdrawHook( - uint256 assets, - uint256 shares, - address receiver, - address owner, - uint256 maxLoss - ) internal virtual {} - - function _postWithdrawHook( - uint256 assets, - uint256 shares, - address receiver, - address owner, - uint256 maxLoss - ) internal virtual {} -} - -contract TransferHooks { - function _preTransferHook( - address from, - address to, - uint256 amount - ) internal virtual {} - - function _postTransferHook( - address from, - address to, - uint256 amount, - bool success - ) internal virtual {} -} - -contract Hooks is DepositHooks, WithdrawHooks, TransferHooks {} - /** * @title Base Hooks * @author Yearn.finance diff --git a/src/Bases/Hooks/Hooks.sol b/src/Bases/Hooks/Hooks.sol new file mode 100644 index 0000000..dd070fb --- /dev/null +++ b/src/Bases/Hooks/Hooks.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity 0.8.18; + +contract Hooks is DepositHooks, WithdrawHooks, TransferHooks {} + +contract DepositHooks { + function _preDepositHook( + uint256 assets, + uint256 shares, + address receiver + ) internal virtual {} + + function _postDepositHook( + uint256 assets, + uint256 shares, + address receiver + ) internal virtual {} +} + +contract WithdrawHooks { + function _preWithdrawHook( + uint256 assets, + uint256 shares, + address receiver, + address owner, + uint256 maxLoss + ) internal virtual {} + + function _postWithdrawHook( + uint256 assets, + uint256 shares, + address receiver, + address owner, + uint256 maxLoss + ) internal virtual {} +} + +contract TransferHooks { + function _preTransferHook( + address from, + address to, + uint256 amount + ) internal virtual {} + + function _postTransferHook( + address from, + address to, + uint256 amount, + bool success + ) internal virtual {} +}