feat: add balancer v2 executor
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../solidity-utils/openzeppelin/IERC20.sol";
|
||||
|
||||
import "./IVault.sol";
|
||||
|
||||
interface IPoolSwapStructs {
|
||||
// This is not really an interface - it just defines common structs used by other interfaces: IGeneralPool and
|
||||
// IMinimalSwapInfoPool.
|
||||
//
|
||||
// This data structure represents a request for a token swap, where `kind` indicates the swap type ('given in' or
|
||||
// 'given out') which indicates whether or not the amount sent by the pool is known.
|
||||
//
|
||||
// The pool receives `tokenIn` and sends `tokenOut`. `amount` is the number of `tokenIn` tokens the pool will take
|
||||
// in, or the number of `tokenOut` tokens the Pool will send out, depending on the given swap `kind`.
|
||||
//
|
||||
// All other fields are not strictly necessary for most swaps, but are provided to support advanced scenarios in
|
||||
// some Pools.
|
||||
//
|
||||
// `poolId` is the ID of the Pool involved in the swap - this is useful for Pool contracts that implement more than
|
||||
// one Pool.
|
||||
//
|
||||
// The meaning of `lastChangeBlock` depends on the Pool specialization:
|
||||
// - Two Token or Minimal Swap Info: the last block in which either `tokenIn` or `tokenOut` changed its total
|
||||
// balance.
|
||||
// - General: the last block in which *any* of the Pool's registered tokens changed its total balance.
|
||||
//
|
||||
// `from` is the origin address for the funds the Pool receives, and `to` is the destination address
|
||||
// where the Pool sends the outgoing tokens.
|
||||
//
|
||||
// `userData` is extra data provided by the caller - typically a signature from a trusted party.
|
||||
struct SwapRequest {
|
||||
IVault.SwapKind kind;
|
||||
IERC20 tokenIn;
|
||||
IERC20 tokenOut;
|
||||
uint256 amount;
|
||||
// Misc data
|
||||
bytes32 poolId;
|
||||
uint256 lastChangeBlock;
|
||||
address from;
|
||||
address to;
|
||||
bytes userData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user