ETH Price: $2,281.85 (-6.62%)

Contract

0x781B291E4D5cA2b0eD46eBd37dDc70b3242FAc2d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...157883122022-10-20 9:07:35865 days ago1666256855IN
0x781B291E...3242FAc2d
0 ETH0.0005684621.03165882

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RangePriceGetter

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 2 : RangePriceGetter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

import {IPriceGetter} from "./interfaces/IPriceGetter.sol";

contract RangePriceGetter is IPriceGetter {

  uint256[2] public priceRange;
  IPriceGetter public priceGetter;
  address public owner;

  constructor(address _priceGetter, uint256[2] memory _priceRange) {
    priceGetter = IPriceGetter(_priceGetter);
    priceRange = _priceRange;
    owner = msg.sender;
  }

  function getPrice() external view override returns (uint256 price) {
    uint256 twapPrice = priceGetter.getPrice();
    uint256 minPrice = min(priceRange[0], priceRange[1]);
    uint256 maxPrice = max(priceRange[0], priceRange[1]);
    if (twapPrice > maxPrice) {
      price = maxPrice;
    } else if (twapPrice < minPrice) {
      price = minPrice;
    } else {
      price = twapPrice;
    }
  }

  function setPriceRange(uint256[2] calldata _priceRange) external onlyOwner {
    priceRange = _priceRange;
  }

  function min(uint256 a, uint256 b) internal pure returns (uint256) {
    return a > b ? b : a;
  }

  function max(uint256 a, uint256 b) internal pure returns (uint256) {
    return a > b ? a : b;
  }

  function transferOwnership(address newOwner) external onlyOwner {
    require(newOwner != address(0), "Ownable: new owner is the zero address");
    owner = newOwner;
  }

  modifier onlyOwner() {
    require(msg.sender == owner, "Only owner can call this function.");
    _;
  }
}

File 2 of 2 : IPriceGetter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

interface IPriceGetter {
  function getPrice() external view returns (uint256 price);
}

Settings
{
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_priceGetter","type":"address"},{"internalType":"uint256[2]","name":"_priceRange","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceGetter","outputs":[{"internalType":"contract IPriceGetter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"priceRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[2]","name":"_priceRange","type":"uint256[2]"}],"name":"setPriceRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506040516107b53803806107b58339818101604052606081101561003357600080fd5b81019080805190602001909291909190505081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060009060026100979291906100e0565b5033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505061013d565b826002810192821561010f579160200282015b8281111561010e5782518255916020019190600101906100f3565b5b50905061011c9190610120565b5090565b5b80821115610139576000816000905550600101610121565b5090565b6106698061014c6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806357332838146100675780635af27e01146100955780638da5cb5b146100d757806398d5fdca1461010b578063ceed1b9014610129578063f2fde38b1461015d575b600080fd5b6100936004803603604081101561007d57600080fd5b81019080806040019091929192905050506101a1565b005b6100c1600480360360208110156100ab57600080fd5b810190808035906020019092919050505061025c565b6040518082815260200191505060405180910390f35b6100df610277565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61011361029d565b6040518082815260200191505060405180910390f35b6101316103c6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61019f6004803603602081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103ec565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610247576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806105ec6022913960400191505060405180910390fd5b80600090600261025892919061058e565b5050565b6000816002811061026c57600080fd5b016000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166398d5fdca6040518163ffffffff1660e01b815260040160206040518083038186803b15801561030857600080fd5b505afa15801561031c573d6000803e3d6000fd5b505050506040513d602081101561033257600080fd5b81019080805190602001909291905050509050600061036e6000806002811061035757fe5b0154600060016002811061036757fe5b015461055c565b905060006103996000806002811061038257fe5b0154600060016002811061039257fe5b0154610575565b9050808311156103ab578093506103c0565b818310156103bb578193506103bf565b8293505b5b50505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610492576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806105ec6022913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610518576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061060e6026913960400191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081831161056b578261056d565b815b905092915050565b60008183116105845781610586565b825b905092915050565b82600281019282156105bd579160200282015b828111156105bc5782358255916020019190600101906105a1565b5b5090506105ca91906105ce565b5090565b5b808211156105e75760008160009055506001016105cf565b509056fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122023a6e8b318d874f05e1f5e0c348b307cbdfa0fc68dfcacadf94017bbad89365264736f6c63430007060033000000000000000000000000d994782fbd30de57cc01b86ff1e1d03b7bd1d6830000000000000000000000000000000000000000000000000000000102168e800000000000000000000000000000000000000000000000000000000102168e80

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100625760003560e01c806357332838146100675780635af27e01146100955780638da5cb5b146100d757806398d5fdca1461010b578063ceed1b9014610129578063f2fde38b1461015d575b600080fd5b6100936004803603604081101561007d57600080fd5b81019080806040019091929192905050506101a1565b005b6100c1600480360360208110156100ab57600080fd5b810190808035906020019092919050505061025c565b6040518082815260200191505060405180910390f35b6100df610277565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61011361029d565b6040518082815260200191505060405180910390f35b6101316103c6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61019f6004803603602081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103ec565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610247576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806105ec6022913960400191505060405180910390fd5b80600090600261025892919061058e565b5050565b6000816002811061026c57600080fd5b016000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166398d5fdca6040518163ffffffff1660e01b815260040160206040518083038186803b15801561030857600080fd5b505afa15801561031c573d6000803e3d6000fd5b505050506040513d602081101561033257600080fd5b81019080805190602001909291905050509050600061036e6000806002811061035757fe5b0154600060016002811061036757fe5b015461055c565b905060006103996000806002811061038257fe5b0154600060016002811061039257fe5b0154610575565b9050808311156103ab578093506103c0565b818310156103bb578193506103bf565b8293505b5b50505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610492576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806105ec6022913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610518576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061060e6026913960400191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081831161056b578261056d565b815b905092915050565b60008183116105845781610586565b825b905092915050565b82600281019282156105bd579160200282015b828111156105bc5782358255916020019190600101906105a1565b5b5090506105ca91906105ce565b5090565b5b808211156105e75760008160009055506001016105cf565b509056fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122023a6e8b318d874f05e1f5e0c348b307cbdfa0fc68dfcacadf94017bbad89365264736f6c63430007060033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000d994782fbd30de57cc01b86ff1e1d03b7bd1d6830000000000000000000000000000000000000000000000000000000102168e800000000000000000000000000000000000000000000000000000000102168e80

-----Decoded View---------------
Arg [0] : _priceGetter (address): 0xd994782fbD30De57cC01B86fF1E1d03B7bd1d683
Arg [1] : _priceRange (uint256[2]): 4330000000,4330000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000d994782fbd30de57cc01b86ff1e1d03b7bd1d683
Arg [1] : 0000000000000000000000000000000000000000000000000000000102168e80
Arg [2] : 0000000000000000000000000000000000000000000000000000000102168e80


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.