|
| 1 | +// SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | + |
| 3 | +pragma solidity ^0.8.24; |
| 4 | + |
| 5 | +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
| 6 | + |
| 7 | +/// @notice Restored from 0xbA1333333333a1BA1108E8412f11850A5C319bA9 (sonic) |
| 8 | +interface IVaultMainV3 { |
| 9 | + struct TokenConfig { |
| 10 | + address token; |
| 11 | + uint8 tokenType; |
| 12 | + address rateProvider; |
| 13 | + bool paysYieldFees; |
| 14 | + } |
| 15 | + |
| 16 | + struct PoolRoleAccounts { |
| 17 | + address pauseManager; |
| 18 | + address swapFeeManager; |
| 19 | + address poolCreator; |
| 20 | + } |
| 21 | + |
| 22 | + struct HooksConfig { |
| 23 | + bool enableHookAdjustedAmounts; |
| 24 | + bool shouldCallBeforeInitialize; |
| 25 | + bool shouldCallAfterInitialize; |
| 26 | + bool shouldCallComputeDynamicSwapFee; |
| 27 | + bool shouldCallBeforeSwap; |
| 28 | + bool shouldCallAfterSwap; |
| 29 | + bool shouldCallBeforeAddLiquidity; |
| 30 | + bool shouldCallAfterAddLiquidity; |
| 31 | + bool shouldCallBeforeRemoveLiquidity; |
| 32 | + bool shouldCallAfterRemoveLiquidity; |
| 33 | + address hooksContract; |
| 34 | + } |
| 35 | + |
| 36 | + struct LiquidityManagement { |
| 37 | + bool disableUnbalancedLiquidity; |
| 38 | + bool enableAddLiquidityCustom; |
| 39 | + bool enableRemoveLiquidityCustom; |
| 40 | + bool enableDonation; |
| 41 | + } |
| 42 | + |
| 43 | + struct AddLiquidityParams { |
| 44 | + address pool; |
| 45 | + address to; |
| 46 | + uint256[] maxAmountsIn; |
| 47 | + uint256 minBptAmountOut; |
| 48 | + uint8 kind; |
| 49 | + bytes userData; |
| 50 | + } |
| 51 | + |
| 52 | + struct BufferWrapOrUnwrapParams { |
| 53 | + uint8 kind; |
| 54 | + uint8 direction; |
| 55 | + address wrappedToken; |
| 56 | + uint256 amountGivenRaw; |
| 57 | + uint256 limitRaw; |
| 58 | + } |
| 59 | + |
| 60 | + struct RemoveLiquidityParams { |
| 61 | + address pool; |
| 62 | + address from; |
| 63 | + uint256 maxBptAmountIn; |
| 64 | + uint256[] minAmountsOut; |
| 65 | + uint8 kind; |
| 66 | + bytes userData; |
| 67 | + } |
| 68 | + |
| 69 | + struct VaultSwapParams { |
| 70 | + uint8 kind; |
| 71 | + address pool; |
| 72 | + address tokenIn; |
| 73 | + address tokenOut; |
| 74 | + uint256 amountGivenRaw; |
| 75 | + uint256 limitRaw; |
| 76 | + bytes userData; |
| 77 | + } |
| 78 | + |
| 79 | + fallback() external payable; |
| 80 | + |
| 81 | + function addLiquidity(AddLiquidityParams memory params) |
| 82 | + external |
| 83 | + returns ( |
| 84 | + uint256[] memory amountsIn, |
| 85 | + uint256 bptAmountOut, |
| 86 | + bytes memory returnData |
| 87 | + ); |
| 88 | + |
| 89 | + function erc4626BufferWrapOrUnwrap(BufferWrapOrUnwrapParams memory params) |
| 90 | + external |
| 91 | + returns ( |
| 92 | + uint256 amountCalculatedRaw, |
| 93 | + uint256 amountInRaw, |
| 94 | + uint256 amountOutRaw |
| 95 | + ); |
| 96 | + |
| 97 | + function getPoolTokenCountAndIndexOfToken(address pool, address token) |
| 98 | + external |
| 99 | + view |
| 100 | + returns (uint256, uint256); |
| 101 | + |
| 102 | + function getVaultExtension() external view returns (address); |
| 103 | + |
| 104 | + function reentrancyGuardEntered() external view returns (bool); |
| 105 | + |
| 106 | + function removeLiquidity(RemoveLiquidityParams memory params) |
| 107 | + external |
| 108 | + returns ( |
| 109 | + uint256 bptAmountIn, |
| 110 | + uint256[] memory amountsOut, |
| 111 | + bytes memory returnData |
| 112 | + ); |
| 113 | + |
| 114 | + function sendTo(address token, address to, uint256 amount) external; |
| 115 | + |
| 116 | + function settle(address token, uint256 amountHint) external returns (uint256 credit); |
| 117 | + |
| 118 | + function swap(VaultSwapParams memory vaultSwapParams) |
| 119 | + external |
| 120 | + returns ( |
| 121 | + uint256 amountCalculated, |
| 122 | + uint256 amountIn, |
| 123 | + uint256 amountOut |
| 124 | + ); |
| 125 | + |
| 126 | + function transfer(address owner, address to, uint256 amount) external returns (bool); |
| 127 | + |
| 128 | + function transferFrom(address spender, address from, address to, uint256 amount) external returns (bool); |
| 129 | + |
| 130 | + /// @notice Creates a context for a sequence of operations (i.e., "unlocks" the Vault). |
| 131 | + /// @dev Performs a callback on msg.sender with arguments provided in `data`. The Callback is `transient`, |
| 132 | + /// meaning all balances for the caller have to be settled at the end. |
| 133 | + /// Implementation in balancer-v3-monorepo is following: |
| 134 | + /// function unlock(bytes calldata data) external transient returns (bytes memory result) { |
| 135 | + /// return (msg.sender).functionCall(data); |
| 136 | + /// } |
| 137 | + /// @param data Contains function signature and args to be passed to the msg.sender |
| 138 | + /// @return result Resulting data from the call |
| 139 | + function unlock(bytes memory data) external returns (bytes memory result); |
| 140 | + |
| 141 | + receive() external payable; |
| 142 | +} |
| 143 | + |
0 commit comments