fix uni
This commit is contained in:
10
contracts/external/Multicall.sol
vendored
10
contracts/external/Multicall.sol
vendored
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
*Submitted for verification at Etherscan.io on 2019-06-10
|
||||
*/
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
@@ -10,17 +6,19 @@ pragma experimental ABIEncoderV2;
|
||||
/// @author Joshua Levine <joshua@makerdao.com>
|
||||
/// @author Nick Johnson <arachnid@notdot.net>
|
||||
|
||||
// WithValid
|
||||
contract Multicall {
|
||||
struct Call {
|
||||
address target;
|
||||
bytes callData;
|
||||
}
|
||||
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) {
|
||||
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData, bool[] memory dataValid) {
|
||||
blockNumber = block.number;
|
||||
returnData = new bytes[](calls.length);
|
||||
dataValid = new bool[](calls.length);
|
||||
for(uint256 i = 0; i < calls.length; i++) {
|
||||
(bool success, bytes memory ret) = calls[i].target.call(calls[i].callData);
|
||||
require(success);
|
||||
dataValid[i] = success;
|
||||
returnData[i] = ret;
|
||||
}
|
||||
}
|
||||
|
||||
48
contracts/external/uniswap/PoolAddress.sol
vendored
Normal file
48
contracts/external/uniswap/PoolAddress.sol
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
pragma solidity >=0.5.0;
|
||||
|
||||
/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
|
||||
library PoolAddress {
|
||||
bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;
|
||||
|
||||
/// @notice The identifying key of the pool
|
||||
struct PoolKey {
|
||||
address token0;
|
||||
address token1;
|
||||
uint24 fee;
|
||||
}
|
||||
|
||||
/// @notice Returns PoolKey: the ordered tokens with the matched fee levels
|
||||
/// @param tokenA The first token of a pool, unsorted
|
||||
/// @param tokenB The second token of a pool, unsorted
|
||||
/// @param fee The fee level of the pool
|
||||
/// @return Poolkey The pool details with ordered token0 and token1 assignments
|
||||
function getPoolKey(
|
||||
address tokenA,
|
||||
address tokenB,
|
||||
uint24 fee
|
||||
) internal pure returns (PoolKey memory) {
|
||||
if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
|
||||
return PoolKey({token0: tokenA, token1: tokenB, fee: fee});
|
||||
}
|
||||
|
||||
/// @notice Deterministically computes the pool address given the factory and PoolKey
|
||||
/// @param factory The Uniswap V3 factory contract address
|
||||
/// @param key The PoolKey
|
||||
/// @return pool The contract address of the V3 pool
|
||||
function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) {
|
||||
require(key.token0 < key.token1);
|
||||
pool = address(
|
||||
uint256(
|
||||
keccak256(
|
||||
abi.encodePacked(
|
||||
hex'ff',
|
||||
factory,
|
||||
keccak256(abi.encode(key.token0, key.token1, key.fee)),
|
||||
POOL_INIT_CODE_HASH
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user