rename pairId to more general poolId

This commit is contained in:
pistomat
2023-12-06 15:12:43 +01:00
parent 223df970d3
commit 9105b898d6
8 changed files with 58 additions and 58 deletions

View File

@@ -13,13 +13,13 @@ contract UniswapV2SwapAdapter is ISwapAdapter {
}
function price(
bytes32 pairId,
bytes32 poolId,
IERC20 sellToken,
IERC20 buyToken,
uint256[] memory specifiedAmounts
) external view override returns (Fraction[] memory prices) {
prices = new Fraction[](specifiedAmounts.length);
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(pairId)));
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(poolId)));
uint112 r0;
uint112 r1;
if (sellToken < buyToken) {
@@ -51,7 +51,7 @@ contract UniswapV2SwapAdapter is ISwapAdapter {
}
function swap(
bytes32 pairId,
bytes32 poolId,
IERC20 sellToken,
IERC20 buyToken,
OrderSide side,
@@ -62,7 +62,7 @@ contract UniswapV2SwapAdapter is ISwapAdapter {
// expected zero Fraction(0, 1)
}
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(pairId)));
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(poolId)));
uint112 r0;
uint112 r1;
bool zero2one = sellToken < buyToken;
@@ -168,13 +168,13 @@ contract UniswapV2SwapAdapter is ISwapAdapter {
amountIn = (numerator / denominator) + 1;
}
function getLimits(bytes32 pairId, IERC20 sellToken, IERC20 buyToken)
function getLimits(bytes32 poolId, IERC20 sellToken, IERC20 buyToken)
external
view
override
returns (uint256[] memory limits)
{
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(pairId)));
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(poolId)));
limits = new uint256[](2);
(uint256 r0, uint256 r1,) = pair.getReserves();
if (sellToken < buyToken) {
@@ -198,14 +198,14 @@ contract UniswapV2SwapAdapter is ISwapAdapter {
capabilities[2] = Capability.PriceFunction;
}
function getTokens(bytes32 pairId)
function getTokens(bytes32 poolId)
external
view
override
returns (IERC20[] memory tokens)
{
tokens = new IERC20[](2);
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(pairId)));
IUniswapV2Pair pair = IUniswapV2Pair(address(bytes20(poolId)));
tokens[0] = IERC20(pair.token0());
tokens[1] = IERC20(pair.token1());
}

View File

@@ -27,7 +27,7 @@ instances:
# getTokens are not implemented.
tests:
instances:
- pair_id: "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc"
- pool_id: "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc"
sell_token: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
buy_token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
block: 17000000