Overview
FTM Balance
0 FTM
FTM Value
$0.00More Info
Private Name Tags
ContractCreator:
Sponsored
Latest 4 from a total of 4 transactions
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
31932652 | 763 days ago | Contract Creation | 0 FTM |
Loading...
Loading
Contract Name:
UniswapPairOracle
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libs/FixedPoint.sol"; import "../libs/UQ112x112.sol"; contract UniswapPairOracle is Ownable { using FixedPoint for *; using SafeMath for uint256; uint256 public PERIOD = 600; // 60-minute TWAP (Time-Weighted Average Price) IUniswapV2Pair public immutable pair; address public immutable token0; address public immutable token1; uint256 public price0CumulativeLast; uint256 public price1CumulativeLast; uint32 public blockTimestampLast; FixedPoint.uq112x112 public price0Average; FixedPoint.uq112x112 public price1Average; constructor(address pairAddress) { IUniswapV2Pair _pair = IUniswapV2Pair(pairAddress); pair = _pair; token0 = _pair.token0(); token1 = _pair.token1(); price0CumulativeLast = _pair.price0CumulativeLast(); // Fetch the current accumulated price value (1 / 0) price1CumulativeLast = _pair.price1CumulativeLast(); // Fetch the current accumulated price value (0 / 1) uint112 reserve0; uint112 reserve1; (reserve0, reserve1, blockTimestampLast) = _pair.getReserves(); require(reserve0 != 0 && reserve1 != 0, "PairOracle: NO_RESERVES"); // Ensure that there's liquidity in the pair } function setPeriod(uint256 _period) external onlyOwner { PERIOD = _period; } function update() external { (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = currentCumulativePrices(address(pair)); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // Overflow is desired // Ensure that at least one full period has passed since the last update require(timeElapsed >= PERIOD, "PairOracle: PERIOD_NOT_ELAPSED"); // Overflow is desired, casting never truncates // Cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed)); price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed)); price0CumulativeLast = price0Cumulative; price1CumulativeLast = price1Cumulative; blockTimestampLast = blockTimestamp; } // Note this will always return 0 before update has been called successfully for the first time. function twap(address token, uint256 pricePrecision) external view returns (uint256 amountOut) { if (token == token0) { amountOut = price0Average.mul(pricePrecision).decode144(); } else { require(token == token1, "PairOracle: INVALID_TOKEN"); amountOut = price1Average.mul(pricePrecision).decode144(); } } function spot(address token, uint256 pricePrecision) external view returns (uint256 amountOut) { IUniswapV2Pair uniswapPair = IUniswapV2Pair(pair); address _token0 = uniswapPair.token0(); address _token1 = uniswapPair.token1(); require(_token0 == token || _token1 == token, "Invalid pair"); (uint256 _reserve0, uint256 _reserve1, ) = uniswapPair.getReserves(); require(_reserve0 > 0 && _reserve1 > 0, "No reserves"); uint8 _token0MissingDecimals = 18 - (ERC20(_token0).decimals()); uint8 _token1MissingDecimals = 18 - (ERC20(_token1).decimals()); uint256 _price = 0; if (token == _token0) { _price = _reserve1.mul(10**_token1MissingDecimals).mul(pricePrecision).div(_reserve0); } else { _price = _reserve0.mul(10**_token0MissingDecimals).mul(pricePrecision).div(_reserve1); } return _price; } function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2**32); } // produces the cumulative price using counterfactuals to save gas and avoid a call to sync. function currentCumulativePrices(address _pair) internal view returns ( uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp ) { blockTimestamp = currentBlockTimestamp(); IUniswapV2Pair uniswapPair = IUniswapV2Pair(_pair); price0Cumulative = uniswapPair.price0CumulativeLast(); price1Cumulative = uniswapPair.price1CumulativeLast(); // if time has elapsed since the last update on the pair, mock the accumulated price values (uint112 reserve0, uint112 reserve1, uint32 _blockTimestampLast) = uniswapPair.getReserves(); if (_blockTimestampLast != blockTimestamp) { // subtraction overflow is desired uint32 timeElapsed = blockTimestamp - _blockTimestampLast; // addition overflow is desired // counterfactual price0Cumulative += uint256(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed; // counterfactual price1Cumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ 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) { unchecked { 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) { unchecked { 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) { unchecked { // 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) { unchecked { 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) { unchecked { 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) { return a + b; } /** * @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) { 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) { return a * b; } /** * @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. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { 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) { 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) { unchecked { 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. * * 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) { unchecked { 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) { unchecked { require(b > 0, errorMessage); return a % b; } } }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; // computes square roots using the babylonian method // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method library Babylonian { function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } // else z = 0 } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./Babylonian.sol"; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) library FixedPoint { // range: [0, 2**112 - 1] // resolution: 1 / 2**112 struct uq112x112 { uint224 _x; } // range: [0, 2**144 - 1] // resolution: 1 / 2**112 struct uq144x112 { uint256 _x; } uint8 private constant RESOLUTION = 112; uint256 private constant Q112 = uint256(1) << RESOLUTION; uint256 private constant Q224 = Q112 << RESOLUTION; // encode a uint112 as a UQ112x112 function encode(uint112 x) internal pure returns (uq112x112 memory) { return uq112x112(uint224(x) << RESOLUTION); } // encodes a uint144 as a UQ144x112 function encode144(uint144 x) internal pure returns (uq144x112 memory) { return uq144x112(uint256(x) << RESOLUTION); } // divide a UQ112x112 by a uint112, returning a UQ112x112 function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) { require(x != 0, "FixedPoint: DIV_BY_ZERO"); return uq112x112(self._x / uint224(x)); } // multiply a UQ112x112 by a uint, returning a UQ144x112 // reverts on overflow function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) { uint256 z; require(y == 0 || (z = uint256(self._x) * y) / y == uint256(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW"); return uq144x112(z); } // returns a UQ112x112 which represents the ratio of the numerator to the denominator // equivalent to encode(numerator).div(denominator) function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) { require(denominator > 0, "FixedPoint: DIV_BY_ZERO"); return uq112x112((uint224(numerator) << RESOLUTION) / denominator); } // decode a UQ112x112 into a uint112 by truncating after the radix point function decode(uq112x112 memory self) internal pure returns (uint112) { return uint112(self._x >> RESOLUTION); } // decode a UQ144x112 into a uint144 by truncating after the radix point function decode144(uq144x112 memory self) internal pure returns (uint144) { return uint144(self._x >> RESOLUTION); } // take the reciprocal of a UQ112x112 function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) { require(self._x != 0, "FixedPoint: ZERO_RECIPROCAL"); return uq112x112(uint224(Q224 / self._x)); } // square root of a UQ112x112 function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) { return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"pairAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price0Average","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price1Average","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"pricePrecision","type":"uint256"}],"name":"spot","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"pricePrecision","type":"uint256"}],"name":"twap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040526102586001553480156200001757600080fd5b5060405162001677380380620016778339810160408190526200003a91620003ff565b620000453362000392565b6000819050806001600160a01b03166080816001600160a01b031660601b81525050806001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620000a157600080fd5b505afa158015620000b6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000dc9190620003ff565b6001600160a01b031660a0816001600160a01b031660601b81525050806001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200013257600080fd5b505afa15801562000147573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200016d9190620003ff565b6001600160a01b031660c0816001600160a01b031660601b81525050806001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b158015620001c357600080fd5b505afa158015620001d8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001fe919062000483565b600281905550806001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b1580156200023e57600080fd5b505afa15801562000253573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000279919062000483565b600381905550600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015620002bc57600080fd5b505afa158015620002d1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002f791906200042f565b6004805463ffffffff191663ffffffff9290921691909117905590925090506001600160701b038216158015906200033757506001600160701b03811615155b620003885760405162461bcd60e51b815260206004820152601760248201527f506169724f7261636c653a204e4f5f5245534552564553000000000000000000604482015260640160405180910390fd5b505050506200049c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160701b0381168114620003fa57600080fd5b919050565b60006020828403121562000411578081fd5b81516001600160a01b038116811462000428578182fd5b9392505050565b60008060006060848603121562000444578182fd5b6200044f84620003e2565b92506200045f60208501620003e2565b9150604084015163ffffffff8116811462000478578182fd5b809150509250925092565b60006020828403121562000495578081fd5b5051919050565b60805160601c60a05160601c60c05160601c611186620004f16000396000818161025d015261071301526000818161010a015261069b015260008181610208015281816102cf015261080901526111866000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063b4d1d79511610066578063b4d1d7951461022a578063c5700a0214610233578063d21220a714610258578063f2fde38b1461027f57600080fd5b80638da5cb5b146101d7578063a2e62045146101e8578063a6bb4539146101f0578063a8aa1b311461020357600080fd5b80635a3d5493116100d35780635a3d5493146101885780635e6aaf2c146101915780636808a128146101bc578063715018a6146101cf57600080fd5b80630dfe1681146101055780630f3a9f6514610149578063153ffc771461015e5780635909c0d51461017f575b600080fd5b61012c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61015c610157366004610eb7565b610292565b005b61017161016c366004610e3e565b6102ca565b604051908152602001610140565b61017160025481565b61017160035481565b6006546101a4906001600160e01b031681565b6040516001600160e01b039091168152602001610140565b6101716101ca366004610e3e565b610697565b61015c6107c9565b6000546001600160a01b031661012c565b61015c6107ff565b6005546101a4906001600160e01b031681565b61012c7f000000000000000000000000000000000000000000000000000000000000000081565b61017160015481565b6004546102439063ffffffff1681565b60405163ffffffff9091168152602001610140565b61012c7f000000000000000000000000000000000000000000000000000000000000000081565b61015c61028d366004610e06565b61096a565b6000546001600160a01b031633146102c55760405162461bcd60e51b81526004016102bc90610f08565b60405180910390fd5b600155565b6000807f000000000000000000000000000000000000000000000000000000000000000090506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561032b57600080fd5b505afa15801561033f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103639190610e22565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d89190610e22565b9050856001600160a01b0316826001600160a01b0316148061040b5750856001600160a01b0316816001600160a01b0316145b6104465760405162461bcd60e51b815260206004820152600c60248201526b24b73b30b634b2103830b4b960a11b60448201526064016102bc565b600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561048257600080fd5b505afa158015610496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba9190610e69565b506001600160701b031691506001600160701b031691506000821180156104e15750600081115b61051b5760405162461bcd60e51b815260206004820152600b60248201526a4e6f20726573657276657360a81b60448201526064016102bc565b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561055657600080fd5b505afa15801561056a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058e9190610ee7565b6105999060126110d8565b90506000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d657600080fd5b505afa1580156105ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060e9190610ee7565b6106199060126110d8565b90506000866001600160a01b03168b6001600160a01b03161415610667576106608561065a8c61065461064d87600a610fd2565b8990610a05565b90610a05565b90610a18565b9050610687565b6106848461065a8c61065461067d88600a610fd2565b8a90610a05565b90505b9750505050505050505b92915050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614156107115760408051602081019091526005546001600160e01b03168152610701906106fa9084610a24565b5160701c90565b6001600160901b03169050610691565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146107925760405162461bcd60e51b815260206004820152601960248201527f506169724f7261636c653a20494e56414c49445f544f4b454e0000000000000060448201526064016102bc565b60408051602081019091526006546001600160e01b031681526107b9906106fa9084610a24565b6001600160901b03169392505050565b6000546001600160a01b031633146107f35760405162461bcd60e51b81526004016102bc90610f08565b6107fd6000610ace565b565b600080600061082d7f0000000000000000000000000000000000000000000000000000000000000000610b1e565b600454929550909350915060009061084b9063ffffffff16836110b3565b90506001548163ffffffff1610156108a55760405162461bcd60e51b815260206004820152601e60248201527f506169724f7261636c653a20504552494f445f4e4f545f454c4150534544000060448201526064016102bc565b60405180602001604052808263ffffffff16600254876108c5919061109c565b6108cf9190610f7b565b6001600160e01b039081169091529051600580546001600160e01b031916919092161790556040805160208101909152600354819063ffffffff841690610916908761109c565b6109209190610f7b565b6001600160e01b039081169091529051600680546001600160e01b03191691909216179055506002929092556003556004805463ffffffff191663ffffffff909216919091179055565b6000546001600160a01b031633146109945760405162461bcd60e51b81526004016102bc90610f08565b6001600160a01b0381166109f95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102bc565b610a0281610ace565b50565b6000610a11828461107d565b9392505050565b6000610a118284610f7b565b6040805160208101909152600081526000821580610a61575083516001600160e01b031683610a53818361107d565b9250610a5f9083610f7b565b145b610ab95760405162461bcd60e51b815260206004820152602360248201527f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552466044820152624c4f5760e81b60648201526084016102bc565b60408051602081019091529081529392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000610b2b610d24565b90506000849050806001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6b57600080fd5b505afa158015610b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba39190610ecf565b9350806001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c169190610ecf565b92506000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c5657600080fd5b505afa158015610c6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8e9190610e69565b9250925092508463ffffffff168163ffffffff1614610d19576000610cb382876110b3565b90508063ffffffff16610cc68486610d3a565b51610cda91906001600160e01b031661107d565b610ce49089610f3d565b97508063ffffffff16610cf78585610d3a565b51610d0b91906001600160e01b031661107d565b610d159088610f3d565b9650505b505050509193909250565b6000610d35640100000000426110fb565b905090565b6040805160208101909152600081526000826001600160701b031611610da25760405162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f00000000000000000060448201526064016102bc565b604080516020810190915280610dd86001600160701b0385166dffffffffffffffffffffffffffff60701b607088901b16610f55565b6001600160e01b031690529392505050565b80516001600160701b0381168114610e0157600080fd5b919050565b600060208284031215610e17578081fd5b8135610a118161113b565b600060208284031215610e33578081fd5b8151610a118161113b565b60008060408385031215610e50578081fd5b8235610e5b8161113b565b946020939093013593505050565b600080600060608486031215610e7d578081fd5b610e8684610dea565b9250610e9460208501610dea565b9150604084015163ffffffff81168114610eac578182fd5b809150509250925092565b600060208284031215610ec8578081fd5b5035919050565b600060208284031215610ee0578081fd5b5051919050565b600060208284031215610ef8578081fd5b815160ff81168114610a11578182fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610f5057610f5061110f565b500190565b60006001600160e01b0383811680610f6f57610f6f611125565b92169190910492915050565b600082610f8a57610f8a611125565b500490565b600181815b80851115610fca578160001904821115610fb057610fb061110f565b80851615610fbd57918102915b93841c9390800290610f94565b509250929050565b6000610a1160ff841683600082610feb57506001610691565b81610ff857506000610691565b816001811461100e576002811461101857611034565b6001915050610691565b60ff8411156110295761102961110f565b50506001821b610691565b5060208310610133831016604e8410600b8410161715611057575081810a610691565b6110618383610f8f565b80600019048211156110755761107561110f565b029392505050565b60008160001904831182151516156110975761109761110f565b500290565b6000828210156110ae576110ae61110f565b500390565b600063ffffffff838116908316818110156110d0576110d061110f565b039392505050565b600060ff821660ff8416808210156110f2576110f261110f565b90039392505050565b60008261110a5761110a611125565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b0381168114610a0257600080fdfea26469706673582212209b20b093c8868186196d6bdce94261a0aaeef33e328603b042d1de28296a115164736f6c63430008040033000000000000000000000000128aff18eff64da69412ea8d262dc4ef8bb3102d
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063b4d1d79511610066578063b4d1d7951461022a578063c5700a0214610233578063d21220a714610258578063f2fde38b1461027f57600080fd5b80638da5cb5b146101d7578063a2e62045146101e8578063a6bb4539146101f0578063a8aa1b311461020357600080fd5b80635a3d5493116100d35780635a3d5493146101885780635e6aaf2c146101915780636808a128146101bc578063715018a6146101cf57600080fd5b80630dfe1681146101055780630f3a9f6514610149578063153ffc771461015e5780635909c0d51461017f575b600080fd5b61012c7f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c8381565b6040516001600160a01b0390911681526020015b60405180910390f35b61015c610157366004610eb7565b610292565b005b61017161016c366004610e3e565b6102ca565b604051908152602001610140565b61017160025481565b61017160035481565b6006546101a4906001600160e01b031681565b6040516001600160e01b039091168152602001610140565b6101716101ca366004610e3e565b610697565b61015c6107c9565b6000546001600160a01b031661012c565b61015c6107ff565b6005546101a4906001600160e01b031681565b61012c7f000000000000000000000000128aff18eff64da69412ea8d262dc4ef8bb3102d81565b61017160015481565b6004546102439063ffffffff1681565b60405163ffffffff9091168152602001610140565b61012c7f000000000000000000000000fbd2945d3601f21540ddd85c29c5c3caf108b96f81565b61015c61028d366004610e06565b61096a565b6000546001600160a01b031633146102c55760405162461bcd60e51b81526004016102bc90610f08565b60405180910390fd5b600155565b6000807f000000000000000000000000128aff18eff64da69412ea8d262dc4ef8bb3102d90506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561032b57600080fd5b505afa15801561033f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103639190610e22565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d89190610e22565b9050856001600160a01b0316826001600160a01b0316148061040b5750856001600160a01b0316816001600160a01b0316145b6104465760405162461bcd60e51b815260206004820152600c60248201526b24b73b30b634b2103830b4b960a11b60448201526064016102bc565b600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561048257600080fd5b505afa158015610496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba9190610e69565b506001600160701b031691506001600160701b031691506000821180156104e15750600081115b61051b5760405162461bcd60e51b815260206004820152600b60248201526a4e6f20726573657276657360a81b60448201526064016102bc565b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561055657600080fd5b505afa15801561056a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058e9190610ee7565b6105999060126110d8565b90506000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d657600080fd5b505afa1580156105ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060e9190610ee7565b6106199060126110d8565b90506000866001600160a01b03168b6001600160a01b03161415610667576106608561065a8c61065461064d87600a610fd2565b8990610a05565b90610a05565b90610a18565b9050610687565b6106848461065a8c61065461067d88600a610fd2565b8a90610a05565b90505b9750505050505050505b92915050565b60007f00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c836001600160a01b0316836001600160a01b031614156107115760408051602081019091526005546001600160e01b03168152610701906106fa9084610a24565b5160701c90565b6001600160901b03169050610691565b7f000000000000000000000000fbd2945d3601f21540ddd85c29c5c3caf108b96f6001600160a01b0316836001600160a01b0316146107925760405162461bcd60e51b815260206004820152601960248201527f506169724f7261636c653a20494e56414c49445f544f4b454e0000000000000060448201526064016102bc565b60408051602081019091526006546001600160e01b031681526107b9906106fa9084610a24565b6001600160901b03169392505050565b6000546001600160a01b031633146107f35760405162461bcd60e51b81526004016102bc90610f08565b6107fd6000610ace565b565b600080600061082d7f000000000000000000000000128aff18eff64da69412ea8d262dc4ef8bb3102d610b1e565b600454929550909350915060009061084b9063ffffffff16836110b3565b90506001548163ffffffff1610156108a55760405162461bcd60e51b815260206004820152601e60248201527f506169724f7261636c653a20504552494f445f4e4f545f454c4150534544000060448201526064016102bc565b60405180602001604052808263ffffffff16600254876108c5919061109c565b6108cf9190610f7b565b6001600160e01b039081169091529051600580546001600160e01b031916919092161790556040805160208101909152600354819063ffffffff841690610916908761109c565b6109209190610f7b565b6001600160e01b039081169091529051600680546001600160e01b03191691909216179055506002929092556003556004805463ffffffff191663ffffffff909216919091179055565b6000546001600160a01b031633146109945760405162461bcd60e51b81526004016102bc90610f08565b6001600160a01b0381166109f95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102bc565b610a0281610ace565b50565b6000610a11828461107d565b9392505050565b6000610a118284610f7b565b6040805160208101909152600081526000821580610a61575083516001600160e01b031683610a53818361107d565b9250610a5f9083610f7b565b145b610ab95760405162461bcd60e51b815260206004820152602360248201527f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552466044820152624c4f5760e81b60648201526084016102bc565b60408051602081019091529081529392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000610b2b610d24565b90506000849050806001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6b57600080fd5b505afa158015610b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba39190610ecf565b9350806001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c169190610ecf565b92506000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c5657600080fd5b505afa158015610c6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8e9190610e69565b9250925092508463ffffffff168163ffffffff1614610d19576000610cb382876110b3565b90508063ffffffff16610cc68486610d3a565b51610cda91906001600160e01b031661107d565b610ce49089610f3d565b97508063ffffffff16610cf78585610d3a565b51610d0b91906001600160e01b031661107d565b610d159088610f3d565b9650505b505050509193909250565b6000610d35640100000000426110fb565b905090565b6040805160208101909152600081526000826001600160701b031611610da25760405162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f00000000000000000060448201526064016102bc565b604080516020810190915280610dd86001600160701b0385166dffffffffffffffffffffffffffff60701b607088901b16610f55565b6001600160e01b031690529392505050565b80516001600160701b0381168114610e0157600080fd5b919050565b600060208284031215610e17578081fd5b8135610a118161113b565b600060208284031215610e33578081fd5b8151610a118161113b565b60008060408385031215610e50578081fd5b8235610e5b8161113b565b946020939093013593505050565b600080600060608486031215610e7d578081fd5b610e8684610dea565b9250610e9460208501610dea565b9150604084015163ffffffff81168114610eac578182fd5b809150509250925092565b600060208284031215610ec8578081fd5b5035919050565b600060208284031215610ee0578081fd5b5051919050565b600060208284031215610ef8578081fd5b815160ff81168114610a11578182fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610f5057610f5061110f565b500190565b60006001600160e01b0383811680610f6f57610f6f611125565b92169190910492915050565b600082610f8a57610f8a611125565b500490565b600181815b80851115610fca578160001904821115610fb057610fb061110f565b80851615610fbd57918102915b93841c9390800290610f94565b509250929050565b6000610a1160ff841683600082610feb57506001610691565b81610ff857506000610691565b816001811461100e576002811461101857611034565b6001915050610691565b60ff8411156110295761102961110f565b50506001821b610691565b5060208310610133831016604e8410600b8410161715611057575081810a610691565b6110618383610f8f565b80600019048211156110755761107561110f565b029392505050565b60008160001904831182151516156110975761109761110f565b500290565b6000828210156110ae576110ae61110f565b500390565b600063ffffffff838116908316818110156110d0576110d061110f565b039392505050565b600060ff821660ff8416808210156110f2576110f261110f565b90039392505050565b60008261110a5761110a611125565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b0381168114610a0257600080fdfea26469706673582212209b20b093c8868186196d6bdce94261a0aaeef33e328603b042d1de28296a115164736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000128aff18eff64da69412ea8d262dc4ef8bb3102d
-----Decoded View---------------
Arg [0] : pairAddress (address): 0x128aff18EfF64dA69412ea8d262DC4ef8bb3102d
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000128aff18eff64da69412ea8d262dc4ef8bb3102d
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.