ETH Price: $3,399.94 (+1.96%)

Contract

0x54bF24e1070784D7F0760095932b47CE55eb3A91
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update Rate77713952019-05-16 12:51:372053 days ago1558011097IN
0x54bF24e1...E55eb3A91
0 ETH0.0005954716
Update Rate77710312019-05-16 11:28:132054 days ago1558006093IN
0x54bF24e1...E55eb3A91
0 ETH0.0003720610
Update Rate77709162019-05-16 11:01:122054 days ago1558004472IN
0x54bF24e1...E55eb3A91
0 ETH0.0006661817.9
Update Rate77707392019-05-16 10:26:112054 days ago1558002371IN
0x54bF24e1...E55eb3A91
0 ETH0.0006659817.9
Update Rate77707172019-05-16 10:21:172054 days ago1558002077IN
0x54bF24e1...E55eb3A91
0 ETH0.0006661817.9
Update Rate77706762019-05-16 10:11:152054 days ago1558001475IN
0x54bF24e1...E55eb3A91
0 ETH0.0006659817.9
Update Rate77706572019-05-16 10:06:312054 days ago1558001191IN
0x54bF24e1...E55eb3A91
0 ETH0.000446612
Update Rate77701382019-05-16 8:06:592054 days ago1557994019IN
0x54bF24e1...E55eb3A91
0 ETH0.0007071219
Update Rate77699702019-05-16 7:26:102054 days ago1557991570IN
0x54bF24e1...E55eb3A91
0 ETH0.0006736918.10181
Update Rate77698562019-05-16 6:56:162054 days ago1557989776IN
0x54bF24e1...E55eb3A91
0 ETH0.000669718
Update Rate77697912019-05-16 6:43:582054 days ago1557989038IN
0x54bF24e1...E55eb3A91
0 ETH0.0003721710
Update Rate77697532019-05-16 6:36:352054 days ago1557988595IN
0x54bF24e1...E55eb3A91
0 ETH0.0005208814
Update Rate77694072019-05-16 5:11:322054 days ago1557983492IN
0x54bF24e1...E55eb3A91
0 ETH0.0005952916
Update Rate77692802019-05-16 4:43:292054 days ago1557981809IN
0x54bF24e1...E55eb3A91
0 ETH0.0005580915
Update Rate77692282019-05-16 4:32:032054 days ago1557981123IN
0x54bF24e1...E55eb3A91
0 ETH0.0005580915
Update Rate77691472019-05-16 4:11:222054 days ago1557979882IN
0x54bF24e1...E55eb3A91
0 ETH0.0005582515
Update Rate77689482019-05-16 3:26:002054 days ago1557977160IN
0x54bF24e1...E55eb3A91
0 ETH0.0004800912.9
Update Rate77688212019-05-16 2:56:132054 days ago1557975373IN
0x54bF24e1...E55eb3A91
0 ETH0.0005210314
Update Rate77688092019-05-16 2:53:062054 days ago1557975186IN
0x54bF24e1...E55eb3A91
0 ETH0.0004836713
Update Rate77686202019-05-16 2:06:242054 days ago1557972384IN
0x54bF24e1...E55eb3A91
0 ETH0.0004836713
Update Rate77682572019-05-16 0:51:122054 days ago1557967872IN
0x54bF24e1...E55eb3A91
0 ETH0.0004836713
Update Rate77682022019-05-16 0:36:282054 days ago1557966988IN
0x54bF24e1...E55eb3A91
0 ETH0.000364729.8
Update Rate77681332019-05-16 0:21:372054 days ago1557966097IN
0x54bF24e1...E55eb3A91
0 ETH0.000297738
Update Rate77679242019-05-15 23:32:172054 days ago1557963137IN
0x54bF24e1...E55eb3A91
0 ETH0.000111613
Update Rate77677872019-05-15 23:02:012054 days ago1557961321IN
0x54bF24e1...E55eb3A91
0 ETH0.0003720610
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MakerDAOPriceFeed

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-07-09
*/

pragma solidity 0.4.24;

// File: contracts/interfaces/EthPriceFeedI.sol

interface EthPriceFeedI {
    function getUnit() external view returns(string);
    function getRate() external view returns(uint256);
    function getLastTimeUpdated() external view returns(uint256); 
}

// File: contracts/interfaces/ReadableI.sol

// https://github.com/makerdao/feeds/blob/master/src/abi/readable.json

pragma solidity 0.4.24;

interface ReadableI {

    // We only care about these functions
    function peek() external view returns(bytes32, bool);
    function read() external view returns(bytes32);

    // function owner() external view returns(address);
    // function zzz() external view returns(uint256);
}

// File: openzeppelin-solidity/contracts/math/SafeMath.sol

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    // uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return a / b;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
    c = a + b;
    assert(c >= a);
    return c;
  }
}

// File: openzeppelin-solidity/contracts/ownership/Ownable.sol

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


  event OwnershipRenounced(address indexed previousOwner);
  event OwnershipTransferred(
    address indexed previousOwner,
    address indexed newOwner
  );


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function transferOwnership(address _newOwner) public onlyOwner {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}

