Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- UniswapPhiatLiquidityAggregator
- Optimization enabled
- true
- Compiler version
- v0.7.6+commit.7338295f
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2026-02-28T18:37:58.672529Z
Constructor Arguments
0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000bb2b8038a1640196fbe3e38816f3e67cba72d9400000000000000000000000000d4a11d5eeaac28ec3f61d100daf4d40471f185200000000000000000000000055d5c232d921b9eaa6b37b5845e439acd04b4dba000000000000000000000000a478c2975ab1ea89e8196811f51a7b7ade33eb11000000000000000000000000811beed0119b4afce20d2583eb608c6f7af1954f000000000000000000000000319e128c8febd6ce7ea0d4c51992a48040719758000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc000000000000000000000000f29a2b454b5da64eeb9c57169ba2776f6955e74800000000000000000000000060594a405d53811d3bc4766596efd80fd545a27000000000000000000000000011b815efb8f581194ae79006d24e0d814b7697f60000000000000000000000004585fe77225b41b697c938b018e2ac67ac5a20c000000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000000000000000094e4b2e24523cf9b3e631a6943c346df9687c72300000000000000000000000078d4704c65dfd869f7f44d78c3fbbbdb5b412c71000000000000000000000000c2e9f25be6257c210d7adf0d4cd6e3e881ba25f80000000000000000000000009e0905249ceefffb9605e034b534544684a58be6000000000000000000000000cbcdf9626bc03e24f779434178a73a0b4bad62ed0000000000000000000000008ad599c3a0ff1de082011efddc58f1908eb6e6d80000000000000000000000002f62f2b4c5fcd7570a709dec05d68ea19c82a9ec0000000000000000000000004e68ccd3e89f51c3074ca5072bbac773960dfa36000000000000000000000000f745b36540a1606f69630da6c6bd9930351b0c68000000000000000000000000a80964c5bbd1a0e95777094420555fead1a26c1e00000000000000000000000082743c07bf3be4d55876f87bca6cce5f84429bd00000000000000000000000006ab3bba2f41e7eaa262fa5a1a9b3932fa161526f000000000000000000000000c5af84701f98fa483ece78af83f11b6c38aca71d0000000000000000000000007bea39867e4169dbe237d55c8242a8f2fcdcc3870000000000000000000000005764a6f2212d502bc5970f9f129ffcd61e5d7563
contracts/oracle/liquidityaggregators/UniswapPhiatLiquidityAggregator.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import {SafeMath} from "../../dependencies/openzeppelin/contracts/SafeMath.sol";
import {IERC20} from "../../dependencies/openzeppelin/contracts/IERC20.sol";
import {IPhiatLiquidityAggregator} from "../../interfaces/IPhiatLiquidityAggregator.sol";
contract UniswapPhiatLiquidityAggregator is IPhiatLiquidityAggregator {
using SafeMath for uint256;
address[] private _pools;
IERC20 private immutable _token;
constructor(address[] memory pools, IERC20 token) {
_pools = pools;
_token = token;
}
// 5-minute TWAP
function latestAnswer() public view override returns (uint256 liquidity) {
for (uint256 i = 0; i < _pools.length; i++) {
liquidity = liquidity.add(_token.balanceOf(_pools[i]));
}
}
}
/
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
interface IPhiatLiquidityAggregator {
function latestAnswer() external view returns (uint256);
}
/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"contracts/oracle/liquidityaggregators/UniswapPhiatLiquidityAggregator.sol":"UniswapPhiatLiquidityAggregator"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address[]","name":"pools","internalType":"address[]"},{"type":"address","name":"token","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"liquidity","internalType":"uint256"}],"name":"latestAnswer","inputs":[]}]
Contract Creation Code
0x60a060405234801561001057600080fd5b506040516103d33803806103d383398101604081905261002f916100ef565b8151610042906000906020850190610059565b5060601b6001600160601b031916608052506101b5565b8280548282559060005260206000209081019282156100ae579160200282015b828111156100ae57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610079565b506100ba9291506100be565b5090565b5b808211156100ba57600081556001016100bf565b80516001600160a01b03811681146100ea57600080fd5b919050565b60008060408385031215610101578182fd5b82516001600160401b0380821115610117578384fd5b818501915085601f83011261012a578384fd5b815160208282111561013857fe5b8082026040518282820101818110868211171561015157fe5b604052838152828101945085830182870184018b101561016f578889fd5b8896505b8487101561019857610184816100d3565b865260019690960195948301948301610173565b5096506101a890508782016100d3565b9450505050509250929050565b60805160601c6102026101d160003980606152506102026000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806350d25bcd14610030575b600080fd5b61003861004e565b60405161004591906101c3565b60405180910390f35b6000805b600054811015610132576101287f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a082316000848154811061009b57fe5b6000918252602090912001546040516001600160e01b031960e084901b1681526100d1916001600160a01b0316906004016101af565b60206040518083038186803b1580156100e957600080fd5b505afa1580156100fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101219190610197565b8390610136565b9150600101610052565b5090565b600082820183811015610190576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000602082840312156101a8578081fd5b5051919050565b6001600160a01b0391909116815260200190565b9081526020019056fea2646970667358221220cca7fd161fcaf361d251803817811b1940314432c0d247cd1ca88915b5cd622064736f6c634300070600330000000000000000000000000000000000000000000000000000000000000040000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000bb2b8038a1640196fbe3e38816f3e67cba72d9400000000000000000000000000d4a11d5eeaac28ec3f61d100daf4d40471f185200000000000000000000000055d5c232d921b9eaa6b37b5845e439acd04b4dba000000000000000000000000a478c2975ab1ea89e8196811f51a7b7ade33eb11000000000000000000000000811beed0119b4afce20d2583eb608c6f7af1954f000000000000000000000000319e128c8febd6ce7ea0d4c51992a48040719758000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc000000000000000000000000f29a2b454b5da64eeb9c57169ba2776f6955e74800000000000000000000000060594a405d53811d3bc4766596efd80fd545a27000000000000000000000000011b815efb8f581194ae79006d24e0d814b7697f60000000000000000000000004585fe77225b41b697c938b018e2ac67ac5a20c000000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000000000000000094e4b2e24523cf9b3e631a6943c346df9687c72300000000000000000000000078d4704c65dfd869f7f44d78c3fbbbdb5b412c71000000000000000000000000c2e9f25be6257c210d7adf0d4cd6e3e881ba25f80000000000000000000000009e0905249ceefffb9605e034b534544684a58be6000000000000000000000000cbcdf9626bc03e24f779434178a73a0b4bad62ed0000000000000000000000008ad599c3a0ff1de082011efddc58f1908eb6e6d80000000000000000000000002f62f2b4c5fcd7570a709dec05d68ea19c82a9ec0000000000000000000000004e68ccd3e89f51c3074ca5072bbac773960dfa36000000000000000000000000f745b36540a1606f69630da6c6bd9930351b0c68000000000000000000000000a80964c5bbd1a0e95777094420555fead1a26c1e00000000000000000000000082743c07bf3be4d55876f87bca6cce5f84429bd00000000000000000000000006ab3bba2f41e7eaa262fa5a1a9b3932fa161526f000000000000000000000000c5af84701f98fa483ece78af83f11b6c38aca71d0000000000000000000000007bea39867e4169dbe237d55c8242a8f2fcdcc3870000000000000000000000005764a6f2212d502bc5970f9f129ffcd61e5d7563
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806350d25bcd14610030575b600080fd5b61003861004e565b60405161004591906101c3565b60405180910390f35b6000805b600054811015610132576101287f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03166370a082316000848154811061009b57fe5b6000918252602090912001546040516001600160e01b031960e084901b1681526100d1916001600160a01b0316906004016101af565b60206040518083038186803b1580156100e957600080fd5b505afa1580156100fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101219190610197565b8390610136565b9150600101610052565b5090565b600082820183811015610190576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000602082840312156101a8578081fd5b5051919050565b6001600160a01b0391909116815260200190565b9081526020019056fea2646970667358221220cca7fd161fcaf361d251803817811b1940314432c0d247cd1ca88915b5cd622064736f6c63430007060033