Refactor and add Balancer V2 stub
This commit is contained in:
84
evm/src/balancer-v2/BalancerV2SwapAdapter.sol
Normal file
84
evm/src/balancer-v2/BalancerV2SwapAdapter.sol
Normal file
@@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import {IERC20, ISwapAdapter} from "interfaces/ISwapAdapter.sol";
|
||||
|
||||
contract BalancerV2SwapAdapter is ISwapAdapter {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
function getPairReserves(
|
||||
bytes32 pairId,
|
||||
IERC20 sellToken,
|
||||
IERC20 buyToken
|
||||
) internal view returns (uint112 r0, uint112 r1) {
|
||||
revert NotImplemented("BalancerV2SwapAdapter.getPairReserves");
|
||||
}
|
||||
|
||||
function price(
|
||||
bytes32 pairId,
|
||||
IERC20 sellToken,
|
||||
IERC20 buyToken,
|
||||
uint256[] memory sellAmounts
|
||||
) external view override returns (Fraction[] memory prices) {
|
||||
revert NotImplemented("BalancerV2SwapAdapter.price");
|
||||
}
|
||||
|
||||
function getPriceAt(uint256 amountIn, uint256 reserveIn, uint256 reserveOut)
|
||||
internal
|
||||
pure
|
||||
returns (Fraction memory)
|
||||
{
|
||||
revert NotImplemented("BalancerV2SwapAdapter.getPriceAt");
|
||||
}
|
||||
|
||||
function swap(
|
||||
bytes32 pairId,
|
||||
IERC20 sellToken,
|
||||
IERC20 buyToken,
|
||||
SwapSide side,
|
||||
uint256 specifiedAmount
|
||||
) external override returns (Trade memory trade) {
|
||||
revert NotImplemented("BalancerV2SwapAdapter.swap");
|
||||
}
|
||||
|
||||
function getLimits(bytes32 pairId, SwapSide side)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (uint256[] memory limits)
|
||||
{
|
||||
revert NotImplemented("BalancerV2SwapAdapter.getLimits");
|
||||
}
|
||||
|
||||
function getCapabilities(bytes32, IERC20, IERC20)
|
||||
external
|
||||
pure
|
||||
override
|
||||
returns (Capability[] memory capabilities)
|
||||
{
|
||||
capabilities = new Capability[](3);
|
||||
capabilities[0] = Capability.SellSide;
|
||||
capabilities[1] = Capability.BuySide;
|
||||
capabilities[2] = Capability.PriceFunction;
|
||||
}
|
||||
|
||||
function getTokens(bytes32 pairId)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (IERC20[] memory tokens)
|
||||
{
|
||||
revert NotImplemented("BalancerV2SwapAdapter.getTokens");
|
||||
}
|
||||
|
||||
function getPoolIds(uint256 offset, uint256 limit)
|
||||
external
|
||||
view
|
||||
override
|
||||
returns (bytes32[] memory ids)
|
||||
{
|
||||
revert NotImplemented("BalancerV2SwapAdapter.getPoolIds");
|
||||
}
|
||||
}
|
||||
36
evm/src/balancer-v2/manifest.yaml
Normal file
36
evm/src/balancer-v2/manifest.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
# information about the author helps us reach out in case of issues.
|
||||
author:
|
||||
name: Propellerheads.xyz
|
||||
email: pistomat@propellerheads.xyz
|
||||
|
||||
# Protocol Constants
|
||||
constants:
|
||||
protocol_gas: 30000
|
||||
# minimum capabilities we can expect, individual pools may extend these
|
||||
capabilities:
|
||||
- SellSide
|
||||
- BuySide
|
||||
- PriceFunction
|
||||
|
||||
# The file containing the adapter contract
|
||||
contract: BalancerV2SwapAdapter.sol
|
||||
|
||||
# Deployment instances used to generate chain specific bytecode.
|
||||
instances:
|
||||
- chain:
|
||||
name: mainnet
|
||||
id: 0
|
||||
arguments:
|
||||
- "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
|
||||
|
||||
# Specify some automatic test cases in case getPoolIds and
|
||||
# getTokens are not implemented.
|
||||
tests:
|
||||
instances:
|
||||
- pair_id: "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc"
|
||||
sell_token: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
||||
buy_token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
||||
block: 17000000
|
||||
chain:
|
||||
id: 0
|
||||
name: mainnet
|
||||
Reference in New Issue
Block a user