// File: contracts/MakerDAOPriceFeed.sol

contract MakerDAOPriceFeed is Ownable, EthPriceFeedI {
    using SafeMath for uint256;
    
    uint256 public constant RATE_THRESHOLD_PERCENTAGE = 10;
    uint256 public constant MAKERDAO_FEED_MULTIPLIER = 10**36;

    ReadableI public makerDAOMedianizer;

    uint256 private weiPerUnitRate;

    uint256 private lastTimeUpdated; 
    
    event RateUpdated(uint256 _newRate, uint256 _timeUpdated);

    modifier isValidRate(uint256 _weiPerUnitRate) {
        require(validRate(_weiPerUnitRate));
        _;
    }

    constructor(ReadableI _makerDAOMedianizer) public {
        require(_makerDAOMedianizer != address(0));
        makerDAOMedianizer = _makerDAOMedianizer;

        weiPerUnitRate = convertToRate(_makerDAOMedianizer.read());
        lastTimeUpdated = now;
    }
    
    /// @dev Receives rate from outside oracle
    /// @param _weiPerUnitRate calculated off chain and received in the contract
    function updateRate(uint256 _weiPerUnitRate) 
        external 
        onlyOwner
        isValidRate(_weiPerUnitRate)
    {
        weiPerUnitRate = _weiPerUnitRate;

        lastTimeUpdated = now; 

        emit RateUpdated(_weiPerUnitRate, now);
    }

    function getUnit()
        external
        view 
        returns(string)
    {
        return "USD";
    }

    /// @dev View function to see the rate stored in the contract.
    function getRate() 
        public 
        view 
        returns(uint256)
    {
        return weiPerUnitRate; 
    }

    /// @dev View function to see that last time that the rate was updated. 
    function getLastTimeUpdated()
        public
        view
        returns(uint256)
    {
        return lastTimeUpdated;
    }

    /// @dev Checks that a rate is valid.
    /// @param _weiPerUnitRate The rate to check
    /// @return True iff the rate is valid
    function validRate(uint256 _weiPerUnitRate) public view returns(bool) {
        if (_weiPerUnitRate == 0) return false;

        (bytes32 value, bool valid) = makerDAOMedianizer.peek();

        // If the value from the medianizer is not valid, use the current rate as reference
        uint256 currentRate = valid ? convertToRate(value) : weiPerUnitRate;

        // Get the difference
        uint256 diff = _weiPerUnitRate < currentRate ?  currentRate.sub(_weiPerUnitRate) : _weiPerUnitRate.sub(currentRate);

        return diff <= currentRate.mul(RATE_THRESHOLD_PERCENTAGE).div(100);
    }

    /// @dev Transforms a bytes32 value taken from MakerDAO's Medianizer contract into wei per usd rate
    /// @param _fromMedianizer Value taken from MakerDAO's Medianizer contract
    /// @return The wei per usd rate
    function convertToRate(bytes32 _fromMedianizer) internal pure returns(uint256) {
        uint256 value = uint256(_fromMedianizer);
        return MAKERDAO_FEED_MULTIPLIER.div(value);
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"makerDAOMedianizer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"RATE_THRESHOLD_PERCENTAGE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_weiPerUnitRate","type":"uint256"}],"name":"validRate","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAKERDAO_FEED_MULTIPLIER","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_weiPerUnitRate","type":"uint256"}],"name":"updateRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastTimeUpdated","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getUnit","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_makerDAOMedianizer","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_newRate","type":"uint256"},{"indexed":false,"name":"_timeUpdated","type":"uint256"}],"name":"RateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

608060405234801561001057600080fd5b50604051602080610783833981016040525160008054600160a060020a03191633179055600160a060020a038116151561004957600080fd5b60018054600160a060020a031916600160a060020a038316908117909155604080517f57de26a400000000000000000000000000000000000000000000000000000000815290516100f692916357de26a49160048083019260209291908290030181600087803b1580156100bc57600080fd5b505af11580156100d0573d6000803e3d6000fd5b505050506040513d60208110156100e657600080fd5b5051640100000000610103810204565b6002555042600355610148565b60008161012c6ec097ce7bc90715b34b9f10000000008264010000000061056e61013382021704565b9392505050565b6000818381151561014057fe5b049392505050565b61062c806101576000396000f3006080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633bd137e081146100b35780633fdbb6c7146100e457806349a742eb1461010b5780634a6213a114610137578063679aefce1461014c57806369ea177114610161578063715018a61461017b5780638da5cb5b14610190578063d390021d146101a5578063e55186a1146101ba578063f2fde38b14610244575b600080fd5b3480156100bf57600080fd5b506100c8610265565b60408051600160a060020a039092168252519081900360200190f35b3480156100f057600080fd5b506100f9610274565b60408051918252519081900360200190f35b34801561011757600080fd5b50610123600435610279565b604080519115158252519081900360200190f35b34801561014357600080fd5b506100f961039b565b34801561015857600080fd5b506100f96103ae565b34801561016d57600080fd5b506101796004356103b4565b005b34801561018757600080fd5b5061017961042a565b34801561019c57600080fd5b506100c8610496565b3480156101b157600080fd5b506100f96104a5565b3480156101c657600080fd5b506101cf6104ab565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b50610179600160a060020a03600435166104e2565b600154600160a060020a031681565b600a81565b60008080808085151561028f5760009450610392565b600154604080517f59e02dd70000000000000000000000000000000000000000000000000000000081528151600160a060020a03909316926359e02dd7926004808401939192918290030181600087803b1580156102ec57600080fd5b505af1158015610300573d6000803e3d6000fd5b505050506040513d604081101561031657600080fd5b5080516020909101519094509250826103315760025461033a565b61033a84610505565b915081861061035857610353868363ffffffff61052e16565b610368565b610368828763ffffffff61052e16565b905061038c606461038084600a63ffffffff61054516565b9063ffffffff61056e16565b81111594505b50505050919050565b6ec097ce7bc90715b34b9f100000000081565b60025490565b600054600160a060020a031633146103cb57600080fd5b806103d581610279565b15156103e057600080fd5b600282905542600381905560408051848152602081019290925280517fb38780ddde1f073d91c150de2696f3f7085883648ba21cc5ef01029cb21d19169281900390910190a15050565b600054600160a060020a0316331461044157600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b60035490565b60408051808201909152600381527f5553440000000000000000000000000000000000000000000000000000000000602082015290565b600054600160a060020a031633146104f957600080fd5b61050281610583565b50565b6000816105276ec097ce7bc90715b34b9f10000000008263ffffffff61056e16565b9392505050565b60008282111561053a57fe5b508082035b92915050565b60008215156105565750600061053f565b5081810281838281151561056657fe5b041461053f57fe5b6000818381151561057b57fe5b049392505050565b600160a060020a038116151561059857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820d59f57543405512b9503a47a684e8feb68229700dd7fc26b98b55b02978ff7da0029000000000000000000000000729d19f657bd0614b4985cf1d82531c67569197b

Deployed Bytecode

0x6080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633bd137e081146100b35780633fdbb6c7146100e457806349a742eb1461010b5780634a6213a114610137578063679aefce1461014c57806369ea177114610161578063715018a61461017b5780638da5cb5b14610190578063d390021d146101a5578063e55186a1146101ba578063f2fde38b14610244575b600080fd5b3480156100bf57600080fd5b506100c8610265565b60408051600160a060020a039092168252519081900360200190f35b3480156100f057600080fd5b506100f9610274565b60408051918252519081900360200190f35b34801561011757600080fd5b50610123600435610279565b604080519115158252519081900360200190f35b34801561014357600080fd5b506100f961039b565b34801561015857600080fd5b506100f96103ae565b34801561016d57600080fd5b506101796004356103b4565b005b34801561018757600080fd5b5061017961042a565b34801561019c57600080fd5b506100c8610496565b3480156101b157600080fd5b506100f96104a5565b3480156101c657600080fd5b506101cf6104ab565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b50610179600160a060020a03600435166104e2565b600154600160a060020a031681565b600a81565b60008080808085151561028f5760009450610392565b600154604080517f59e02dd70000000000000000000000000000000000000000000000000000000081528151600160a060020a03909316926359e02dd7926004808401939192918290030181600087803b1580156102ec57600080fd5b505af1158015610300573d6000803e3d6000fd5b505050506040513d604081101561031657600080fd5b5080516020909101519094509250826103315760025461033a565b61033a84610505565b915081861061035857610353868363ffffffff61052e16565b610368565b610368828763ffffffff61052e16565b905061038c606461038084600a63ffffffff61054516565b9063ffffffff61056e16565b81111594505b50505050919050565b6ec097ce7bc90715b34b9f100000000081565b60025490565b600054600160a060020a031633146103cb57600080fd5b806103d581610279565b15156103e057600080fd5b600282905542600381905560408051848152602081019290925280517fb38780ddde1f073d91c150de2696f3f7085883648ba21cc5ef01029cb21d19169281900390910190a15050565b600054600160a060020a0316331461044157600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b60035490565b60408051808201909152600381527f5553440000000000000000000000000000000000000000000000000000000000602082015290565b600054600160a060020a031633146104f957600080fd5b61050281610583565b50565b6000816105276ec097ce7bc90715b34b9f10000000008263ffffffff61056e16565b9392505050565b60008282111561053a57fe5b508082035b92915050565b60008215156105565750600061053f565b5081810281838281151561056657fe5b041461053f57fe5b6000818381151561057b57fe5b049392505050565b600160a060020a038116151561059857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820d59f57543405512b9503a47a684e8feb68229700dd7fc26b98b55b02978ff7da0029

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

000000000000000000000000729d19f657bd0614b4985cf1d82531c67569197b

-----Decoded View---------------
Arg [0] : _makerDAOMedianizer (address): 0x729D19f657BD0614b4985Cf1D82531c67569197B

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000729d19f657bd0614b4985cf1d82531c67569197b


Swarm Source

bzzr://d59f57543405512b9503a47a684e8feb68229700dd7fc26b98b55b02978ff7da

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.