// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.24; import { IERC4626 } from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IProtocolFeeController } from "./IProtocolFeeController.sol"; import { IAuthorizer } from "./IAuthorizer.sol"; import { IHooks } from "./IHooks.sol"; import "./VaultTypes.sol"; /// @dev Events are declared inside an interface (namespace) to improve DX with Typechain. interface IVaultEvents { /** * @notice A Pool was registered by calling `registerPool`. * @param pool The pool being registered * @param factory The factory creating the pool * @param tokenConfig An array of descriptors for the tokens the pool will manage * @param swapFeePercentage The static swap fee of the pool * @param pauseWindowEndTime The pool's pause window end time * @param roleAccounts Addresses the Vault will allow to change certain pool settings * @param hooksConfig Flags indicating which hooks the pool supports and address of hooks contract * @param liquidityManagement Supported liquidity management hook flags */ event PoolRegistered( address indexed pool, address indexed factory, TokenConfig[] tokenConfig, uint256 swapFeePercentage, uint32 pauseWindowEndTime, PoolRoleAccounts roleAccounts, HooksConfig hooksConfig, LiquidityManagement liquidityManagement ); /** * @notice A Pool was initialized by calling `initialize`. * @param pool The pool being initialized */ event PoolInitialized(address indexed pool); /** * @notice A swap has occurred. * @param pool The pool with the tokens being swapped * @param tokenIn The token entering the Vault (balance increases) * @param tokenOut The token leaving the Vault (balance decreases) * @param amountIn Number of tokenIn tokens * @param amountOut Number of tokenOut tokens * @param swapFeePercentage Swap fee percentage applied (can differ if dynamic) * @param swapFeeAmount Swap fee amount paid */ event Swap( address indexed pool, IERC20 indexed tokenIn, IERC20 indexed tokenOut, uint256 amountIn, uint256 amountOut, uint256 swapFeePercentage, uint256 swapFeeAmount ); /** * @notice A wrap operation has occurred. * @param wrappedToken The wrapped token address * @param depositedUnderlying Number of underlying tokens deposited * @param mintedShares Number of shares (wrapped tokens) minted * @param bufferBalances The final buffer balances, packed in 128-bit words (underlying, wrapped) */ event Wrap( IERC4626 indexed wrappedToken, uint256 depositedUnderlying, uint256 mintedShares, bytes32 bufferBalances ); /** * @notice An unwrap operation has occurred. * @param wrappedToken The wrapped token address * @param burnedShares Number of shares (wrapped tokens) burned * @param withdrawnUnderlying Number of underlying tokens withdrawn * @param bufferBalances The final buffer balances, packed in 128-bit words (underlying, wrapped) */ event Unwrap( IERC4626 indexed wrappedToken, uint256 burnedShares, uint256 withdrawnUnderlying, bytes32 bufferBalances ); /** * @notice Liquidity has been added to a pool (including initialization). * @param pool The pool with liquidity added * @param liquidityProvider The user performing the operation * @param kind The add liquidity operation type (e.g., proportional, custom) * @param totalSupply The total supply of the pool after the operation * @param amountsAddedRaw The amount of each token that was added, sorted in token registration order * @param swapFeeAmountsRaw The total swap fees charged, sorted in token registration order */ event LiquidityAdded( address indexed pool, address indexed liquidityProvider, AddLiquidityKind indexed kind, uint256 totalSupply, uint256[] amountsAddedRaw, uint256[] swapFeeAmountsRaw ); /** * @notice Liquidity has been removed from a pool. * @param pool The pool with liquidity removed * @param liquidityProvider The user performing the operation * @param kind The remove liquidity operation type (e.g., proportional, custom) * @param totalSupply The total supply of the pool after the operation * @param amountsRemovedRaw The amount of each token that was removed, sorted in token registration order * @param swapFeeAmountsRaw The total swap fees charged, sorted in token registration order */ event LiquidityRemoved( address indexed pool, address indexed liquidityProvider, RemoveLiquidityKind indexed kind, uint256 totalSupply, uint256[] amountsRemovedRaw, uint256[] swapFeeAmountsRaw ); /** * @notice The Vault's pause status has changed. * @param paused True if the Vault was paused */ event VaultPausedStateChanged(bool paused); /// @notice `disableQuery` has been called on the Vault, disabling query functionality. event VaultQueriesDisabled(); /// @notice `enableQuery` has been called on the Vault, enabling query functionality. event VaultQueriesEnabled(); /** * @notice A Pool's pause status has changed. * @param pool The pool that was just paused or unpaused * @param paused True if the pool was paused */ event PoolPausedStateChanged(address indexed pool, bool paused); /** * @notice Emitted when the swap fee percentage of a pool is updated. * @param swapFeePercentage The new swap fee percentage for the pool */ event SwapFeePercentageChanged(address indexed pool, uint256 swapFeePercentage); /** * @notice Recovery mode has been enabled or disabled for a pool. * @param pool The pool * @param recoveryMode True if recovery mode was enabled */ event PoolRecoveryModeStateChanged(address indexed pool, bool recoveryMode); /** * @notice A protocol or pool creator fee has changed, causing an update to the aggregate swap fee. * @dev The `ProtocolFeeController` will emit an event with the underlying change. * @param pool The pool whose aggregate swap fee percentage changed * @param aggregateSwapFeePercentage The new aggregate swap fee percentage */ event AggregateSwapFeePercentageChanged(address indexed pool, uint256 aggregateSwapFeePercentage); /** * @notice A protocol or pool creator fee has changed, causing an update to the aggregate yield fee. * @dev The `ProtocolFeeController` will emit an event with the underlying change. * @param pool The pool whose aggregate yield fee percentage changed * @param aggregateYieldFeePercentage The new aggregate yield fee percentage */ event AggregateYieldFeePercentageChanged(address indexed pool, uint256 aggregateYieldFeePercentage); /** * @notice A new authorizer is set by `setAuthorizer`. * @param newAuthorizer The address of the new authorizer */ event AuthorizerChanged(IAuthorizer indexed newAuthorizer); /** * @notice A new protocol fee controller is set by `setProtocolFeeController`. * @param newProtocolFeeController The address of the new protocol fee controller */ event ProtocolFeeControllerChanged(IProtocolFeeController indexed newProtocolFeeController); /** * @notice Liquidity was added to an ERC4626 buffer corresponding to the given wrapped token. * @dev The underlying token can be derived from the wrapped token, so it's not included here. * * @param wrappedToken The wrapped token that identifies the buffer * @param amountUnderlying The amount of the underlying token that was deposited * @param amountWrapped The amount of the wrapped token that was deposited * @param bufferBalances The final buffer balances, packed in 128-bit words (underlying, wrapped) */ event LiquidityAddedToBuffer( IERC4626 indexed wrappedToken, uint256 amountUnderlying, uint256 amountWrapped, bytes32 bufferBalances ); /** * @notice Buffer shares were minted for an ERC4626 buffer corresponding to a given wrapped token. * @dev The shares are not tokenized like pool BPT, but accounted for in the Vault. `getBufferOwnerShares` * retrieves the current total shares for a given buffer and address, and `getBufferTotalShares` returns the * "totalSupply" of a buffer. * * @param wrappedToken The wrapped token that identifies the buffer * @param to The owner of the minted shares * @param issuedShares The amount of "internal BPT" shares created */ event BufferSharesMinted(IERC4626 indexed wrappedToken, address indexed to, uint256 issuedShares); /** * @notice Buffer shares were burned for an ERC4626 buffer corresponding to a given wrapped token. * @dev The shares are not tokenized like pool BPT, but accounted for in the Vault. `getBufferOwnerShares` * retrieves the current total shares for a given buffer and address, and `getBufferTotalShares` returns the * "totalSupply" of a buffer. * * @param wrappedToken The wrapped token that identifies the buffer * @param from The owner of the burned shares * @param burnedShares The amount of "internal BPT" shares burned */ event BufferSharesBurned(IERC4626 indexed wrappedToken, address indexed from, uint256 burnedShares); /** * @notice Liquidity was removed from an ERC4626 buffer. * @dev The underlying token can be derived from the wrapped token, so it's not included here. * @param wrappedToken The wrapped token that identifies the buffer * @param amountUnderlying The amount of the underlying token that was withdrawn * @param amountWrapped The amount of the wrapped token that was withdrawn * @param bufferBalances The final buffer balances, packed in 128-bit words (underlying, wrapped) */ event LiquidityRemovedFromBuffer( IERC4626 indexed wrappedToken, uint256 amountUnderlying, uint256 amountWrapped, bytes32 bufferBalances ); /** * @notice The Vault buffers pause status has changed. * @dev If buffers all paused, all buffer operations (i.e., all calls through the Router with `isBuffer` * set to true) will revert. * * @param paused True if the Vault buffers were paused */ event VaultBuffersPausedStateChanged(bool paused); /** * @notice Pools can use this event to emit event data from the Vault. * @param pool Pool address * @param eventKey Event key * @param eventData Encoded event data */ event VaultAuxiliary(address indexed pool, bytes32 indexed eventKey, bytes eventData); }